diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2013-11-25 14:29:30 +0100 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2013-11-25 14:29:30 +0100 |
commit | 9a5f20bc7d5218f864fb65d5d20775596065280d (patch) | |
tree | 82c176a82f64ca3c1a26648b9e3bf0d2f7282dd8 /ui | |
parent | 1bc5d087467c913b92c927d05259eea72f96f4ed (diff) | |
parent | 8eeb0e7d88a943e3860f8492661ac8090cb8d3ac (diff) | |
download | jquery-ui-9a5f20bc7d5218f864fb65d5d20775596065280d.tar.gz jquery-ui-9a5f20bc7d5218f864fb65d5d20775596065280d.zip |
Merge branch 'master' into selectmenu
Diffstat (limited to 'ui')
-rw-r--r-- | ui/.jshintrc | 1 | ||||
-rw-r--r-- | ui/jquery.ui.dialog.js | 23 |
2 files changed, 22 insertions, 2 deletions
diff --git a/ui/.jshintrc b/ui/.jshintrc index a5d36e1d3..073418812 100644 --- a/ui/.jshintrc +++ b/ui/.jshintrc @@ -14,6 +14,7 @@ "unused": true, "browser": true, + "es3": true, "jquery": true, "globals": { diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index d3ce333f4..7f90908bd 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -182,6 +182,7 @@ $.widget( "ui.dialog", { this._isOpen = false; this._focusedElement = null; this._destroyOverlay(); + this._untrackInstance(); if ( !this.opener.filter( ":focusable" ).focus().length ) { @@ -562,11 +563,30 @@ $.widget( "ui.dialog", { _trackFocus: function() { this._on( this.widget(), { "focusin": function( event ) { + this._untrackInstance(); + this._trackingInstances().unshift( this ); this._focusedElement = $( event.target ); } }); }, + _untrackInstance: function() { + var instances = this._trackingInstances(), + exists = $.inArray( this, instances ); + if ( exists !== -1 ) { + instances.splice( exists, 1 ); + } + }, + + _trackingInstances: function() { + var instances = this.document.data( "ui-dialog-instances" ); + if ( !instances ) { + instances = []; + this.document.data( "ui-dialog-instances", instances ); + } + return instances; + }, + _minHeight: function() { var options = this.options; @@ -783,8 +803,7 @@ $.widget( "ui.dialog", { if ( !this._allowInteraction( event ) ) { event.preventDefault(); - this.document.find( ".ui-dialog:visible:last .ui-dialog-content" ) - .data( this.widgetFullName )._focusTabbable(); + this._trackingInstances()[ 0 ]._focusTabbable(); } } }); |