diff options
author | rvelices <rv-github@modusoptimus.com> | 2014-06-24 20:16:59 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2014-06-24 20:16:59 +0000 |
commit | 09228a746f3a67ea80ab6cc6013f535da8332a64 (patch) | |
tree | 15107374e3de6b8da403af5b75f828c7ea77315b /themes/default/js/ui/jquery.ui.dialog.js | |
parent | 03a3d1830cf67eb468bf4e48a879d2994055a492 (diff) |
upgrade jquery ui from 1.10.1 to 1.10.4
git-svn-id: http://piwigo.org/svn/trunk@28780 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | themes/default/js/ui/jquery.ui.dialog.js | 54 |
1 files changed, 39 insertions, 15 deletions
diff --git a/themes/default/js/ui/jquery.ui.dialog.js b/themes/default/js/ui/jquery.ui.dialog.js index 492cab878..89b71a552 100644 --- a/themes/default/js/ui/jquery.ui.dialog.js +++ b/themes/default/js/ui/jquery.ui.dialog.js @@ -1,8 +1,8 @@ /*! - * jQuery UI Dialog 1.10.1 + * jQuery UI Dialog 1.10.4 * http://jqueryui.com * - * Copyright 2013 jQuery Foundation and other contributors + * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * @@ -36,7 +36,7 @@ var sizeRelatedOptions = { }; $.widget( "ui.dialog", { - version: "1.10.1", + version: "1.10.4", options: { appendTo: "body", autoOpen: true, @@ -169,7 +169,8 @@ $.widget( "ui.dialog", { enable: $.noop, close: function( event ) { - var that = this; + var activeElement, + that = this; if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) { return; @@ -179,10 +180,22 @@ $.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 <iframe> + try { + activeElement = this.document[ 0 ].activeElement; + + // Support: IE9, IE10 + // If the <body> is blurred, IE will switch windows, see #4520 + if ( activeElement && activeElement.nodeName.toLowerCase() !== "body" ) { + + // 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 + $( activeElement ).blur(); + } + } catch ( error ) {} } this._hide( this.uiDialog, this.options.hide, function() { @@ -342,7 +355,10 @@ $.widget( "ui.dialog", { } }); - this.uiDialogTitlebarClose = $("<button></button>") + // support: IE + // Use type="button" to prevent enter keypresses in textboxes from closing the + // dialog in IE (#9312) + this.uiDialogTitlebarClose = $( "<button type='button'></button>" ) .button({ label: this.options.closeText, icons: { @@ -556,7 +572,6 @@ $.widget( "ui.dialog", { }, _setOption: function( key, value ) { - /*jshint maxcomplexity:15*/ var isDraggable, isResizable, uiDialog = this.uiDialog; @@ -692,11 +707,23 @@ $.widget( "ui.dialog", { } }, + _allowInteraction: function( event ) { + if ( $( event.target ).closest(".ui-dialog").length ) { + return true; + } + + // TODO: Remove hack when datepicker implements + // the .ui-front logic (#8989) + return !!$( event.target ).closest(".ui-datepicker").length; + }, + _createOverlay: function() { if ( !this.options.modal ) { return; } + var that = this, + widgetFullName = this.widgetFullName; if ( !$.ui.dialog.overlayInstances ) { // Prevent use of anchors and inputs. // We use a delay in case the overlay is created from an @@ -705,13 +732,10 @@ $.widget( "ui.dialog", { // Handle .dialog().dialog("close") (#4065) if ( $.ui.dialog.overlayInstances ) { this.document.bind( "focusin.dialog", function( event ) { - if ( !$( event.target ).closest(".ui-dialog").length && - // TODO: Remove hack when datepicker implements - // the .ui-front logic (#8989) - !$( event.target ).closest(".ui-datepicker").length ) { + if ( !that._allowInteraction( event ) ) { event.preventDefault(); $(".ui-dialog:visible:last .ui-dialog-content") - .data("ui-dialog")._focusTabbable(); + .data( widgetFullName )._focusTabbable(); } }); } |