From 7ea33988e9eceb93196ff3011bb6d434d92f4821 Mon Sep 17 00:00:00 2001 From: Clorith Date: Fri, 28 Jan 2022 16:44:05 +0000 Subject: [PATCH] External libraries: Update jQuery UI to 1.13.1 Some regressions happened alongside the release of jQuery UI 1.13.0, this brings the fixes from 1.13.1 downstream to WordPress, notably relating to Widget, Autocomplete, Sortable, and Tooltip modules. See the changelog between version 1.13.0 and 1.13.1 at https://github.com/jquery/jquery-ui/compare/1.13.0...1.13.1 Props blogaid, linux4me2, mgol. Fixes #54902. Built from https://develop.svn.wordpress.org/trunk@52648 git-svn-id: http://core.svn.wordpress.org/trunk@52237 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/js/jquery/ui/accordion.js | 96 +++--- wp-includes/js/jquery/ui/accordion.min.js | 4 +- wp-includes/js/jquery/ui/autocomplete.js | 139 +++++---- wp-includes/js/jquery/ui/autocomplete.min.js | 4 +- wp-includes/js/jquery/ui/button.js | 10 +- wp-includes/js/jquery/ui/button.min.js | 4 +- wp-includes/js/jquery/ui/checkboxradio.js | 4 +- wp-includes/js/jquery/ui/checkboxradio.min.js | 4 +- wp-includes/js/jquery/ui/controlgroup.js | 4 +- wp-includes/js/jquery/ui/controlgroup.min.js | 4 +- wp-includes/js/jquery/ui/core.js | 49 +-- wp-includes/js/jquery/ui/core.min.js | 32 +- wp-includes/js/jquery/ui/datepicker.js | 288 +++++++++--------- wp-includes/js/jquery/ui/datepicker.min.js | 4 +- wp-includes/js/jquery/ui/dialog.js | 10 +- wp-includes/js/jquery/ui/dialog.min.js | 4 +- wp-includes/js/jquery/ui/draggable.js | 78 ++--- wp-includes/js/jquery/ui/draggable.min.js | 4 +- wp-includes/js/jquery/ui/droppable.js | 66 ++-- wp-includes/js/jquery/ui/droppable.min.js | 4 +- wp-includes/js/jquery/ui/effect-blind.js | 2 +- wp-includes/js/jquery/ui/effect-blind.min.js | 2 +- wp-includes/js/jquery/ui/effect-bounce.js | 2 +- wp-includes/js/jquery/ui/effect-bounce.min.js | 2 +- wp-includes/js/jquery/ui/effect-clip.js | 2 +- wp-includes/js/jquery/ui/effect-clip.min.js | 2 +- wp-includes/js/jquery/ui/effect-drop.js | 2 +- wp-includes/js/jquery/ui/effect-drop.min.js | 2 +- wp-includes/js/jquery/ui/effect-explode.js | 32 +- .../js/jquery/ui/effect-explode.min.js | 2 +- wp-includes/js/jquery/ui/effect-fade.js | 2 +- wp-includes/js/jquery/ui/effect-fade.min.js | 2 +- wp-includes/js/jquery/ui/effect-fold.js | 2 +- wp-includes/js/jquery/ui/effect-fold.min.js | 2 +- wp-includes/js/jquery/ui/effect-highlight.js | 2 +- .../js/jquery/ui/effect-highlight.min.js | 2 +- wp-includes/js/jquery/ui/effect-puff.js | 2 +- wp-includes/js/jquery/ui/effect-puff.min.js | 2 +- wp-includes/js/jquery/ui/effect-pulsate.js | 2 +- .../js/jquery/ui/effect-pulsate.min.js | 2 +- wp-includes/js/jquery/ui/effect-scale.js | 2 +- wp-includes/js/jquery/ui/effect-scale.min.js | 2 +- wp-includes/js/jquery/ui/effect-shake.js | 2 +- wp-includes/js/jquery/ui/effect-shake.min.js | 2 +- wp-includes/js/jquery/ui/effect-size.js | 2 +- wp-includes/js/jquery/ui/effect-size.min.js | 2 +- wp-includes/js/jquery/ui/effect-slide.js | 2 +- wp-includes/js/jquery/ui/effect-slide.min.js | 2 +- wp-includes/js/jquery/ui/effect-transfer.js | 2 +- .../js/jquery/ui/effect-transfer.min.js | 2 +- wp-includes/js/jquery/ui/effect.js | 90 +++--- wp-includes/js/jquery/ui/effect.min.js | 6 +- wp-includes/js/jquery/ui/menu.js | 172 +++++------ wp-includes/js/jquery/ui/menu.min.js | 4 +- wp-includes/js/jquery/ui/mouse.js | 10 +- wp-includes/js/jquery/ui/mouse.min.js | 4 +- wp-includes/js/jquery/ui/progressbar.js | 4 +- wp-includes/js/jquery/ui/progressbar.min.js | 4 +- wp-includes/js/jquery/ui/resizable.js | 82 ++--- wp-includes/js/jquery/ui/resizable.min.js | 4 +- wp-includes/js/jquery/ui/selectable.js | 8 +- wp-includes/js/jquery/ui/selectable.min.js | 4 +- wp-includes/js/jquery/ui/selectmenu.js | 102 +++---- wp-includes/js/jquery/ui/selectmenu.min.js | 4 +- wp-includes/js/jquery/ui/slider.js | 8 +- wp-includes/js/jquery/ui/slider.min.js | 4 +- wp-includes/js/jquery/ui/sortable.js | 251 ++++++++------- wp-includes/js/jquery/ui/sortable.min.js | 4 +- wp-includes/js/jquery/ui/spinner.js | 42 +-- wp-includes/js/jquery/ui/spinner.min.js | 4 +- wp-includes/js/jquery/ui/tabs.js | 88 +++--- wp-includes/js/jquery/ui/tabs.min.js | 4 +- wp-includes/js/jquery/ui/tooltip.js | 11 +- wp-includes/js/jquery/ui/tooltip.min.js | 4 +- wp-includes/script-loader.php | 78 ++--- wp-includes/version.php | 2 +- 76 files changed, 955 insertions(+), 945 deletions(-) diff --git a/wp-includes/js/jquery/ui/accordion.js b/wp-includes/js/jquery/ui/accordion.js index 0c1035d82e..f77d2d4ff7 100644 --- a/wp-includes/js/jquery/ui/accordion.js +++ b/wp-includes/js/jquery/ui/accordion.js @@ -1,5 +1,5 @@ /*! - * jQuery UI Accordion 1.13.0 + * jQuery UI Accordion 1.13.1 * http://jqueryui.com * * Copyright jQuery Foundation and other contributors @@ -37,7 +37,7 @@ "use strict"; return $.widget( "ui.accordion", { - version: "1.13.0", + version: "1.13.1", options: { active: 0, animate: {}, @@ -204,24 +204,24 @@ return $.widget( "ui.accordion", { toFocus = false; switch ( event.keyCode ) { - case keyCode.RIGHT: - case keyCode.DOWN: - toFocus = this.headers[ ( currentIndex + 1 ) % length ]; - break; - case keyCode.LEFT: - case keyCode.UP: - toFocus = this.headers[ ( currentIndex - 1 + length ) % length ]; - break; - case keyCode.SPACE: - case keyCode.ENTER: - this._eventHandler( event ); - break; - case keyCode.HOME: - toFocus = this.headers[ 0 ]; - break; - case keyCode.END: - toFocus = this.headers[ length - 1 ]; - break; + case keyCode.RIGHT: + case keyCode.DOWN: + toFocus = this.headers[ ( currentIndex + 1 ) % length ]; + break; + case keyCode.LEFT: + case keyCode.UP: + toFocus = this.headers[ ( currentIndex - 1 + length ) % length ]; + break; + case keyCode.SPACE: + case keyCode.ENTER: + this._eventHandler( event ); + break; + case keyCode.HOME: + toFocus = this.headers[ 0 ]; + break; + case keyCode.END: + toFocus = this.headers[ length - 1 ]; + break; } if ( toFocus ) { @@ -244,15 +244,15 @@ return $.widget( "ui.accordion", { // Was collapsed or no panel if ( ( options.active === false && options.collapsible === true ) || - !this.headers.length ) { + !this.headers.length ) { options.active = false; this.active = $(); - // active false only when collapsible is true + // active false only when collapsible is true } else if ( options.active === false ) { this._activate( 0 ); - // was active, but active panel is gone + // was active, but active panel is gone } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { // all remaining panel are disabled @@ -260,12 +260,12 @@ return $.widget( "ui.accordion", { options.active = false; this.active = $(); - // activate previous panel + // activate previous panel } else { this._activate( Math.max( 0, options.active - 1 ) ); } - // was active, active panel still exists + // was active, active panel still exists } else { // make sure active index is correct @@ -322,20 +322,20 @@ return $.widget( "ui.accordion", { panel.attr( "aria-labelledby", headerId ); } ) .next() - .attr( "role", "tabpanel" ); + .attr( "role", "tabpanel" ); this.headers .not( this.active ) - .attr( { - "aria-selected": "false", - "aria-expanded": "false", - tabIndex: -1 - } ) - .next() - .attr( { - "aria-hidden": "true" - } ) - .hide(); + .attr( { + "aria-selected": "false", + "aria-expanded": "false", + tabIndex: -1 + } ) + .next() + .attr( { + "aria-hidden": "true" + } ) + .hide(); // Make sure at least one header is in the tab order if ( !this.active.length ) { @@ -347,9 +347,9 @@ return $.widget( "ui.accordion", { tabIndex: 0 } ) .next() - .attr( { - "aria-hidden": "false" - } ); + .attr( { + "aria-hidden": "false" + } ); } this._createIcons(); @@ -454,11 +454,11 @@ return $.widget( "ui.accordion", { if ( - // click on active header, but not collapsible - ( clickedIsActive && !options.collapsible ) || + // click on active header, but not collapsible + ( clickedIsActive && !options.collapsible ) || - // allow canceling activation - ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { + // allow canceling activation + ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { return; } @@ -534,11 +534,11 @@ return $.widget( "ui.accordion", { toShow .attr( "aria-hidden", "false" ) .prev() - .attr( { - "aria-selected": "true", - "aria-expanded": "true", - tabIndex: 0 - } ); + .attr( { + "aria-selected": "true", + "aria-expanded": "true", + tabIndex: 0 + } ); }, _animate: function( toShow, toHide, data ) { diff --git a/wp-includes/js/jquery/ui/accordion.min.js b/wp-includes/js/jquery/ui/accordion.min.js index f99ba07209..1e31bf959c 100644 --- a/wp-includes/js/jquery/ui/accordion.min.js +++ b/wp-includes/js/jquery/ui/accordion.min.js @@ -1,9 +1,9 @@ /*! - * jQuery UI Accordion 1.13.0 + * jQuery UI Accordion 1.13.1 * http://jqueryui.com * * Copyright jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license */ -!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","./core"],e):e(jQuery)}(function(o){"use strict";return o.widget("ui.accordion",{version:"1.13.0",options:{active:0,animate:{},classes:{"ui-accordion-header":"ui-corner-top","ui-accordion-header-collapsed":"ui-corner-all","ui-accordion-content":"ui-corner-bottom"},collapsible:!1,event:"click",header:function(e){return e.find("> li > :first-child").add(e.find("> :not(li)").even())},heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var e=this.options;this.prevShow=this.prevHide=o(),this._addClass("ui-accordion","ui-widget ui-helper-reset"),this.element.attr("role","tablist"),e.collapsible||!1!==e.active&&null!=e.active||(e.active=0),this._processPanels(),e.active<0&&(e.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():o()}},_createIcons:function(){var e,t=this.options.icons;t&&(e=o(""),this._addClass(e,"ui-accordion-header-icon","ui-icon "+t.header),e.prependTo(this.headers),e=this.active.children(".ui-accordion-header-icon"),this._removeClass(e,t.header)._addClass(e,null,t.activeHeader)._addClass(this.headers,"ui-accordion-icons"))},_destroyIcons:function(){this._removeClass(this.headers,"ui-accordion-icons"),this.headers.children(".ui-accordion-header-icon").remove()},_destroy:function(){var e;this.element.removeAttr("role"),this.headers.removeAttr("role aria-expanded aria-selected aria-controls tabIndex").removeUniqueId(),this._destroyIcons(),e=this.headers.next().css("display","").removeAttr("role aria-hidden aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&e.css("height","")},_setOption:function(e,t){"active"!==e?("event"===e&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(t)),this._super(e,t),"collapsible"!==e||t||!1!==this.options.active||this._activate(0),"icons"===e&&(this._destroyIcons(),t&&this._createIcons())):this._activate(t)},_setOptionDisabled:function(e){this._super(e),this.element.attr("aria-disabled",e),this._toggleClass(null,"ui-state-disabled",!!e),this._toggleClass(this.headers.add(this.headers.next()),null,"ui-state-disabled",!!e)},_keydown:function(e){if(!e.altKey&&!e.ctrlKey){var t=o.ui.keyCode,i=this.headers.length,a=this.headers.index(e.target),s=!1;switch(e.keyCode){case t.RIGHT:case t.DOWN:s=this.headers[(a+1)%i];break;case t.LEFT:case t.UP:s=this.headers[(a-1+i)%i];break;case t.SPACE:case t.ENTER:this._eventHandler(e);break;case t.HOME:s=this.headers[0];break;case t.END:s=this.headers[i-1]}s&&(o(e.target).attr("tabIndex",-1),o(s).attr("tabIndex",0),o(s).trigger("focus"),e.preventDefault())}},_panelKeyDown:function(e){e.keyCode===o.ui.keyCode.UP&&e.ctrlKey&&o(e.currentTarget).prev().trigger("focus")},refresh:function(){var e=this.options;this._processPanels(),!1===e.active&&!0===e.collapsible||!this.headers.length?(e.active=!1,this.active=o()):!1===e.active?this._activate(0):this.active.length&&!o.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(e.active=!1,this.active=o()):this._activate(Math.max(0,e.active-1)):e.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var e=this.headers,t=this.panels;"function"==typeof this.options.header?this.headers=this.options.header(this.element):this.headers=this.element.find(this.options.header),this._addClass(this.headers,"ui-accordion-header ui-accordion-header-collapsed","ui-state-default"),this.panels=this.headers.next().filter(":not(.ui-accordion-content-active)").hide(),this._addClass(this.panels,"ui-accordion-content","ui-helper-reset ui-widget-content"),t&&(this._off(e.not(this.headers)),this._off(t.not(this.panels)))},_refresh:function(){var i,e=this.options,t=e.heightStyle,a=this.element.parent();this.active=this._findActive(e.active),this._addClass(this.active,"ui-accordion-header-active","ui-state-active")._removeClass(this.active,"ui-accordion-header-collapsed"),this._addClass(this.active.next(),"ui-accordion-content-active"),this.active.next().show(),this.headers.attr("role","tab").each(function(){var e=o(this),t=e.uniqueId().attr("id"),i=e.next(),a=i.uniqueId().attr("id");e.attr("aria-controls",a),i.attr("aria-labelledby",t)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(e.event),"fill"===t?(i=a.height(),this.element.siblings(":visible").each(function(){var e=o(this),t=e.css("position");"absolute"!==t&&"fixed"!==t&&(i-=e.outerHeight(!0))}),this.headers.each(function(){i-=o(this).outerHeight(!0)}),this.headers.next().each(function(){o(this).height(Math.max(0,i-o(this).innerHeight()+o(this).height()))}).css("overflow","auto")):"auto"===t&&(i=0,this.headers.next().each(function(){var e=o(this).is(":visible");e||o(this).show(),i=Math.max(i,o(this).css("height","").height()),e||o(this).hide()}).height(i))},_activate:function(e){e=this._findActive(e)[0];e!==this.active[0]&&(e=e||this.active[0],this._eventHandler({target:e,currentTarget:e,preventDefault:o.noop}))},_findActive:function(e){return"number"==typeof e?this.headers.eq(e):o()},_setupEvents:function(e){var i={keydown:"_keydown"};e&&o.each(e.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(e){var t=this.options,i=this.active,a=o(e.currentTarget),s=a[0]===i[0],n=s&&t.collapsible,h=n?o():a.next(),r=i.next(),h={oldHeader:i,oldPanel:r,newHeader:n?o():a,newPanel:h};e.preventDefault(),s&&!t.collapsible||!1===this._trigger("beforeActivate",e,h)||(t.active=!n&&this.headers.index(a),this.active=s?o():a,this._toggle(h),this._removeClass(i,"ui-accordion-header-active","ui-state-active"),t.icons&&(i=i.children(".ui-accordion-header-icon"),this._removeClass(i,null,t.icons.activeHeader)._addClass(i,null,t.icons.header)),s||(this._removeClass(a,"ui-accordion-header-collapsed")._addClass(a,"ui-accordion-header-active","ui-state-active"),t.icons&&(s=a.children(".ui-accordion-header-icon"),this._removeClass(s,null,t.icons.header)._addClass(s,null,t.icons.activeHeader)),this._addClass(a.next(),"ui-accordion-content-active")))},_toggle:function(e){var t=e.newPanel,i=this.prevShow.length?this.prevShow:e.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=t,this.prevHide=i,this.options.animate?this._animate(t,i,e):(i.hide(),t.show(),this._toggleComplete(e)),i.attr({"aria-hidden":"true"}),i.prev().attr({"aria-selected":"false","aria-expanded":"false"}),t.length&&i.length?i.prev().attr({tabIndex:-1,"aria-expanded":"false"}):t.length&&this.headers.filter(function(){return 0===parseInt(o(this).attr("tabIndex"),10)}).attr("tabIndex",-1),t.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(e,i,t){var a,s,n,h=this,r=0,o=e.css("box-sizing"),d=e.length&&(!i.length||e.index() li > :first-child").add(e.find("> :not(li)").even())},heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var e=this.options;this.prevShow=this.prevHide=o(),this._addClass("ui-accordion","ui-widget ui-helper-reset"),this.element.attr("role","tablist"),e.collapsible||!1!==e.active&&null!=e.active||(e.active=0),this._processPanels(),e.active<0&&(e.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():o()}},_createIcons:function(){var e,t=this.options.icons;t&&(e=o(""),this._addClass(e,"ui-accordion-header-icon","ui-icon "+t.header),e.prependTo(this.headers),e=this.active.children(".ui-accordion-header-icon"),this._removeClass(e,t.header)._addClass(e,null,t.activeHeader)._addClass(this.headers,"ui-accordion-icons"))},_destroyIcons:function(){this._removeClass(this.headers,"ui-accordion-icons"),this.headers.children(".ui-accordion-header-icon").remove()},_destroy:function(){var e;this.element.removeAttr("role"),this.headers.removeAttr("role aria-expanded aria-selected aria-controls tabIndex").removeUniqueId(),this._destroyIcons(),e=this.headers.next().css("display","").removeAttr("role aria-hidden aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&e.css("height","")},_setOption:function(e,t){"active"!==e?("event"===e&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(t)),this._super(e,t),"collapsible"!==e||t||!1!==this.options.active||this._activate(0),"icons"===e&&(this._destroyIcons(),t&&this._createIcons())):this._activate(t)},_setOptionDisabled:function(e){this._super(e),this.element.attr("aria-disabled",e),this._toggleClass(null,"ui-state-disabled",!!e),this._toggleClass(this.headers.add(this.headers.next()),null,"ui-state-disabled",!!e)},_keydown:function(e){if(!e.altKey&&!e.ctrlKey){var t=o.ui.keyCode,i=this.headers.length,a=this.headers.index(e.target),s=!1;switch(e.keyCode){case t.RIGHT:case t.DOWN:s=this.headers[(a+1)%i];break;case t.LEFT:case t.UP:s=this.headers[(a-1+i)%i];break;case t.SPACE:case t.ENTER:this._eventHandler(e);break;case t.HOME:s=this.headers[0];break;case t.END:s=this.headers[i-1]}s&&(o(e.target).attr("tabIndex",-1),o(s).attr("tabIndex",0),o(s).trigger("focus"),e.preventDefault())}},_panelKeyDown:function(e){e.keyCode===o.ui.keyCode.UP&&e.ctrlKey&&o(e.currentTarget).prev().trigger("focus")},refresh:function(){var e=this.options;this._processPanels(),!1===e.active&&!0===e.collapsible||!this.headers.length?(e.active=!1,this.active=o()):!1===e.active?this._activate(0):this.active.length&&!o.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(e.active=!1,this.active=o()):this._activate(Math.max(0,e.active-1)):e.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var e=this.headers,t=this.panels;"function"==typeof this.options.header?this.headers=this.options.header(this.element):this.headers=this.element.find(this.options.header),this._addClass(this.headers,"ui-accordion-header ui-accordion-header-collapsed","ui-state-default"),this.panels=this.headers.next().filter(":not(.ui-accordion-content-active)").hide(),this._addClass(this.panels,"ui-accordion-content","ui-helper-reset ui-widget-content"),t&&(this._off(e.not(this.headers)),this._off(t.not(this.panels)))},_refresh:function(){var i,e=this.options,t=e.heightStyle,a=this.element.parent();this.active=this._findActive(e.active),this._addClass(this.active,"ui-accordion-header-active","ui-state-active")._removeClass(this.active,"ui-accordion-header-collapsed"),this._addClass(this.active.next(),"ui-accordion-content-active"),this.active.next().show(),this.headers.attr("role","tab").each(function(){var e=o(this),t=e.uniqueId().attr("id"),i=e.next(),a=i.uniqueId().attr("id");e.attr("aria-controls",a),i.attr("aria-labelledby",t)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(e.event),"fill"===t?(i=a.height(),this.element.siblings(":visible").each(function(){var e=o(this),t=e.css("position");"absolute"!==t&&"fixed"!==t&&(i-=e.outerHeight(!0))}),this.headers.each(function(){i-=o(this).outerHeight(!0)}),this.headers.next().each(function(){o(this).height(Math.max(0,i-o(this).innerHeight()+o(this).height()))}).css("overflow","auto")):"auto"===t&&(i=0,this.headers.next().each(function(){var e=o(this).is(":visible");e||o(this).show(),i=Math.max(i,o(this).css("height","").height()),e||o(this).hide()}).height(i))},_activate:function(e){e=this._findActive(e)[0];e!==this.active[0]&&(e=e||this.active[0],this._eventHandler({target:e,currentTarget:e,preventDefault:o.noop}))},_findActive:function(e){return"number"==typeof e?this.headers.eq(e):o()},_setupEvents:function(e){var i={keydown:"_keydown"};e&&o.each(e.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(e){var t=this.options,i=this.active,a=o(e.currentTarget),s=a[0]===i[0],n=s&&t.collapsible,h=n?o():a.next(),r=i.next(),h={oldHeader:i,oldPanel:r,newHeader:n?o():a,newPanel:h};e.preventDefault(),s&&!t.collapsible||!1===this._trigger("beforeActivate",e,h)||(t.active=!n&&this.headers.index(a),this.active=s?o():a,this._toggle(h),this._removeClass(i,"ui-accordion-header-active","ui-state-active"),t.icons&&(i=i.children(".ui-accordion-header-icon"),this._removeClass(i,null,t.icons.activeHeader)._addClass(i,null,t.icons.header)),s||(this._removeClass(a,"ui-accordion-header-collapsed")._addClass(a,"ui-accordion-header-active","ui-state-active"),t.icons&&(s=a.children(".ui-accordion-header-icon"),this._removeClass(s,null,t.icons.header)._addClass(s,null,t.icons.activeHeader)),this._addClass(a.next(),"ui-accordion-content-active")))},_toggle:function(e){var t=e.newPanel,i=this.prevShow.length?this.prevShow:e.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=t,this.prevHide=i,this.options.animate?this._animate(t,i,e):(i.hide(),t.show(),this._toggleComplete(e)),i.attr({"aria-hidden":"true"}),i.prev().attr({"aria-selected":"false","aria-expanded":"false"}),t.length&&i.length?i.prev().attr({tabIndex:-1,"aria-expanded":"false"}):t.length&&this.headers.filter(function(){return 0===parseInt(o(this).attr("tabIndex"),10)}).attr("tabIndex",-1),t.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(e,i,t){var a,s,n,h=this,r=0,o=e.css("box-sizing"),d=e.length&&(!i.length||e.index()", options: { appendTo: null, @@ -62,6 +62,7 @@ $.widget( "ui.autocomplete", { requestIndex: 0, pending: 0, + liveRegionTimer: null, _create: function() { @@ -103,58 +104,58 @@ $.widget( "ui.autocomplete", { suppressKeyPressRepeat = false; var keyCode = $.ui.keyCode; switch ( event.keyCode ) { - case keyCode.PAGE_UP: - suppressKeyPress = true; - this._move( "previousPage", event ); - break; - case keyCode.PAGE_DOWN: - suppressKeyPress = true; - this._move( "nextPage", event ); - break; - case keyCode.UP: - suppressKeyPress = true; - this._keyEvent( "previous", event ); - break; - case keyCode.DOWN: - suppressKeyPress = true; - this._keyEvent( "next", event ); - break; - case keyCode.ENTER: - - // when menu is open and has focus - if ( this.menu.active ) { - - // #6055 - Opera still allows the keypress to occur - // which causes forms to submit + case keyCode.PAGE_UP: suppressKeyPress = true; - event.preventDefault(); - this.menu.select( event ); - } - break; - case keyCode.TAB: - if ( this.menu.active ) { - this.menu.select( event ); - } - break; - case keyCode.ESCAPE: - if ( this.menu.element.is( ":visible" ) ) { - if ( !this.isMultiLine ) { - this._value( this.term ); + this._move( "previousPage", event ); + break; + case keyCode.PAGE_DOWN: + suppressKeyPress = true; + this._move( "nextPage", event ); + break; + case keyCode.UP: + suppressKeyPress = true; + this._keyEvent( "previous", event ); + break; + case keyCode.DOWN: + suppressKeyPress = true; + this._keyEvent( "next", event ); + break; + case keyCode.ENTER: + + // when menu is open and has focus + if ( this.menu.active ) { + + // #6055 - Opera still allows the keypress to occur + // which causes forms to submit + suppressKeyPress = true; + event.preventDefault(); + this.menu.select( event ); } - this.close( event ); + break; + case keyCode.TAB: + if ( this.menu.active ) { + this.menu.select( event ); + } + break; + case keyCode.ESCAPE: + if ( this.menu.element.is( ":visible" ) ) { + if ( !this.isMultiLine ) { + this._value( this.term ); + } + this.close( event ); - // Different browsers have different default behavior for escape - // Single press can mean undo or clear - // Double press in IE means clear the whole form - event.preventDefault(); - } - break; - default: - suppressKeyPressRepeat = true; + // Different browsers have different default behavior for escape + // Single press can mean undo or clear + // Double press in IE means clear the whole form + event.preventDefault(); + } + break; + default: + suppressKeyPressRepeat = true; - // search timeout should be triggered before the input value is changed - this._searchTimeout( event ); - break; + // search timeout should be triggered before the input value is changed + this._searchTimeout( event ); + break; } }, keypress: function( event ) { @@ -172,18 +173,18 @@ $.widget( "ui.autocomplete", { // Replicate some key handlers to allow them to repeat in Firefox and Opera var keyCode = $.ui.keyCode; switch ( event.keyCode ) { - case keyCode.PAGE_UP: - this._move( "previousPage", event ); - break; - case keyCode.PAGE_DOWN: - this._move( "nextPage", event ); - break; - case keyCode.UP: - this._keyEvent( "previous", event ); - break; - case keyCode.DOWN: - this._keyEvent( "next", event ); - break; + case keyCode.PAGE_UP: + this._move( "previousPage", event ); + break; + case keyCode.PAGE_DOWN: + this._move( "nextPage", event ); + break; + case keyCode.UP: + this._keyEvent( "previous", event ); + break; + case keyCode.DOWN: + this._keyEvent( "next", event ); + break; } }, input: function( event ) { @@ -263,8 +264,10 @@ $.widget( "ui.autocomplete", { // Announce the value in the liveRegion label = ui.item.attr( "aria-label" ) || item.value; if ( label && String.prototype.trim.call( label ).length ) { - this.liveRegion.children().hide(); - $( "
" ).text( label ).appendTo( this.liveRegion ); + clearTimeout( this.liveRegionTimer ); + this.liveRegionTimer = this._delay( function() { + this.liveRegion.html( $( "
" ).text( label ) ); + }, 100 ); } }, menuselect: function( event, ui ) { @@ -574,7 +577,7 @@ $.widget( "ui.autocomplete", { return; } if ( this.menu.isFirstItem() && /^previous/.test( direction ) || - this.menu.isLastItem() && /^next/.test( direction ) ) { + this.menu.isLastItem() && /^next/.test( direction ) ) { if ( !this.isMultiLine ) { this._value( this.term ); @@ -659,8 +662,10 @@ $.widget( "ui.autocomplete", $.ui.autocomplete, { } else { message = this.options.messages.noResults; } - this.liveRegion.children().hide(); - $( "
" ).text( message ).appendTo( this.liveRegion ); + clearTimeout( this.liveRegionTimer ); + this.liveRegionTimer = this._delay( function() { + this.liveRegion.html( $( "
" ).text( message ) ); + }, 100 ); } } ); diff --git a/wp-includes/js/jquery/ui/autocomplete.min.js b/wp-includes/js/jquery/ui/autocomplete.min.js index 4e677b9afa..911db3ed9f 100644 --- a/wp-includes/js/jquery/ui/autocomplete.min.js +++ b/wp-includes/js/jquery/ui/autocomplete.min.js @@ -1,9 +1,9 @@ /*! - * jQuery UI Autocomplete 1.13.0 + * jQuery UI Autocomplete 1.13.1 * http://jqueryui.com * * Copyright jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license */ -!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","./menu","./core"],e):e(jQuery)}(function(o){"use strict";return o.widget("ui.autocomplete",{version:"1.13.0",defaultElement:"",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var i,s,n,e=this.element[0].nodeName.toLowerCase(),t="textarea"===e,e="input"===e;this.isMultiLine=t||!e&&this._isContentEditable(this.element),this.valueMethod=this.element[t||e?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(e){if(this.element.prop("readOnly"))s=n=i=!0;else{s=n=i=!1;var t=o.ui.keyCode;switch(e.keyCode){case t.PAGE_UP:i=!0,this._move("previousPage",e);break;case t.PAGE_DOWN:i=!0,this._move("nextPage",e);break;case t.UP:i=!0,this._keyEvent("previous",e);break;case t.DOWN:i=!0,this._keyEvent("next",e);break;case t.ENTER:this.menu.active&&(i=!0,e.preventDefault(),this.menu.select(e));break;case t.TAB:this.menu.active&&this.menu.select(e);break;case t.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(e),e.preventDefault());break;default:s=!0,this._searchTimeout(e)}}},keypress:function(e){if(i)return i=!1,void(this.isMultiLine&&!this.menu.element.is(":visible")||e.preventDefault());if(!s){var t=o.ui.keyCode;switch(e.keyCode){case t.PAGE_UP:this._move("previousPage",e);break;case t.PAGE_DOWN:this._move("nextPage",e);break;case t.UP:this._keyEvent("previous",e);break;case t.DOWN:this._keyEvent("next",e)}}},input:function(e){if(n)return n=!1,void e.preventDefault();this._searchTimeout(e)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){clearTimeout(this.searching),this.close(e),this._change(e)}}),this._initSource(),this.menu=o("