mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
57 lines
1.3 KiB
JavaScript
57 lines
1.3 KiB
JavaScript
/*!
|
|
* jQuery UI Legacy jQuery Core patches 1.14.1
|
|
* 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;
|
|
} );
|
|
}
|
|
} );
|
|
}
|
|
|
|
} );
|