| 1 | /*! |
| 2 | * jQuery JavaScript Library v3.7.1 -ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-deprecated/ajax-event-alias,-effects,-effects/animatedSelector,-effects/Tween |
| 3 | * https://jquery.com/ |
| 4 | * |
| 5 | * Copyright OpenJS Foundation and other contributors |
| 6 | * Released under the MIT license |
| 7 | * https://jquery.org/license |
| 8 | * |
| 9 | * Date: 2023-08-28T13:37Z |
| 10 | */ |
| 11 | ( function( global, factory ) { |
| 12 | |
| 13 | "use strict"; |
| 14 | |
| 15 | if ( typeof module === "object" && typeof module.exports === "object" ) { |
| 16 | |
| 17 | // For CommonJS and CommonJS-like environments where a proper `window` |
| 18 | // is present, execute the factory and get jQuery. |
| 19 | // For environments that do not have a `window` with a `document` |
| 20 | // (such as Node.js), expose a factory as module.exports. |
| 21 | // This accentuates the need for the creation of a real `window`. |
| 22 | // e.g. var jQuery = require("jquery")(window); |
| 23 | // See ticket trac-14549 for more info. |
| 24 | module.exports = global.document ? |
| 25 | factory( global, true ) : |
| 26 | function( w ) { |
| 27 | if ( !w.document ) { |
| 28 | throw new Error( "jQuery requires a window with a document" ); |
| 29 | } |
| 30 | return factory( w ); |
| 31 | }; |
| 32 | } else { |
| 33 | factory( global ); |
| 34 | } |
| 35 | |
| 36 | // Pass this if window is not defined yet |
| 37 | } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { |
| 38 | |
| 39 | // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 |
| 40 | // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode |
| 41 | // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common |
| 42 | // enough that all such attempts are guarded in a try block. |
| 43 | "use strict"; |
| 44 | |
| 45 | var arr = []; |
| 46 | |
| 47 | var getProto = Object.getPrototypeOf; |
| 48 | |
| 49 | var slice = arr.slice; |
| 50 | |
| 51 | var flat = arr.flat ? function( array ) { |
| 52 | return arr.flat.call( array ); |
| 53 | } : function( array ) { |
| 54 | return arr.concat.apply( [], array ); |
| 55 | }; |
| 56 | |
| 57 | |
| 58 | var push = arr.push; |
| 59 | |
| 60 | var indexOf = arr.indexOf; |
| 61 | |
| 62 | var class2type = {}; |
| 63 | |
| 64 | var toString = class2type.toString; |
| 65 | |
| 66 | var hasOwn = class2type.hasOwnProperty; |
| 67 | |
| 68 | var fnToString = hasOwn.toString; |
| 69 | |
| 70 | var ObjectFunctionString = fnToString.call( Object ); |
| 71 | |
| 72 | var support = {}; |
| 73 | |
| 74 | var isFunction = function isFunction( obj ) { |
| 75 | |
| 76 | // Support: Chrome <=57, Firefox <=52 |
| 77 | // In some browsers, typeof returns "function" for HTML <object> elements |
| 78 | // (i.e., `typeof document.createElement( "object" ) === "function"`). |
| 79 | // We don't want to classify *any* DOM node as a function. |
| 80 | // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5 |
| 81 | // Plus for old WebKit, typeof returns "function" for HTML collections |
| 82 | // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756) |
| 83 | return typeof obj === "function" && typeof obj.nodeType !== "number" && |
| 84 | typeof obj.item !== "function"; |
| 85 | }; |
| 86 | |
| 87 | |
| 88 | var isWindow = function isWindow( obj ) { |
| 89 | return obj != null && obj === obj.window; |
| 90 | }; |
| 91 | |
| 92 | |
| 93 | var document = window.document; |
| 94 | |
| 95 | |
| 96 | |
| 97 | var preservedScriptAttributes = { |
| 98 | type: true, |
| 99 | src: true, |
| 100 | nonce: true, |
| 101 | noModule: true |
| 102 | }; |
| 103 | |
| 104 | function DOMEval( code, node, doc ) { |
| 105 | doc = doc || document; |
| 106 | |
| 107 | var i, val, |
| 108 | script = doc.createElement( "script" ); |
| 109 | |
| 110 | script.text = code; |
| 111 | if ( node ) { |
| 112 | for ( i in preservedScriptAttributes ) { |
| 113 | |
| 114 | // Support: Firefox 64+, Edge 18+ |
| 115 | // Some browsers don't support the "nonce" property on scripts. |
| 116 | // On the other hand, just using `getAttribute` is not enough as |
| 117 | // the `nonce` attribute is reset to an empty string whenever it |
| 118 | // becomes browsing-context connected. |
| 119 | // See https://github.com/whatwg/html/issues/2369 |
| 120 | // See https://html.spec.whatwg.org/#nonce-attributes |
| 121 | // The `node.getAttribute` check was added for the sake of |
| 122 | // `jQuery.globalEval` so that it can fake a nonce-containing node |
| 123 | // via an object. |
| 124 | val = node[ i ] || node.getAttribute && node.getAttribute( i ); |
| 125 | if ( val ) { |
| 126 | script.setAttribute( i, val ); |
| 127 | } |
| 128 | } |
| 129 | } |
| 130 | doc.head.appendChild( script ).parentNode.removeChild( script ); |
| 131 | } |
| 132 | |
| 133 | |
| 134 | function toType( obj ) { |
| 135 | if ( obj == null ) { |
| 136 | return obj + ""; |
| 137 | } |
| 138 | |
| 139 | // Support: Android <=2.3 only (functionish RegExp) |
| 140 | return typeof obj === "object" || typeof obj === "function" ? |
| 141 | class2type[ toString.call( obj ) ] || "object" : |
| 142 | typeof obj; |
| 143 | } |
| 144 | /* global Symbol */ |
| 145 | // Defining this global in .eslintrc.json would create a danger of using the global |
| 146 | // unguarded in another place, it seems safer to define global only for this module |
| 147 | |
| 148 | |
| 149 | |
| 150 | var version = "3.7.1 -ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-deprecated/ajax-event-alias,-effects,-effects/animatedSelector,-effects/Tween", |
| 151 | |
| 152 | rhtmlSuffix = /HTML$/i, |
| 153 | |
| 154 | // Define a local copy of jQuery |
| 155 | jQuery = function( selector, context ) { |
| 156 | |
| 157 | // The jQuery object is actually just the init constructor 'enhanced' |
| 158 | // Need init if jQuery is called (just allow error to be thrown if not included) |
| 159 | return new jQuery.fn.init( selector, context ); |
| 160 | }; |
| 161 | |
| 162 | jQuery.fn = jQuery.prototype = { |
| 163 | |
| 164 | // The current version of jQuery being used |
| 165 | jquery: version, |
| 166 | |
| 167 | constructor: jQuery, |
| 168 | |
| 169 | // The default length of a jQuery object is 0 |
| 170 | length: 0, |
| 171 | |
| 172 | toArray: function() { |
| 173 | return slice.call( this ); |
| 174 | }, |
| 175 | |
| 176 | // Get the Nth element in the matched element set OR |
| 177 | // Get the whole matched element set as a clean array |
| 178 | get: function( num ) { |
| 179 | |
| 180 | // Return all the elements in a clean array |
| 181 | if ( num == null ) { |
| 182 | return slice.call( this ); |
| 183 | } |
| 184 | |
| 185 | // Return just the one element from the set |
| 186 | return num < 0 ? this[ num + this.length ] : this[ num ]; |
| 187 | }, |
| 188 | |
| 189 | // Take an array of elements and push it onto the stack |
| 190 | // (returning the new matched element set) |
| 191 | pushStack: function( elems ) { |
| 192 | |
| 193 | // Build a new jQuery matched element set |
| 194 | var ret = jQuery.merge( this.constructor(), elems ); |
| 195 | |
| 196 | // Add the old object onto the stack (as a reference) |
| 197 | ret.prevObject = this; |
| 198 | |
| 199 | // Return the newly-formed element set |
| 200 | return ret; |
| 201 | }, |
| 202 | |
| 203 | // Execute a callback for every element in the matched set. |
| 204 | each: function( callback ) { |
| 205 | return jQuery.each( this, callback ); |
| 206 | }, |
| 207 | |
| 208 | map: function( callback ) { |
| 209 | return this.pushStack( jQuery.map( this, function( elem, i ) { |
| 210 | return callback.call( elem, i, elem ); |
| 211 | } ) ); |
| 212 | }, |
| 213 | |
| 214 | slice: function() { |
| 215 | return this.pushStack( slice.apply( this, arguments ) ); |
| 216 | }, |
| 217 | |
| 218 | first: function() { |
| 219 | return this.eq( 0 ); |
| 220 | }, |
| 221 | |
| 222 | last: function() { |
| 223 | return this.eq( -1 ); |
| 224 | }, |
| 225 | |
| 226 | even: function() { |
| 227 | return this.pushStack( jQuery.grep( this, function( _elem, i ) { |
| 228 | return ( i + 1 ) % 2; |
| 229 | } ) ); |
| 230 | }, |
| 231 | |
| 232 | odd: function() { |
| 233 | return this.pushStack( jQuery.grep( this, function( _elem, i ) { |
| 234 | return i % 2; |
| 235 | } ) ); |
| 236 | }, |
| 237 | |
| 238 | eq: function( i ) { |
| 239 | var len = this.length, |
| 240 | j = +i + ( i < 0 ? len : 0 ); |
| 241 | return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); |
| 242 | }, |
| 243 | |
| 244 | end: function() { |
| 245 | return this.prevObject || this.constructor(); |
| 246 | }, |
| 247 | |
| 248 | // For internal use only. |
| 249 | // Behaves like an Array's method, not like a jQuery method. |
| 250 | push: push, |
| 251 | sort: arr.sort, |
| 252 | splice: arr.splice |
| 253 | }; |
| 254 | |
| 255 | jQuery.extend = jQuery.fn.extend = function() { |
| 256 | var options, name, src, copy, copyIsArray, clone, |
| 257 | target = arguments[ 0 ] || {}, |
| 258 | i = 1, |
| 259 | length = arguments.length, |
| 260 | deep = false; |
| 261 | |
| 262 | // Handle a deep copy situation |
| 263 | if ( typeof target === "boolean" ) { |
| 264 | deep = target; |
| 265 | |
| 266 | // Skip the boolean and the target |
| 267 | target = arguments[ i ] || {}; |
| 268 | i++; |
| 269 | } |
| 270 | |
| 271 | // Handle case when target is a string or something (possible in deep copy) |
| 272 | if ( typeof target !== "object" && !isFunction( target ) ) { |
| 273 | target = {}; |
| 274 | } |
| 275 | |
| 276 | // Extend jQuery itself if only one argument is passed |
| 277 | if ( i === length ) { |
| 278 | target = this; |
| 279 | i--; |
| 280 | } |
| 281 | |
| 282 | for ( ; i < length; i++ ) { |
| 283 | |
| 284 | // Only deal with non-null/undefined values |
| 285 | if ( ( options = arguments[ i ] ) != null ) { |
| 286 | |
| 287 | // Extend the base object |
| 288 | for ( name in options ) { |
| 289 | copy = options[ name ]; |
| 290 | |
| 291 | // Prevent Object.prototype pollution |
| 292 | // Prevent never-ending loop |
| 293 | if ( name === "__proto__" || target === copy ) { |
| 294 | continue; |
| 295 | } |
| 296 | |
| 297 | // Recurse if we're merging plain objects or arrays |
| 298 | if ( deep && copy && ( jQuery.isPlainObject( copy ) || |
| 299 | ( copyIsArray = Array.isArray( copy ) ) ) ) { |
| 300 | src = target[ name ]; |
| 301 | |
| 302 | // Ensure proper type for the source value |
| 303 | if ( copyIsArray && !Array.isArray( src ) ) { |
| 304 | clone = []; |
| 305 | } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { |
| 306 | clone = {}; |
| 307 | } else { |
| 308 | clone = src; |
| 309 | } |
| 310 | copyIsArray = false; |
| 311 | |
| 312 | // Never move original objects, clone them |
| 313 | target[ name ] = jQuery.extend( deep, clone, copy ); |
| 314 | |
| 315 | // Don't bring in undefined values |
| 316 | } else if ( copy !== undefined ) { |
| 317 | target[ name ] = copy; |
| 318 | } |
| 319 | } |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | // Return the modified object |
| 324 | return target; |
| 325 | }; |
| 326 | |
| 327 | jQuery.extend( { |
| 328 | |
| 329 | // Unique for each copy of jQuery on the page |
| 330 | expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), |
| 331 | |
| 332 | // Assume jQuery is ready without the ready module |
| 333 | isReady: true, |
| 334 | |
| 335 | error: function( msg ) { |
| 336 | throw new Error( msg ); |
| 337 | }, |
| 338 | |
| 339 | noop: function() {}, |
| 340 | |
| 341 | isPlainObject: function( obj ) { |
| 342 | var proto, Ctor; |
| 343 | |
| 344 | // Detect obvious negatives |
| 345 | // Use toString instead of jQuery.type to catch host objects |
| 346 | if ( !obj || toString.call( obj ) !== "[object Object]" ) { |
| 347 | return false; |
| 348 | } |
| 349 | |
| 350 | proto = getProto( obj ); |
| 351 | |
| 352 | // Objects with no prototype (e.g., `Object.create( null )`) are plain |
| 353 | if ( !proto ) { |
| 354 | return true; |
| 355 | } |
| 356 | |
| 357 | // Objects with prototype are plain iff they were constructed by a global Object function |
| 358 | Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; |
| 359 | return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; |
| 360 | }, |
| 361 | |
| 362 | isEmptyObject: function( obj ) { |
| 363 | var name; |
| 364 | |
| 365 | for ( name in obj ) { |
| 366 | return false; |
| 367 | } |
| 368 | return true; |
| 369 | }, |
| 370 | |
| 371 | // Evaluates a script in a provided context; falls back to the global one |
| 372 | // if not specified. |
| 373 | globalEval: function( code, options, doc ) { |
| 374 | DOMEval( code, { nonce: options && options.nonce }, doc ); |
| 375 | }, |
| 376 | |
| 377 | each: function( obj, callback ) { |
| 378 | var length, i = 0; |
| 379 | |
| 380 | if ( isArrayLike( obj ) ) { |
| 381 | length = obj.length; |
| 382 | for ( ; i < length; i++ ) { |
| 383 | if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { |
| 384 | break; |
| 385 | } |
| 386 | } |
| 387 | } else { |
| 388 | for ( i in obj ) { |
| 389 | if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { |
| 390 | break; |
| 391 | } |
| 392 | } |
| 393 | } |
| 394 | |
| 395 | return obj; |
| 396 | }, |
| 397 | |
| 398 | |
| 399 | // Retrieve the text value of an array of DOM nodes |
| 400 | text: function( elem ) { |
| 401 | var node, |
| 402 | ret = "", |
| 403 | i = 0, |
| 404 | nodeType = elem.nodeType; |
| 405 | |
| 406 | if ( !nodeType ) { |
| 407 | |
| 408 | // If no nodeType, this is expected to be an array |
| 409 | while ( ( node = elem[ i++ ] ) ) { |
| 410 | |
| 411 | // Do not traverse comment nodes |
| 412 | ret += jQuery.text( node ); |
| 413 | } |
| 414 | } |
| 415 | if ( nodeType === 1 || nodeType === 11 ) { |
| 416 | return elem.textContent; |
| 417 | } |
| 418 | if ( nodeType === 9 ) { |
| 419 | return elem.documentElement.textContent; |
| 420 | } |
| 421 | if ( nodeType === 3 || nodeType === 4 ) { |
| 422 | return elem.nodeValue; |
| 423 | } |
| 424 | |
| 425 | // Do not include comment or processing instruction nodes |
| 426 | |
| 427 | return ret; |
| 428 | }, |
| 429 | |
| 430 | // results is for internal usage only |
| 431 | makeArray: function( arr, results ) { |
| 432 | var ret = results || []; |
| 433 | |
| 434 | if ( arr != null ) { |
| 435 | if ( isArrayLike( Object( arr ) ) ) { |
| 436 | jQuery.merge( ret, |
| 437 | typeof arr === "string" ? |
| 438 | [ arr ] : arr |
| 439 | ); |
| 440 | } else { |
| 441 | push.call( ret, arr ); |
| 442 | } |
| 443 | } |
| 444 | |
| 445 | return ret; |
| 446 | }, |
| 447 | |
| 448 | inArray: function( elem, arr, i ) { |
| 449 | return arr == null ? -1 : indexOf.call( arr, elem, i ); |
| 450 | }, |
| 451 | |
| 452 | isXMLDoc: function( elem ) { |
| 453 | var namespace = elem && elem.namespaceURI, |
| 454 | docElem = elem && ( elem.ownerDocument || elem ).documentElement; |
| 455 | |
| 456 | // Assume HTML when documentElement doesn't yet exist, such as inside |
| 457 | // document fragments. |
| 458 | return !rhtmlSuffix.test( namespace || docElem && docElem.nodeName || "HTML" ); |
| 459 | }, |
| 460 | |
| 461 | // Support: Android <=4.0 only, PhantomJS 1 only |
| 462 | // push.apply(_, arraylike) throws on ancient WebKit |
| 463 | merge: function( first, second ) { |
| 464 | var len = +second.length, |
| 465 | j = 0, |
| 466 | i = first.length; |
| 467 | |
| 468 | for ( ; j < len; j++ ) { |
| 469 | first[ i++ ] = second[ j ]; |
| 470 | } |
| 471 | |
| 472 | first.length = i; |
| 473 | |
| 474 | return first; |
| 475 | }, |
| 476 | |
| 477 | grep: function( elems, callback, invert ) { |
| 478 | var callbackInverse, |
| 479 | matches = [], |
| 480 | i = 0, |
| 481 | length = elems.length, |
| 482 | callbackExpect = !invert; |
| 483 | |
| 484 | // Go through the array, only saving the items |
| 485 | // that pass the validator function |
| 486 | for ( ; i < length; i++ ) { |
| 487 | callbackInverse = !callback( elems[ i ], i ); |
| 488 | if ( callbackInverse !== callbackExpect ) { |
| 489 | matches.push( elems[ i ] ); |
| 490 | } |
| 491 | } |
| 492 | |
| 493 | return matches; |
| 494 | }, |
| 495 | |
| 496 | // arg is for internal usage only |
| 497 | map: function( elems, callback, arg ) { |
| 498 | var length, value, |
| 499 | i = 0, |
| 500 | ret = []; |
| 501 | |
| 502 | // Go through the array, translating each of the items to their new values |
| 503 | if ( isArrayLike( elems ) ) { |
| 504 | length = elems.length; |
| 505 | for ( ; i < length; i++ ) { |
| 506 | value = callback( elems[ i ], i, arg ); |
| 507 | |
| 508 | if ( value != null ) { |
| 509 | ret.push( value ); |
| 510 | } |
| 511 | } |
| 512 | |
| 513 | // Go through every key on the object, |
| 514 | } else { |
| 515 | for ( i in elems ) { |
| 516 | value = callback( elems[ i ], i, arg ); |
| 517 | |
| 518 | if ( value != null ) { |
| 519 | ret.push( value ); |
| 520 | } |
| 521 | } |
| 522 | } |
| 523 | |
| 524 | // Flatten any nested arrays |
| 525 | return flat( ret ); |
| 526 | }, |
| 527 | |
| 528 | // A global GUID counter for objects |
| 529 | guid: 1, |
| 530 | |
| 531 | // jQuery.support is not used in Core but other projects attach their |
| 532 | // properties to it so it needs to exist. |
| 533 | support: support |
| 534 | } ); |
| 535 | |
| 536 | if ( typeof Symbol === "function" ) { |
| 537 | jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; |
| 538 | } |
| 539 | |
| 540 | // Populate the class2type map |
| 541 | jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), |
| 542 | function( _i, name ) { |
| 543 | class2type[ "[object " + name + "]" ] = name.toLowerCase(); |
| 544 | } ); |
| 545 | |
| 546 | function isArrayLike( obj ) { |
| 547 | |
| 548 | // Support: real iOS 8.2 only (not reproducible in simulator) |
| 549 | // `in` check used to prevent JIT error (gh-2145) |
| 550 | // hasOwn isn't used here due to false negatives |
| 551 | // regarding Nodelist length in IE |
| 552 | var length = !!obj && "length" in obj && obj.length, |
| 553 | type = toType( obj ); |
| 554 | |
| 555 | if ( isFunction( obj ) || isWindow( obj ) ) { |
| 556 | return false; |
| 557 | } |
| 558 | |
| 559 | return type === "array" || length === 0 || |
| 560 | typeof length === "number" && length > 0 && ( length - 1 ) in obj; |
| 561 | } |
| 562 | |
| 563 | |
| 564 | function nodeName( elem, name ) { |
| 565 | |
| 566 | return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); |
| 567 | |
| 568 | } |
| 569 | var pop = arr.pop; |
| 570 | |
| 571 | |
| 572 | var sort = arr.sort; |
| 573 | |
| 574 | |
| 575 | var splice = arr.splice; |
| 576 | |
| 577 | |
| 578 | var whitespace = "[\\x20\\t\\r\\n\\f]"; |
| 579 | |
| 580 | |
| 581 | var rtrimCSS = new RegExp( |
| 582 | "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", |
| 583 | "g" |
| 584 | ); |
| 585 | |
| 586 | |
| 587 | |
| 588 | |
| 589 | // Note: an element does not contain itself |
| 590 | jQuery.contains = function( a, b ) { |
| 591 | var bup = b && b.parentNode; |
| 592 | |
| 593 | return a === bup || !!( bup && bup.nodeType === 1 && ( |
| 594 | |
| 595 | // Support: IE 9 - 11+ |
| 596 | // IE doesn't have `contains` on SVG. |
| 597 | a.contains ? |
| 598 | a.contains( bup ) : |
| 599 | a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 |
| 600 | ) ); |
| 601 | }; |
| 602 | |
| 603 | |
| 604 | |
| 605 | |
| 606 | // CSS string/identifier serialization |
| 607 | // https://drafts.csswg.org/cssom/#common-serializing-idioms |
| 608 | var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; |
| 609 | |
| 610 | function fcssescape( ch, asCodePoint ) { |
| 611 | if ( asCodePoint ) { |
| 612 | |
| 613 | // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER |
| 614 | if ( ch === "\0" ) { |
| 615 | return "\uFFFD"; |
| 616 | } |
| 617 | |
| 618 | // Control characters and (dependent upon position) numbers get escaped as code points |
| 619 | return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; |
| 620 | } |
| 621 | |
| 622 | // Other potentially-special ASCII characters get backslash-escaped |
| 623 | return "\\" + ch; |
| 624 | } |
| 625 | |
| 626 | jQuery.escapeSelector = function( sel ) { |
| 627 | return ( sel + "" ).replace( rcssescape, fcssescape ); |
| 628 | }; |
| 629 | |
| 630 | |
| 631 | |
| 632 | |
| 633 | var preferredDoc = document, |
| 634 | pushNative = push; |
| 635 | |
| 636 | ( function() { |
| 637 | |
| 638 | var i, |
| 639 | Expr, |
| 640 | outermostContext, |
| 641 | sortInput, |
| 642 | hasDuplicate, |
| 643 | push = pushNative, |
| 644 | |
| 645 | // Local document vars |
| 646 | document, |
| 647 | documentElement, |
| 648 | documentIsHTML, |
| 649 | rbuggyQSA, |
| 650 | matches, |
| 651 | |
| 652 | // Instance-specific data |
| 653 | expando = jQuery.expando, |
| 654 | dirruns = 0, |
| 655 | done = 0, |
| 656 | classCache = createCache(), |
| 657 | tokenCache = createCache(), |
| 658 | compilerCache = createCache(), |
| 659 | nonnativeSelectorCache = createCache(), |
| 660 | sortOrder = function( a, b ) { |
| 661 | if ( a === b ) { |
| 662 | hasDuplicate = true; |
| 663 | } |
| 664 | return 0; |
| 665 | }, |
| 666 | |
| 667 | booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" + |
| 668 | "loop|multiple|open|readonly|required|scoped", |
| 669 | |
| 670 | // Regular expressions |
| 671 | |
| 672 | // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram |
| 673 | identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + |
| 674 | "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", |
| 675 | |
| 676 | // Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors |
| 677 | attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + |
| 678 | |
| 679 | // Operator (capture 2) |
| 680 | "*([*^$|!~]?=)" + whitespace + |
| 681 | |
| 682 | // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" |
| 683 | "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + |
| 684 | whitespace + "*\\]", |
| 685 | |
| 686 | pseudos = ":(" + identifier + ")(?:\\((" + |
| 687 | |
| 688 | // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: |
| 689 | // 1. quoted (capture 3; capture 4 or capture 5) |
| 690 | "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + |
| 691 | |
| 692 | // 2. simple (capture 6) |
| 693 | "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + |
| 694 | |
| 695 | // 3. anything else (capture 2) |
| 696 | ".*" + |
| 697 | ")\\)|)", |
| 698 | |
| 699 | // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter |
| 700 | rwhitespace = new RegExp( whitespace + "+", "g" ), |
| 701 | |
| 702 | rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), |
| 703 | rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + |
| 704 | whitespace + "*" ), |
| 705 | rdescend = new RegExp( whitespace + "|>" ), |
| 706 | |
| 707 | rpseudo = new RegExp( pseudos ), |
| 708 | ridentifier = new RegExp( "^" + identifier + "$" ), |
| 709 | |
| 710 | matchExpr = { |
| 711 | ID: new RegExp( "^#(" + identifier + ")" ), |
| 712 | CLASS: new RegExp( "^\\.(" + identifier + ")" ), |
| 713 | TAG: new RegExp( "^(" + identifier + "|[*])" ), |
| 714 | ATTR: new RegExp( "^" + attributes ), |
| 715 | PSEUDO: new RegExp( "^" + pseudos ), |
| 716 | CHILD: new RegExp( |
| 717 | "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + |
| 718 | whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + |
| 719 | whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), |
| 720 | bool: new RegExp( "^(?:" + booleans + ")$", "i" ), |
| 721 | |
| 722 | // For use in libraries implementing .is() |
| 723 | // We use this for POS matching in `select` |
| 724 | needsContext: new RegExp( "^" + whitespace + |
| 725 | "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + |
| 726 | "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) |
| 727 | }, |
| 728 | |
| 729 | rinputs = /^(?:input|select|textarea|button)$/i, |
| 730 | rheader = /^h\d$/i, |
| 731 | |
| 732 | // Easily-parseable/retrievable ID or TAG or CLASS selectors |
| 733 | rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, |
| 734 | |
| 735 | rsibling = /[+~]/, |
| 736 | |
| 737 | // CSS escapes |
| 738 | // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters |
| 739 | runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + |
| 740 | "?|\\\\([^\\r\\n\\f])", "g" ), |
| 741 | funescape = function( escape, nonHex ) { |
| 742 | var high = "0x" + escape.slice( 1 ) - 0x10000; |
| 743 | |
| 744 | if ( nonHex ) { |
| 745 | |
| 746 | // Strip the backslash prefix from a non-hex escape sequence |
| 747 | return nonHex; |
| 748 | } |
| 749 | |
| 750 | // Replace a hexadecimal escape sequence with the encoded Unicode code point |
| 751 | // Support: IE <=11+ |
| 752 | // For values outside the Basic Multilingual Plane (BMP), manually construct a |
| 753 | // surrogate pair |
| 754 | return high < 0 ? |
| 755 | String.fromCharCode( high + 0x10000 ) : |
| 756 | String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); |
| 757 | }, |
| 758 | |
| 759 | // Used for iframes; see `setDocument`. |
| 760 | // Support: IE 9 - 11+, Edge 12 - 18+ |
| 761 | // Removing the function wrapper causes a "Permission Denied" |
| 762 | // error in IE/Edge. |
| 763 | unloadHandler = function() { |
| 764 | setDocument(); |
| 765 | }, |
| 766 | |
| 767 | inDisabledFieldset = addCombinator( |
| 768 | function( elem ) { |
| 769 | return elem.disabled === true && nodeName( elem, "fieldset" ); |
| 770 | }, |
| 771 | { dir: "parentNode", next: "legend" } |
| 772 | ); |
| 773 | |
| 774 | // Support: IE <=9 only |
| 775 | // Accessing document.activeElement can throw unexpectedly |
| 776 | // https://bugs.jquery.com/ticket/13393 |
| 777 | function safeActiveElement() { |
| 778 | try { |
| 779 | return document.activeElement; |
| 780 | } catch ( err ) { } |
| 781 | } |
| 782 | |
| 783 | // Optimize for push.apply( _, NodeList ) |
| 784 | try { |
| 785 | push.apply( |
| 786 | ( arr = slice.call( preferredDoc.childNodes ) ), |
| 787 | preferredDoc.childNodes |
| 788 | ); |
| 789 | |
| 790 | // Support: Android <=4.0 |
| 791 | // Detect silently failing push.apply |
| 792 | // eslint-disable-next-line no-unused-expressions |
| 793 | arr[ preferredDoc.childNodes.length ].nodeType; |
| 794 | } catch ( e ) { |
| 795 | push = { |
| 796 | apply: function( target, els ) { |
| 797 | pushNative.apply( target, slice.call( els ) ); |
| 798 | }, |
| 799 | call: function( target ) { |
| 800 | pushNative.apply( target, slice.call( arguments, 1 ) ); |
| 801 | } |
| 802 | }; |
| 803 | } |
| 804 | |
| 805 | function find( selector, context, results, seed ) { |
| 806 | var m, i, elem, nid, match, groups, newSelector, |
| 807 | newContext = context && context.ownerDocument, |
| 808 | |
| 809 | // nodeType defaults to 9, since context defaults to document |
| 810 | nodeType = context ? context.nodeType : 9; |
| 811 | |
| 812 | results = results || []; |
| 813 | |
| 814 | // Return early from calls with invalid selector or context |
| 815 | if ( typeof selector !== "string" || !selector || |
| 816 | nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { |
| 817 | |
| 818 | return results; |
| 819 | } |
| 820 | |
| 821 | // Try to shortcut find operations (as opposed to filters) in HTML documents |
| 822 | if ( !seed ) { |
| 823 | setDocument( context ); |
| 824 | context = context || document; |
| 825 | |
| 826 | if ( documentIsHTML ) { |
| 827 | |
| 828 | // If the selector is sufficiently simple, try using a "get*By*" DOM method |
| 829 | // (excepting DocumentFragment context, where the methods don't exist) |
| 830 | if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) { |
| 831 | |
| 832 | // ID selector |
| 833 | if ( ( m = match[ 1 ] ) ) { |
| 834 | |
| 835 | // Document context |
| 836 | if ( nodeType === 9 ) { |
| 837 | if ( ( elem = context.getElementById( m ) ) ) { |
| 838 | |
| 839 | // Support: IE 9 only |
| 840 | // getElementById can match elements by name instead of ID |
| 841 | if ( elem.id === m ) { |
| 842 | push.call( results, elem ); |
| 843 | return results; |
| 844 | } |
| 845 | } else { |
| 846 | return results; |
| 847 | } |
| 848 | |
| 849 | // Element context |
| 850 | } else { |
| 851 | |
| 852 | // Support: IE 9 only |
| 853 | // getElementById can match elements by name instead of ID |
| 854 | if ( newContext && ( elem = newContext.getElementById( m ) ) && |
| 855 | find.contains( context, elem ) && |
| 856 | elem.id === m ) { |
| 857 | |
| 858 | push.call( results, elem ); |
| 859 | return results; |
| 860 | } |
| 861 | } |
| 862 | |
| 863 | // Type selector |
| 864 | } else if ( match[ 2 ] ) { |
| 865 | push.apply( results, context.getElementsByTagName( selector ) ); |
| 866 | return results; |
| 867 | |
| 868 | // Class selector |
| 869 | } else if ( ( m = match[ 3 ] ) && context.getElementsByClassName ) { |
| 870 | push.apply( results, context.getElementsByClassName( m ) ); |
| 871 | return results; |
| 872 | } |
| 873 | } |
| 874 | |
| 875 | // Take advantage of querySelectorAll |
| 876 | if ( !nonnativeSelectorCache[ selector + " " ] && |
| 877 | ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) ) { |
| 878 | |
| 879 | newSelector = selector; |
| 880 | newContext = context; |
| 881 | |
| 882 | // qSA considers elements outside a scoping root when evaluating child or |
| 883 | // descendant combinators, which is not what we want. |
| 884 | // In such cases, we work around the behavior by prefixing every selector in the |
| 885 | // list with an ID selector referencing the scope context. |
| 886 | // The technique has to be used as well when a leading combinator is used |
| 887 | // as such selectors are not recognized by querySelectorAll. |
| 888 | // Thanks to Andrew Dupont for this technique. |
| 889 | if ( nodeType === 1 && |
| 890 | ( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) { |
| 891 | |
| 892 | // Expand context for sibling selectors |
| 893 | newContext = rsibling.test( selector ) && testContext( context.parentNode ) || |
| 894 | context; |
| 895 | |
| 896 | // We can use :scope instead of the ID hack if the browser |
| 897 | // supports it & if we're not changing the context. |
| 898 | // Support: IE 11+, Edge 17 - 18+ |
| 899 | // IE/Edge sometimes throw a "Permission denied" error when |
| 900 | // strict-comparing two documents; shallow comparisons work. |
| 901 | // eslint-disable-next-line eqeqeq |
| 902 | if ( newContext != context || !support.scope ) { |
| 903 | |
| 904 | // Capture the context ID, setting it first if necessary |
| 905 | if ( ( nid = context.getAttribute( "id" ) ) ) { |
| 906 | nid = jQuery.escapeSelector( nid ); |
| 907 | } else { |
| 908 | context.setAttribute( "id", ( nid = expando ) ); |
| 909 | } |
| 910 | } |
| 911 | |
| 912 | // Prefix every selector in the list |
| 913 | groups = tokenize( selector ); |
| 914 | i = groups.length; |
| 915 | while ( i-- ) { |
| 916 | groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " + |
| 917 | toSelector( groups[ i ] ); |
| 918 | } |
| 919 | newSelector = groups.join( "," ); |
| 920 | } |
| 921 | |
| 922 | try { |
| 923 | push.apply( results, |
| 924 | newContext.querySelectorAll( newSelector ) |
| 925 | ); |
| 926 | return results; |
| 927 | } catch ( qsaError ) { |
| 928 | nonnativeSelectorCache( selector, true ); |
| 929 | } finally { |
| 930 | if ( nid === expando ) { |
| 931 | context.removeAttribute( "id" ); |
| 932 | } |
| 933 | } |
| 934 | } |
| 935 | } |
| 936 | } |
| 937 | |
| 938 | // All others |
| 939 | return select( selector.replace( rtrimCSS, "$1" ), context, results, seed ); |
| 940 | } |
| 941 | |
| 942 | /** |
| 943 | * Create key-value caches of limited size |
| 944 | * @returns {function(string, object)} Returns the Object data after storing it on itself with |
| 945 | * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) |
| 946 | * deleting the oldest entry |
| 947 | */ |
| 948 | function createCache() { |
| 949 | var keys = []; |
| 950 | |
| 951 | function cache( key, value ) { |
| 952 | |
| 953 | // Use (key + " ") to avoid collision with native prototype properties |
| 954 | // (see https://github.com/jquery/sizzle/issues/157) |
| 955 | if ( keys.push( key + " " ) > Expr.cacheLength ) { |
| 956 | |
| 957 | // Only keep the most recent entries |
| 958 | delete cache[ keys.shift() ]; |
| 959 | } |
| 960 | return ( cache[ key + " " ] = value ); |
| 961 | } |
| 962 | return cache; |
| 963 | } |
| 964 | |
| 965 | /** |
| 966 | * Mark a function for special use by jQuery selector module |
| 967 | * @param {Function} fn The function to mark |
| 968 | */ |
| 969 | function markFunction( fn ) { |
| 970 | fn[ expando ] = true; |
| 971 | return fn; |
| 972 | } |
| 973 | |
| 974 | /** |
| 975 | * Support testing using an element |
| 976 | * @param {Function} fn Passed the created element and returns a boolean result |
| 977 | */ |
| 978 | function assert( fn ) { |
| 979 | var el = document.createElement( "fieldset" ); |
| 980 | |
| 981 | try { |
| 982 | return !!fn( el ); |
| 983 | } catch ( e ) { |
| 984 | return false; |
| 985 | } finally { |
| 986 | |
| 987 | // Remove from its parent by default |
| 988 | if ( el.parentNode ) { |
| 989 | el.parentNode.removeChild( el ); |
| 990 | } |
| 991 | |
| 992 | // release memory in IE |
| 993 | el = null; |
| 994 | } |
| 995 | } |
| 996 | |
| 997 | /** |
| 998 | * Returns a function to use in pseudos for input types |
| 999 | * @param {String} type |
| 1000 | */ |
| 1001 | function createInputPseudo( type ) { |
| 1002 | return function( elem ) { |
| 1003 | return nodeName( elem, "input" ) && elem.type === type; |
| 1004 | }; |
| 1005 | } |
| 1006 | |
| 1007 | /** |
| 1008 | * Returns a function to use in pseudos for buttons |
| 1009 | * @param {String} type |
| 1010 | */ |
| 1011 | function createButtonPseudo( type ) { |
| 1012 | return function( elem ) { |
| 1013 | return ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) && |
| 1014 | elem.type === type; |
| 1015 | }; |
| 1016 | } |
| 1017 | |
| 1018 | /** |
| 1019 | * Returns a function to use in pseudos for :enabled/:disabled |
| 1020 | * @param {Boolean} disabled true for :disabled; false for :enabled |
| 1021 | */ |
| 1022 | function createDisabledPseudo( disabled ) { |
| 1023 | |
| 1024 | // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable |
| 1025 | return function( elem ) { |
| 1026 | |
| 1027 | // Only certain elements can match :enabled or :disabled |
| 1028 | // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled |
| 1029 | // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled |
| 1030 | if ( "form" in elem ) { |
| 1031 | |
| 1032 | // Check for inherited disabledness on relevant non-disabled elements: |
| 1033 | // * listed form-associated elements in a disabled fieldset |
| 1034 | // https://html.spec.whatwg.org/multipage/forms.html#category-listed |
| 1035 | // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled |
| 1036 | // * option elements in a disabled optgroup |
| 1037 | // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled |
| 1038 | // All such elements have a "form" property. |
| 1039 | if ( elem.parentNode && elem.disabled === false ) { |
| 1040 | |
| 1041 | // Option elements defer to a parent optgroup if present |
| 1042 | if ( "label" in elem ) { |
| 1043 | if ( "label" in elem.parentNode ) { |
| 1044 | return elem.parentNode.disabled === disabled; |
| 1045 | } else { |
| 1046 | return elem.disabled === disabled; |
| 1047 | } |
| 1048 | } |
| 1049 | |
| 1050 | // Support: IE 6 - 11+ |
| 1051 | // Use the isDisabled shortcut property to check for disabled fieldset ancestors |
| 1052 | return elem.isDisabled === disabled || |
| 1053 | |
| 1054 | // Where there is no isDisabled, check manually |
| 1055 | elem.isDisabled !== !disabled && |
| 1056 | inDisabledFieldset( elem ) === disabled; |
| 1057 | } |
| 1058 | |
| 1059 | return elem.disabled === disabled; |
| 1060 | |
| 1061 | // Try to winnow out elements that can't be disabled before trusting the disabled property. |
| 1062 | // Some victims get caught in our net (label, legend, menu, track), but it shouldn't |
| 1063 | // even exist on them, let alone have a boolean value. |
| 1064 | } else if ( "label" in elem ) { |
| 1065 | return elem.disabled === disabled; |
| 1066 | } |
| 1067 | |
| 1068 | // Remaining elements are neither :enabled nor :disabled |
| 1069 | return false; |
| 1070 | }; |
| 1071 | } |
| 1072 | |
| 1073 | /** |
| 1074 | * Returns a function to use in pseudos for positionals |
| 1075 | * @param {Function} fn |
| 1076 | */ |
| 1077 | function createPositionalPseudo( fn ) { |
| 1078 | return markFunction( function( argument ) { |
| 1079 | argument = +argument; |
| 1080 | return markFunction( function( seed, matches ) { |
| 1081 | var j, |
| 1082 | matchIndexes = fn( [], seed.length, argument ), |
| 1083 | i = matchIndexes.length; |
| 1084 | |
| 1085 | // Match elements found at the specified indexes |
| 1086 | while ( i-- ) { |
| 1087 | if ( seed[ ( j = matchIndexes[ i ] ) ] ) { |
| 1088 | seed[ j ] = !( matches[ j ] = seed[ j ] ); |
| 1089 | } |
| 1090 | } |
| 1091 | } ); |
| 1092 | } ); |
| 1093 | } |
| 1094 | |
| 1095 | /** |
| 1096 | * Checks a node for validity as a jQuery selector context |
| 1097 | * @param {Element|Object=} context |
| 1098 | * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value |
| 1099 | */ |
| 1100 | function testContext( context ) { |
| 1101 | return context && typeof context.getElementsByTagName !== "undefined" && context; |
| 1102 | } |
| 1103 | |
| 1104 | /** |
| 1105 | * Sets document-related variables once based on the current document |
| 1106 | * @param {Element|Object} [node] An element or document object to use to set the document |
| 1107 | * @returns {Object} Returns the current document |
| 1108 | */ |
| 1109 | function setDocument( node ) { |
| 1110 | var subWindow, |
| 1111 | doc = node ? node.ownerDocument || node : preferredDoc; |
| 1112 | |
| 1113 | // Return early if doc is invalid or already selected |
| 1114 | // Support: IE 11+, Edge 17 - 18+ |
| 1115 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
| 1116 | // two documents; shallow comparisons work. |
| 1117 | // eslint-disable-next-line eqeqeq |
| 1118 | if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) { |
| 1119 | return document; |
| 1120 | } |
| 1121 | |
| 1122 | // Update global variables |
| 1123 | document = doc; |
| 1124 | documentElement = document.documentElement; |
| 1125 | documentIsHTML = !jQuery.isXMLDoc( document ); |
| 1126 | |
| 1127 | // Support: iOS 7 only, IE 9 - 11+ |
| 1128 | // Older browsers didn't support unprefixed `matches`. |
| 1129 | matches = documentElement.matches || |
| 1130 | documentElement.webkitMatchesSelector || |
| 1131 | documentElement.msMatchesSelector; |
| 1132 | |
| 1133 | // Support: IE 9 - 11+, Edge 12 - 18+ |
| 1134 | // Accessing iframe documents after unload throws "permission denied" errors |
| 1135 | // (see trac-13936). |
| 1136 | // Limit the fix to IE & Edge Legacy; despite Edge 15+ implementing `matches`, |
| 1137 | // all IE 9+ and Edge Legacy versions implement `msMatchesSelector` as well. |
| 1138 | if ( documentElement.msMatchesSelector && |
| 1139 | |
| 1140 | // Support: IE 11+, Edge 17 - 18+ |
| 1141 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
| 1142 | // two documents; shallow comparisons work. |
| 1143 | // eslint-disable-next-line eqeqeq |
| 1144 | preferredDoc != document && |
| 1145 | ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { |
| 1146 | |
| 1147 | // Support: IE 9 - 11+, Edge 12 - 18+ |
| 1148 | subWindow.addEventListener( "unload", unloadHandler ); |
| 1149 | } |
| 1150 | |
| 1151 | // Support: IE <10 |
| 1152 | // Check if getElementById returns elements by name |
| 1153 | // The broken getElementById methods don't pick up programmatically-set names, |
| 1154 | // so use a roundabout getElementsByName test |
| 1155 | support.getById = assert( function( el ) { |
| 1156 | documentElement.appendChild( el ).id = jQuery.expando; |
| 1157 | return !document.getElementsByName || |
| 1158 | !document.getElementsByName( jQuery.expando ).length; |
| 1159 | } ); |
| 1160 | |
| 1161 | // Support: IE 9 only |
| 1162 | // Check to see if it's possible to do matchesSelector |
| 1163 | // on a disconnected node. |
| 1164 | support.disconnectedMatch = assert( function( el ) { |
| 1165 | return matches.call( el, "*" ); |
| 1166 | } ); |
| 1167 | |
| 1168 | // Support: IE 9 - 11+, Edge 12 - 18+ |
| 1169 | // IE/Edge don't support the :scope pseudo-class. |
| 1170 | support.scope = assert( function() { |
| 1171 | return document.querySelectorAll( ":scope" ); |
| 1172 | } ); |
| 1173 | |
| 1174 | // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only |
| 1175 | // Make sure the `:has()` argument is parsed unforgivingly. |
| 1176 | // We include `*` in the test to detect buggy implementations that are |
| 1177 | // _selectively_ forgiving (specifically when the list includes at least |
| 1178 | // one valid selector). |
| 1179 | // Note that we treat complete lack of support for `:has()` as if it were |
| 1180 | // spec-compliant support, which is fine because use of `:has()` in such |
| 1181 | // environments will fail in the qSA path and fall back to jQuery traversal |
| 1182 | // anyway. |
| 1183 | support.cssHas = assert( function() { |
| 1184 | try { |
| 1185 | document.querySelector( ":has(*,:jqfake)" ); |
| 1186 | return false; |
| 1187 | } catch ( e ) { |
| 1188 | return true; |
| 1189 | } |
| 1190 | } ); |
| 1191 | |
| 1192 | // ID filter and find |
| 1193 | if ( support.getById ) { |
| 1194 | Expr.filter.ID = function( id ) { |
| 1195 | var attrId = id.replace( runescape, funescape ); |
| 1196 | return function( elem ) { |
| 1197 | return elem.getAttribute( "id" ) === attrId; |
| 1198 | }; |
| 1199 | }; |
| 1200 | Expr.find.ID = function( id, context ) { |
| 1201 | if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { |
| 1202 | var elem = context.getElementById( id ); |
| 1203 | return elem ? [ elem ] : []; |
| 1204 | } |
| 1205 | }; |
| 1206 | } else { |
| 1207 | Expr.filter.ID = function( id ) { |
| 1208 | var attrId = id.replace( runescape, funescape ); |
| 1209 | return function( elem ) { |
| 1210 | var node = typeof elem.getAttributeNode !== "undefined" && |
| 1211 | elem.getAttributeNode( "id" ); |
| 1212 | return node && node.value === attrId; |
| 1213 | }; |
| 1214 | }; |
| 1215 | |
| 1216 | // Support: IE 6 - 7 only |
| 1217 | // getElementById is not reliable as a find shortcut |
| 1218 | Expr.find.ID = function( id, context ) { |
| 1219 | if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { |
| 1220 | var node, i, elems, |
| 1221 | elem = context.getElementById( id ); |
| 1222 | |
| 1223 | if ( elem ) { |
| 1224 | |
| 1225 | // Verify the id attribute |
| 1226 | node = elem.getAttributeNode( "id" ); |
| 1227 | if ( node && node.value === id ) { |
| 1228 | return [ elem ]; |
| 1229 | } |
| 1230 | |
| 1231 | // Fall back on getElementsByName |
| 1232 | elems = context.getElementsByName( id ); |
| 1233 | i = 0; |
| 1234 | while ( ( elem = elems[ i++ ] ) ) { |
| 1235 | node = elem.getAttributeNode( "id" ); |
| 1236 | if ( node && node.value === id ) { |
| 1237 | return [ elem ]; |
| 1238 | } |
| 1239 | } |
| 1240 | } |
| 1241 | |
| 1242 | return []; |
| 1243 | } |
| 1244 | }; |
| 1245 | } |
| 1246 | |
| 1247 | // Tag |
| 1248 | Expr.find.TAG = function( tag, context ) { |
| 1249 | if ( typeof context.getElementsByTagName !== "undefined" ) { |
| 1250 | return context.getElementsByTagName( tag ); |
| 1251 | |
| 1252 | // DocumentFragment nodes don't have gEBTN |
| 1253 | } else { |
| 1254 | return context.querySelectorAll( tag ); |
| 1255 | } |
| 1256 | }; |
| 1257 | |
| 1258 | // Class |
| 1259 | Expr.find.CLASS = function( className, context ) { |
| 1260 | if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { |
| 1261 | return context.getElementsByClassName( className ); |
| 1262 | } |
| 1263 | }; |
| 1264 | |
| 1265 | /* QSA/matchesSelector |
| 1266 | ---------------------------------------------------------------------- */ |
| 1267 | |
| 1268 | // QSA and matchesSelector support |
| 1269 | |
| 1270 | rbuggyQSA = []; |
| 1271 | |
| 1272 | // Build QSA regex |
| 1273 | // Regex strategy adopted from Diego Perini |
| 1274 | assert( function( el ) { |
| 1275 | |
| 1276 | var input; |
| 1277 | |
| 1278 | documentElement.appendChild( el ).innerHTML = |
| 1279 | "<a id='" + expando + "' href='' disabled='disabled'></a>" + |
| 1280 | "<select id='" + expando + "-\r\\' disabled='disabled'>" + |
| 1281 | "<option selected=''></option></select>"; |
| 1282 | |
| 1283 | // Support: iOS <=7 - 8 only |
| 1284 | // Boolean attributes and "value" are not treated correctly in some XML documents |
| 1285 | if ( !el.querySelectorAll( "[selected]" ).length ) { |
| 1286 | rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); |
| 1287 | } |
| 1288 | |
| 1289 | // Support: iOS <=7 - 8 only |
| 1290 | if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { |
| 1291 | rbuggyQSA.push( "~=" ); |
| 1292 | } |
| 1293 | |
| 1294 | // Support: iOS 8 only |
| 1295 | // https://bugs.webkit.org/show_bug.cgi?id=136851 |
| 1296 | // In-page `selector#id sibling-combinator selector` fails |
| 1297 | if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { |
| 1298 | rbuggyQSA.push( ".#.+[+~]" ); |
| 1299 | } |
| 1300 | |
| 1301 | // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ |
| 1302 | // In some of the document kinds, these selectors wouldn't work natively. |
| 1303 | // This is probably OK but for backwards compatibility we want to maintain |
| 1304 | // handling them through jQuery traversal in jQuery 3.x. |
| 1305 | if ( !el.querySelectorAll( ":checked" ).length ) { |
| 1306 | rbuggyQSA.push( ":checked" ); |
| 1307 | } |
| 1308 | |
| 1309 | // Support: Windows 8 Native Apps |
| 1310 | // The type and name attributes are restricted during .innerHTML assignment |
| 1311 | input = document.createElement( "input" ); |
| 1312 | input.setAttribute( "type", "hidden" ); |
| 1313 | el.appendChild( input ).setAttribute( "name", "D" ); |
| 1314 | |
| 1315 | // Support: IE 9 - 11+ |
| 1316 | // IE's :disabled selector does not pick up the children of disabled fieldsets |
| 1317 | // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ |
| 1318 | // In some of the document kinds, these selectors wouldn't work natively. |
| 1319 | // This is probably OK but for backwards compatibility we want to maintain |
| 1320 | // handling them through jQuery traversal in jQuery 3.x. |
| 1321 | documentElement.appendChild( el ).disabled = true; |
| 1322 | if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { |
| 1323 | rbuggyQSA.push( ":enabled", ":disabled" ); |
| 1324 | } |
| 1325 | |
| 1326 | // Support: IE 11+, Edge 15 - 18+ |
| 1327 | // IE 11/Edge don't find elements on a `[name='']` query in some cases. |
| 1328 | // Adding a temporary attribute to the document before the selection works |
| 1329 | // around the issue. |
| 1330 | // Interestingly, IE 10 & older don't seem to have the issue. |
| 1331 | input = document.createElement( "input" ); |
| 1332 | input.setAttribute( "name", "" ); |
| 1333 | el.appendChild( input ); |
| 1334 | if ( !el.querySelectorAll( "[name='']" ).length ) { |
| 1335 | rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + |
| 1336 | whitespace + "*(?:''|\"\")" ); |
| 1337 | } |
| 1338 | } ); |
| 1339 | |
| 1340 | if ( !support.cssHas ) { |
| 1341 | |
| 1342 | // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+ |
| 1343 | // Our regular `try-catch` mechanism fails to detect natively-unsupported |
| 1344 | // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`) |
| 1345 | // in browsers that parse the `:has()` argument as a forgiving selector list. |
| 1346 | // https://drafts.csswg.org/selectors/#relational now requires the argument |
| 1347 | // to be parsed unforgivingly, but browsers have not yet fully adjusted. |
| 1348 | rbuggyQSA.push( ":has" ); |
| 1349 | } |
| 1350 | |
| 1351 | rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); |
| 1352 | |
| 1353 | /* Sorting |
| 1354 | ---------------------------------------------------------------------- */ |
| 1355 | |
| 1356 | // Document order sorting |
| 1357 | sortOrder = function( a, b ) { |
| 1358 | |
| 1359 | // Flag for duplicate removal |
| 1360 | if ( a === b ) { |
| 1361 | hasDuplicate = true; |
| 1362 | return 0; |
| 1363 | } |
| 1364 | |
| 1365 | // Sort on method existence if only one input has compareDocumentPosition |
| 1366 | var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; |
| 1367 | if ( compare ) { |
| 1368 | return compare; |
| 1369 | } |
| 1370 | |
| 1371 | // Calculate position if both inputs belong to the same document |
| 1372 | // Support: IE 11+, Edge 17 - 18+ |
| 1373 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
| 1374 | // two documents; shallow comparisons work. |
| 1375 | // eslint-disable-next-line eqeqeq |
| 1376 | compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? |
| 1377 | a.compareDocumentPosition( b ) : |
| 1378 | |
| 1379 | // Otherwise we know they are disconnected |
| 1380 | 1; |
| 1381 | |
| 1382 | // Disconnected nodes |
| 1383 | if ( compare & 1 || |
| 1384 | ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) { |
| 1385 | |
| 1386 | // Choose the first element that is related to our preferred document |
| 1387 | // Support: IE 11+, Edge 17 - 18+ |
| 1388 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
| 1389 | // two documents; shallow comparisons work. |
| 1390 | // eslint-disable-next-line eqeqeq |
| 1391 | if ( a === document || a.ownerDocument == preferredDoc && |
| 1392 | find.contains( preferredDoc, a ) ) { |
| 1393 | return -1; |
| 1394 | } |
| 1395 | |
| 1396 | // Support: IE 11+, Edge 17 - 18+ |
| 1397 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
| 1398 | // two documents; shallow comparisons work. |
| 1399 | // eslint-disable-next-line eqeqeq |
| 1400 | if ( b === document || b.ownerDocument == preferredDoc && |
| 1401 | find.contains( preferredDoc, b ) ) { |
| 1402 | return 1; |
| 1403 | } |
| 1404 | |
| 1405 | // Maintain original order |
| 1406 | return sortInput ? |
| 1407 | ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : |
| 1408 | 0; |
| 1409 | } |
| 1410 | |
| 1411 | return compare & 4 ? -1 : 1; |
| 1412 | }; |
| 1413 | |
| 1414 | return document; |
| 1415 | } |
| 1416 | |
| 1417 | find.matches = function( expr, elements ) { |
| 1418 | return find( expr, null, null, elements ); |
| 1419 | }; |
| 1420 | |
| 1421 | find.matchesSelector = function( elem, expr ) { |
| 1422 | setDocument( elem ); |
| 1423 | |
| 1424 | if ( documentIsHTML && |
| 1425 | !nonnativeSelectorCache[ expr + " " ] && |
| 1426 | ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { |
| 1427 | |
| 1428 | try { |
| 1429 | var ret = matches.call( elem, expr ); |
| 1430 | |
| 1431 | // IE 9's matchesSelector returns false on disconnected nodes |
| 1432 | if ( ret || support.disconnectedMatch || |
| 1433 | |
| 1434 | // As well, disconnected nodes are said to be in a document |
| 1435 | // fragment in IE 9 |
| 1436 | elem.document && elem.document.nodeType !== 11 ) { |
| 1437 | return ret; |
| 1438 | } |
| 1439 | } catch ( e ) { |
| 1440 | nonnativeSelectorCache( expr, true ); |
| 1441 | } |
| 1442 | } |
| 1443 | |
| 1444 | return find( expr, document, null, [ elem ] ).length > 0; |
| 1445 | }; |
| 1446 | |
| 1447 | find.contains = function( context, elem ) { |
| 1448 | |
| 1449 | // Set document vars if needed |
| 1450 | // Support: IE 11+, Edge 17 - 18+ |
| 1451 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
| 1452 | // two documents; shallow comparisons work. |
| 1453 | // eslint-disable-next-line eqeqeq |
| 1454 | if ( ( context.ownerDocument || context ) != document ) { |
| 1455 | setDocument( context ); |
| 1456 | } |
| 1457 | return jQuery.contains( context, elem ); |
| 1458 | }; |
| 1459 | |
| 1460 | |
| 1461 | find.attr = function( elem, name ) { |
| 1462 | |
| 1463 | // Set document vars if needed |
| 1464 | // Support: IE 11+, Edge 17 - 18+ |
| 1465 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
| 1466 | // two documents; shallow comparisons work. |
| 1467 | // eslint-disable-next-line eqeqeq |
| 1468 | if ( ( elem.ownerDocument || elem ) != document ) { |
| 1469 | setDocument( elem ); |
| 1470 | } |
| 1471 | |
| 1472 | var fn = Expr.attrHandle[ name.toLowerCase() ], |
| 1473 | |
| 1474 | // Don't get fooled by Object.prototype properties (see trac-13807) |
| 1475 | val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? |
| 1476 | fn( elem, name, !documentIsHTML ) : |
| 1477 | undefined; |
| 1478 | |
| 1479 | if ( val !== undefined ) { |
| 1480 | return val; |
| 1481 | } |
| 1482 | |
| 1483 | return elem.getAttribute( name ); |
| 1484 | }; |
| 1485 | |
| 1486 | find.error = function( msg ) { |
| 1487 | throw new Error( "Syntax error, unrecognized expression: " + msg ); |
| 1488 | }; |
| 1489 | |
| 1490 | /** |
| 1491 | * Document sorting and removing duplicates |
| 1492 | * @param {ArrayLike} results |
| 1493 | */ |
| 1494 | jQuery.uniqueSort = function( results ) { |
| 1495 | var elem, |
| 1496 | duplicates = [], |
| 1497 | j = 0, |
| 1498 | i = 0; |
| 1499 | |
| 1500 | // Unless we *know* we can detect duplicates, assume their presence |
| 1501 | // |
| 1502 | // Support: Android <=4.0+ |
| 1503 | // Testing for detecting duplicates is unpredictable so instead assume we can't |
| 1504 | // depend on duplicate detection in all browsers without a stable sort. |
| 1505 | hasDuplicate = !support.sortStable; |
| 1506 | sortInput = !support.sortStable && slice.call( results, 0 ); |
| 1507 | sort.call( results, sortOrder ); |
| 1508 | |
| 1509 | if ( hasDuplicate ) { |
| 1510 | while ( ( elem = results[ i++ ] ) ) { |
| 1511 | if ( elem === results[ i ] ) { |
| 1512 | j = duplicates.push( i ); |
| 1513 | } |
| 1514 | } |
| 1515 | while ( j-- ) { |
| 1516 | splice.call( results, duplicates[ j ], 1 ); |
| 1517 | } |
| 1518 | } |
| 1519 | |
| 1520 | // Clear input after sorting to release objects |
| 1521 | // See https://github.com/jquery/sizzle/pull/225 |
| 1522 | sortInput = null; |
| 1523 | |
| 1524 | return results; |
| 1525 | }; |
| 1526 | |
| 1527 | jQuery.fn.uniqueSort = function() { |
| 1528 | return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) ); |
| 1529 | }; |
| 1530 | |
| 1531 | Expr = jQuery.expr = { |
| 1532 | |
| 1533 | // Can be adjusted by the user |
| 1534 | cacheLength: 50, |
| 1535 | |
| 1536 | createPseudo: markFunction, |
| 1537 | |
| 1538 | match: matchExpr, |
| 1539 | |
| 1540 | attrHandle: {}, |
| 1541 | |
| 1542 | find: {}, |
| 1543 | |
| 1544 | relative: { |
| 1545 | ">": { dir: "parentNode", first: true }, |
| 1546 | " ": { dir: "parentNode" }, |
| 1547 | "+": { dir: "previousSibling", first: true }, |
| 1548 | "~": { dir: "previousSibling" } |
| 1549 | }, |
| 1550 | |
| 1551 | preFilter: { |
| 1552 | ATTR: function( match ) { |
| 1553 | match[ 1 ] = match[ 1 ].replace( runescape, funescape ); |
| 1554 | |
| 1555 | // Move the given value to match[3] whether quoted or unquoted |
| 1556 | match[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" ) |
| 1557 | .replace( runescape, funescape ); |
| 1558 | |
| 1559 | if ( match[ 2 ] === "~=" ) { |
| 1560 | match[ 3 ] = " " + match[ 3 ] + " "; |
| 1561 | } |
| 1562 | |
| 1563 | return match.slice( 0, 4 ); |
| 1564 | }, |
| 1565 | |
| 1566 | CHILD: function( match ) { |
| 1567 | |
| 1568 | /* matches from matchExpr["CHILD"] |
| 1569 | 1 type (only|nth|...) |
| 1570 | 2 what (child|of-type) |
| 1571 | 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) |
| 1572 | 4 xn-component of xn+y argument ([+-]?\d*n|) |
| 1573 | 5 sign of xn-component |
| 1574 | 6 x of xn-component |
| 1575 | 7 sign of y-component |
| 1576 | 8 y of y-component |
| 1577 | */ |
| 1578 | match[ 1 ] = match[ 1 ].toLowerCase(); |
| 1579 | |
| 1580 | if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { |
| 1581 | |
| 1582 | // nth-* requires argument |
| 1583 | if ( !match[ 3 ] ) { |
| 1584 | find.error( match[ 0 ] ); |
| 1585 | } |
| 1586 | |
| 1587 | // numeric x and y parameters for Expr.filter.CHILD |
| 1588 | // remember that false/true cast respectively to 0/1 |
| 1589 | match[ 4 ] = +( match[ 4 ] ? |
| 1590 | match[ 5 ] + ( match[ 6 ] || 1 ) : |
| 1591 | 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) |
| 1592 | ); |
| 1593 | match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); |
| 1594 | |
| 1595 | // other types prohibit arguments |
| 1596 | } else if ( match[ 3 ] ) { |
| 1597 | find.error( match[ 0 ] ); |
| 1598 | } |
| 1599 | |
| 1600 | return match; |
| 1601 | }, |
| 1602 | |
| 1603 | PSEUDO: function( match ) { |
| 1604 | var excess, |
| 1605 | unquoted = !match[ 6 ] && match[ 2 ]; |
| 1606 | |
| 1607 | if ( matchExpr.CHILD.test( match[ 0 ] ) ) { |
| 1608 | return null; |
| 1609 | } |
| 1610 | |
| 1611 | // Accept quoted arguments as-is |
| 1612 | if ( match[ 3 ] ) { |
| 1613 | match[ 2 ] = match[ 4 ] || match[ 5 ] || ""; |
| 1614 | |
| 1615 | // Strip excess characters from unquoted arguments |
| 1616 | } else if ( unquoted && rpseudo.test( unquoted ) && |
| 1617 | |
| 1618 | // Get excess from tokenize (recursively) |
| 1619 | ( excess = tokenize( unquoted, true ) ) && |
| 1620 | |
| 1621 | // advance to the next closing parenthesis |
| 1622 | ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) { |
| 1623 | |
| 1624 | // excess is a negative index |
| 1625 | match[ 0 ] = match[ 0 ].slice( 0, excess ); |
| 1626 | match[ 2 ] = unquoted.slice( 0, excess ); |
| 1627 | } |
| 1628 | |
| 1629 | // Return only captures needed by the pseudo filter method (type and argument) |
| 1630 | return match.slice( 0, 3 ); |
| 1631 | } |
| 1632 | }, |
| 1633 | |
| 1634 | filter: { |
| 1635 | |
| 1636 | TAG: function( nodeNameSelector ) { |
| 1637 | var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); |
| 1638 | return nodeNameSelector === "*" ? |
| 1639 | function() { |
| 1640 | return true; |
| 1641 | } : |
| 1642 | function( elem ) { |
| 1643 | return nodeName( elem, expectedNodeName ); |
| 1644 | }; |
| 1645 | }, |
| 1646 | |
| 1647 | CLASS: function( className ) { |
| 1648 | var pattern = classCache[ className + " " ]; |
| 1649 | |
| 1650 | return pattern || |
| 1651 | ( pattern = new RegExp( "(^|" + whitespace + ")" + className + |
| 1652 | "(" + whitespace + "|$)" ) ) && |
| 1653 | classCache( className, function( elem ) { |
| 1654 | return pattern.test( |
| 1655 | typeof elem.className === "string" && elem.className || |
| 1656 | typeof elem.getAttribute !== "undefined" && |
| 1657 | elem.getAttribute( "class" ) || |
| 1658 | "" |
| 1659 | ); |
| 1660 | } ); |
| 1661 | }, |
| 1662 | |
| 1663 | ATTR: function( name, operator, check ) { |
| 1664 | return function( elem ) { |
| 1665 | var result = find.attr( elem, name ); |
| 1666 | |
| 1667 | if ( result == null ) { |
| 1668 | return operator === "!="; |
| 1669 | } |
| 1670 | if ( !operator ) { |
| 1671 | return true; |
| 1672 | } |
| 1673 | |
| 1674 | result += ""; |
| 1675 | |
| 1676 | if ( operator === "=" ) { |
| 1677 | return result === check; |
| 1678 | } |
| 1679 | if ( operator === "!=" ) { |
| 1680 | return result !== check; |
| 1681 | } |
| 1682 | if ( operator === "^=" ) { |
| 1683 | return check && result.indexOf( check ) === 0; |
| 1684 | } |
| 1685 | if ( operator === "*=" ) { |
| 1686 | return check && result.indexOf( check ) > -1; |
| 1687 | } |
| 1688 | if ( operator === "$=" ) { |
| 1689 | return check && result.slice( -check.length ) === check; |
| 1690 | } |
| 1691 | if ( operator === "~=" ) { |
| 1692 | return ( " " + result.replace( rwhitespace, " " ) + " " ) |
| 1693 | .indexOf( check ) > -1; |
| 1694 | } |
| 1695 | if ( operator === "|=" ) { |
| 1696 | return result === check || result.slice( 0, check.length + 1 ) === check + "-"; |
| 1697 | } |
| 1698 | |
| 1699 | return false; |
| 1700 | }; |
| 1701 | }, |
| 1702 | |
| 1703 | CHILD: function( type, what, _argument, first, last ) { |
| 1704 | var simple = type.slice( 0, 3 ) !== "nth", |
| 1705 | forward = type.slice( -4 ) !== "last", |
| 1706 | ofType = what === "of-type"; |
| 1707 | |
| 1708 | return first === 1 && last === 0 ? |
| 1709 | |
| 1710 | // Shortcut for :nth-*(n) |
| 1711 | function( elem ) { |
| 1712 | return !!elem.parentNode; |
| 1713 | } : |
| 1714 | |
| 1715 | function( elem, _context, xml ) { |
| 1716 | var cache, outerCache, node, nodeIndex, start, |
| 1717 | dir = simple !== forward ? "nextSibling" : "previousSibling", |
| 1718 | parent = elem.parentNode, |
| 1719 | name = ofType && elem.nodeName.toLowerCase(), |
| 1720 | useCache = !xml && !ofType, |
| 1721 | diff = false; |
| 1722 | |
| 1723 | if ( parent ) { |
| 1724 | |
| 1725 | // :(first|last|only)-(child|of-type) |
| 1726 | if ( simple ) { |
| 1727 | while ( dir ) { |
| 1728 | node = elem; |
| 1729 | while ( ( node = node[ dir ] ) ) { |
| 1730 | if ( ofType ? |
| 1731 | nodeName( node, name ) : |
| 1732 | node.nodeType === 1 ) { |
| 1733 | |
| 1734 | return false; |
| 1735 | } |
| 1736 | } |
| 1737 | |
| 1738 | // Reverse direction for :only-* (if we haven't yet done so) |
| 1739 | start = dir = type === "only" && !start && "nextSibling"; |
| 1740 | } |
| 1741 | return true; |
| 1742 | } |
| 1743 | |
| 1744 | start = [ forward ? parent.firstChild : parent.lastChild ]; |
| 1745 | |
| 1746 | // non-xml :nth-child(...) stores cache data on `parent` |
| 1747 | if ( forward && useCache ) { |
| 1748 | |
| 1749 | // Seek `elem` from a previously-cached index |
| 1750 | outerCache = parent[ expando ] || ( parent[ expando ] = {} ); |
| 1751 | cache = outerCache[ type ] || []; |
| 1752 | nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; |
| 1753 | diff = nodeIndex && cache[ 2 ]; |
| 1754 | node = nodeIndex && parent.childNodes[ nodeIndex ]; |
| 1755 | |
| 1756 | while ( ( node = ++nodeIndex && node && node[ dir ] || |
| 1757 | |
| 1758 | // Fallback to seeking `elem` from the start |
| 1759 | ( diff = nodeIndex = 0 ) || start.pop() ) ) { |
| 1760 | |
| 1761 | // When found, cache indexes on `parent` and break |
| 1762 | if ( node.nodeType === 1 && ++diff && node === elem ) { |
| 1763 | outerCache[ type ] = [ dirruns, nodeIndex, diff ]; |
| 1764 | break; |
| 1765 | } |
| 1766 | } |
| 1767 | |
| 1768 | } else { |
| 1769 | |
| 1770 | // Use previously-cached element index if available |
| 1771 | if ( useCache ) { |
| 1772 | outerCache = elem[ expando ] || ( elem[ expando ] = {} ); |
| 1773 | cache = outerCache[ type ] || []; |
| 1774 | nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; |
| 1775 | diff = nodeIndex; |
| 1776 | } |
| 1777 | |
| 1778 | // xml :nth-child(...) |
| 1779 | // or :nth-last-child(...) or :nth(-last)?-of-type(...) |
| 1780 | if ( diff === false ) { |
| 1781 | |
| 1782 | // Use the same loop as above to seek `elem` from the start |
| 1783 | while ( ( node = ++nodeIndex && node && node[ dir ] || |
| 1784 | ( diff = nodeIndex = 0 ) || start.pop() ) ) { |
| 1785 | |
| 1786 | if ( ( ofType ? |
| 1787 | nodeName( node, name ) : |
| 1788 | node.nodeType === 1 ) && |
| 1789 | ++diff ) { |
| 1790 | |
| 1791 | // Cache the index of each encountered element |
| 1792 | if ( useCache ) { |
| 1793 | outerCache = node[ expando ] || |
| 1794 | ( node[ expando ] = {} ); |
| 1795 | outerCache[ type ] = [ dirruns, diff ]; |
| 1796 | } |
| 1797 | |
| 1798 | if ( node === elem ) { |
| 1799 | break; |
| 1800 | } |
| 1801 | } |
| 1802 | } |
| 1803 | } |
| 1804 | } |
| 1805 | |
| 1806 | // Incorporate the offset, then check against cycle size |
| 1807 | diff -= last; |
| 1808 | return diff === first || ( diff % first === 0 && diff / first >= 0 ); |
| 1809 | } |
| 1810 | }; |
| 1811 | }, |
| 1812 | |
| 1813 | PSEUDO: function( pseudo, argument ) { |
| 1814 | |
| 1815 | // pseudo-class names are case-insensitive |
| 1816 | // https://www.w3.org/TR/selectors/#pseudo-classes |
| 1817 | // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters |
| 1818 | // Remember that setFilters inherits from pseudos |
| 1819 | var args, |
| 1820 | fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || |
| 1821 | find.error( "unsupported pseudo: " + pseudo ); |
| 1822 | |
| 1823 | // The user may use createPseudo to indicate that |
| 1824 | // arguments are needed to create the filter function |
| 1825 | // just as jQuery does |
| 1826 | if ( fn[ expando ] ) { |
| 1827 | return fn( argument ); |
| 1828 | } |
| 1829 | |
| 1830 | // But maintain support for old signatures |
| 1831 | if ( fn.length > 1 ) { |
| 1832 | args = [ pseudo, pseudo, "", argument ]; |
| 1833 | return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? |
| 1834 | markFunction( function( seed, matches ) { |
| 1835 | var idx, |
| 1836 | matched = fn( seed, argument ), |
| 1837 | i = matched.length; |
| 1838 | while ( i-- ) { |
| 1839 | idx = indexOf.call( seed, matched[ i ] ); |
| 1840 | seed[ idx ] = !( matches[ idx ] = matched[ i ] ); |
| 1841 | } |
| 1842 | } ) : |
| 1843 | function( elem ) { |
| 1844 | return fn( elem, 0, args ); |
| 1845 | }; |
| 1846 | } |
| 1847 | |
| 1848 | return fn; |
| 1849 | } |
| 1850 | }, |
| 1851 | |
| 1852 | pseudos: { |
| 1853 | |
| 1854 | // Potentially complex pseudos |
| 1855 | not: markFunction( function( selector ) { |
| 1856 | |
| 1857 | // Trim the selector passed to compile |
| 1858 | // to avoid treating leading and trailing |
| 1859 | // spaces as combinators |
| 1860 | var input = [], |
| 1861 | results = [], |
| 1862 | matcher = compile( selector.replace( rtrimCSS, "$1" ) ); |
| 1863 | |
| 1864 | return matcher[ expando ] ? |
| 1865 | markFunction( function( seed, matches, _context, xml ) { |
| 1866 | var elem, |
| 1867 | unmatched = matcher( seed, null, xml, [] ), |
| 1868 | i = seed.length; |
| 1869 | |
| 1870 | // Match elements unmatched by `matcher` |
| 1871 | while ( i-- ) { |
| 1872 | if ( ( elem = unmatched[ i ] ) ) { |
| 1873 | seed[ i ] = !( matches[ i ] = elem ); |
| 1874 | } |
| 1875 | } |
| 1876 | } ) : |
| 1877 | function( elem, _context, xml ) { |
| 1878 | input[ 0 ] = elem; |
| 1879 | matcher( input, null, xml, results ); |
| 1880 | |
| 1881 | // Don't keep the element |
| 1882 | // (see https://github.com/jquery/sizzle/issues/299) |
| 1883 | input[ 0 ] = null; |
| 1884 | return !results.pop(); |
| 1885 | }; |
| 1886 | } ), |
| 1887 | |
| 1888 | has: markFunction( function( selector ) { |
| 1889 | return function( elem ) { |
| 1890 | return find( selector, elem ).length > 0; |
| 1891 | }; |
| 1892 | } ), |
| 1893 | |
| 1894 | contains: markFunction( function( text ) { |
| 1895 | text = text.replace( runescape, funescape ); |
| 1896 | return function( elem ) { |
| 1897 | return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1; |
| 1898 | }; |
| 1899 | } ), |
| 1900 | |
| 1901 | // "Whether an element is represented by a :lang() selector |
| 1902 | // is based solely on the element's language value |
| 1903 | // being equal to the identifier C, |
| 1904 | // or beginning with the identifier C immediately followed by "-". |
| 1905 | // The matching of C against the element's language value is performed case-insensitively. |
| 1906 | // The identifier C does not have to be a valid language name." |
| 1907 | // https://www.w3.org/TR/selectors/#lang-pseudo |
| 1908 | lang: markFunction( function( lang ) { |
| 1909 | |
| 1910 | // lang value must be a valid identifier |
| 1911 | if ( !ridentifier.test( lang || "" ) ) { |
| 1912 | find.error( "unsupported lang: " + lang ); |
| 1913 | } |
| 1914 | lang = lang.replace( runescape, funescape ).toLowerCase(); |
| 1915 | return function( elem ) { |
| 1916 | var elemLang; |
| 1917 | do { |
| 1918 | if ( ( elemLang = documentIsHTML ? |
| 1919 | elem.lang : |
| 1920 | elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) { |
| 1921 | |
| 1922 | elemLang = elemLang.toLowerCase(); |
| 1923 | return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; |
| 1924 | } |
| 1925 | } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 ); |
| 1926 | return false; |
| 1927 | }; |
| 1928 | } ), |
| 1929 | |
| 1930 | // Miscellaneous |
| 1931 | target: function( elem ) { |
| 1932 | var hash = window.location && window.location.hash; |
| 1933 | return hash && hash.slice( 1 ) === elem.id; |
| 1934 | }, |
| 1935 | |
| 1936 | root: function( elem ) { |
| 1937 | return elem === documentElement; |
| 1938 | }, |
| 1939 | |
| 1940 | focus: function( elem ) { |
| 1941 | return elem === safeActiveElement() && |
| 1942 | document.hasFocus() && |
| 1943 | !!( elem.type || elem.href || ~elem.tabIndex ); |
| 1944 | }, |
| 1945 | |
| 1946 | // Boolean properties |
| 1947 | enabled: createDisabledPseudo( false ), |
| 1948 | disabled: createDisabledPseudo( true ), |
| 1949 | |
| 1950 | checked: function( elem ) { |
| 1951 | |
| 1952 | // In CSS3, :checked should return both checked and selected elements |
| 1953 | // https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked |
| 1954 | return ( nodeName( elem, "input" ) && !!elem.checked ) || |
| 1955 | ( nodeName( elem, "option" ) && !!elem.selected ); |
| 1956 | }, |
| 1957 | |
| 1958 | selected: function( elem ) { |
| 1959 | |
| 1960 | // Support: IE <=11+ |
| 1961 | // Accessing the selectedIndex property |
| 1962 | // forces the browser to treat the default option as |
| 1963 | // selected when in an optgroup. |
| 1964 | if ( elem.parentNode ) { |
| 1965 | // eslint-disable-next-line no-unused-expressions |
| 1966 | elem.parentNode.selectedIndex; |
| 1967 | } |
| 1968 | |
| 1969 | return elem.selected === true; |
| 1970 | }, |
| 1971 | |
| 1972 | // Contents |
| 1973 | empty: function( elem ) { |
| 1974 | |
| 1975 | // https://www.w3.org/TR/selectors/#empty-pseudo |
| 1976 | // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), |
| 1977 | // but not by others (comment: 8; processing instruction: 7; etc.) |
| 1978 | // nodeType < 6 works because attributes (2) do not appear as children |
| 1979 | for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { |
| 1980 | if ( elem.nodeType < 6 ) { |
| 1981 | return false; |
| 1982 | } |
| 1983 | } |
| 1984 | return true; |
| 1985 | }, |
| 1986 | |
| 1987 | parent: function( elem ) { |
| 1988 | return !Expr.pseudos.empty( elem ); |
| 1989 | }, |
| 1990 | |
| 1991 | // Element/input types |
| 1992 | header: function( elem ) { |
| 1993 | return rheader.test( elem.nodeName ); |
| 1994 | }, |
| 1995 | |
| 1996 | input: function( elem ) { |
| 1997 | return rinputs.test( elem.nodeName ); |
| 1998 | }, |
| 1999 | |
| 2000 | button: function( elem ) { |
| 2001 | return nodeName( elem, "input" ) && elem.type === "button" || |
| 2002 | nodeName( elem, "button" ); |
| 2003 | }, |
| 2004 | |
| 2005 | text: function( elem ) { |
| 2006 | var attr; |
| 2007 | return nodeName( elem, "input" ) && elem.type === "text" && |
| 2008 | |
| 2009 | // Support: IE <10 only |
| 2010 | // New HTML5 attribute values (e.g., "search") appear |
| 2011 | // with elem.type === "text" |
| 2012 | ( ( attr = elem.getAttribute( "type" ) ) == null || |
| 2013 | attr.toLowerCase() === "text" ); |
| 2014 | }, |
| 2015 | |
| 2016 | // Position-in-collection |
| 2017 | first: createPositionalPseudo( function() { |
| 2018 | return [ 0 ]; |
| 2019 | } ), |
| 2020 | |
| 2021 | last: createPositionalPseudo( function( _matchIndexes, length ) { |
| 2022 | return [ length - 1 ]; |
| 2023 | } ), |
| 2024 | |
| 2025 | eq: createPositionalPseudo( function( _matchIndexes, length, argument ) { |
| 2026 | return [ argument < 0 ? argument + length : argument ]; |
| 2027 | } ), |
| 2028 | |
| 2029 | even: createPositionalPseudo( function( matchIndexes, length ) { |
| 2030 | var i = 0; |
| 2031 | for ( ; i < length; i += 2 ) { |
| 2032 | matchIndexes.push( i ); |
| 2033 | } |
| 2034 | return matchIndexes; |
| 2035 | } ), |
| 2036 | |
| 2037 | odd: createPositionalPseudo( function( matchIndexes, length ) { |
| 2038 | var i = 1; |
| 2039 | for ( ; i < length; i += 2 ) { |
| 2040 | matchIndexes.push( i ); |
| 2041 | } |
| 2042 | return matchIndexes; |
| 2043 | } ), |
| 2044 | |
| 2045 | lt: createPositionalPseudo( function( matchIndexes, length, argument ) { |
| 2046 | var i; |
| 2047 | |
| 2048 | if ( argument < 0 ) { |
| 2049 | i = argument + length; |
| 2050 | } else if ( argument > length ) { |
| 2051 | i = length; |
| 2052 | } else { |
| 2053 | i = argument; |
| 2054 | } |
| 2055 | |
| 2056 | for ( ; --i >= 0; ) { |
| 2057 | matchIndexes.push( i ); |
| 2058 | } |
| 2059 | return matchIndexes; |
| 2060 | } ), |
| 2061 | |
| 2062 | gt: createPositionalPseudo( function( matchIndexes, length, argument ) { |
| 2063 | var i = argument < 0 ? argument + length : argument; |
| 2064 | for ( ; ++i < length; ) { |
| 2065 | matchIndexes.push( i ); |
| 2066 | } |
| 2067 | return matchIndexes; |
| 2068 | } ) |
| 2069 | } |
| 2070 | }; |
| 2071 | |
| 2072 | Expr.pseudos.nth = Expr.pseudos.eq; |
| 2073 | |
| 2074 | // Add button/input type pseudos |
| 2075 | for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { |
| 2076 | Expr.pseudos[ i ] = createInputPseudo( i ); |
| 2077 | } |
| 2078 | for ( i in { submit: true, reset: true } ) { |
| 2079 | Expr.pseudos[ i ] = createButtonPseudo( i ); |
| 2080 | } |
| 2081 | |
| 2082 | // Easy API for creating new setFilters |
| 2083 | function setFilters() {} |
| 2084 | setFilters.prototype = Expr.filters = Expr.pseudos; |
| 2085 | Expr.setFilters = new setFilters(); |
| 2086 | |
| 2087 | function tokenize( selector, parseOnly ) { |
| 2088 | var matched, match, tokens, type, |
| 2089 | soFar, groups, preFilters, |
| 2090 | cached = tokenCache[ selector + " " ]; |
| 2091 | |
| 2092 | if ( cached ) { |
| 2093 | return parseOnly ? 0 : cached.slice( 0 ); |
| 2094 | } |
| 2095 | |
| 2096 | soFar = selector; |
| 2097 | groups = []; |
| 2098 | preFilters = Expr.preFilter; |
| 2099 | |
| 2100 | while ( soFar ) { |
| 2101 | |
| 2102 | // Comma and first run |
| 2103 | if ( !matched || ( match = rcomma.exec( soFar ) ) ) { |
| 2104 | if ( match ) { |
| 2105 | |
| 2106 | // Don't consume trailing commas as valid |
| 2107 | soFar = soFar.slice( match[ 0 ].length ) || soFar; |
| 2108 | } |
| 2109 | groups.push( ( tokens = [] ) ); |
| 2110 | } |
| 2111 | |
| 2112 | matched = false; |
| 2113 | |
| 2114 | // Combinators |
| 2115 | if ( ( match = rleadingCombinator.exec( soFar ) ) ) { |
| 2116 | matched = match.shift(); |
| 2117 | tokens.push( { |
| 2118 | value: matched, |
| 2119 | |
| 2120 | // Cast descendant combinators to space |
| 2121 | type: match[ 0 ].replace( rtrimCSS, " " ) |
| 2122 | } ); |
| 2123 | soFar = soFar.slice( matched.length ); |
| 2124 | } |
| 2125 | |
| 2126 | // Filters |
| 2127 | for ( type in Expr.filter ) { |
| 2128 | if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || |
| 2129 | ( match = preFilters[ type ]( match ) ) ) ) { |
| 2130 | matched = match.shift(); |
| 2131 | tokens.push( { |
| 2132 | value: matched, |
| 2133 | type: type, |
| 2134 | matches: match |
| 2135 | } ); |
| 2136 | soFar = soFar.slice( matched.length ); |
| 2137 | } |
| 2138 | } |
| 2139 | |
| 2140 | if ( !matched ) { |
| 2141 | break; |
| 2142 | } |
| 2143 | } |
| 2144 | |
| 2145 | // Return the length of the invalid excess |
| 2146 | // if we're just parsing |
| 2147 | // Otherwise, throw an error or return tokens |
| 2148 | if ( parseOnly ) { |
| 2149 | return soFar.length; |
| 2150 | } |
| 2151 | |
| 2152 | return soFar ? |
| 2153 | find.error( selector ) : |
| 2154 | |
| 2155 | // Cache the tokens |
| 2156 | tokenCache( selector, groups ).slice( 0 ); |
| 2157 | } |
| 2158 | |
| 2159 | function toSelector( tokens ) { |
| 2160 | var i = 0, |
| 2161 | len = tokens.length, |
| 2162 | selector = ""; |
| 2163 | for ( ; i < len; i++ ) { |
| 2164 | selector += tokens[ i ].value; |
| 2165 | } |
| 2166 | return selector; |
| 2167 | } |
| 2168 | |
| 2169 | function addCombinator( matcher, combinator, base ) { |
| 2170 | var dir = combinator.dir, |
| 2171 | skip = combinator.next, |
| 2172 | key = skip || dir, |
| 2173 | checkNonElements = base && key === "parentNode", |
| 2174 | doneName = done++; |
| 2175 | |
| 2176 | return combinator.first ? |
| 2177 | |
| 2178 | // Check against closest ancestor/preceding element |
| 2179 | function( elem, context, xml ) { |
| 2180 | while ( ( elem = elem[ dir ] ) ) { |
| 2181 | if ( elem.nodeType === 1 || checkNonElements ) { |
| 2182 | return matcher( elem, context, xml ); |
| 2183 | } |
| 2184 | } |
| 2185 | return false; |
| 2186 | } : |
| 2187 | |
| 2188 | // Check against all ancestor/preceding elements |
| 2189 | function( elem, context, xml ) { |
| 2190 | var oldCache, outerCache, |
| 2191 | newCache = [ dirruns, doneName ]; |
| 2192 | |
| 2193 | // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching |
| 2194 | if ( xml ) { |
| 2195 | while ( ( elem = elem[ dir ] ) ) { |
| 2196 | if ( elem.nodeType === 1 || checkNonElements ) { |
| 2197 | if ( matcher( elem, context, xml ) ) { |
| 2198 | return true; |
| 2199 | } |
| 2200 | } |
| 2201 | } |
| 2202 | } else { |
| 2203 | while ( ( elem = elem[ dir ] ) ) { |
| 2204 | if ( elem.nodeType === 1 || checkNonElements ) { |
| 2205 | outerCache = elem[ expando ] || ( elem[ expando ] = {} ); |
| 2206 | |
| 2207 | if ( skip && nodeName( elem, skip ) ) { |
| 2208 | elem = elem[ dir ] || elem; |
| 2209 | } else if ( ( oldCache = outerCache[ key ] ) && |
| 2210 | oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { |
| 2211 | |
| 2212 | // Assign to newCache so results back-propagate to previous elements |
| 2213 | return ( newCache[ 2 ] = oldCache[ 2 ] ); |
| 2214 | } else { |
| 2215 | |
| 2216 | // Reuse newcache so results back-propagate to previous elements |
| 2217 | outerCache[ key ] = newCache; |
| 2218 | |
| 2219 | // A match means we're done; a fail means we have to keep checking |
| 2220 | if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { |
| 2221 | return true; |
| 2222 | } |
| 2223 | } |
| 2224 | } |
| 2225 | } |
| 2226 | } |
| 2227 | return false; |
| 2228 | }; |
| 2229 | } |
| 2230 | |
| 2231 | function elementMatcher( matchers ) { |
| 2232 | return matchers.length > 1 ? |
| 2233 | function( elem, context, xml ) { |
| 2234 | var i = matchers.length; |
| 2235 | while ( i-- ) { |
| 2236 | if ( !matchers[ i ]( elem, context, xml ) ) { |
| 2237 | return false; |
| 2238 | } |
| 2239 | } |
| 2240 | return true; |
| 2241 | } : |
| 2242 | matchers[ 0 ]; |
| 2243 | } |
| 2244 | |
| 2245 | function multipleContexts( selector, contexts, results ) { |
| 2246 | var i = 0, |
| 2247 | len = contexts.length; |
| 2248 | for ( ; i < len; i++ ) { |
| 2249 | find( selector, contexts[ i ], results ); |
| 2250 | } |
| 2251 | return results; |
| 2252 | } |
| 2253 | |
| 2254 | function condense( unmatched, map, filter, context, xml ) { |
| 2255 | var elem, |
| 2256 | newUnmatched = [], |
| 2257 | i = 0, |
| 2258 | len = unmatched.length, |
| 2259 | mapped = map != null; |
| 2260 | |
| 2261 | for ( ; i < len; i++ ) { |
| 2262 | if ( ( elem = unmatched[ i ] ) ) { |
| 2263 | if ( !filter || filter( elem, context, xml ) ) { |
| 2264 | newUnmatched.push( elem ); |
| 2265 | if ( mapped ) { |
| 2266 | map.push( i ); |
| 2267 | } |
| 2268 | } |
| 2269 | } |
| 2270 | } |
| 2271 | |
| 2272 | return newUnmatched; |
| 2273 | } |
| 2274 | |
| 2275 | function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { |
| 2276 | if ( postFilter && !postFilter[ expando ] ) { |
| 2277 | postFilter = setMatcher( postFilter ); |
| 2278 | } |
| 2279 | if ( postFinder && !postFinder[ expando ] ) { |
| 2280 | postFinder = setMatcher( postFinder, postSelector ); |
| 2281 | } |
| 2282 | return markFunction( function( seed, results, context, xml ) { |
| 2283 | var temp, i, elem, matcherOut, |
| 2284 | preMap = [], |
| 2285 | postMap = [], |
| 2286 | preexisting = results.length, |
| 2287 | |
| 2288 | // Get initial elements from seed or context |
| 2289 | elems = seed || |
| 2290 | multipleContexts( selector || "*", |
| 2291 | context.nodeType ? [ context ] : context, [] ), |
| 2292 | |
| 2293 | // Prefilter to get matcher input, preserving a map for seed-results synchronization |
| 2294 | matcherIn = preFilter && ( seed || !selector ) ? |
| 2295 | condense( elems, preMap, preFilter, context, xml ) : |
| 2296 | elems; |
| 2297 | |
| 2298 | if ( matcher ) { |
| 2299 | |
| 2300 | // If we have a postFinder, or filtered seed, or non-seed postFilter |
| 2301 | // or preexisting results, |
| 2302 | matcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ? |
| 2303 | |
| 2304 | // ...intermediate processing is necessary |
| 2305 | [] : |
| 2306 | |
| 2307 | // ...otherwise use results directly |
| 2308 | results; |
| 2309 | |
| 2310 | // Find primary matches |
| 2311 | matcher( matcherIn, matcherOut, context, xml ); |
| 2312 | } else { |
| 2313 | matcherOut = matcherIn; |
| 2314 | } |
| 2315 | |
| 2316 | // Apply postFilter |
| 2317 | if ( postFilter ) { |
| 2318 | temp = condense( matcherOut, postMap ); |
| 2319 | postFilter( temp, [], context, xml ); |
| 2320 | |
| 2321 | // Un-match failing elements by moving them back to matcherIn |
| 2322 | i = temp.length; |
| 2323 | while ( i-- ) { |
| 2324 | if ( ( elem = temp[ i ] ) ) { |
| 2325 | matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem ); |
| 2326 | } |
| 2327 | } |
| 2328 | } |
| 2329 | |
| 2330 | if ( seed ) { |
| 2331 | if ( postFinder || preFilter ) { |
| 2332 | if ( postFinder ) { |
| 2333 | |
| 2334 | // Get the final matcherOut by condensing this intermediate into postFinder contexts |
| 2335 | temp = []; |
| 2336 | i = matcherOut.length; |
| 2337 | while ( i-- ) { |
| 2338 | if ( ( elem = matcherOut[ i ] ) ) { |
| 2339 | |
| 2340 | // Restore matcherIn since elem is not yet a final match |
| 2341 | temp.push( ( matcherIn[ i ] = elem ) ); |
| 2342 | } |
| 2343 | } |
| 2344 | postFinder( null, ( matcherOut = [] ), temp, xml ); |
| 2345 | } |
| 2346 | |
| 2347 | // Move matched elements from seed to results to keep them synchronized |
| 2348 | i = matcherOut.length; |
| 2349 | while ( i-- ) { |
| 2350 | if ( ( elem = matcherOut[ i ] ) && |
| 2351 | ( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) { |
| 2352 | |
| 2353 | seed[ temp ] = !( results[ temp ] = elem ); |
| 2354 | } |
| 2355 | } |
| 2356 | } |
| 2357 | |
| 2358 | // Add elements to results, through postFinder if defined |
| 2359 | } else { |
| 2360 | matcherOut = condense( |
| 2361 | matcherOut === results ? |
| 2362 | matcherOut.splice( preexisting, matcherOut.length ) : |
| 2363 | matcherOut |
| 2364 | ); |
| 2365 | if ( postFinder ) { |
| 2366 | postFinder( null, results, matcherOut, xml ); |
| 2367 | } else { |
| 2368 | push.apply( results, matcherOut ); |
| 2369 | } |
| 2370 | } |
| 2371 | } ); |
| 2372 | } |
| 2373 | |
| 2374 | function matcherFromTokens( tokens ) { |
| 2375 | var checkContext, matcher, j, |
| 2376 | len = tokens.length, |
| 2377 | leadingRelative = Expr.relative[ tokens[ 0 ].type ], |
| 2378 | implicitRelative = leadingRelative || Expr.relative[ " " ], |
| 2379 | i = leadingRelative ? 1 : 0, |
| 2380 | |
| 2381 | // The foundational matcher ensures that elements are reachable from top-level context(s) |
| 2382 | matchContext = addCombinator( function( elem ) { |
| 2383 | return elem === checkContext; |
| 2384 | }, implicitRelative, true ), |
| 2385 | matchAnyContext = addCombinator( function( elem ) { |
| 2386 | return indexOf.call( checkContext, elem ) > -1; |
| 2387 | }, implicitRelative, true ), |
| 2388 | matchers = [ function( elem, context, xml ) { |
| 2389 | |
| 2390 | // Support: IE 11+, Edge 17 - 18+ |
| 2391 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
| 2392 | // two documents; shallow comparisons work. |
| 2393 | // eslint-disable-next-line eqeqeq |
| 2394 | var ret = ( !leadingRelative && ( xml || context != outermostContext ) ) || ( |
| 2395 | ( checkContext = context ).nodeType ? |
| 2396 | matchContext( elem, context, xml ) : |
| 2397 | matchAnyContext( elem, context, xml ) ); |
| 2398 | |
| 2399 | // Avoid hanging onto element |
| 2400 | // (see https://github.com/jquery/sizzle/issues/299) |
| 2401 | checkContext = null; |
| 2402 | return ret; |
| 2403 | } ]; |
| 2404 | |
| 2405 | for ( ; i < len; i++ ) { |
| 2406 | if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) { |
| 2407 | matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; |
| 2408 | } else { |
| 2409 | matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches ); |
| 2410 | |
| 2411 | // Return special upon seeing a positional matcher |
| 2412 | if ( matcher[ expando ] ) { |
| 2413 | |
| 2414 | // Find the next relative operator (if any) for proper handling |
| 2415 | j = ++i; |
| 2416 | for ( ; j < len; j++ ) { |
| 2417 | if ( Expr.relative[ tokens[ j ].type ] ) { |
| 2418 | break; |
| 2419 | } |
| 2420 | } |
| 2421 | return setMatcher( |
| 2422 | i > 1 && elementMatcher( matchers ), |
| 2423 | i > 1 && toSelector( |
| 2424 | |
| 2425 | // If the preceding token was a descendant combinator, insert an implicit any-element `*` |
| 2426 | tokens.slice( 0, i - 1 ) |
| 2427 | .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) |
| 2428 | ).replace( rtrimCSS, "$1" ), |
| 2429 | matcher, |
| 2430 | i < j && matcherFromTokens( tokens.slice( i, j ) ), |
| 2431 | j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), |
| 2432 | j < len && toSelector( tokens ) |
| 2433 | ); |
| 2434 | } |
| 2435 | matchers.push( matcher ); |
| 2436 | } |
| 2437 | } |
| 2438 | |
| 2439 | return elementMatcher( matchers ); |
| 2440 | } |
| 2441 | |
| 2442 | function matcherFromGroupMatchers( elementMatchers, setMatchers ) { |
| 2443 | var bySet = setMatchers.length > 0, |
| 2444 | byElement = elementMatchers.length > 0, |
| 2445 | superMatcher = function( seed, context, xml, results, outermost ) { |
| 2446 | var elem, j, matcher, |
| 2447 | matchedCount = 0, |
| 2448 | i = "0", |
| 2449 | unmatched = seed && [], |
| 2450 | setMatched = [], |
| 2451 | contextBackup = outermostContext, |
| 2452 | |
| 2453 | // We must always have either seed elements or outermost context |
| 2454 | elems = seed || byElement && Expr.find.TAG( "*", outermost ), |
| 2455 | |
| 2456 | // Use integer dirruns iff this is the outermost matcher |
| 2457 | dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), |
| 2458 | len = elems.length; |
| 2459 | |
| 2460 | if ( outermost ) { |
| 2461 | |
| 2462 | // Support: IE 11+, Edge 17 - 18+ |
| 2463 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
| 2464 | // two documents; shallow comparisons work. |
| 2465 | // eslint-disable-next-line eqeqeq |
| 2466 | outermostContext = context == document || context || outermost; |
| 2467 | } |
| 2468 | |
| 2469 | // Add elements passing elementMatchers directly to results |
| 2470 | // Support: iOS <=7 - 9 only |
| 2471 | // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching |
| 2472 | // elements by id. (see trac-14142) |
| 2473 | for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { |
| 2474 | if ( byElement && elem ) { |
| 2475 | j = 0; |
| 2476 | |
| 2477 | // Support: IE 11+, Edge 17 - 18+ |
| 2478 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
| 2479 | // two documents; shallow comparisons work. |
| 2480 | // eslint-disable-next-line eqeqeq |
| 2481 | if ( !context && elem.ownerDocument != document ) { |
| 2482 | setDocument( elem ); |
| 2483 | xml = !documentIsHTML; |
| 2484 | } |
| 2485 | while ( ( matcher = elementMatchers[ j++ ] ) ) { |
| 2486 | if ( matcher( elem, context || document, xml ) ) { |
| 2487 | push.call( results, elem ); |
| 2488 | break; |
| 2489 | } |
| 2490 | } |
| 2491 | if ( outermost ) { |
| 2492 | dirruns = dirrunsUnique; |
| 2493 | } |
| 2494 | } |
| 2495 | |
| 2496 | // Track unmatched elements for set filters |
| 2497 | if ( bySet ) { |
| 2498 | |
| 2499 | // They will have gone through all possible matchers |
| 2500 | if ( ( elem = !matcher && elem ) ) { |
| 2501 | matchedCount--; |
| 2502 | } |
| 2503 | |
| 2504 | // Lengthen the array for every element, matched or not |
| 2505 | if ( seed ) { |
| 2506 | unmatched.push( elem ); |
| 2507 | } |
| 2508 | } |
| 2509 | } |
| 2510 | |
| 2511 | // `i` is now the count of elements visited above, and adding it to `matchedCount` |
| 2512 | // makes the latter nonnegative. |
| 2513 | matchedCount += i; |
| 2514 | |
| 2515 | // Apply set filters to unmatched elements |
| 2516 | // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` |
| 2517 | // equals `i`), unless we didn't visit _any_ elements in the above loop because we have |
| 2518 | // no element matchers and no seed. |
| 2519 | // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that |
| 2520 | // case, which will result in a "00" `matchedCount` that differs from `i` but is also |
| 2521 | // numerically zero. |
| 2522 | if ( bySet && i !== matchedCount ) { |
| 2523 | j = 0; |
| 2524 | while ( ( matcher = setMatchers[ j++ ] ) ) { |
| 2525 | matcher( unmatched, setMatched, context, xml ); |
| 2526 | } |
| 2527 | |
| 2528 | if ( seed ) { |
| 2529 | |
| 2530 | // Reintegrate element matches to eliminate the need for sorting |
| 2531 | if ( matchedCount > 0 ) { |
| 2532 | while ( i-- ) { |
| 2533 | if ( !( unmatched[ i ] || setMatched[ i ] ) ) { |
| 2534 | setMatched[ i ] = pop.call( results ); |
| 2535 | } |
| 2536 | } |
| 2537 | } |
| 2538 | |
| 2539 | // Discard index placeholder values to get only actual matches |
| 2540 | setMatched = condense( setMatched ); |
| 2541 | } |
| 2542 | |
| 2543 | // Add matches to results |
| 2544 | push.apply( results, setMatched ); |
| 2545 | |
| 2546 | // Seedless set matches succeeding multiple successful matchers stipulate sorting |
| 2547 | if ( outermost && !seed && setMatched.length > 0 && |
| 2548 | ( matchedCount + setMatchers.length ) > 1 ) { |
| 2549 | |
| 2550 | jQuery.uniqueSort( results ); |
| 2551 | } |
| 2552 | } |
| 2553 | |
| 2554 | // Override manipulation of globals by nested matchers |
| 2555 | if ( outermost ) { |
| 2556 | dirruns = dirrunsUnique; |
| 2557 | outermostContext = contextBackup; |
| 2558 | } |
| 2559 | |
| 2560 | return unmatched; |
| 2561 | }; |
| 2562 | |
| 2563 | return bySet ? |
| 2564 | markFunction( superMatcher ) : |
| 2565 | superMatcher; |
| 2566 | } |
| 2567 | |
| 2568 | function compile( selector, match /* Internal Use Only */ ) { |
| 2569 | var i, |
| 2570 | setMatchers = [], |
| 2571 | elementMatchers = [], |
| 2572 | cached = compilerCache[ selector + " " ]; |
| 2573 | |
| 2574 | if ( !cached ) { |
| 2575 | |
| 2576 | // Generate a function of recursive functions that can be used to check each element |
| 2577 | if ( !match ) { |
| 2578 | match = tokenize( selector ); |
| 2579 | } |
| 2580 | i = match.length; |
| 2581 | while ( i-- ) { |
| 2582 | cached = matcherFromTokens( match[ i ] ); |
| 2583 | if ( cached[ expando ] ) { |
| 2584 | setMatchers.push( cached ); |
| 2585 | } else { |
| 2586 | elementMatchers.push( cached ); |
| 2587 | } |
| 2588 | } |
| 2589 | |
| 2590 | // Cache the compiled function |
| 2591 | cached = compilerCache( selector, |
| 2592 | matcherFromGroupMatchers( elementMatchers, setMatchers ) ); |
| 2593 | |
| 2594 | // Save selector and tokenization |
| 2595 | cached.selector = selector; |
| 2596 | } |
| 2597 | return cached; |
| 2598 | } |
| 2599 | |
| 2600 | /** |
| 2601 | * A low-level selection function that works with jQuery's compiled |
| 2602 | * selector functions |
| 2603 | * @param {String|Function} selector A selector or a pre-compiled |
| 2604 | * selector function built with jQuery selector compile |
| 2605 | * @param {Element} context |
| 2606 | * @param {Array} [results] |
| 2607 | * @param {Array} [seed] A set of elements to match against |
| 2608 | */ |
| 2609 | function select( selector, context, results, seed ) { |
| 2610 | var i, tokens, token, type, find, |
| 2611 | compiled = typeof selector === "function" && selector, |
| 2612 | match = !seed && tokenize( ( selector = compiled.selector || selector ) ); |
| 2613 | |
| 2614 | results = results || []; |
| 2615 | |
| 2616 | // Try to minimize operations if there is only one selector in the list and no seed |
| 2617 | // (the latter of which guarantees us context) |
| 2618 | if ( match.length === 1 ) { |
| 2619 | |
| 2620 | // Reduce context if the leading compound selector is an ID |
| 2621 | tokens = match[ 0 ] = match[ 0 ].slice( 0 ); |
| 2622 | if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && |
| 2623 | context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { |
| 2624 | |
| 2625 | context = ( Expr.find.ID( |
| 2626 | token.matches[ 0 ].replace( runescape, funescape ), |
| 2627 | context |
| 2628 | ) || [] )[ 0 ]; |
| 2629 | if ( !context ) { |
| 2630 | return results; |
| 2631 | |
| 2632 | // Precompiled matchers will still verify ancestry, so step up a level |
| 2633 | } else if ( compiled ) { |
| 2634 | context = context.parentNode; |
| 2635 | } |
| 2636 | |
| 2637 | selector = selector.slice( tokens.shift().value.length ); |
| 2638 | } |
| 2639 | |
| 2640 | // Fetch a seed set for right-to-left matching |
| 2641 | i = matchExpr.needsContext.test( selector ) ? 0 : tokens.length; |
| 2642 | while ( i-- ) { |
| 2643 | token = tokens[ i ]; |
| 2644 | |
| 2645 | // Abort if we hit a combinator |
| 2646 | if ( Expr.relative[ ( type = token.type ) ] ) { |
| 2647 | break; |
| 2648 | } |
| 2649 | if ( ( find = Expr.find[ type ] ) ) { |
| 2650 | |
| 2651 | // Search, expanding context for leading sibling combinators |
| 2652 | if ( ( seed = find( |
| 2653 | token.matches[ 0 ].replace( runescape, funescape ), |
| 2654 | rsibling.test( tokens[ 0 ].type ) && |
| 2655 | testContext( context.parentNode ) || context |
| 2656 | ) ) ) { |
| 2657 | |
| 2658 | // If seed is empty or no tokens remain, we can return early |
| 2659 | tokens.splice( i, 1 ); |
| 2660 | selector = seed.length && toSelector( tokens ); |
| 2661 | if ( !selector ) { |
| 2662 | push.apply( results, seed ); |
| 2663 | return results; |
| 2664 | } |
| 2665 | |
| 2666 | break; |
| 2667 | } |
| 2668 | } |
| 2669 | } |
| 2670 | } |
| 2671 | |
| 2672 | // Compile and execute a filtering function if one is not provided |
| 2673 | // Provide `match` to avoid retokenization if we modified the selector above |
| 2674 | ( compiled || compile( selector, match ) )( |
| 2675 | seed, |
| 2676 | context, |
| 2677 | !documentIsHTML, |
| 2678 | results, |
| 2679 | !context || rsibling.test( selector ) && testContext( context.parentNode ) || context |
| 2680 | ); |
| 2681 | return results; |
| 2682 | } |
| 2683 | |
| 2684 | // One-time assignments |
| 2685 | |
| 2686 | // Support: Android <=4.0 - 4.1+ |
| 2687 | // Sort stability |
| 2688 | support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; |
| 2689 | |
| 2690 | // Initialize against the default document |
| 2691 | setDocument(); |
| 2692 | |
| 2693 | // Support: Android <=4.0 - 4.1+ |
| 2694 | // Detached nodes confoundingly follow *each other* |
| 2695 | support.sortDetached = assert( function( el ) { |
| 2696 | |
| 2697 | // Should return 1, but returns 4 (following) |
| 2698 | return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; |
| 2699 | } ); |
| 2700 | |
| 2701 | jQuery.find = find; |
| 2702 | |
| 2703 | // Deprecated |
| 2704 | jQuery.expr[ ":" ] = jQuery.expr.pseudos; |
| 2705 | jQuery.unique = jQuery.uniqueSort; |
| 2706 | |
| 2707 | // These have always been private, but they used to be documented as part of |
| 2708 | // Sizzle so let's maintain them for now for backwards compatibility purposes. |
| 2709 | find.compile = compile; |
| 2710 | find.select = select; |
| 2711 | find.setDocument = setDocument; |
| 2712 | find.tokenize = tokenize; |
| 2713 | |
| 2714 | find.escape = jQuery.escapeSelector; |
| 2715 | find.getText = jQuery.text; |
| 2716 | find.isXML = jQuery.isXMLDoc; |
| 2717 | find.selectors = jQuery.expr; |
| 2718 | find.support = jQuery.support; |
| 2719 | find.uniqueSort = jQuery.uniqueSort; |
| 2720 | |
| 2721 | /* eslint-enable */ |
| 2722 | |
| 2723 | } )(); |
| 2724 | |
| 2725 | |
| 2726 | var dir = function( elem, dir, until ) { |
| 2727 | var matched = [], |
| 2728 | truncate = until !== undefined; |
| 2729 | |
| 2730 | while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { |
| 2731 | if ( elem.nodeType === 1 ) { |
| 2732 | if ( truncate && jQuery( elem ).is( until ) ) { |
| 2733 | break; |
| 2734 | } |
| 2735 | matched.push( elem ); |
| 2736 | } |
| 2737 | } |
| 2738 | return matched; |
| 2739 | }; |
| 2740 | |
| 2741 | |
| 2742 | var siblings = function( n, elem ) { |
| 2743 | var matched = []; |
| 2744 | |
| 2745 | for ( ; n; n = n.nextSibling ) { |
| 2746 | if ( n.nodeType === 1 && n !== elem ) { |
| 2747 | matched.push( n ); |
| 2748 | } |
| 2749 | } |
| 2750 | |
| 2751 | return matched; |
| 2752 | }; |
| 2753 | |
| 2754 | |
| 2755 | var rneedsContext = jQuery.expr.match.needsContext; |
| 2756 | |
| 2757 | var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); |
| 2758 | |
| 2759 | |
| 2760 | |
| 2761 | // Implement the identical functionality for filter and not |
| 2762 | function winnow( elements, qualifier, not ) { |
| 2763 | if ( isFunction( qualifier ) ) { |
| 2764 | return jQuery.grep( elements, function( elem, i ) { |
| 2765 | return !!qualifier.call( elem, i, elem ) !== not; |
| 2766 | } ); |
| 2767 | } |
| 2768 | |
| 2769 | // Single element |
| 2770 | if ( qualifier.nodeType ) { |
| 2771 | return jQuery.grep( elements, function( elem ) { |
| 2772 | return ( elem === qualifier ) !== not; |
| 2773 | } ); |
| 2774 | } |
| 2775 | |
| 2776 | // Arraylike of elements (jQuery, arguments, Array) |
| 2777 | if ( typeof qualifier !== "string" ) { |
| 2778 | return jQuery.grep( elements, function( elem ) { |
| 2779 | return ( indexOf.call( qualifier, elem ) > -1 ) !== not; |
| 2780 | } ); |
| 2781 | } |
| 2782 | |
| 2783 | // Filtered directly for both simple and complex selectors |
| 2784 | return jQuery.filter( qualifier, elements, not ); |
| 2785 | } |
| 2786 | |
| 2787 | jQuery.filter = function( expr, elems, not ) { |
| 2788 | var elem = elems[ 0 ]; |
| 2789 | |
| 2790 | if ( not ) { |
| 2791 | expr = ":not(" + expr + ")"; |
| 2792 | } |
| 2793 | |
| 2794 | if ( elems.length === 1 && elem.nodeType === 1 ) { |
| 2795 | return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; |
| 2796 | } |
| 2797 | |
| 2798 | return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { |
| 2799 | return elem.nodeType === 1; |
| 2800 | } ) ); |
| 2801 | }; |
| 2802 | |
| 2803 | jQuery.fn.extend( { |
| 2804 | find: function( selector ) { |
| 2805 | var i, ret, |
| 2806 | len = this.length, |
| 2807 | self = this; |
| 2808 | |
| 2809 | if ( typeof selector !== "string" ) { |
| 2810 | return this.pushStack( jQuery( selector ).filter( function() { |
| 2811 | for ( i = 0; i < len; i++ ) { |
| 2812 | if ( jQuery.contains( self[ i ], this ) ) { |
| 2813 | return true; |
| 2814 | } |
| 2815 | } |
| 2816 | } ) ); |
| 2817 | } |
| 2818 | |
| 2819 | ret = this.pushStack( [] ); |
| 2820 | |
| 2821 | for ( i = 0; i < len; i++ ) { |
| 2822 | jQuery.find( selector, self[ i ], ret ); |
| 2823 | } |
| 2824 | |
| 2825 | return len > 1 ? jQuery.uniqueSort( ret ) : ret; |
| 2826 | }, |
| 2827 | filter: function( selector ) { |
| 2828 | return this.pushStack( winnow( this, selector || [], false ) ); |
| 2829 | }, |
| 2830 | not: function( selector ) { |
| 2831 | return this.pushStack( winnow( this, selector || [], true ) ); |
| 2832 | }, |
| 2833 | is: function( selector ) { |
| 2834 | return !!winnow( |
| 2835 | this, |
| 2836 | |
| 2837 | // If this is a positional/relative selector, check membership in the returned set |
| 2838 | // so $("p:first").is("p:last") won't return true for a doc with two "p". |
| 2839 | typeof selector === "string" && rneedsContext.test( selector ) ? |
| 2840 | jQuery( selector ) : |
| 2841 | selector || [], |
| 2842 | false |
| 2843 | ).length; |
| 2844 | } |
| 2845 | } ); |
| 2846 | |
| 2847 | |
| 2848 | // Initialize a jQuery object |
| 2849 | |
| 2850 | |
| 2851 | // A central reference to the root jQuery(document) |
| 2852 | var rootjQuery, |
| 2853 | |
| 2854 | // A simple way to check for HTML strings |
| 2855 | // Prioritize #id over <tag> to avoid XSS via location.hash (trac-9521) |
| 2856 | // Strict HTML recognition (trac-11290: must start with <) |
| 2857 | // Shortcut simple #id case for speed |
| 2858 | rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, |
| 2859 | |
| 2860 | init = jQuery.fn.init = function( selector, context, root ) { |
| 2861 | var match, elem; |
| 2862 | |
| 2863 | // HANDLE: $(""), $(null), $(undefined), $(false) |
| 2864 | if ( !selector ) { |
| 2865 | return this; |
| 2866 | } |
| 2867 | |
| 2868 | // Method init() accepts an alternate rootjQuery |
| 2869 | // so migrate can support jQuery.sub (gh-2101) |
| 2870 | root = root || rootjQuery; |
| 2871 | |
| 2872 | // Handle HTML strings |
| 2873 | if ( typeof selector === "string" ) { |
| 2874 | if ( selector[ 0 ] === "<" && |
| 2875 | selector[ selector.length - 1 ] === ">" && |
| 2876 | selector.length >= 3 ) { |
| 2877 | |
| 2878 | // Assume that strings that start and end with <> are HTML and skip the regex check |
| 2879 | match = [ null, selector, null ]; |
| 2880 | |
| 2881 | } else { |
| 2882 | match = rquickExpr.exec( selector ); |
| 2883 | } |
| 2884 | |
| 2885 | // Match html or make sure no context is specified for #id |
| 2886 | if ( match && ( match[ 1 ] || !context ) ) { |
| 2887 | |
| 2888 | // HANDLE: $(html) -> $(array) |
| 2889 | if ( match[ 1 ] ) { |
| 2890 | context = context instanceof jQuery ? context[ 0 ] : context; |
| 2891 | |
| 2892 | // Option to run scripts is true for back-compat |
| 2893 | // Intentionally let the error be thrown if parseHTML is not present |
| 2894 | jQuery.merge( this, jQuery.parseHTML( |
| 2895 | match[ 1 ], |
| 2896 | context && context.nodeType ? context.ownerDocument || context : document, |
| 2897 | true |
| 2898 | ) ); |
| 2899 | |
| 2900 | // HANDLE: $(html, props) |
| 2901 | if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { |
| 2902 | for ( match in context ) { |
| 2903 | |
| 2904 | // Properties of context are called as methods if possible |
| 2905 | if ( isFunction( this[ match ] ) ) { |
| 2906 | this[ match ]( context[ match ] ); |
| 2907 | |
| 2908 | // ...and otherwise set as attributes |
| 2909 | } else { |
| 2910 | this.attr( match, context[ match ] ); |
| 2911 | } |
| 2912 | } |
| 2913 | } |
| 2914 | |
| 2915 | return this; |
| 2916 | |
| 2917 | // HANDLE: $(#id) |
| 2918 | } else { |
| 2919 | elem = document.getElementById( match[ 2 ] ); |
| 2920 | |
| 2921 | if ( elem ) { |
| 2922 | |
| 2923 | // Inject the element directly into the jQuery object |
| 2924 | this[ 0 ] = elem; |
| 2925 | this.length = 1; |
| 2926 | } |
| 2927 | return this; |
| 2928 | } |
| 2929 | |
| 2930 | // HANDLE: $(expr, $(...)) |
| 2931 | } else if ( !context || context.jquery ) { |
| 2932 | return ( context || root ).find( selector ); |
| 2933 | |
| 2934 | // HANDLE: $(expr, context) |
| 2935 | // (which is just equivalent to: $(context).find(expr) |
| 2936 | } else { |
| 2937 | return this.constructor( context ).find( selector ); |
| 2938 | } |
| 2939 | |
| 2940 | // HANDLE: $(DOMElement) |
| 2941 | } else if ( selector.nodeType ) { |
| 2942 | this[ 0 ] = selector; |
| 2943 | this.length = 1; |
| 2944 | return this; |
| 2945 | |
| 2946 | // HANDLE: $(function) |
| 2947 | // Shortcut for document ready |
| 2948 | } else if ( isFunction( selector ) ) { |
| 2949 | return root.ready !== undefined ? |
| 2950 | root.ready( selector ) : |
| 2951 | |
| 2952 | // Execute immediately if ready is not present |
| 2953 | selector( jQuery ); |
| 2954 | } |
| 2955 | |
| 2956 | return jQuery.makeArray( selector, this ); |
| 2957 | }; |
| 2958 | |
| 2959 | // Give the init function the jQuery prototype for later instantiation |
| 2960 | init.prototype = jQuery.fn; |
| 2961 | |
| 2962 | // Initialize central reference |
| 2963 | rootjQuery = jQuery( document ); |
| 2964 | |
| 2965 | |
| 2966 | var rparentsprev = /^(?:parents|prev(?:Until|All))/, |
| 2967 | |
| 2968 | // Methods guaranteed to produce a unique set when starting from a unique set |
| 2969 | guaranteedUnique = { |
| 2970 | children: true, |
| 2971 | contents: true, |
| 2972 | next: true, |
| 2973 | prev: true |
| 2974 | }; |
| 2975 | |
| 2976 | jQuery.fn.extend( { |
| 2977 | has: function( target ) { |
| 2978 | var targets = jQuery( target, this ), |
| 2979 | l = targets.length; |
| 2980 | |
| 2981 | return this.filter( function() { |
| 2982 | var i = 0; |
| 2983 | for ( ; i < l; i++ ) { |
| 2984 | if ( jQuery.contains( this, targets[ i ] ) ) { |
| 2985 | return true; |
| 2986 | } |
| 2987 | } |
| 2988 | } ); |
| 2989 | }, |
| 2990 | |
| 2991 | closest: function( selectors, context ) { |
| 2992 | var cur, |
| 2993 | i = 0, |
| 2994 | l = this.length, |
| 2995 | matched = [], |
| 2996 | targets = typeof selectors !== "string" && jQuery( selectors ); |
| 2997 | |
| 2998 | // Positional selectors never match, since there's no _selection_ context |
| 2999 | if ( !rneedsContext.test( selectors ) ) { |
| 3000 | for ( ; i < l; i++ ) { |
| 3001 | for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { |
| 3002 | |
| 3003 | // Always skip document fragments |
| 3004 | if ( cur.nodeType < 11 && ( targets ? |
| 3005 | targets.index( cur ) > -1 : |
| 3006 | |
| 3007 | // Don't pass non-elements to jQuery#find |
| 3008 | cur.nodeType === 1 && |
| 3009 | jQuery.find.matchesSelector( cur, selectors ) ) ) { |
| 3010 | |
| 3011 | matched.push( cur ); |
| 3012 | break; |
| 3013 | } |
| 3014 | } |
| 3015 | } |
| 3016 | } |
| 3017 | |
| 3018 | return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); |
| 3019 | }, |
| 3020 | |
| 3021 | // Determine the position of an element within the set |
| 3022 | index: function( elem ) { |
| 3023 | |
| 3024 | // No argument, return index in parent |
| 3025 | if ( !elem ) { |
| 3026 | return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; |
| 3027 | } |
| 3028 | |
| 3029 | // Index in selector |
| 3030 | if ( typeof elem === "string" ) { |
| 3031 | return indexOf.call( jQuery( elem ), this[ 0 ] ); |
| 3032 | } |
| 3033 | |
| 3034 | // Locate the position of the desired element |
| 3035 | return indexOf.call( this, |
| 3036 | |
| 3037 | // If it receives a jQuery object, the first element is used |
| 3038 | elem.jquery ? elem[ 0 ] : elem |
| 3039 | ); |
| 3040 | }, |
| 3041 | |
| 3042 | add: function( selector, context ) { |
| 3043 | return this.pushStack( |
| 3044 | jQuery.uniqueSort( |
| 3045 | jQuery.merge( this.get(), jQuery( selector, context ) ) |
| 3046 | ) |
| 3047 | ); |
| 3048 | }, |
| 3049 | |
| 3050 | addBack: function( selector ) { |
| 3051 | return this.add( selector == null ? |
| 3052 | this.prevObject : this.prevObject.filter( selector ) |
| 3053 | ); |
| 3054 | } |
| 3055 | } ); |
| 3056 | |
| 3057 | function sibling( cur, dir ) { |
| 3058 | while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} |
| 3059 | return cur; |
| 3060 | } |
| 3061 | |
| 3062 | jQuery.each( { |
| 3063 | parent: function( elem ) { |
| 3064 | var parent = elem.parentNode; |
| 3065 | return parent && parent.nodeType !== 11 ? parent : null; |
| 3066 | }, |
| 3067 | parents: function( elem ) { |
| 3068 | return dir( elem, "parentNode" ); |
| 3069 | }, |
| 3070 | parentsUntil: function( elem, _i, until ) { |
| 3071 | return dir( elem, "parentNode", until ); |
| 3072 | }, |
| 3073 | next: function( elem ) { |
| 3074 | return sibling( elem, "nextSibling" ); |
| 3075 | }, |
| 3076 | prev: function( elem ) { |
| 3077 | return sibling( elem, "previousSibling" ); |
| 3078 | }, |
| 3079 | nextAll: function( elem ) { |
| 3080 | return dir( elem, "nextSibling" ); |
| 3081 | }, |
| 3082 | prevAll: function( elem ) { |
| 3083 | return dir( elem, "previousSibling" ); |
| 3084 | }, |
| 3085 | nextUntil: function( elem, _i, until ) { |
| 3086 | return dir( elem, "nextSibling", until ); |
| 3087 | }, |
| 3088 | prevUntil: function( elem, _i, until ) { |
| 3089 | return dir( elem, "previousSibling", until ); |
| 3090 | }, |
| 3091 | siblings: function( elem ) { |
| 3092 | return siblings( ( elem.parentNode || {} ).firstChild, elem ); |
| 3093 | }, |
| 3094 | children: function( elem ) { |
| 3095 | return siblings( elem.firstChild ); |
| 3096 | }, |
| 3097 | contents: function( elem ) { |
| 3098 | if ( elem.contentDocument != null && |
| 3099 | |
| 3100 | // Support: IE 11+ |
| 3101 | // <object> elements with no `data` attribute has an object |
| 3102 | // `contentDocument` with a `null` prototype. |
| 3103 | getProto( elem.contentDocument ) ) { |
| 3104 | |
| 3105 | return elem.contentDocument; |
| 3106 | } |
| 3107 | |
| 3108 | // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only |
| 3109 | // Treat the template element as a regular one in browsers that |
| 3110 | // don't support it. |
| 3111 | if ( nodeName( elem, "template" ) ) { |
| 3112 | elem = elem.content || elem; |
| 3113 | } |
| 3114 | |
| 3115 | return jQuery.merge( [], elem.childNodes ); |
| 3116 | } |
| 3117 | }, function( name, fn ) { |
| 3118 | jQuery.fn[ name ] = function( until, selector ) { |
| 3119 | var matched = jQuery.map( this, fn, until ); |
| 3120 | |
| 3121 | if ( name.slice( -5 ) !== "Until" ) { |
| 3122 | selector = until; |
| 3123 | } |
| 3124 | |
| 3125 | if ( selector && typeof selector === "string" ) { |
| 3126 | matched = jQuery.filter( selector, matched ); |
| 3127 | } |
| 3128 | |
| 3129 | if ( this.length > 1 ) { |
| 3130 | |
| 3131 | // Remove duplicates |
| 3132 | if ( !guaranteedUnique[ name ] ) { |
| 3133 | jQuery.uniqueSort( matched ); |
| 3134 | } |
| 3135 | |
| 3136 | // Reverse order for parents* and prev-derivatives |
| 3137 | if ( rparentsprev.test( name ) ) { |
| 3138 | matched.reverse(); |
| 3139 | } |
| 3140 | } |
| 3141 | |
| 3142 | return this.pushStack( matched ); |
| 3143 | }; |
| 3144 | } ); |
| 3145 | var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); |
| 3146 | |
| 3147 | |
| 3148 | |
| 3149 | // Convert String-formatted options into Object-formatted ones |
| 3150 | function createOptions( options ) { |
| 3151 | var object = {}; |
| 3152 | jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { |
| 3153 | object[ flag ] = true; |
| 3154 | } ); |
| 3155 | return object; |
| 3156 | } |
| 3157 | |
| 3158 | /* |
| 3159 | * Create a callback list using the following parameters: |
| 3160 | * |
| 3161 | * options: an optional list of space-separated options that will change how |
| 3162 | * the callback list behaves or a more traditional option object |
| 3163 | * |
| 3164 | * By default a callback list will act like an event callback list and can be |
| 3165 | * "fired" multiple times. |
| 3166 | * |
| 3167 | * Possible options: |
| 3168 | * |
| 3169 | * once: will ensure the callback list can only be fired once (like a Deferred) |
| 3170 | * |
| 3171 | * memory: will keep track of previous values and will call any callback added |
| 3172 | * after the list has been fired right away with the latest "memorized" |
| 3173 | * values (like a Deferred) |
| 3174 | * |
| 3175 | * unique: will ensure a callback can only be added once (no duplicate in the list) |
| 3176 | * |
| 3177 | * stopOnFalse: interrupt callings when a callback returns false |
| 3178 | * |
| 3179 | */ |
| 3180 | jQuery.Callbacks = function( options ) { |
| 3181 | |
| 3182 | // Convert options from String-formatted to Object-formatted if needed |
| 3183 | // (we check in cache first) |
| 3184 | options = typeof options === "string" ? |
| 3185 | createOptions( options ) : |
| 3186 | jQuery.extend( {}, options ); |
| 3187 | |
| 3188 | var // Flag to know if list is currently firing |
| 3189 | firing, |
| 3190 | |
| 3191 | // Last fire value for non-forgettable lists |
| 3192 | memory, |
| 3193 | |
| 3194 | // Flag to know if list was already fired |
| 3195 | fired, |
| 3196 | |
| 3197 | // Flag to prevent firing |
| 3198 | locked, |
| 3199 | |
| 3200 | // Actual callback list |
| 3201 | list = [], |
| 3202 | |
| 3203 | // Queue of execution data for repeatable lists |
| 3204 | queue = [], |
| 3205 | |
| 3206 | // Index of currently firing callback (modified by add/remove as needed) |
| 3207 | firingIndex = -1, |
| 3208 | |
| 3209 | // Fire callbacks |
| 3210 | fire = function() { |
| 3211 | |
| 3212 | // Enforce single-firing |
| 3213 | locked = locked || options.once; |
| 3214 | |
| 3215 | // Execute callbacks for all pending executions, |
| 3216 | // respecting firingIndex overrides and runtime changes |
| 3217 | fired = firing = true; |
| 3218 | for ( ; queue.length; firingIndex = -1 ) { |
| 3219 | memory = queue.shift(); |
| 3220 | while ( ++firingIndex < list.length ) { |
| 3221 | |
| 3222 | // Run callback and check for early termination |
| 3223 | if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && |
| 3224 | options.stopOnFalse ) { |
| 3225 | |
| 3226 | // Jump to end and forget the data so .add doesn't re-fire |
| 3227 | firingIndex = list.length; |
| 3228 | memory = false; |
| 3229 | } |
| 3230 | } |
| 3231 | } |
| 3232 | |
| 3233 | // Forget the data if we're done with it |
| 3234 | if ( !options.memory ) { |
| 3235 | memory = false; |
| 3236 | } |
| 3237 | |
| 3238 | firing = false; |
| 3239 | |
| 3240 | // Clean up if we're done firing for good |
| 3241 | if ( locked ) { |
| 3242 | |
| 3243 | // Keep an empty list if we have data for future add calls |
| 3244 | if ( memory ) { |
| 3245 | list = []; |
| 3246 | |
| 3247 | // Otherwise, this object is spent |
| 3248 | } else { |
| 3249 | list = ""; |
| 3250 | } |
| 3251 | } |
| 3252 | }, |
| 3253 | |
| 3254 | // Actual Callbacks object |
| 3255 | self = { |
| 3256 | |
| 3257 | // Add a callback or a collection of callbacks to the list |
| 3258 | add: function() { |
| 3259 | if ( list ) { |
| 3260 | |
| 3261 | // If we have memory from a past run, we should fire after adding |
| 3262 | if ( memory && !firing ) { |
| 3263 | firingIndex = list.length - 1; |
| 3264 | queue.push( memory ); |
| 3265 | } |
| 3266 | |
| 3267 | ( function add( args ) { |
| 3268 | jQuery.each( args, function( _, arg ) { |
| 3269 | if ( isFunction( arg ) ) { |
| 3270 | if ( !options.unique || !self.has( arg ) ) { |
| 3271 | list.push( arg ); |
| 3272 | } |
| 3273 | } else if ( arg && arg.length && toType( arg ) !== "string" ) { |
| 3274 | |
| 3275 | // Inspect recursively |
| 3276 | add( arg ); |
| 3277 | } |
| 3278 | } ); |
| 3279 | } )( arguments ); |
| 3280 | |
| 3281 | if ( memory && !firing ) { |
| 3282 | fire(); |
| 3283 | } |
| 3284 | } |
| 3285 | return this; |
| 3286 | }, |
| 3287 | |
| 3288 | // Remove a callback from the list |
| 3289 | remove: function() { |
| 3290 | jQuery.each( arguments, function( _, arg ) { |
| 3291 | var index; |
| 3292 | while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { |
| 3293 | list.splice( index, 1 ); |
| 3294 | |
| 3295 | // Handle firing indexes |
| 3296 | if ( index <= firingIndex ) { |
| 3297 | firingIndex--; |
| 3298 | } |
| 3299 | } |
| 3300 | } ); |
| 3301 | return this; |
| 3302 | }, |
| 3303 | |
| 3304 | // Check if a given callback is in the list. |
| 3305 | // If no argument is given, return whether or not list has callbacks attached. |
| 3306 | has: function( fn ) { |
| 3307 | return fn ? |
| 3308 | jQuery.inArray( fn, list ) > -1 : |
| 3309 | list.length > 0; |
| 3310 | }, |
| 3311 | |
| 3312 | // Remove all callbacks from the list |
| 3313 | empty: function() { |
| 3314 | if ( list ) { |
| 3315 | list = []; |
| 3316 | } |
| 3317 | return this; |
| 3318 | }, |
| 3319 | |
| 3320 | // Disable .fire and .add |
| 3321 | // Abort any current/pending executions |
| 3322 | // Clear all callbacks and values |
| 3323 | disable: function() { |
| 3324 | locked = queue = []; |
| 3325 | list = memory = ""; |
| 3326 | return this; |
| 3327 | }, |
| 3328 | disabled: function() { |
| 3329 | return !list; |
| 3330 | }, |
| 3331 | |
| 3332 | // Disable .fire |
| 3333 | // Also disable .add unless we have memory (since it would have no effect) |
| 3334 | // Abort any pending executions |
| 3335 | lock: function() { |
| 3336 | locked = queue = []; |
| 3337 | if ( !memory && !firing ) { |
| 3338 | list = memory = ""; |
| 3339 | } |
| 3340 | return this; |
| 3341 | }, |
| 3342 | locked: function() { |
| 3343 | return !!locked; |
| 3344 | }, |
| 3345 | |
| 3346 | // Call all callbacks with the given context and arguments |
| 3347 | fireWith: function( context, args ) { |
| 3348 | if ( !locked ) { |
| 3349 | args = args || []; |
| 3350 | args = [ context, args.slice ? args.slice() : args ]; |
| 3351 | queue.push( args ); |
| 3352 | if ( !firing ) { |
| 3353 | fire(); |
| 3354 | } |
| 3355 | } |
| 3356 | return this; |
| 3357 | }, |
| 3358 | |
| 3359 | // Call all the callbacks with the given arguments |
| 3360 | fire: function() { |
| 3361 | self.fireWith( this, arguments ); |
| 3362 | return this; |
| 3363 | }, |
| 3364 | |
| 3365 | // To know if the callbacks have already been called at least once |
| 3366 | fired: function() { |
| 3367 | return !!fired; |
| 3368 | } |
| 3369 | }; |
| 3370 | |
| 3371 | return self; |
| 3372 | }; |
| 3373 | |
| 3374 | |
| 3375 | function Identity( v ) { |
| 3376 | return v; |
| 3377 | } |
| 3378 | function Thrower( ex ) { |
| 3379 | throw ex; |
| 3380 | } |
| 3381 | |
| 3382 | function adoptValue( value, resolve, reject, noValue ) { |
| 3383 | var method; |
| 3384 | |
| 3385 | try { |
| 3386 | |
| 3387 | // Check for promise aspect first to privilege synchronous behavior |
| 3388 | if ( value && isFunction( ( method = value.promise ) ) ) { |
| 3389 | method.call( value ).done( resolve ).fail( reject ); |
| 3390 | |
| 3391 | // Other thenables |
| 3392 | } else if ( value && isFunction( ( method = value.then ) ) ) { |
| 3393 | method.call( value, resolve, reject ); |
| 3394 | |
| 3395 | // Other non-thenables |
| 3396 | } else { |
| 3397 | |
| 3398 | // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: |
| 3399 | // * false: [ value ].slice( 0 ) => resolve( value ) |
| 3400 | // * true: [ value ].slice( 1 ) => resolve() |
| 3401 | resolve.apply( undefined, [ value ].slice( noValue ) ); |
| 3402 | } |
| 3403 | |
| 3404 | // For Promises/A+, convert exceptions into rejections |
| 3405 | // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in |
| 3406 | // Deferred#then to conditionally suppress rejection. |
| 3407 | } catch ( value ) { |
| 3408 | |
| 3409 | // Support: Android 4.0 only |
| 3410 | // Strict mode functions invoked without .call/.apply get global-object context |
| 3411 | reject.apply( undefined, [ value ] ); |
| 3412 | } |
| 3413 | } |
| 3414 | |
| 3415 | jQuery.extend( { |
| 3416 | |
| 3417 | Deferred: function( func ) { |
| 3418 | var tuples = [ |
| 3419 | |
| 3420 | // action, add listener, callbacks, |
| 3421 | // ... .then handlers, argument index, [final state] |
| 3422 | [ "notify", "progress", jQuery.Callbacks( "memory" ), |
| 3423 | jQuery.Callbacks( "memory" ), 2 ], |
| 3424 | [ "resolve", "done", jQuery.Callbacks( "once memory" ), |
| 3425 | jQuery.Callbacks( "once memory" ), 0, "resolved" ], |
| 3426 | [ "reject", "fail", jQuery.Callbacks( "once memory" ), |
| 3427 | jQuery.Callbacks( "once memory" ), 1, "rejected" ] |
| 3428 | ], |
| 3429 | state = "pending", |
| 3430 | promise = { |
| 3431 | state: function() { |
| 3432 | return state; |
| 3433 | }, |
| 3434 | always: function() { |
| 3435 | deferred.done( arguments ).fail( arguments ); |
| 3436 | return this; |
| 3437 | }, |
| 3438 | "catch": function( fn ) { |
| 3439 | return promise.then( null, fn ); |
| 3440 | }, |
| 3441 | |
| 3442 | // Keep pipe for back-compat |
| 3443 | pipe: function( /* fnDone, fnFail, fnProgress */ ) { |
| 3444 | var fns = arguments; |
| 3445 | |
| 3446 | return jQuery.Deferred( function( newDefer ) { |
| 3447 | jQuery.each( tuples, function( _i, tuple ) { |
| 3448 | |
| 3449 | // Map tuples (progress, done, fail) to arguments (done, fail, progress) |
| 3450 | var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; |
| 3451 | |
| 3452 | // deferred.progress(function() { bind to newDefer or newDefer.notify }) |
| 3453 | // deferred.done(function() { bind to newDefer or newDefer.resolve }) |
| 3454 | // deferred.fail(function() { bind to newDefer or newDefer.reject }) |
| 3455 | deferred[ tuple[ 1 ] ]( function() { |
| 3456 | var returned = fn && fn.apply( this, arguments ); |
| 3457 | if ( returned && isFunction( returned.promise ) ) { |
| 3458 | returned.promise() |
| 3459 | .progress( newDefer.notify ) |
| 3460 | .done( newDefer.resolve ) |
| 3461 | .fail( newDefer.reject ); |
| 3462 | } else { |
| 3463 | newDefer[ tuple[ 0 ] + "With" ]( |
| 3464 | this, |
| 3465 | fn ? [ returned ] : arguments |
| 3466 | ); |
| 3467 | } |
| 3468 | } ); |
| 3469 | } ); |
| 3470 | fns = null; |
| 3471 | } ).promise(); |
| 3472 | }, |
| 3473 | then: function( onFulfilled, onRejected, onProgress ) { |
| 3474 | var maxDepth = 0; |
| 3475 | function resolve( depth, deferred, handler, special ) { |
| 3476 | return function() { |
| 3477 | var that = this, |
| 3478 | args = arguments, |
| 3479 | mightThrow = function() { |
| 3480 | var returned, then; |
| 3481 | |
| 3482 | // Support: Promises/A+ section 2.3.3.3.3 |
| 3483 | // https://promisesaplus.com/#point-59 |
| 3484 | // Ignore double-resolution attempts |
| 3485 | if ( depth < maxDepth ) { |
| 3486 | return; |
| 3487 | } |
| 3488 | |
| 3489 | returned = handler.apply( that, args ); |
| 3490 | |
| 3491 | // Support: Promises/A+ section 2.3.1 |
| 3492 | // https://promisesaplus.com/#point-48 |
| 3493 | if ( returned === deferred.promise() ) { |
| 3494 | throw new TypeError( "Thenable self-resolution" ); |
| 3495 | } |
| 3496 | |
| 3497 | // Support: Promises/A+ sections 2.3.3.1, 3.5 |
| 3498 | // https://promisesaplus.com/#point-54 |
| 3499 | // https://promisesaplus.com/#point-75 |
| 3500 | // Retrieve `then` only once |
| 3501 | then = returned && |
| 3502 | |
| 3503 | // Support: Promises/A+ section 2.3.4 |
| 3504 | // https://promisesaplus.com/#point-64 |
| 3505 | // Only check objects and functions for thenability |
| 3506 | ( typeof returned === "object" || |
| 3507 | typeof returned === "function" ) && |
| 3508 | returned.then; |
| 3509 | |
| 3510 | // Handle a returned thenable |
| 3511 | if ( isFunction( then ) ) { |
| 3512 | |
| 3513 | // Special processors (notify) just wait for resolution |
| 3514 | if ( special ) { |
| 3515 | then.call( |
| 3516 | returned, |
| 3517 | resolve( maxDepth, deferred, Identity, special ), |
| 3518 | resolve( maxDepth, deferred, Thrower, special ) |
| 3519 | ); |
| 3520 | |
| 3521 | // Normal processors (resolve) also hook into progress |
| 3522 | } else { |
| 3523 | |
| 3524 | // ...and disregard older resolution values |
| 3525 | maxDepth++; |
| 3526 | |
| 3527 | then.call( |
| 3528 | returned, |
| 3529 | resolve( maxDepth, deferred, Identity, special ), |
| 3530 | resolve( maxDepth, deferred, Thrower, special ), |
| 3531 | resolve( maxDepth, deferred, Identity, |
| 3532 | deferred.notifyWith ) |
| 3533 | ); |
| 3534 | } |
| 3535 | |
| 3536 | // Handle all other returned values |
| 3537 | } else { |
| 3538 | |
| 3539 | // Only substitute handlers pass on context |
| 3540 | // and multiple values (non-spec behavior) |
| 3541 | if ( handler !== Identity ) { |
| 3542 | that = undefined; |
| 3543 | args = [ returned ]; |
| 3544 | } |
| 3545 | |
| 3546 | // Process the value(s) |
| 3547 | // Default process is resolve |
| 3548 | ( special || deferred.resolveWith )( that, args ); |
| 3549 | } |
| 3550 | }, |
| 3551 | |
| 3552 | // Only normal processors (resolve) catch and reject exceptions |
| 3553 | process = special ? |
| 3554 | mightThrow : |
| 3555 | function() { |
| 3556 | try { |
| 3557 | mightThrow(); |
| 3558 | } catch ( e ) { |
| 3559 | |
| 3560 | if ( jQuery.Deferred.exceptionHook ) { |
| 3561 | jQuery.Deferred.exceptionHook( e, |
| 3562 | process.error ); |
| 3563 | } |
| 3564 | |
| 3565 | // Support: Promises/A+ section 2.3.3.3.4.1 |
| 3566 | // https://promisesaplus.com/#point-61 |
| 3567 | // Ignore post-resolution exceptions |
| 3568 | if ( depth + 1 >= maxDepth ) { |
| 3569 | |
| 3570 | // Only substitute handlers pass on context |
| 3571 | // and multiple values (non-spec behavior) |
| 3572 | if ( handler !== Thrower ) { |
| 3573 | that = undefined; |
| 3574 | args = [ e ]; |
| 3575 | } |
| 3576 | |
| 3577 | deferred.rejectWith( that, args ); |
| 3578 | } |
| 3579 | } |
| 3580 | }; |
| 3581 | |
| 3582 | // Support: Promises/A+ section 2.3.3.3.1 |
| 3583 | // https://promisesaplus.com/#point-57 |
| 3584 | // Re-resolve promises immediately to dodge false rejection from |
| 3585 | // subsequent errors |
| 3586 | if ( depth ) { |
| 3587 | process(); |
| 3588 | } else { |
| 3589 | |
| 3590 | // Call an optional hook to record the error, in case of exception |
| 3591 | // since it's otherwise lost when execution goes async |
| 3592 | if ( jQuery.Deferred.getErrorHook ) { |
| 3593 | process.error = jQuery.Deferred.getErrorHook(); |
| 3594 | |
| 3595 | // The deprecated alias of the above. While the name suggests |
| 3596 | // returning the stack, not an error instance, jQuery just passes |
| 3597 | // it directly to `console.warn` so both will work; an instance |
| 3598 | // just better cooperates with source maps. |
| 3599 | } else if ( jQuery.Deferred.getStackHook ) { |
| 3600 | process.error = jQuery.Deferred.getStackHook(); |
| 3601 | } |
| 3602 | window.setTimeout( process ); |
| 3603 | } |
| 3604 | }; |
| 3605 | } |
| 3606 | |
| 3607 | return jQuery.Deferred( function( newDefer ) { |
| 3608 | |
| 3609 | // progress_handlers.add( ... ) |
| 3610 | tuples[ 0 ][ 3 ].add( |
| 3611 | resolve( |
| 3612 | 0, |
| 3613 | newDefer, |
| 3614 | isFunction( onProgress ) ? |
| 3615 | onProgress : |
| 3616 | Identity, |
| 3617 | newDefer.notifyWith |
| 3618 | ) |
| 3619 | ); |
| 3620 | |
| 3621 | // fulfilled_handlers.add( ... ) |
| 3622 | tuples[ 1 ][ 3 ].add( |
| 3623 | resolve( |
| 3624 | 0, |
| 3625 | newDefer, |
| 3626 | isFunction( onFulfilled ) ? |
| 3627 | onFulfilled : |
| 3628 | Identity |
| 3629 | ) |
| 3630 | ); |
| 3631 | |
| 3632 | // rejected_handlers.add( ... ) |
| 3633 | tuples[ 2 ][ 3 ].add( |
| 3634 | resolve( |
| 3635 | 0, |
| 3636 | newDefer, |
| 3637 | isFunction( onRejected ) ? |
| 3638 | onRejected : |
| 3639 | Thrower |
| 3640 | ) |
| 3641 | ); |
| 3642 | } ).promise(); |
| 3643 | }, |
| 3644 | |
| 3645 | // Get a promise for this deferred |
| 3646 | // If obj is provided, the promise aspect is added to the object |
| 3647 | promise: function( obj ) { |
| 3648 | return obj != null ? jQuery.extend( obj, promise ) : promise; |
| 3649 | } |
| 3650 | }, |
| 3651 | deferred = {}; |
| 3652 | |
| 3653 | // Add list-specific methods |
| 3654 | jQuery.each( tuples, function( i, tuple ) { |
| 3655 | var list = tuple[ 2 ], |
| 3656 | stateString = tuple[ 5 ]; |
| 3657 | |
| 3658 | // promise.progress = list.add |
| 3659 | // promise.done = list.add |
| 3660 | // promise.fail = list.add |
| 3661 | promise[ tuple[ 1 ] ] = list.add; |
| 3662 | |
| 3663 | // Handle state |
| 3664 | if ( stateString ) { |
| 3665 | list.add( |
| 3666 | function() { |
| 3667 | |
| 3668 | // state = "resolved" (i.e., fulfilled) |
| 3669 | // state = "rejected" |
| 3670 | state = stateString; |
| 3671 | }, |
| 3672 | |
| 3673 | // rejected_callbacks.disable |
| 3674 | // fulfilled_callbacks.disable |
| 3675 | tuples[ 3 - i ][ 2 ].disable, |
| 3676 | |
| 3677 | // rejected_handlers.disable |
| 3678 | // fulfilled_handlers.disable |
| 3679 | tuples[ 3 - i ][ 3 ].disable, |
| 3680 | |
| 3681 | // progress_callbacks.lock |
| 3682 | tuples[ 0 ][ 2 ].lock, |
| 3683 | |
| 3684 | // progress_handlers.lock |
| 3685 | tuples[ 0 ][ 3 ].lock |
| 3686 | ); |
| 3687 | } |
| 3688 | |
| 3689 | // progress_handlers.fire |
| 3690 | // fulfilled_handlers.fire |
| 3691 | // rejected_handlers.fire |
| 3692 | list.add( tuple[ 3 ].fire ); |
| 3693 | |
| 3694 | // deferred.notify = function() { deferred.notifyWith(...) } |
| 3695 | // deferred.resolve = function() { deferred.resolveWith(...) } |
| 3696 | // deferred.reject = function() { deferred.rejectWith(...) } |
| 3697 | deferred[ tuple[ 0 ] ] = function() { |
| 3698 | deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); |
| 3699 | return this; |
| 3700 | }; |
| 3701 | |
| 3702 | // deferred.notifyWith = list.fireWith |
| 3703 | // deferred.resolveWith = list.fireWith |
| 3704 | // deferred.rejectWith = list.fireWith |
| 3705 | deferred[ tuple[ 0 ] + "With" ] = list.fireWith; |
| 3706 | } ); |
| 3707 | |
| 3708 | // Make the deferred a promise |
| 3709 | promise.promise( deferred ); |
| 3710 | |
| 3711 | // Call given func if any |
| 3712 | if ( func ) { |
| 3713 | func.call( deferred, deferred ); |
| 3714 | } |
| 3715 | |
| 3716 | // All done! |
| 3717 | return deferred; |
| 3718 | }, |
| 3719 | |
| 3720 | // Deferred helper |
| 3721 | when: function( singleValue ) { |
| 3722 | var |
| 3723 | |
| 3724 | // count of uncompleted subordinates |
| 3725 | remaining = arguments.length, |
| 3726 | |
| 3727 | // count of unprocessed arguments |
| 3728 | i = remaining, |
| 3729 | |
| 3730 | // subordinate fulfillment data |
| 3731 | resolveContexts = Array( i ), |
| 3732 | resolveValues = slice.call( arguments ), |
| 3733 | |
| 3734 | // the primary Deferred |
| 3735 | primary = jQuery.Deferred(), |
| 3736 | |
| 3737 | // subordinate callback factory |
| 3738 | updateFunc = function( i ) { |
| 3739 | return function( value ) { |
| 3740 | resolveContexts[ i ] = this; |
| 3741 | resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; |
| 3742 | if ( !( --remaining ) ) { |
| 3743 | primary.resolveWith( resolveContexts, resolveValues ); |
| 3744 | } |
| 3745 | }; |
| 3746 | }; |
| 3747 | |
| 3748 | // Single- and empty arguments are adopted like Promise.resolve |
| 3749 | if ( remaining <= 1 ) { |
| 3750 | adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject, |
| 3751 | !remaining ); |
| 3752 | |
| 3753 | // Use .then() to unwrap secondary thenables (cf. gh-3000) |
| 3754 | if ( primary.state() === "pending" || |
| 3755 | isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { |
| 3756 | |
| 3757 | return primary.then(); |
| 3758 | } |
| 3759 | } |
| 3760 | |
| 3761 | // Multiple arguments are aggregated like Promise.all array elements |
| 3762 | while ( i-- ) { |
| 3763 | adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject ); |
| 3764 | } |
| 3765 | |
| 3766 | return primary.promise(); |
| 3767 | } |
| 3768 | } ); |
| 3769 | |
| 3770 | |
| 3771 | // These usually indicate a programmer mistake during development, |
| 3772 | // warn about them ASAP rather than swallowing them by default. |
| 3773 | var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; |
| 3774 | |
| 3775 | // If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error |
| 3776 | // captured before the async barrier to get the original error cause |
| 3777 | // which may otherwise be hidden. |
| 3778 | jQuery.Deferred.exceptionHook = function( error, asyncError ) { |
| 3779 | |
| 3780 | // Support: IE 8 - 9 only |
| 3781 | // Console exists when dev tools are open, which can happen at any time |
| 3782 | if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { |
| 3783 | window.console.warn( "jQuery.Deferred exception: " + error.message, |
| 3784 | error.stack, asyncError ); |
| 3785 | } |
| 3786 | }; |
| 3787 | |
| 3788 | |
| 3789 | |
| 3790 | |
| 3791 | jQuery.readyException = function( error ) { |
| 3792 | window.setTimeout( function() { |
| 3793 | throw error; |
| 3794 | } ); |
| 3795 | }; |
| 3796 | |
| 3797 | |
| 3798 | |
| 3799 | |
| 3800 | // The deferred used on DOM ready |
| 3801 | var readyList = jQuery.Deferred(); |
| 3802 | |
| 3803 | jQuery.fn.ready = function( fn ) { |
| 3804 | |
| 3805 | readyList |
| 3806 | .then( fn ) |
| 3807 | |
| 3808 | // Wrap jQuery.readyException in a function so that the lookup |
| 3809 | // happens at the time of error handling instead of callback |
| 3810 | // registration. |
| 3811 | .catch( function( error ) { |
| 3812 | jQuery.readyException( error ); |
| 3813 | } ); |
| 3814 | |
| 3815 | return this; |
| 3816 | }; |
| 3817 | |
| 3818 | jQuery.extend( { |
| 3819 | |
| 3820 | // Is the DOM ready to be used? Set to true once it occurs. |
| 3821 | isReady: false, |
| 3822 | |
| 3823 | // A counter to track how many items to wait for before |
| 3824 | // the ready event fires. See trac-6781 |
| 3825 | readyWait: 1, |
| 3826 | |
| 3827 | // Handle when the DOM is ready |
| 3828 | ready: function( wait ) { |
| 3829 | |
| 3830 | // Abort if there are pending holds or we're already ready |
| 3831 | if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { |
| 3832 | return; |
| 3833 | } |
| 3834 | |
| 3835 | // Remember that the DOM is ready |
| 3836 | jQuery.isReady = true; |
| 3837 | |
| 3838 | // If a normal DOM Ready event fired, decrement, and wait if need be |
| 3839 | if ( wait !== true && --jQuery.readyWait > 0 ) { |
| 3840 | return; |
| 3841 | } |
| 3842 | |
| 3843 | // If there are functions bound, to execute |
| 3844 | readyList.resolveWith( document, [ jQuery ] ); |
| 3845 | } |
| 3846 | } ); |
| 3847 | |
| 3848 | jQuery.ready.then = readyList.then; |
| 3849 | |
| 3850 | // The ready event handler and self cleanup method |
| 3851 | function completed() { |
| 3852 | document.removeEventListener( "DOMContentLoaded", completed ); |
| 3853 | window.removeEventListener( "load", completed ); |
| 3854 | jQuery.ready(); |
| 3855 | } |
| 3856 | |
| 3857 | // Catch cases where $(document).ready() is called |
| 3858 | // after the browser event has already occurred. |
| 3859 | // Support: IE <=9 - 10 only |
| 3860 | // Older IE sometimes signals "interactive" too soon |
| 3861 | if ( document.readyState === "complete" || |
| 3862 | ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { |
| 3863 | |
| 3864 | // Handle it asynchronously to allow scripts the opportunity to delay ready |
| 3865 | window.setTimeout( jQuery.ready ); |
| 3866 | |
| 3867 | } else { |
| 3868 | |
| 3869 | // Use the handy event callback |
| 3870 | document.addEventListener( "DOMContentLoaded", completed ); |
| 3871 | |
| 3872 | // A fallback to window.onload, that will always work |
| 3873 | window.addEventListener( "load", completed ); |
| 3874 | } |
| 3875 | |
| 3876 | |
| 3877 | |
| 3878 | |
| 3879 | // Multifunctional method to get and set values of a collection |
| 3880 | // The value/s can optionally be executed if it's a function |
| 3881 | var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { |
| 3882 | var i = 0, |
| 3883 | len = elems.length, |
| 3884 | bulk = key == null; |
| 3885 | |
| 3886 | // Sets many values |
| 3887 | if ( toType( key ) === "object" ) { |
| 3888 | chainable = true; |
| 3889 | for ( i in key ) { |
| 3890 | access( elems, fn, i, key[ i ], true, emptyGet, raw ); |
| 3891 | } |
| 3892 | |
| 3893 | // Sets one value |
| 3894 | } else if ( value !== undefined ) { |
| 3895 | chainable = true; |
| 3896 | |
| 3897 | if ( !isFunction( value ) ) { |
| 3898 | raw = true; |
| 3899 | } |
| 3900 | |
| 3901 | if ( bulk ) { |
| 3902 | |
| 3903 | // Bulk operations run against the entire set |
| 3904 | if ( raw ) { |
| 3905 | fn.call( elems, value ); |
| 3906 | fn = null; |
| 3907 | |
| 3908 | // ...except when executing function values |
| 3909 | } else { |
| 3910 | bulk = fn; |
| 3911 | fn = function( elem, _key, value ) { |
| 3912 | return bulk.call( jQuery( elem ), value ); |
| 3913 | }; |
| 3914 | } |
| 3915 | } |
| 3916 | |
| 3917 | if ( fn ) { |
| 3918 | for ( ; i < len; i++ ) { |
| 3919 | fn( |
| 3920 | elems[ i ], key, raw ? |
| 3921 | value : |
| 3922 | value.call( elems[ i ], i, fn( elems[ i ], key ) ) |
| 3923 | ); |
| 3924 | } |
| 3925 | } |
| 3926 | } |
| 3927 | |
| 3928 | if ( chainable ) { |
| 3929 | return elems; |
| 3930 | } |
| 3931 | |
| 3932 | // Gets |
| 3933 | if ( bulk ) { |
| 3934 | return fn.call( elems ); |
| 3935 | } |
| 3936 | |
| 3937 | return len ? fn( elems[ 0 ], key ) : emptyGet; |
| 3938 | }; |
| 3939 | |
| 3940 | |
| 3941 | // Matches dashed string for camelizing |
| 3942 | var rmsPrefix = /^-ms-/, |
| 3943 | rdashAlpha = /-([a-z])/g; |
| 3944 | |
| 3945 | // Used by camelCase as callback to replace() |
| 3946 | function fcamelCase( _all, letter ) { |
| 3947 | return letter.toUpperCase(); |
| 3948 | } |
| 3949 | |
| 3950 | // Convert dashed to camelCase; used by the css and data modules |
| 3951 | // Support: IE <=9 - 11, Edge 12 - 15 |
| 3952 | // Microsoft forgot to hump their vendor prefix (trac-9572) |
| 3953 | function camelCase( string ) { |
| 3954 | return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); |
| 3955 | } |
| 3956 | var acceptData = function( owner ) { |
| 3957 | |
| 3958 | // Accepts only: |
| 3959 | // - Node |
| 3960 | // - Node.ELEMENT_NODE |
| 3961 | // - Node.DOCUMENT_NODE |
| 3962 | // - Object |
| 3963 | // - Any |
| 3964 | return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); |
| 3965 | }; |
| 3966 | |
| 3967 | |
| 3968 | |
| 3969 | |
| 3970 | function Data() { |
| 3971 | this.expando = jQuery.expando + Data.uid++; |
| 3972 | } |
| 3973 | |
| 3974 | Data.uid = 1; |
| 3975 | |
| 3976 | Data.prototype = { |
| 3977 | |
| 3978 | cache: function( owner ) { |
| 3979 | |
| 3980 | // Check if the owner object already has a cache |
| 3981 | var value = owner[ this.expando ]; |
| 3982 | |
| 3983 | // If not, create one |
| 3984 | if ( !value ) { |
| 3985 | value = {}; |
| 3986 | |
| 3987 | // We can accept data for non-element nodes in modern browsers, |
| 3988 | // but we should not, see trac-8335. |
| 3989 | // Always return an empty object. |
| 3990 | if ( acceptData( owner ) ) { |
| 3991 | |
| 3992 | // If it is a node unlikely to be stringify-ed or looped over |
| 3993 | // use plain assignment |
| 3994 | if ( owner.nodeType ) { |
| 3995 | owner[ this.expando ] = value; |
| 3996 | |
| 3997 | // Otherwise secure it in a non-enumerable property |
| 3998 | // configurable must be true to allow the property to be |
| 3999 | // deleted when data is removed |
| 4000 | } else { |
| 4001 | Object.defineProperty( owner, this.expando, { |
| 4002 | value: value, |
| 4003 | configurable: true |
| 4004 | } ); |
| 4005 | } |
| 4006 | } |
| 4007 | } |
| 4008 | |
| 4009 | return value; |
| 4010 | }, |
| 4011 | set: function( owner, data, value ) { |
| 4012 | var prop, |
| 4013 | cache = this.cache( owner ); |
| 4014 | |
| 4015 | // Handle: [ owner, key, value ] args |
| 4016 | // Always use camelCase key (gh-2257) |
| 4017 | if ( typeof data === "string" ) { |
| 4018 | cache[ camelCase( data ) ] = value; |
| 4019 | |
| 4020 | // Handle: [ owner, { properties } ] args |
| 4021 | } else { |
| 4022 | |
| 4023 | // Copy the properties one-by-one to the cache object |
| 4024 | for ( prop in data ) { |
| 4025 | cache[ camelCase( prop ) ] = data[ prop ]; |
| 4026 | } |
| 4027 | } |
| 4028 | return cache; |
| 4029 | }, |
| 4030 | get: function( owner, key ) { |
| 4031 | return key === undefined ? |
| 4032 | this.cache( owner ) : |
| 4033 | |
| 4034 | // Always use camelCase key (gh-2257) |
| 4035 | owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; |
| 4036 | }, |
| 4037 | access: function( owner, key, value ) { |
| 4038 | |
| 4039 | // In cases where either: |
| 4040 | // |
| 4041 | // 1. No key was specified |
| 4042 | // 2. A string key was specified, but no value provided |
| 4043 | // |
| 4044 | // Take the "read" path and allow the get method to determine |
| 4045 | // which value to return, respectively either: |
| 4046 | // |
| 4047 | // 1. The entire cache object |
| 4048 | // 2. The data stored at the key |
| 4049 | // |
| 4050 | if ( key === undefined || |
| 4051 | ( ( key && typeof key === "string" ) && value === undefined ) ) { |
| 4052 | |
| 4053 | return this.get( owner, key ); |
| 4054 | } |
| 4055 | |
| 4056 | // When the key is not a string, or both a key and value |
| 4057 | // are specified, set or extend (existing objects) with either: |
| 4058 | // |
| 4059 | // 1. An object of properties |
| 4060 | // 2. A key and value |
| 4061 | // |
| 4062 | this.set( owner, key, value ); |
| 4063 | |
| 4064 | // Since the "set" path can have two possible entry points |
| 4065 | // return the expected data based on which path was taken[*] |
| 4066 | return value !== undefined ? value : key; |
| 4067 | }, |
| 4068 | remove: function( owner, key ) { |
| 4069 | var i, |
| 4070 | cache = owner[ this.expando ]; |
| 4071 | |
| 4072 | if ( cache === undefined ) { |
| 4073 | return; |
| 4074 | } |
| 4075 | |
| 4076 | if ( key !== undefined ) { |
| 4077 | |
| 4078 | // Support array or space separated string of keys |
| 4079 | if ( Array.isArray( key ) ) { |
| 4080 | |
| 4081 | // If key is an array of keys... |
| 4082 | // We always set camelCase keys, so remove that. |
| 4083 | key = key.map( camelCase ); |
| 4084 | } else { |
| 4085 | key = camelCase( key ); |
| 4086 | |
| 4087 | // If a key with the spaces exists, use it. |
| 4088 | // Otherwise, create an array by matching non-whitespace |
| 4089 | key = key in cache ? |
| 4090 | [ key ] : |
| 4091 | ( key.match( rnothtmlwhite ) || [] ); |
| 4092 | } |
| 4093 | |
| 4094 | i = key.length; |
| 4095 | |
| 4096 | while ( i-- ) { |
| 4097 | delete cache[ key[ i ] ]; |
| 4098 | } |
| 4099 | } |
| 4100 | |
| 4101 | // Remove the expando if there's no more data |
| 4102 | if ( key === undefined || jQuery.isEmptyObject( cache ) ) { |
| 4103 | |
| 4104 | // Support: Chrome <=35 - 45 |
| 4105 | // Webkit & Blink performance suffers when deleting properties |
| 4106 | // from DOM nodes, so set to undefined instead |
| 4107 | // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) |
| 4108 | if ( owner.nodeType ) { |
| 4109 | owner[ this.expando ] = undefined; |
| 4110 | } else { |
| 4111 | delete owner[ this.expando ]; |
| 4112 | } |
| 4113 | } |
| 4114 | }, |
| 4115 | hasData: function( owner ) { |
| 4116 | var cache = owner[ this.expando ]; |
| 4117 | return cache !== undefined && !jQuery.isEmptyObject( cache ); |
| 4118 | } |
| 4119 | }; |
| 4120 | var dataPriv = new Data(); |
| 4121 | |
| 4122 | var dataUser = new Data(); |
| 4123 | |
| 4124 | |
| 4125 | |
| 4126 | // Implementation Summary |
| 4127 | // |
| 4128 | // 1. Enforce API surface and semantic compatibility with 1.9.x branch |
| 4129 | // 2. Improve the module's maintainability by reducing the storage |
| 4130 | // paths to a single mechanism. |
| 4131 | // 3. Use the same single mechanism to support "private" and "user" data. |
| 4132 | // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) |
| 4133 | // 5. Avoid exposing implementation details on user objects (eg. expando properties) |
| 4134 | // 6. Provide a clear path for implementation upgrade to WeakMap in 2014 |
| 4135 | |
| 4136 | var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, |
| 4137 | rmultiDash = /[A-Z]/g; |
| 4138 | |
| 4139 | function getData( data ) { |
| 4140 | if ( data === "true" ) { |
| 4141 | return true; |
| 4142 | } |
| 4143 | |
| 4144 | if ( data === "false" ) { |
| 4145 | return false; |
| 4146 | } |
| 4147 | |
| 4148 | if ( data === "null" ) { |
| 4149 | return null; |
| 4150 | } |
| 4151 | |
| 4152 | // Only convert to a number if it doesn't change the string |
| 4153 | if ( data === +data + "" ) { |
| 4154 | return +data; |
| 4155 | } |
| 4156 | |
| 4157 | if ( rbrace.test( data ) ) { |
| 4158 | return JSON.parse( data ); |
| 4159 | } |
| 4160 | |
| 4161 | return data; |
| 4162 | } |
| 4163 | |
| 4164 | function dataAttr( elem, key, data ) { |
| 4165 | var name; |
| 4166 | |
| 4167 | // If nothing was found internally, try to fetch any |
| 4168 | // data from the HTML5 data-* attribute |
| 4169 | if ( data === undefined && elem.nodeType === 1 ) { |
| 4170 | name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); |
| 4171 | data = elem.getAttribute( name ); |
| 4172 | |
| 4173 | if ( typeof data === "string" ) { |
| 4174 | try { |
| 4175 | data = getData( data ); |
| 4176 | } catch ( e ) {} |
| 4177 | |
| 4178 | // Make sure we set the data so it isn't changed later |
| 4179 | dataUser.set( elem, key, data ); |
| 4180 | } else { |
| 4181 | data = undefined; |
| 4182 | } |
| 4183 | } |
| 4184 | return data; |
| 4185 | } |
| 4186 | |
| 4187 | jQuery.extend( { |
| 4188 | hasData: function( elem ) { |
| 4189 | return dataUser.hasData( elem ) || dataPriv.hasData( elem ); |
| 4190 | }, |
| 4191 | |
| 4192 | data: function( elem, name, data ) { |
| 4193 | return dataUser.access( elem, name, data ); |
| 4194 | }, |
| 4195 | |
| 4196 | removeData: function( elem, name ) { |
| 4197 | dataUser.remove( elem, name ); |
| 4198 | }, |
| 4199 | |
| 4200 | // TODO: Now that all calls to _data and _removeData have been replaced |
| 4201 | // with direct calls to dataPriv methods, these can be deprecated. |
| 4202 | _data: function( elem, name, data ) { |
| 4203 | return dataPriv.access( elem, name, data ); |
| 4204 | }, |
| 4205 | |
| 4206 | _removeData: function( elem, name ) { |
| 4207 | dataPriv.remove( elem, name ); |
| 4208 | } |
| 4209 | } ); |
| 4210 | |
| 4211 | jQuery.fn.extend( { |
| 4212 | data: function( key, value ) { |
| 4213 | var i, name, data, |
| 4214 | elem = this[ 0 ], |
| 4215 | attrs = elem && elem.attributes; |
| 4216 | |
| 4217 | // Gets all values |
| 4218 | if ( key === undefined ) { |
| 4219 | if ( this.length ) { |
| 4220 | data = dataUser.get( elem ); |
| 4221 | |
| 4222 | if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { |
| 4223 | i = attrs.length; |
| 4224 | while ( i-- ) { |
| 4225 | |
| 4226 | // Support: IE 11 only |
| 4227 | // The attrs elements can be null (trac-14894) |
| 4228 | if ( attrs[ i ] ) { |
| 4229 | name = attrs[ i ].name; |
| 4230 | if ( name.indexOf( "data-" ) === 0 ) { |
| 4231 | name = camelCase( name.slice( 5 ) ); |
| 4232 | dataAttr( elem, name, data[ name ] ); |
| 4233 | } |
| 4234 | } |
| 4235 | } |
| 4236 | dataPriv.set( elem, "hasDataAttrs", true ); |
| 4237 | } |
| 4238 | } |
| 4239 | |
| 4240 | return data; |
| 4241 | } |
| 4242 | |
| 4243 | // Sets multiple values |
| 4244 | if ( typeof key === "object" ) { |
| 4245 | return this.each( function() { |
| 4246 | dataUser.set( this, key ); |
| 4247 | } ); |
| 4248 | } |
| 4249 | |
| 4250 | return access( this, function( value ) { |
| 4251 | var data; |
| 4252 | |
| 4253 | // The calling jQuery object (element matches) is not empty |
| 4254 | // (and therefore has an element appears at this[ 0 ]) and the |
| 4255 | // `value` parameter was not undefined. An empty jQuery object |
| 4256 | // will result in `undefined` for elem = this[ 0 ] which will |
| 4257 | // throw an exception if an attempt to read a data cache is made. |
| 4258 | if ( elem && value === undefined ) { |
| 4259 | |
| 4260 | // Attempt to get data from the cache |
| 4261 | // The key will always be camelCased in Data |
| 4262 | data = dataUser.get( elem, key ); |
| 4263 | if ( data !== undefined ) { |
| 4264 | return data; |
| 4265 | } |
| 4266 | |
| 4267 | // Attempt to "discover" the data in |
| 4268 | // HTML5 custom data-* attrs |
| 4269 | data = dataAttr( elem, key ); |
| 4270 | if ( data !== undefined ) { |
| 4271 | return data; |
| 4272 | } |
| 4273 | |
| 4274 | // We tried really hard, but the data doesn't exist. |
| 4275 | return; |
| 4276 | } |
| 4277 | |
| 4278 | // Set the data... |
| 4279 | this.each( function() { |
| 4280 | |
| 4281 | // We always store the camelCased key |
| 4282 | dataUser.set( this, key, value ); |
| 4283 | } ); |
| 4284 | }, null, value, arguments.length > 1, null, true ); |
| 4285 | }, |
| 4286 | |
| 4287 | removeData: function( key ) { |
| 4288 | return this.each( function() { |
| 4289 | dataUser.remove( this, key ); |
| 4290 | } ); |
| 4291 | } |
| 4292 | } ); |
| 4293 | |
| 4294 | |
| 4295 | jQuery.extend( { |
| 4296 | queue: function( elem, type, data ) { |
| 4297 | var queue; |
| 4298 | |
| 4299 | if ( elem ) { |
| 4300 | type = ( type || "fx" ) + "queue"; |
| 4301 | queue = dataPriv.get( elem, type ); |
| 4302 | |
| 4303 | // Speed up dequeue by getting out quickly if this is just a lookup |
| 4304 | if ( data ) { |
| 4305 | if ( !queue || Array.isArray( data ) ) { |
| 4306 | queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); |
| 4307 | } else { |
| 4308 | queue.push( data ); |
| 4309 | } |
| 4310 | } |
| 4311 | return queue || []; |
| 4312 | } |
| 4313 | }, |
| 4314 | |
| 4315 | dequeue: function( elem, type ) { |
| 4316 | type = type || "fx"; |
| 4317 | |
| 4318 | var queue = jQuery.queue( elem, type ), |
| 4319 | startLength = queue.length, |
| 4320 | fn = queue.shift(), |
| 4321 | hooks = jQuery._queueHooks( elem, type ), |
| 4322 | next = function() { |
| 4323 | jQuery.dequeue( elem, type ); |
| 4324 | }; |
| 4325 | |
| 4326 | // If the fx queue is dequeued, always remove the progress sentinel |
| 4327 | if ( fn === "inprogress" ) { |
| 4328 | fn = queue.shift(); |
| 4329 | startLength--; |
| 4330 | } |
| 4331 | |
| 4332 | if ( fn ) { |
| 4333 | |
| 4334 | // Add a progress sentinel to prevent the fx queue from being |
| 4335 | // automatically dequeued |
| 4336 | if ( type === "fx" ) { |
| 4337 | queue.unshift( "inprogress" ); |
| 4338 | } |
| 4339 | |
| 4340 | // Clear up the last queue stop function |
| 4341 | delete hooks.stop; |
| 4342 | fn.call( elem, next, hooks ); |
| 4343 | } |
| 4344 | |
| 4345 | if ( !startLength && hooks ) { |
| 4346 | hooks.empty.fire(); |
| 4347 | } |
| 4348 | }, |
| 4349 | |
| 4350 | // Not public - generate a queueHooks object, or return the current one |
| 4351 | _queueHooks: function( elem, type ) { |
| 4352 | var key = type + "queueHooks"; |
| 4353 | return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { |
| 4354 | empty: jQuery.Callbacks( "once memory" ).add( function() { |
| 4355 | dataPriv.remove( elem, [ type + "queue", key ] ); |
| 4356 | } ) |
| 4357 | } ); |
| 4358 | } |
| 4359 | } ); |
| 4360 | |
| 4361 | jQuery.fn.extend( { |
| 4362 | queue: function( type, data ) { |
| 4363 | var setter = 2; |
| 4364 | |
| 4365 | if ( typeof type !== "string" ) { |
| 4366 | data = type; |
| 4367 | type = "fx"; |
| 4368 | setter--; |
| 4369 | } |
| 4370 | |
| 4371 | if ( arguments.length < setter ) { |
| 4372 | return jQuery.queue( this[ 0 ], type ); |
| 4373 | } |
| 4374 | |
| 4375 | return data === undefined ? |
| 4376 | this : |
| 4377 | this.each( function() { |
| 4378 | var queue = jQuery.queue( this, type, data ); |
| 4379 | |
| 4380 | // Ensure a hooks for this queue |
| 4381 | jQuery._queueHooks( this, type ); |
| 4382 | |
| 4383 | if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { |
| 4384 | jQuery.dequeue( this, type ); |
| 4385 | } |
| 4386 | } ); |
| 4387 | }, |
| 4388 | dequeue: function( type ) { |
| 4389 | return this.each( function() { |
| 4390 | jQuery.dequeue( this, type ); |
| 4391 | } ); |
| 4392 | }, |
| 4393 | clearQueue: function( type ) { |
| 4394 | return this.queue( type || "fx", [] ); |
| 4395 | }, |
| 4396 | |
| 4397 | // Get a promise resolved when queues of a certain type |
| 4398 | // are emptied (fx is the type by default) |
| 4399 | promise: function( type, obj ) { |
| 4400 | var tmp, |
| 4401 | count = 1, |
| 4402 | defer = jQuery.Deferred(), |
| 4403 | elements = this, |
| 4404 | i = this.length, |
| 4405 | resolve = function() { |
| 4406 | if ( !( --count ) ) { |
| 4407 | defer.resolveWith( elements, [ elements ] ); |
| 4408 | } |
| 4409 | }; |
| 4410 | |
| 4411 | if ( typeof type !== "string" ) { |
| 4412 | obj = type; |
| 4413 | type = undefined; |
| 4414 | } |
| 4415 | type = type || "fx"; |
| 4416 | |
| 4417 | while ( i-- ) { |
| 4418 | tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); |
| 4419 | if ( tmp && tmp.empty ) { |
| 4420 | count++; |
| 4421 | tmp.empty.add( resolve ); |
| 4422 | } |
| 4423 | } |
| 4424 | resolve(); |
| 4425 | return defer.promise( obj ); |
| 4426 | } |
| 4427 | } ); |
| 4428 | var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; |
| 4429 | |
| 4430 | var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); |
| 4431 | |
| 4432 | |
| 4433 | var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; |
| 4434 | |
| 4435 | var documentElement = document.documentElement; |
| 4436 | |
| 4437 | |
| 4438 | |
| 4439 | var isAttached = function( elem ) { |
| 4440 | return jQuery.contains( elem.ownerDocument, elem ); |
| 4441 | }, |
| 4442 | composed = { composed: true }; |
| 4443 | |
| 4444 | // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only |
| 4445 | // Check attachment across shadow DOM boundaries when possible (gh-3504) |
| 4446 | // Support: iOS 10.0-10.2 only |
| 4447 | // Early iOS 10 versions support `attachShadow` but not `getRootNode`, |
| 4448 | // leading to errors. We need to check for `getRootNode`. |
| 4449 | if ( documentElement.getRootNode ) { |
| 4450 | isAttached = function( elem ) { |
| 4451 | return jQuery.contains( elem.ownerDocument, elem ) || |
| 4452 | elem.getRootNode( composed ) === elem.ownerDocument; |
| 4453 | }; |
| 4454 | } |
| 4455 | var isHiddenWithinTree = function( elem, el ) { |
| 4456 | |
| 4457 | // isHiddenWithinTree might be called from jQuery#filter function; |
| 4458 | // in that case, element will be second argument |
| 4459 | elem = el || elem; |
| 4460 | |
| 4461 | // Inline style trumps all |
| 4462 | return elem.style.display === "none" || |
| 4463 | elem.style.display === "" && |
| 4464 | |
| 4465 | // Otherwise, check computed style |
| 4466 | // Support: Firefox <=43 - 45 |
| 4467 | // Disconnected elements can have computed display: none, so first confirm that elem is |
| 4468 | // in the document. |
| 4469 | isAttached( elem ) && |
| 4470 | |
| 4471 | jQuery.css( elem, "display" ) === "none"; |
| 4472 | }; |
| 4473 | |
| 4474 | |
| 4475 | |
| 4476 | function adjustCSS( elem, prop, valueParts, tween ) { |
| 4477 | var adjusted, scale, |
| 4478 | maxIterations = 20, |
| 4479 | currentValue = tween ? |
| 4480 | function() { |
| 4481 | return tween.cur(); |
| 4482 | } : |
| 4483 | function() { |
| 4484 | return jQuery.css( elem, prop, "" ); |
| 4485 | }, |
| 4486 | initial = currentValue(), |
| 4487 | unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), |
| 4488 | |
| 4489 | // Starting value computation is required for potential unit mismatches |
| 4490 | initialInUnit = elem.nodeType && |
| 4491 | ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && |
| 4492 | rcssNum.exec( jQuery.css( elem, prop ) ); |
| 4493 | |
| 4494 | if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { |
| 4495 | |
| 4496 | // Support: Firefox <=54 |
| 4497 | // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) |
| 4498 | initial = initial / 2; |
| 4499 | |
| 4500 | // Trust units reported by jQuery.css |
| 4501 | unit = unit || initialInUnit[ 3 ]; |
| 4502 | |
| 4503 | // Iteratively approximate from a nonzero starting point |
| 4504 | initialInUnit = +initial || 1; |
| 4505 | |
| 4506 | while ( maxIterations-- ) { |
| 4507 | |
| 4508 | // Evaluate and update our best guess (doubling guesses that zero out). |
| 4509 | // Finish if the scale equals or crosses 1 (making the old*new product non-positive). |
| 4510 | jQuery.style( elem, prop, initialInUnit + unit ); |
| 4511 | if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { |
| 4512 | maxIterations = 0; |
| 4513 | } |
| 4514 | initialInUnit = initialInUnit / scale; |
| 4515 | |
| 4516 | } |
| 4517 | |
| 4518 | initialInUnit = initialInUnit * 2; |
| 4519 | jQuery.style( elem, prop, initialInUnit + unit ); |
| 4520 | |
| 4521 | // Make sure we update the tween properties later on |
| 4522 | valueParts = valueParts || []; |
| 4523 | } |
| 4524 | |
| 4525 | if ( valueParts ) { |
| 4526 | initialInUnit = +initialInUnit || +initial || 0; |
| 4527 | |
| 4528 | // Apply relative offset (+=/-=) if specified |
| 4529 | adjusted = valueParts[ 1 ] ? |
| 4530 | initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : |
| 4531 | +valueParts[ 2 ]; |
| 4532 | if ( tween ) { |
| 4533 | tween.unit = unit; |
| 4534 | tween.start = initialInUnit; |
| 4535 | tween.end = adjusted; |
| 4536 | } |
| 4537 | } |
| 4538 | return adjusted; |
| 4539 | } |
| 4540 | |
| 4541 | |
| 4542 | var defaultDisplayMap = {}; |
| 4543 | |
| 4544 | function getDefaultDisplay( elem ) { |
| 4545 | var temp, |
| 4546 | doc = elem.ownerDocument, |
| 4547 | nodeName = elem.nodeName, |
| 4548 | display = defaultDisplayMap[ nodeName ]; |
| 4549 | |
| 4550 | if ( display ) { |
| 4551 | return display; |
| 4552 | } |
| 4553 | |
| 4554 | temp = doc.body.appendChild( doc.createElement( nodeName ) ); |
| 4555 | display = jQuery.css( temp, "display" ); |
| 4556 | |
| 4557 | temp.parentNode.removeChild( temp ); |
| 4558 | |
| 4559 | if ( display === "none" ) { |
| 4560 | display = "block"; |
| 4561 | } |
| 4562 | defaultDisplayMap[ nodeName ] = display; |
| 4563 | |
| 4564 | return display; |
| 4565 | } |
| 4566 | |
| 4567 | function showHide( elements, show ) { |
| 4568 | var display, elem, |
| 4569 | values = [], |
| 4570 | index = 0, |
| 4571 | length = elements.length; |
| 4572 | |
| 4573 | // Determine new display value for elements that need to change |
| 4574 | for ( ; index < length; index++ ) { |
| 4575 | elem = elements[ index ]; |
| 4576 | if ( !elem.style ) { |
| 4577 | continue; |
| 4578 | } |
| 4579 | |
| 4580 | display = elem.style.display; |
| 4581 | if ( show ) { |
| 4582 | |
| 4583 | // Since we force visibility upon cascade-hidden elements, an immediate (and slow) |
| 4584 | // check is required in this first loop unless we have a nonempty display value (either |
| 4585 | // inline or about-to-be-restored) |
| 4586 | if ( display === "none" ) { |
| 4587 | values[ index ] = dataPriv.get( elem, "display" ) || null; |
| 4588 | if ( !values[ index ] ) { |
| 4589 | elem.style.display = ""; |
| 4590 | } |
| 4591 | } |
| 4592 | if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { |
| 4593 | values[ index ] = getDefaultDisplay( elem ); |
| 4594 | } |
| 4595 | } else { |
| 4596 | if ( display !== "none" ) { |
| 4597 | values[ index ] = "none"; |
| 4598 | |
| 4599 | // Remember what we're overwriting |
| 4600 | dataPriv.set( elem, "display", display ); |
| 4601 | } |
| 4602 | } |
| 4603 | } |
| 4604 | |
| 4605 | // Set the display of the elements in a second loop to avoid constant reflow |
| 4606 | for ( index = 0; index < length; index++ ) { |
| 4607 | if ( values[ index ] != null ) { |
| 4608 | elements[ index ].style.display = values[ index ]; |
| 4609 | } |
| 4610 | } |
| 4611 | |
| 4612 | return elements; |
| 4613 | } |
| 4614 | |
| 4615 | jQuery.fn.extend( { |
| 4616 | show: function() { |
| 4617 | return showHide( this, true ); |
| 4618 | }, |
| 4619 | hide: function() { |
| 4620 | return showHide( this ); |
| 4621 | }, |
| 4622 | toggle: function( state ) { |
| 4623 | if ( typeof state === "boolean" ) { |
| 4624 | return state ? this.show() : this.hide(); |
| 4625 | } |
| 4626 | |
| 4627 | return this.each( function() { |
| 4628 | if ( isHiddenWithinTree( this ) ) { |
| 4629 | jQuery( this ).show(); |
| 4630 | } else { |
| 4631 | jQuery( this ).hide(); |
| 4632 | } |
| 4633 | } ); |
| 4634 | } |
| 4635 | } ); |
| 4636 | var rcheckableType = ( /^(?:checkbox|radio)$/i ); |
| 4637 | |
| 4638 | var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); |
| 4639 | |
| 4640 | var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); |
| 4641 | |
| 4642 | |
| 4643 | |
| 4644 | ( function() { |
| 4645 | var fragment = document.createDocumentFragment(), |
| 4646 | div = fragment.appendChild( document.createElement( "div" ) ), |
| 4647 | input = document.createElement( "input" ); |
| 4648 | |
| 4649 | // Support: Android 4.0 - 4.3 only |
| 4650 | // Check state lost if the name is set (trac-11217) |
| 4651 | // Support: Windows Web Apps (WWA) |
| 4652 | // `name` and `type` must use .setAttribute for WWA (trac-14901) |
| 4653 | input.setAttribute( "type", "radio" ); |
| 4654 | input.setAttribute( "checked", "checked" ); |
| 4655 | input.setAttribute( "name", "t" ); |
| 4656 | |
| 4657 | div.appendChild( input ); |
| 4658 | |
| 4659 | // Support: Android <=4.1 only |
| 4660 | // Older WebKit doesn't clone checked state correctly in fragments |
| 4661 | support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; |
| 4662 | |
| 4663 | // Support: IE <=11 only |
| 4664 | // Make sure textarea (and checkbox) defaultValue is properly cloned |
| 4665 | div.innerHTML = "<textarea>x</textarea>"; |
| 4666 | support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; |
| 4667 | |
| 4668 | // Support: IE <=9 only |
| 4669 | // IE <=9 replaces <option> tags with their contents when inserted outside of |
| 4670 | // the select element. |
| 4671 | div.innerHTML = "<option></option>"; |
| 4672 | support.option = !!div.lastChild; |
| 4673 | } )(); |
| 4674 | |
| 4675 | |
| 4676 | // We have to close these tags to support XHTML (trac-13200) |
| 4677 | var wrapMap = { |
| 4678 | |
| 4679 | // XHTML parsers do not magically insert elements in the |
| 4680 | // same way that tag soup parsers do. So we cannot shorten |
| 4681 | // this by omitting <tbody> or other required elements. |
| 4682 | thead: [ 1, "<table>", "</table>" ], |
| 4683 | col: [ 2, "<table><colgroup>", "</colgroup></table>" ], |
| 4684 | tr: [ 2, "<table><tbody>", "</tbody></table>" ], |
| 4685 | td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], |
| 4686 | |
| 4687 | _default: [ 0, "", "" ] |
| 4688 | }; |
| 4689 | |
| 4690 | wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; |
| 4691 | wrapMap.th = wrapMap.td; |
| 4692 | |
| 4693 | // Support: IE <=9 only |
| 4694 | if ( !support.option ) { |
| 4695 | wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ]; |
| 4696 | } |
| 4697 | |
| 4698 | |
| 4699 | function getAll( context, tag ) { |
| 4700 | |
| 4701 | // Support: IE <=9 - 11 only |
| 4702 | // Use typeof to avoid zero-argument method invocation on host objects (trac-15151) |
| 4703 | var ret; |
| 4704 | |
| 4705 | if ( typeof context.getElementsByTagName !== "undefined" ) { |
| 4706 | ret = context.getElementsByTagName( tag || "*" ); |
| 4707 | |
| 4708 | } else if ( typeof context.querySelectorAll !== "undefined" ) { |
| 4709 | ret = context.querySelectorAll( tag || "*" ); |
| 4710 | |
| 4711 | } else { |
| 4712 | ret = []; |
| 4713 | } |
| 4714 | |
| 4715 | if ( tag === undefined || tag && nodeName( context, tag ) ) { |
| 4716 | return jQuery.merge( [ context ], ret ); |
| 4717 | } |
| 4718 | |
| 4719 | return ret; |
| 4720 | } |
| 4721 | |
| 4722 | |
| 4723 | // Mark scripts as having already been evaluated |
| 4724 | function setGlobalEval( elems, refElements ) { |
| 4725 | var i = 0, |
| 4726 | l = elems.length; |
| 4727 | |
| 4728 | for ( ; i < l; i++ ) { |
| 4729 | dataPriv.set( |
| 4730 | elems[ i ], |
| 4731 | "globalEval", |
| 4732 | !refElements || dataPriv.get( refElements[ i ], "globalEval" ) |
| 4733 | ); |
| 4734 | } |
| 4735 | } |
| 4736 | |
| 4737 | |
| 4738 | var rhtml = /<|&#?\w+;/; |
| 4739 | |
| 4740 | function buildFragment( elems, context, scripts, selection, ignored ) { |
| 4741 | var elem, tmp, tag, wrap, attached, j, |
| 4742 | fragment = context.createDocumentFragment(), |
| 4743 | nodes = [], |
| 4744 | i = 0, |
| 4745 | l = elems.length; |
| 4746 | |
| 4747 | for ( ; i < l; i++ ) { |
| 4748 | elem = elems[ i ]; |
| 4749 | |
| 4750 | if ( elem || elem === 0 ) { |
| 4751 | |
| 4752 | // Add nodes directly |
| 4753 | if ( toType( elem ) === "object" ) { |
| 4754 | |
| 4755 | // Support: Android <=4.0 only, PhantomJS 1 only |
| 4756 | // push.apply(_, arraylike) throws on ancient WebKit |
| 4757 | jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); |
| 4758 | |
| 4759 | // Convert non-html into a text node |
| 4760 | } else if ( !rhtml.test( elem ) ) { |
| 4761 | nodes.push( context.createTextNode( elem ) ); |
| 4762 | |
| 4763 | // Convert html into DOM nodes |
| 4764 | } else { |
| 4765 | tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); |
| 4766 | |
| 4767 | // Deserialize a standard representation |
| 4768 | tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); |
| 4769 | wrap = wrapMap[ tag ] || wrapMap._default; |
| 4770 | tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; |
| 4771 | |
| 4772 | // Descend through wrappers to the right content |
| 4773 | j = wrap[ 0 ]; |
| 4774 | while ( j-- ) { |
| 4775 | tmp = tmp.lastChild; |
| 4776 | } |
| 4777 | |
| 4778 | // Support: Android <=4.0 only, PhantomJS 1 only |
| 4779 | // push.apply(_, arraylike) throws on ancient WebKit |
| 4780 | jQuery.merge( nodes, tmp.childNodes ); |
| 4781 | |
| 4782 | // Remember the top-level container |
| 4783 | tmp = fragment.firstChild; |
| 4784 | |
| 4785 | // Ensure the created nodes are orphaned (trac-12392) |
| 4786 | tmp.textContent = ""; |
| 4787 | } |
| 4788 | } |
| 4789 | } |
| 4790 | |
| 4791 | // Remove wrapper from fragment |
| 4792 | fragment.textContent = ""; |
| 4793 | |
| 4794 | i = 0; |
| 4795 | while ( ( elem = nodes[ i++ ] ) ) { |
| 4796 | |
| 4797 | // Skip elements already in the context collection (trac-4087) |
| 4798 | if ( selection && jQuery.inArray( elem, selection ) > -1 ) { |
| 4799 | if ( ignored ) { |
| 4800 | ignored.push( elem ); |
| 4801 | } |
| 4802 | continue; |
| 4803 | } |
| 4804 | |
| 4805 | attached = isAttached( elem ); |
| 4806 | |
| 4807 | // Append to fragment |
| 4808 | tmp = getAll( fragment.appendChild( elem ), "script" ); |
| 4809 | |
| 4810 | // Preserve script evaluation history |
| 4811 | if ( attached ) { |
| 4812 | setGlobalEval( tmp ); |
| 4813 | } |
| 4814 | |
| 4815 | // Capture executables |
| 4816 | if ( scripts ) { |
| 4817 | j = 0; |
| 4818 | while ( ( elem = tmp[ j++ ] ) ) { |
| 4819 | if ( rscriptType.test( elem.type || "" ) ) { |
| 4820 | scripts.push( elem ); |
| 4821 | } |
| 4822 | } |
| 4823 | } |
| 4824 | } |
| 4825 | |
| 4826 | return fragment; |
| 4827 | } |
| 4828 | |
| 4829 | |
| 4830 | var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; |
| 4831 | |
| 4832 | function returnTrue() { |
| 4833 | return true; |
| 4834 | } |
| 4835 | |
| 4836 | function returnFalse() { |
| 4837 | return false; |
| 4838 | } |
| 4839 | |
| 4840 | function on( elem, types, selector, data, fn, one ) { |
| 4841 | var origFn, type; |
| 4842 | |
| 4843 | // Types can be a map of types/handlers |
| 4844 | if ( typeof types === "object" ) { |
| 4845 | |
| 4846 | // ( types-Object, selector, data ) |
| 4847 | if ( typeof selector !== "string" ) { |
| 4848 | |
| 4849 | // ( types-Object, data ) |
| 4850 | data = data || selector; |
| 4851 | selector = undefined; |
| 4852 | } |
| 4853 | for ( type in types ) { |
| 4854 | on( elem, type, selector, data, types[ type ], one ); |
| 4855 | } |
| 4856 | return elem; |
| 4857 | } |
| 4858 | |
| 4859 | if ( data == null && fn == null ) { |
| 4860 | |
| 4861 | // ( types, fn ) |
| 4862 | fn = selector; |
| 4863 | data = selector = undefined; |
| 4864 | } else if ( fn == null ) { |
| 4865 | if ( typeof selector === "string" ) { |
| 4866 | |
| 4867 | // ( types, selector, fn ) |
| 4868 | fn = data; |
| 4869 | data = undefined; |
| 4870 | } else { |
| 4871 | |
| 4872 | // ( types, data, fn ) |
| 4873 | fn = data; |
| 4874 | data = selector; |
| 4875 | selector = undefined; |
| 4876 | } |
| 4877 | } |
| 4878 | if ( fn === false ) { |
| 4879 | fn = returnFalse; |
| 4880 | } else if ( !fn ) { |
| 4881 | return elem; |
| 4882 | } |
| 4883 | |
| 4884 | if ( one === 1 ) { |
| 4885 | origFn = fn; |
| 4886 | fn = function( event ) { |
| 4887 | |
| 4888 | // Can use an empty set, since event contains the info |
| 4889 | jQuery().off( event ); |
| 4890 | return origFn.apply( this, arguments ); |
| 4891 | }; |
| 4892 | |
| 4893 | // Use same guid so caller can remove using origFn |
| 4894 | fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); |
| 4895 | } |
| 4896 | return elem.each( function() { |
| 4897 | jQuery.event.add( this, types, fn, data, selector ); |
| 4898 | } ); |
| 4899 | } |
| 4900 | |
| 4901 | /* |
| 4902 | * Helper functions for managing events -- not part of the public interface. |
| 4903 | * Props to Dean Edwards' addEvent library for many of the ideas. |
| 4904 | */ |
| 4905 | jQuery.event = { |
| 4906 | |
| 4907 | global: {}, |
| 4908 | |
| 4909 | add: function( elem, types, handler, data, selector ) { |
| 4910 | |
| 4911 | var handleObjIn, eventHandle, tmp, |
| 4912 | events, t, handleObj, |
| 4913 | special, handlers, type, namespaces, origType, |
| 4914 | elemData = dataPriv.get( elem ); |
| 4915 | |
| 4916 | // Only attach events to objects that accept data |
| 4917 | if ( !acceptData( elem ) ) { |
| 4918 | return; |
| 4919 | } |
| 4920 | |
| 4921 | // Caller can pass in an object of custom data in lieu of the handler |
| 4922 | if ( handler.handler ) { |
| 4923 | handleObjIn = handler; |
| 4924 | handler = handleObjIn.handler; |
| 4925 | selector = handleObjIn.selector; |
| 4926 | } |
| 4927 | |
| 4928 | // Ensure that invalid selectors throw exceptions at attach time |
| 4929 | // Evaluate against documentElement in case elem is a non-element node (e.g., document) |
| 4930 | if ( selector ) { |
| 4931 | jQuery.find.matchesSelector( documentElement, selector ); |
| 4932 | } |
| 4933 | |
| 4934 | // Make sure that the handler has a unique ID, used to find/remove it later |
| 4935 | if ( !handler.guid ) { |
| 4936 | handler.guid = jQuery.guid++; |
| 4937 | } |
| 4938 | |
| 4939 | // Init the element's event structure and main handler, if this is the first |
| 4940 | if ( !( events = elemData.events ) ) { |
| 4941 | events = elemData.events = Object.create( null ); |
| 4942 | } |
| 4943 | if ( !( eventHandle = elemData.handle ) ) { |
| 4944 | eventHandle = elemData.handle = function( e ) { |
| 4945 | |
| 4946 | // Discard the second event of a jQuery.event.trigger() and |
| 4947 | // when an event is called after a page has unloaded |
| 4948 | return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? |
| 4949 | jQuery.event.dispatch.apply( elem, arguments ) : undefined; |
| 4950 | }; |
| 4951 | } |
| 4952 | |
| 4953 | // Handle multiple events separated by a space |
| 4954 | types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; |
| 4955 | t = types.length; |
| 4956 | while ( t-- ) { |
| 4957 | tmp = rtypenamespace.exec( types[ t ] ) || []; |
| 4958 | type = origType = tmp[ 1 ]; |
| 4959 | namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); |
| 4960 | |
| 4961 | // There *must* be a type, no attaching namespace-only handlers |
| 4962 | if ( !type ) { |
| 4963 | continue; |
| 4964 | } |
| 4965 | |
| 4966 | // If event changes its type, use the special event handlers for the changed type |
| 4967 | special = jQuery.event.special[ type ] || {}; |
| 4968 | |
| 4969 | // If selector defined, determine special event api type, otherwise given type |
| 4970 | type = ( selector ? special.delegateType : special.bindType ) || type; |
| 4971 | |
| 4972 | // Update special based on newly reset type |
| 4973 | special = jQuery.event.special[ type ] || {}; |
| 4974 | |
| 4975 | // handleObj is passed to all event handlers |
| 4976 | handleObj = jQuery.extend( { |
| 4977 | type: type, |
| 4978 | origType: origType, |
| 4979 | data: data, |
| 4980 | handler: handler, |
| 4981 | guid: handler.guid, |
| 4982 | selector: selector, |
| 4983 | needsContext: selector && jQuery.expr.match.needsContext.test( selector ), |
| 4984 | namespace: namespaces.join( "." ) |
| 4985 | }, handleObjIn ); |
| 4986 | |
| 4987 | // Init the event handler queue if we're the first |
| 4988 | if ( !( handlers = events[ type ] ) ) { |
| 4989 | handlers = events[ type ] = []; |
| 4990 | handlers.delegateCount = 0; |
| 4991 | |
| 4992 | // Only use addEventListener if the special events handler returns false |
| 4993 | if ( !special.setup || |
| 4994 | special.setup.call( elem, data, namespaces, eventHandle ) === false ) { |
| 4995 | |
| 4996 | if ( elem.addEventListener ) { |
| 4997 | elem.addEventListener( type, eventHandle ); |
| 4998 | } |
| 4999 | } |
| 5000 | } |
Showing first 5,000 of 8,617 lines.
View raw