Skip to content

Commit

Permalink
MDL-43886 Javascript: Remove dialouges from the DOM upon destroy
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Jan 28, 2014
1 parent 9788e26 commit 0860dd7
Show file tree
Hide file tree
Showing 17 changed files with 21 additions and 13 deletions.
2 changes: 2 additions & 0 deletions lib/upgrade.txt
Expand Up @@ -22,6 +22,8 @@ YUI:
deprecated and replaced by the modal attribute. This was actually
changed in Moodle 2.2, but has only been marked as deprecated now. It
will be removed in Moodle 2.9.
* When destroying any type of dialogue based on moodle-core-notification, the relevant content is also removed from
the DOM. Previously it was left orphaned.

JavaSript:
* The findChildNodes global function has been deprecated. Y.all should
Expand Down
Expand Up @@ -64,7 +64,6 @@ Y.extend(ALERT, M.core.dialogue, {
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
this.setStdModContent(Y.WidgetStdMod.HEADER,
'<h1 id="moodle-dialogue-'+this.get('COUNT')+'-header-text">' + this.get(TITLE) + '</h1>', Y.WidgetStdMod.REPLACE);
this.after('destroyedChange', function(){this.get(BASE).remove();}, this);
this._enterKeypress = Y.on('key', this.submit, window, 'down:13', this);
yes.on('click', this.submit, this);
},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -64,7 +64,6 @@ Y.extend(ALERT, M.core.dialogue, {
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
this.setStdModContent(Y.WidgetStdMod.HEADER,
'<h1 id="moodle-dialogue-'+this.get('COUNT')+'-header-text">' + this.get(TITLE) + '</h1>', Y.WidgetStdMod.REPLACE);
this.after('destroyedChange', function(){this.get(BASE).remove();}, this);
this._enterKeypress = Y.on('key', this.submit, window, 'down:13', this);
yes.on('click', this.submit, this);
},
Expand Down
Expand Up @@ -68,7 +68,6 @@ Y.extend(CONFIRM, M.core.dialogue, {
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
this.setStdModContent(Y.WidgetStdMod.HEADER,
'<h1 id="moodle-dialogue-'+this.get('COUNT')+'-header-text">' + this.get(TITLE) + '</h1>', Y.WidgetStdMod.REPLACE);
this.after('destroyedChange', function(){this.get(BASE).remove();}, this);
this._enterKeypress = Y.on('key', this.submit, window, 'down:13', this, true);
this._escKeypress = Y.on('key', this.submit, window, 'down:27', this, false);
yes.on('click', this.submit, this, true);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -68,7 +68,6 @@ Y.extend(CONFIRM, M.core.dialogue, {
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
this.setStdModContent(Y.WidgetStdMod.HEADER,
'<h1 id="moodle-dialogue-'+this.get('COUNT')+'-header-text">' + this.get(TITLE) + '</h1>', Y.WidgetStdMod.REPLACE);
this.after('destroyedChange', function(){this.get(BASE).remove();}, this);
this._enterKeypress = Y.on('key', this.submit, window, 'down:13', this, true);
this._escKeypress = Y.on('key', this.submit, window, 'down:27', this, false);
yes.on('click', this.submit, this, true);
Expand Down
Expand Up @@ -138,6 +138,11 @@ Y.extend(DIALOGUE, Y.Panel, {
this.show();
this.keyDelegation();
}

// Remove the dialogue from the DOM when it is destroyed.
this.after('destroyedChange', function(){
this.get(BASE).remove(true);
}, this);
},

/**
Expand Down

0 comments on commit 0860dd7

Please sign in to comment.