blob: a4001048d881c9748961d4ba6c66a0242b9a21bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
/*!
* jQuery UI Legacy jQuery Core patches @VERSION
* https://jqueryui.com
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* https://jquery.org/license
*
*/
//>>label: Legacy jQuery Core patches
//>>group: Core
//>>description: Backport `.even()`, `.odd()` and `$.escapeSelector` to older jQuery Core versions (deprecated)
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery", "./version" ], factory );
} else {
// Browser globals
factory( jQuery );
}
} )( function( $ ) {
"use strict";
// Support: jQuery 2.2.x or older.
// 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 ) {
$.escapeSelector = function( id ) {
return CSS.escape( id + "" );
};
}
// Support: jQuery 3.4.x or older
// These methods have been defined in jQuery 3.5.0.
if ( !$.fn.even || !$.fn.odd ) {
$.fn.extend( {
even: function() {
return this.filter( function( i ) {
return i % 2 === 0;
} );
},
odd: function() {
return this.filter( function( i ) {
return i % 2 === 1;
} );
}
} );
}
} );
|