Merge pull request #4727 from edlinklater/3-iframe-contents

Don't try to unbind events from inside top-level iframes
This commit is contained in:
Ingo Schommer 2015-11-02 10:42:08 +13:00
commit fc7f574920

View File

@ -28,7 +28,7 @@
// Remove all bound events. // Remove all bound events.
// This guards against an edge case where the click handlers are not unbound // This guards against an edge case where the click handlers are not unbound
// because the panel is still open when the ajax edit form reloads. // because the panel is still open when the ajax edit form reloads.
var frame = $('.cms').find('iframe'); var frame = $('.cms-container').find('iframe');
frame.each(function(index, iframe){ frame.each(function(index, iframe){
$(iframe).contents().off('click.ss-ui-action-tabset'); $(iframe).contents().off('click.ss-ui-action-tabset');
}); });
@ -58,7 +58,7 @@
* Note: Should be called by a click event attached to 'this' * Note: Should be called by a click event attached to 'this'
*/ */
attachCloseHandler: function(event, ui) { attachCloseHandler: function(event, ui) {
var that = this, frame = $('.cms').find('iframe'), closeHandler; var that = this, frame = $('.cms-container').find('iframe'), closeHandler;
// Create a handler for the click event so we can close tabs // Create a handler for the click event so we can close tabs
// and easily remove the event once done // and easily remove the event once done
@ -74,7 +74,7 @@
that.tabs('option', 'active', false); // close tabs that.tabs('option', 'active', false); // close tabs
// remove click event from objects it is bound to (iframe's and document) // remove click event from objects it is bound to (iframe's and document)
frame = $('.cms').find('iframe'); frame = $('.cms-container').find('iframe');
frame.each(function(index, iframe){ frame.each(function(index, iframe){
$(iframe).contents().off('click.ss-ui-action-tabset', closeHandler); $(iframe).contents().off('click.ss-ui-action-tabset', closeHandler);
}); });