Commit 867bf59f authored by alexpott's avatar alexpott

Issue #2559241 by droplet, tic2000: Closing an #ajax dialog triggers...

Issue #2559241 by droplet, tic2000: Closing an #ajax dialog triggers Javascript errors when scrolling
parent 9ccbfdac
......@@ -31,6 +31,7 @@
// `jQuery(event.target).remove()` as well, to remove the dialog on
// closing.
close: function (event) {
Drupal.dialog(event.target).close();
Drupal.detachBehaviors(event.target, null, 'unload');
}
};
......@@ -60,6 +61,19 @@
* @return {Drupal.dialog~dialogDefinition}
*/
Drupal.dialog = function (element, options) {
var undef;
var $element = $(element);
var dialog = {
open: false,
returnValue: undef,
show: function () {
openDialog({modal: false});
},
showModal: function () {
openDialog({modal: true});
},
close: closeDialog
};
function openDialog(settings) {
settings = $.extend({}, drupalSettings.dialog, options, settings);
......@@ -78,20 +92,6 @@
$(window).trigger('dialog:afterclose', [dialog, $element]);
}
var undef;
var $element = $(element);
var dialog = {
open: false,
returnValue: undef,
show: function () {
openDialog({modal: false});
},
showModal: function () {
openDialog({modal: true});
},
close: closeDialog
};
return dialog;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment