From b2500c880b9c478905448470fc04e16e288e08b9 Mon Sep 17 00:00:00 2001 From: Jamie Pratt Date: Wed, 8 Aug 2012 16:01:33 +0700 Subject: [PATCH] MDL-47494 ddmarker: NOBUG fixing redundant empty divs every 2 secs --- question/type/ddmarker/yui/dd/dd.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/question/type/ddmarker/yui/dd/dd.js b/question/type/ddmarker/yui/dd/dd.js index 1d93d478ba9..be56cd67958 100644 --- a/question/type/ddmarker/yui/dd/dd.js +++ b/question/type/ddmarker/yui/dd/dd.js @@ -423,16 +423,14 @@ YUI.add('moodle-qtype_ddmarker-dd', function(Y) { } }, this); if (this.graphics !== null) { - var oldshapes = this.graphics.get('shapes'); - for (var id in oldshapes) { - oldshapes[id].destroy(); - } - } - if (this.get('dropzones').length !== 0) { - this.restart_colours(); + this.graphics.clear(); + } else { this.graphics = new Y.Graphic( {render:this.doc.top_node().one("div.ddarea div.dropzones")} ); + } + if (this.get('dropzones').length !== 0) { + this.restart_colours(); for (var dropzoneno in this.get('dropzones')) { var colourfordropzone = this.get_next_colour(); var d = this.get('dropzones')[dropzoneno];