Skip to content

Commit 6979b20

Browse files
committed
All: Drop jquery-patch.js
Avoid patching jQuery. Instead: * use `CSS.escape` instead of `jQuery.escapeSelector` * use `.filter()` with a proper handler instead of `.even()`
1 parent 816bf15 commit 6979b20

File tree

9 files changed

+26
-92
lines changed

9 files changed

+26
-92
lines changed

tests/lib/bootstrap.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,6 @@ function migrateUrl() {
169169
}
170170
}
171171

172-
var jQueryVersion = parseUrl().jquery;
173-
174-
// Load the jQuery fixes, if necessary
175-
if ( !jQueryVersion ||
176-
( jQueryVersion.indexOf( "git" ) === -1 && parseFloat( jQueryVersion ) < 4 ) ) {
177-
modules.unshift( "ui/jquery-patch" );
178-
}
179-
180172
requireTests( modules, noBackCompat );
181173
} )();
182174

tests/unit/accordion/common.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,17 @@ common.testWidget( "accordion", {
1616
disabled: false,
1717
event: "click",
1818
header: function( elem ) {
19-
return elem.find( "> li > :first-child" ).add( elem.find( "> :not(li)" ).even() );
19+
return elem
20+
.find( "> li > :first-child" )
21+
.add(
22+
elem.find( "> :not(li)" )
23+
24+
// Support: jQuery <3.5 only
25+
// We could use `.even()` but that's unavailable in older jQuery.
26+
.filter( function( i ) {
27+
return i % 2 === 0;
28+
} )
29+
);
2030
},
2131
heightStyle: "auto",
2232
icons: {

ui/core.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ define( [
99
"./focusable",
1010
"./keycode",
1111
"./labels",
12-
"./jquery-patch",
1312
"./plugin",
1413
"./scroll-parent",
1514
"./tabbable",

ui/jquery-patch.js

Lines changed: 0 additions & 77 deletions
This file was deleted.

ui/labels.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ return $.fn.labels = function() {
5555
ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() );
5656

5757
// Create a selector for the label based on the id
58-
selector = "label[for='" + $.escapeSelector( id ) + "']";
58+
selector = "label[for='" + CSS.escape( id ) + "']";
5959

6060
labels = labels.add( ancestors.find( selector ).addBack( selector ) );
6161

ui/widgets/accordion.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,17 @@ return $.widget( "ui.accordion", {
5252
collapsible: false,
5353
event: "click",
5454
header: function( elem ) {
55-
return elem.find( "> li > :first-child" ).add( elem.find( "> :not(li)" ).even() );
55+
return elem
56+
.find( "> li > :first-child" )
57+
.add(
58+
elem.find( "> :not(li)" )
59+
60+
// Support: jQuery <3.5 only
61+
// We could use `.even()` but that's unavailable in older jQuery.
62+
.filter( function( i ) {
63+
return i % 2 === 0;
64+
} )
65+
);
5666
},
5767
heightStyle: "auto",
5868
icons: {

ui/widgets/checkboxradio.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ $.widget( "ui.checkboxradio", [ $.ui.formResetMixin, {
156156
_getRadioGroup: function() {
157157
var group;
158158
var name = this.element[ 0 ].name;
159-
var nameSelector = "input[name='" + $.escapeSelector( name ) + "']";
159+
var nameSelector = "input[name='" + CSS.escape( name ) + "']";
160160

161161
if ( !name ) {
162162
return $( [] );

ui/widgets/selectmenu.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ return $.widget( "ui.selectmenu", [ $.ui.formResetMixin, {
415415
}
416416

417417
if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" +
418-
$.escapeSelector( this.ids.button ) ).length ) {
418+
CSS.escape( this.ids.button ) ).length ) {
419419
this.close( event );
420420
}
421421
}

ui/widgets/tabs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ $.widget( "ui.tabs", {
722722
// meta-function to give users option to provide a href string instead of a numerical index.
723723
if ( typeof index === "string" ) {
724724
index = this.anchors.index( this.anchors.filter( "[href$='" +
725-
$.escapeSelector( index ) + "']" ) );
725+
CSS.escape( index ) + "']" ) );
726726
}
727727

728728
return index;

0 commit comments

Comments
 (0)