this.bodyJS = null;
this.footerJS = null;
this.modalCount = modalCounter++;
+ this.attachmentPoint = document.createElement('div');
+ document.body.append(this.attachmentPoint);
if (!this.root.is(SELECTORS.CONTAINER)) {
Notification.exception({message: 'Element is not a modal container'});
* @returns {jQuery}
*/
Modal.prototype.getAttachmentPoint = function() {
- return $(Fullscreen.getElement() || document.body);
+ return $(Fullscreen.getElement() || this.attachmentPoint);
};
/**
this.hide();
this.root.remove();
this.root.trigger(ModalEvents.destroyed, this);
+ this.attachmentPoint.remove();
};
/**
}
if (e.keyCode == KeyCodes.escape) {
- this.hide();
+ if (this.removeOnClose) {
+ this.destroy();
+ } else {
+ this.hide();
+ }
}
}.bind(this));
var ModalBackdrop = function(root) {
this.root = $(root);
this.isAttached = false;
+ this.attachmentPoint = document.createElement('div');
+ document.body.append(this.attachmentPoint);
if (!this.root.is(SELECTORS.ROOT)) {
Notification.exception({message: 'Element is not a modal backdrop'});
* @returns {jQuery}
*/
ModalBackdrop.prototype.getAttachmentPoint = function() {
- return $(Fullscreen.getElement() || document.body);
+ return $(Fullscreen.getElement() || this.attachmentPoint);
};
/**
*/
ModalBackdrop.prototype.destroy = function() {
this.root.remove();
+ this.attachmentPoint.remove();
};
return ModalBackdrop;