Debian Codegraph @

ui/jquery-patch.js

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