aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/core.js1
-rw-r--r--ui/jquery-patch.js31
-rw-r--r--ui/labels.js2
-rw-r--r--ui/widgets/accordion.js12
-rw-r--r--ui/widgets/checkboxradio.js2
-rw-r--r--ui/widgets/selectmenu.js2
-rw-r--r--ui/widgets/tabs.js2
7 files changed, 20 insertions, 32 deletions
diff --git a/ui/core.js b/ui/core.js
index 33d7974e2..d4651c689 100644
--- a/ui/core.js
+++ b/ui/core.js
@@ -9,7 +9,6 @@ define( [
"./focusable",
"./keycode",
"./labels",
- "./jquery-patch",
"./plugin",
"./scroll-parent",
"./tabbable",
diff --git a/ui/jquery-patch.js b/ui/jquery-patch.js
index e03b32edf..a4001048d 100644
--- a/ui/jquery-patch.js
+++ b/ui/jquery-patch.js
@@ -1,5 +1,5 @@
/*!
- * jQuery UI Support for jQuery core 1.8.x and newer @VERSION
+ * jQuery UI Legacy jQuery Core patches @VERSION
* https://jqueryui.com
*
* Copyright OpenJS Foundation and other contributors
@@ -8,9 +8,9 @@
*
*/
-//>>label: jQuery 1.8+ Support
+//>>label: Legacy jQuery Core patches
//>>group: Core
-//>>description: Support version 1.8.x and newer of jQuery core
+//>>description: Backport `.even()`, `.odd()` and `$.escapeSelector` to older jQuery Core versions (deprecated)
( function( factory ) {
"use strict";
@@ -31,29 +31,8 @@
// This method has been defined in jQuery 3.0.0.
// Code from https://github.com/jquery/jquery/blob/e539bac79e666bba95bba86d690b4e609dca2286/src/selector/escapeSelector.js
if ( !$.escapeSelector ) {
-
- // CSS string/identifier serialization
- // https://drafts.csswg.org/cssom/#common-serializing-idioms
- var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
-
- var fcssescape = function( ch, asCodePoint ) {
- if ( asCodePoint ) {
-
- // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
- if ( ch === "\0" ) {
- return "\uFFFD";
- }
-
- // Control characters and (dependent upon position) numbers get escaped as code points
- return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
- }
-
- // Other potentially-special ASCII characters get backslash-escaped
- return "\\" + ch;
- };
-
- $.escapeSelector = function( sel ) {
- return ( sel + "" ).replace( rcssescape, fcssescape );
+ $.escapeSelector = function( id ) {
+ return CSS.escape( id + "" );
};
}
diff --git a/ui/labels.js b/ui/labels.js
index 4f6533451..5ff44c28b 100644
--- a/ui/labels.js
+++ b/ui/labels.js
@@ -55,7 +55,7 @@ return $.fn.labels = function() {
ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() );
// Create a selector for the label based on the id
- selector = "label[for='" + $.escapeSelector( id ) + "']";
+ selector = "label[for='" + CSS.escape( id ) + "']";
labels = labels.add( ancestors.find( selector ).addBack( selector ) );
diff --git a/ui/widgets/accordion.js b/ui/widgets/accordion.js
index b6a7a7eee..ff6e4631d 100644
--- a/ui/widgets/accordion.js
+++ b/ui/widgets/accordion.js
@@ -52,7 +52,17 @@ return $.widget( "ui.accordion", {
collapsible: false,
event: "click",
header: function( elem ) {
- return elem.find( "> li > :first-child" ).add( elem.find( "> :not(li)" ).even() );
+ return elem
+ .find( "> li > :first-child" )
+ .add(
+ elem.find( "> :not(li)" )
+
+ // Support: jQuery <3.5 only
+ // We could use `.even()` but that's unavailable in older jQuery.
+ .filter( function( i ) {
+ return i % 2 === 0;
+ } )
+ );
},
heightStyle: "auto",
icons: {
diff --git a/ui/widgets/checkboxradio.js b/ui/widgets/checkboxradio.js
index fc812116e..379252758 100644
--- a/ui/widgets/checkboxradio.js
+++ b/ui/widgets/checkboxradio.js
@@ -156,7 +156,7 @@ $.widget( "ui.checkboxradio", [ $.ui.formResetMixin, {
_getRadioGroup: function() {
var group;
var name = this.element[ 0 ].name;
- var nameSelector = "input[name='" + $.escapeSelector( name ) + "']";
+ var nameSelector = "input[name='" + CSS.escape( name ) + "']";
if ( !name ) {
return $( [] );
diff --git a/ui/widgets/selectmenu.js b/ui/widgets/selectmenu.js
index eecd368f5..f1b48fa60 100644
--- a/ui/widgets/selectmenu.js
+++ b/ui/widgets/selectmenu.js
@@ -415,7 +415,7 @@ return $.widget( "ui.selectmenu", [ $.ui.formResetMixin, {
}
if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" +
- $.escapeSelector( this.ids.button ) ).length ) {
+ CSS.escape( this.ids.button ) ).length ) {
this.close( event );
}
}
diff --git a/ui/widgets/tabs.js b/ui/widgets/tabs.js
index e191dfbb4..72b868e4f 100644
--- a/ui/widgets/tabs.js
+++ b/ui/widgets/tabs.js
@@ -722,7 +722,7 @@ $.widget( "ui.tabs", {
// meta-function to give users option to provide a href string instead of a numerical index.
if ( typeof index === "string" ) {
index = this.anchors.index( this.anchors.filter( "[href$='" +
- $.escapeSelector( index ) + "']" ) );
+ CSS.escape( index ) + "']" ) );
}
return index;