From 56858da82ffd620a7b4c5711821266118d66394c Mon Sep 17 00:00:00 2001 From: TJ VanToll Date: Mon, 30 Sep 2013 17:49:42 +0300 Subject: [PATCH 1/2] Dialog: Safe activeElement access. Fixed #9420 - Dialog: Close causes blur of window in IE9 Fixed #8443 - Dialog: "unspecified error" when using ie9 and iframe --- ui/jquery.ui.dialog.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index 0170a42d2fe..e9b803425d3 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -169,7 +169,8 @@ $.widget( "ui.dialog", { enable: $.noop, close: function( event ) { - var that = this; + var that = this, + document = this.document[ 0 ]; if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) { return; @@ -179,10 +180,18 @@ $.widget( "ui.dialog", { this._destroyOverlay(); if ( !this.opener.filter(":focusable").focus().length ) { - // Hiding a focused element doesn't trigger blur in WebKit - // so in case we have nothing to focus on, explicitly blur the active element - // https://bugs.webkit.org/show_bug.cgi?id=47182 - $( this.document[0].activeElement ).blur(); + // support: IE9 + // IE9 throws an "Unspecified error" accessing document.activeElement from an