| 1 |
/*! |
| 2 |
* jQuery JavaScript Library v3.6.0 |
| 3 |
* https://jquery.com/ |
| 4 |
* |
| 5 |
* Includes Sizzle.js |
| 6 |
* https://sizzlejs.com/ |
| 7 |
* |
| 8 |
* Copyright OpenJS Foundation and other contributors |
| 9 |
* Released under the MIT license |
| 10 |
* https://jquery.org/license |
| 11 |
* |
| 12 |
* Date: 2021-03-02T17:08Z |
| 13 |
*/ |
| 14 |
(function (global, factory) { |
| 15 |
"use strict"; |
| 16 |
|
| 17 |
if (typeof module === "object" && typeof module.exports === "object") { |
| 18 |
// For CommonJS and CommonJS-like environments where a proper `window` |
| 19 |
// is present, execute the factory and get jQuery. |
| 20 |
// For environments that do not have a `window` with a `document` |
| 21 |
// (such as Node.js), expose a factory as module.exports. |
| 22 |
// This accentuates the need for the creation of a real `window`. |
| 23 |
// e.g. var jQuery = require("jquery")(window); |
| 24 |
// See ticket #14549 for more info. |
| 25 |
module.exports = global.document |
| 26 |
? factory(global, true) |
| 27 |
: function (w) { |
| 28 |
if (!w.document) { |
| 29 |
throw new Error("jQuery requires a window with a document"); |
| 30 |
} |
| 31 |
return factory(w); |
| 32 |
}; |
| 33 |
} else { |
| 34 |
factory(global); |
| 35 |
} |
| 36 |
|
| 37 |
// Pass this if window is not defined yet |
| 38 |
})(typeof window !== "undefined" ? window : this, function (window, noGlobal) { |
| 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 |
| 52 |
? function (array) { |
| 53 |
return arr.flat.call(array); |
| 54 |
} |
| 55 |
: function (array) { |
| 56 |
return arr.concat.apply([], array); |
| 57 |
}; |
| 58 |
|
| 59 |
var push = arr.push; |
| 60 |
|
| 61 |
var indexOf = arr.indexOf; |
| 62 |
|
| 63 |
var class2type = {}; |
| 64 |
|
| 65 |
var toString = class2type.toString; |
| 66 |
|
| 67 |
var hasOwn = class2type.hasOwnProperty; |
| 68 |
|
| 69 |
var fnToString = hasOwn.toString; |
| 70 |
|
| 71 |
var ObjectFunctionString = fnToString.call(Object); |
| 72 |
|
| 73 |
var support = {}; |
| 74 |
|
| 75 |
var isFunction = function isFunction(obj) { |
| 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 ( |
| 84 |
typeof obj === "function" && |
| 85 |
typeof obj.nodeType !== "number" && |
| 86 |
typeof obj.item !== "function" |
| 87 |
); |
| 88 |
}; |
| 89 |
|
| 90 |
var isWindow = function isWindow(obj) { |
| 91 |
return obj != null && obj === obj.window; |
| 92 |
}; |
| 93 |
|
| 94 |
var document = window.document; |
| 95 |
|
| 96 |
var preservedScriptAttributes = { |
| 97 |
type: true, |
| 98 |
src: true, |
| 99 |
nonce: true, |
| 100 |
noModule: true, |
| 101 |
}; |
| 102 |
|
| 103 |
function DOMEval(code, node, doc) { |
| 104 |
doc = doc || document; |
| 105 |
|
| 106 |
var i, |
| 107 |
val, |
| 108 |
script = doc.createElement("script"); |
| 109 |
|
| 110 |
script.text = code; |
| 111 |
if (node) { |
| 112 |
for (i in preservedScriptAttributes) { |
| 113 |
// Support: Firefox 64+, Edge 18+ |
| 114 |
// Some browsers don't support the "nonce" property on scripts. |
| 115 |
// On the other hand, just using `getAttribute` is not enough as |
| 116 |
// the `nonce` attribute is reset to an empty string whenever it |
| 117 |
// becomes browsing-context connected. |
| 118 |
// See https://github.com/whatwg/html/issues/2369 |
| 119 |
// See https://html.spec.whatwg.org/#nonce-attributes |
| 120 |
// The `node.getAttribute` check was added for the sake of |
| 121 |
// `jQuery.globalEval` so that it can fake a nonce-containing node |
| 122 |
// via an object. |
| 123 |
val = node[i] || (node.getAttribute && node.getAttribute(i)); |
| 124 |
if (val) { |
| 125 |
script.setAttribute(i, val); |
| 126 |
} |
| 127 |
} |
| 128 |
} |
| 129 |
doc.head.appendChild(script).parentNode.removeChild(script); |
| 130 |
} |
| 131 |
|
| 132 |
function toType(obj) { |
| 133 |
if (obj == null) { |
| 134 |
return obj + ""; |
| 135 |
} |
| 136 |
|
| 137 |
// Support: Android <=2.3 only (functionish RegExp) |
| 138 |
return typeof obj === "object" || typeof obj === "function" |
| 139 |
? class2type[toString.call(obj)] || "object" |
| 140 |
: typeof obj; |
| 141 |
} |
| 142 |
/* global Symbol */ |
| 143 |
// Defining this global in .eslintrc.json would create a danger of using the global |
| 144 |
// unguarded in another place, it seems safer to define global only for this module |
| 145 |
|
| 146 |
var version = "3.6.0", |
| 147 |
// Define a local copy of jQuery |
| 148 |
jQuery = function (selector, context) { |
| 149 |
// The jQuery object is actually just the init constructor 'enhanced' |
| 150 |
// Need init if jQuery is called (just allow error to be thrown if not included) |
| 151 |
return new jQuery.fn.init(selector, context); |
| 152 |
}; |
| 153 |
|
| 154 |
jQuery.fn = jQuery.prototype = { |
| 155 |
// The current version of jQuery being used |
| 156 |
jquery: version, |
| 157 |
|
| 158 |
constructor: jQuery, |
| 159 |
|
| 160 |
// The default length of a jQuery object is 0 |
| 161 |
length: 0, |
| 162 |
|
| 163 |
toArray: function () { |
| 164 |
return slice.call(this); |
| 165 |
}, |
| 166 |
|
| 167 |
// Get the Nth element in the matched element set OR |
| 168 |
// Get the whole matched element set as a clean array |
| 169 |
get: function (num) { |
| 170 |
// Return all the elements in a clean array |
| 171 |
if (num == null) { |
| 172 |
return slice.call(this); |
| 173 |
} |
| 174 |
|
| 175 |
// Return just the one element from the set |
| 176 |
return num < 0 ? this[num + this.length] : this[num]; |
| 177 |
}, |
| 178 |
|
| 179 |
// Take an array of elements and push it onto the stack |
| 180 |
// (returning the new matched element set) |
| 181 |
pushStack: function (elems) { |
| 182 |
// Build a new jQuery matched element set |
| 183 |
var ret = jQuery.merge(this.constructor(), elems); |
| 184 |
|
| 185 |
// Add the old object onto the stack (as a reference) |
| 186 |
ret.prevObject = this; |
| 187 |
|
| 188 |
// Return the newly-formed element set |
| 189 |
return ret; |
| 190 |
}, |
| 191 |
|
| 192 |
// Execute a callback for every element in the matched set. |
| 193 |
each: function (callback) { |
| 194 |
return jQuery.each(this, callback); |
| 195 |
}, |
| 196 |
|
| 197 |
map: function (callback) { |
| 198 |
return this.pushStack( |
| 199 |
jQuery.map(this, function (elem, i) { |
| 200 |
return callback.call(elem, i, elem); |
| 201 |
}) |
| 202 |
); |
| 203 |
}, |
| 204 |
|
| 205 |
slice: function () { |
| 206 |
return this.pushStack(slice.apply(this, arguments)); |
| 207 |
}, |
| 208 |
|
| 209 |
first: function () { |
| 210 |
return this.eq(0); |
| 211 |
}, |
| 212 |
|
| 213 |
last: function () { |
| 214 |
return this.eq(-1); |
| 215 |
}, |
| 216 |
|
| 217 |
even: function () { |
| 218 |
return this.pushStack( |
| 219 |
jQuery.grep(this, function (_elem, i) { |
| 220 |
return (i + 1) % 2; |
| 221 |
}) |
| 222 |
); |
| 223 |
}, |
| 224 |
|
| 225 |
odd: function () { |
| 226 |
return this.pushStack( |
| 227 |
jQuery.grep(this, function (_elem, i) { |
| 228 |
return i % 2; |
| 229 |
}) |
| 230 |
); |
| 231 |
}, |
| 232 |
|
| 233 |
eq: function (i) { |
| 234 |
var len = this.length, |
| 235 |
j = +i + (i < 0 ? len : 0); |
| 236 |
return this.pushStack(j >= 0 && j < len ? [this[j]] : []); |
| 237 |
}, |
| 238 |
|
| 239 |
end: function () { |
| 240 |
return this.prevObject || this.constructor(); |
| 241 |
}, |
| 242 |
|
| 243 |
// For internal use only. |
| 244 |
// Behaves like an Array's method, not like a jQuery method. |
| 245 |
push: push, |
| 246 |
sort: arr.sort, |
| 247 |
splice: arr.splice, |
| 248 |
}; |
| 249 |
|
| 250 |
jQuery.extend = jQuery.fn.extend = function () { |
| 251 |
var options, |
| 252 |
name, |
| 253 |
src, |
| 254 |
copy, |
| 255 |
copyIsArray, |
| 256 |
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 |
// Only deal with non-null/undefined values |
| 284 |
if ((options = arguments[i]) != null) { |
| 285 |
// Extend the base object |
| 286 |
for (name in options) { |
| 287 |
copy = options[name]; |
| 288 |
|
| 289 |
// Prevent Object.prototype pollution |
| 290 |
// Prevent never-ending loop |
| 291 |
if (name === "__proto__" || target === copy) { |
| 292 |
continue; |
| 293 |
} |
| 294 |
|
| 295 |
// Recurse if we're merging plain objects or arrays |
| 296 |
if ( |
| 297 |
deep && |
| 298 |
copy && |
| 299 |
(jQuery.isPlainObject(copy) || (copyIsArray = Array.isArray(copy))) |
| 300 |
) { |
| 301 |
src = target[name]; |
| 302 |
|
| 303 |
// Ensure proper type for the source value |
| 304 |
if (copyIsArray && !Array.isArray(src)) { |
| 305 |
clone = []; |
| 306 |
} else if (!copyIsArray && !jQuery.isPlainObject(src)) { |
| 307 |
clone = {}; |
| 308 |
} else { |
| 309 |
clone = src; |
| 310 |
} |
| 311 |
copyIsArray = false; |
| 312 |
|
| 313 |
// Never move original objects, clone them |
| 314 |
target[name] = jQuery.extend(deep, clone, copy); |
| 315 |
|
| 316 |
// Don't bring in undefined values |
| 317 |
} else if (copy !== undefined) { |
| 318 |
target[name] = copy; |
| 319 |
} |
| 320 |
} |
| 321 |
} |
| 322 |
} |
| 323 |
|
| 324 |
// Return the modified object |
| 325 |
return target; |
| 326 |
}; |
| 327 |
|
| 328 |
jQuery.extend({ |
| 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 ( |
| 360 |
typeof Ctor === "function" && |
| 361 |
fnToString.call(Ctor) === ObjectFunctionString |
| 362 |
); |
| 363 |
}, |
| 364 |
|
| 365 |
isEmptyObject: function (obj) { |
| 366 |
var name; |
| 367 |
|
| 368 |
for (name in obj) { |
| 369 |
return false; |
| 370 |
} |
| 371 |
return true; |
| 372 |
}, |
| 373 |
|
| 374 |
// Evaluates a script in a provided context; falls back to the global one |
| 375 |
// if not specified. |
| 376 |
globalEval: function (code, options, doc) { |
| 377 |
DOMEval(code, { nonce: options && options.nonce }, doc); |
| 378 |
}, |
| 379 |
|
| 380 |
each: function (obj, callback) { |
| 381 |
var length, |
| 382 |
i = 0; |
| 383 |
|
| 384 |
if (isArrayLike(obj)) { |
| 385 |
length = obj.length; |
| 386 |
for (; i < length; i++) { |
| 387 |
if (callback.call(obj[i], i, obj[i]) === false) { |
| 388 |
break; |
| 389 |
} |
| 390 |
} |
| 391 |
} else { |
| 392 |
for (i in obj) { |
| 393 |
if (callback.call(obj[i], i, obj[i]) === false) { |
| 394 |
break; |
| 395 |
} |
| 396 |
} |
| 397 |
} |
| 398 |
|
| 399 |
return obj; |
| 400 |
}, |
| 401 |
|
| 402 |
// results is for internal usage only |
| 403 |
makeArray: function (arr, results) { |
| 404 |
var ret = results || []; |
| 405 |
|
| 406 |
if (arr != null) { |
| 407 |
if (isArrayLike(Object(arr))) { |
| 408 |
jQuery.merge(ret, typeof arr === "string" ? [arr] : arr); |
| 409 |
} else { |
| 410 |
push.call(ret, arr); |
| 411 |
} |
| 412 |
} |
| 413 |
|
| 414 |
return ret; |
| 415 |
}, |
| 416 |
|
| 417 |
inArray: function (elem, arr, i) { |
| 418 |
return arr == null ? -1 : indexOf.call(arr, elem, i); |
| 419 |
}, |
| 420 |
|
| 421 |
// Support: Android <=4.0 only, PhantomJS 1 only |
| 422 |
// push.apply(_, arraylike) throws on ancient WebKit |
| 423 |
merge: function (first, second) { |
| 424 |
var len = +second.length, |
| 425 |
j = 0, |
| 426 |
i = first.length; |
| 427 |
|
| 428 |
for (; j < len; j++) { |
| 429 |
first[i++] = second[j]; |
| 430 |
} |
| 431 |
|
| 432 |
first.length = i; |
| 433 |
|
| 434 |
return first; |
| 435 |
}, |
| 436 |
|
| 437 |
grep: function (elems, callback, invert) { |
| 438 |
var callbackInverse, |
| 439 |
matches = [], |
| 440 |
i = 0, |
| 441 |
length = elems.length, |
| 442 |
callbackExpect = !invert; |
| 443 |
|
| 444 |
// Go through the array, only saving the items |
| 445 |
// that pass the validator function |
| 446 |
for (; i < length; i++) { |
| 447 |
callbackInverse = !callback(elems[i], i); |
| 448 |
if (callbackInverse !== callbackExpect) { |
| 449 |
matches.push(elems[i]); |
| 450 |
} |
| 451 |
} |
| 452 |
|
| 453 |
return matches; |
| 454 |
}, |
| 455 |
|
| 456 |
// arg is for internal usage only |
| 457 |
map: function (elems, callback, arg) { |
| 458 |
var length, |
| 459 |
value, |
| 460 |
i = 0, |
| 461 |
ret = []; |
| 462 |
|
| 463 |
// Go through the array, translating each of the items to their new values |
| 464 |
if (isArrayLike(elems)) { |
| 465 |
length = elems.length; |
| 466 |
for (; i < length; i++) { |
| 467 |
value = callback(elems[i], i, arg); |
| 468 |
|
| 469 |
if (value != null) { |
| 470 |
ret.push(value); |
| 471 |
} |
| 472 |
} |
| 473 |
|
| 474 |
// Go through every key on the object, |
| 475 |
} else { |
| 476 |
for (i in elems) { |
| 477 |
value = callback(elems[i], i, arg); |
| 478 |
|
| 479 |
if (value != null) { |
| 480 |
ret.push(value); |
| 481 |
} |
| 482 |
} |
| 483 |
} |
| 484 |
|
| 485 |
// Flatten any nested arrays |
| 486 |
return flat(ret); |
| 487 |
}, |
| 488 |
|
| 489 |
// A global GUID counter for objects |
| 490 |
guid: 1, |
| 491 |
|
| 492 |
// jQuery.support is not used in Core but other projects attach their |
| 493 |
// properties to it so it needs to exist. |
| 494 |
support: support, |
| 495 |
}); |
| 496 |
|
| 497 |
if (typeof Symbol === "function") { |
| 498 |
jQuery.fn[Symbol.iterator] = arr[Symbol.iterator]; |
| 499 |
} |
| 500 |
|
| 501 |
// Populate the class2type map |
| 502 |
jQuery.each( |
| 503 |
"Boolean Number String Function Array Date RegExp Object Error Symbol".split( |
| 504 |
" " |
| 505 |
), |
| 506 |
function (_i, name) { |
| 507 |
class2type["[object " + name + "]"] = name.toLowerCase(); |
| 508 |
} |
| 509 |
); |
| 510 |
|
| 511 |
function isArrayLike(obj) { |
| 512 |
// Support: real iOS 8.2 only (not reproducible in simulator) |
| 513 |
// `in` check used to prevent JIT error (gh-2145) |
| 514 |
// hasOwn isn't used here due to false negatives |
| 515 |
// regarding Nodelist length in IE |
| 516 |
var length = !!obj && "length" in obj && obj.length, |
| 517 |
type = toType(obj); |
| 518 |
|
| 519 |
if (isFunction(obj) || isWindow(obj)) { |
| 520 |
return false; |
| 521 |
} |
| 522 |
|
| 523 |
return ( |
| 524 |
type === "array" || |
| 525 |
length === 0 || |
| 526 |
(typeof length === "number" && length > 0 && length - 1 in obj) |
| 527 |
); |
| 528 |
} |
| 529 |
var Sizzle = |
| 530 |
/*! |
| 531 |
* Sizzle CSS Selector Engine v2.3.6 |
| 532 |
* https://sizzlejs.com/ |
| 533 |
* |
| 534 |
* Copyright JS Foundation and other contributors |
| 535 |
* Released under the MIT license |
| 536 |
* https://js.foundation/ |
| 537 |
* |
| 538 |
* Date: 2021-02-16 |
| 539 |
*/ |
| 540 |
(function (window) { |
| 541 |
var i, |
| 542 |
support, |
| 543 |
Expr, |
| 544 |
getText, |
| 545 |
isXML, |
| 546 |
tokenize, |
| 547 |
compile, |
| 548 |
select, |
| 549 |
outermostContext, |
| 550 |
sortInput, |
| 551 |
hasDuplicate, |
| 552 |
// Local document vars |
| 553 |
setDocument, |
| 554 |
document, |
| 555 |
docElem, |
| 556 |
documentIsHTML, |
| 557 |
rbuggyQSA, |
| 558 |
rbuggyMatches, |
| 559 |
matches, |
| 560 |
contains, |
| 561 |
// Instance-specific data |
| 562 |
expando = "sizzle" + 1 * new Date(), |
| 563 |
preferredDoc = window.document, |
| 564 |
dirruns = 0, |
| 565 |
done = 0, |
| 566 |
classCache = createCache(), |
| 567 |
tokenCache = createCache(), |
| 568 |
compilerCache = createCache(), |
| 569 |
nonnativeSelectorCache = createCache(), |
| 570 |
sortOrder = function (a, b) { |
| 571 |
if (a === b) { |
| 572 |
hasDuplicate = true; |
| 573 |
} |
| 574 |
return 0; |
| 575 |
}, |
| 576 |
// Instance methods |
| 577 |
hasOwn = {}.hasOwnProperty, |
| 578 |
arr = [], |
| 579 |
pop = arr.pop, |
| 580 |
pushNative = arr.push, |
| 581 |
push = arr.push, |
| 582 |
slice = arr.slice, |
| 583 |
// Use a stripped-down indexOf as it's faster than native |
| 584 |
// https://jsperf.com/thor-indexof-vs-for/5 |
| 585 |
indexOf = function (list, elem) { |
| 586 |
var i = 0, |
| 587 |
len = list.length; |
| 588 |
for (; i < len; i++) { |
| 589 |
if (list[i] === elem) { |
| 590 |
return i; |
| 591 |
} |
| 592 |
} |
| 593 |
return -1; |
| 594 |
}, |
| 595 |
booleans = |
| 596 |
"checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" + |
| 597 |
"ismap|loop|multiple|open|readonly|required|scoped", |
| 598 |
// Regular expressions |
| 599 |
|
| 600 |
// http://www.w3.org/TR/css3-selectors/#whitespace |
| 601 |
whitespace = "[\\x20\\t\\r\\n\\f]", |
| 602 |
// https://www.w3.org/TR/css-syntax-3/#ident-token-diagram |
| 603 |
identifier = |
| 604 |
"(?:\\\\[\\da-fA-F]{1,6}" + |
| 605 |
whitespace + |
| 606 |
"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", |
| 607 |
// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors |
| 608 |
attributes = |
| 609 |
"\\[" + |
| 610 |
whitespace + |
| 611 |
"*(" + |
| 612 |
identifier + |
| 613 |
")(?:" + |
| 614 |
whitespace + |
| 615 |
// Operator (capture 2) |
| 616 |
"*([*^$|!~]?=)" + |
| 617 |
whitespace + |
| 618 |
// "Attribute values must be CSS identifiers [capture 5] |
| 619 |
// or strings [capture 3 or capture 4]" |
| 620 |
"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + |
| 621 |
identifier + |
| 622 |
"))|)" + |
| 623 |
whitespace + |
| 624 |
"*\\]", |
| 625 |
pseudos = |
| 626 |
":(" + |
| 627 |
identifier + |
| 628 |
")(?:\\((" + |
| 629 |
// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: |
| 630 |
// 1. quoted (capture 3; capture 4 or capture 5) |
| 631 |
"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + |
| 632 |
// 2. simple (capture 6) |
| 633 |
"((?:\\\\.|[^\\\\()[\\]]|" + |
| 634 |
attributes + |
| 635 |
")*)|" + |
| 636 |
// 3. anything else (capture 2) |
| 637 |
".*" + |
| 638 |
")\\)|)", |
| 639 |
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter |
| 640 |
rwhitespace = new RegExp(whitespace + "+", "g"), |
| 641 |
rtrim = new RegExp( |
| 642 |
"^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", |
| 643 |
"g" |
| 644 |
), |
| 645 |
rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"), |
| 646 |
rcombinators = new RegExp( |
| 647 |
"^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" |
| 648 |
), |
| 649 |
rdescend = new RegExp(whitespace + "|>"), |
| 650 |
rpseudo = new RegExp(pseudos), |
| 651 |
ridentifier = new RegExp("^" + identifier + "$"), |
| 652 |
matchExpr = { |
| 653 |
ID: new RegExp("^#(" + identifier + ")"), |
| 654 |
CLASS: new RegExp("^\\.(" + identifier + ")"), |
| 655 |
TAG: new RegExp("^(" + identifier + "|[*])"), |
| 656 |
ATTR: new RegExp("^" + attributes), |
| 657 |
PSEUDO: new RegExp("^" + pseudos), |
| 658 |
CHILD: new RegExp( |
| 659 |
"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + |
| 660 |
whitespace + |
| 661 |
"*(even|odd|(([+-]|)(\\d*)n|)" + |
| 662 |
whitespace + |
| 663 |
"*(?:([+-]|)" + |
| 664 |
whitespace + |
| 665 |
"*(\\d+)|))" + |
| 666 |
whitespace + |
| 667 |
"*\\)|)", |
| 668 |
"i" |
| 669 |
), |
| 670 |
bool: new RegExp("^(?:" + booleans + ")$", "i"), |
| 671 |
|
| 672 |
// For use in libraries implementing .is() |
| 673 |
// We use this for POS matching in `select` |
| 674 |
needsContext: new RegExp( |
| 675 |
"^" + |
| 676 |
whitespace + |
| 677 |
"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + |
| 678 |
whitespace + |
| 679 |
"*((?:-\\d)?\\d*)" + |
| 680 |
whitespace + |
| 681 |
"*\\)|)(?=[^-]|$)", |
| 682 |
"i" |
| 683 |
), |
| 684 |
}, |
| 685 |
rhtml = /HTML$/i, |
| 686 |
rinputs = /^(?:input|select|textarea|button)$/i, |
| 687 |
rheader = /^h\d$/i, |
| 688 |
rnative = /^[^{]+\{\s*\[native \w/, |
| 689 |
// Easily-parseable/retrievable ID or TAG or CLASS selectors |
| 690 |
rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, |
| 691 |
rsibling = /[+~]/, |
| 692 |
// CSS escapes |
| 693 |
// http://www.w3.org/TR/CSS21/syndata.html#escaped-characters |
| 694 |
runescape = new RegExp( |
| 695 |
"\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", |
| 696 |
"g" |
| 697 |
), |
| 698 |
funescape = function (escape, nonHex) { |
| 699 |
var high = "0x" + escape.slice(1) - 0x10000; |
| 700 |
|
| 701 |
return nonHex |
| 702 |
? // Strip the backslash prefix from a non-hex escape sequence |
| 703 |
nonHex |
| 704 |
: // Replace a hexadecimal escape sequence with the encoded Unicode code point |
| 705 |
// Support: IE <=11+ |
| 706 |
// For values outside the Basic Multilingual Plane (BMP), manually construct a |
| 707 |
// surrogate pair |
| 708 |
high < 0 |
| 709 |
? String.fromCharCode(high + 0x10000) |
| 710 |
: String.fromCharCode( |
| 711 |
(high >> 10) | 0xd800, |
| 712 |
(high & 0x3ff) | 0xdc00 |
| 713 |
); |
| 714 |
}, |
| 715 |
// CSS string/identifier serialization |
| 716 |
// https://drafts.csswg.org/cssom/#common-serializing-idioms |
| 717 |
rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, |
| 718 |
fcssescape = function (ch, asCodePoint) { |
| 719 |
if (asCodePoint) { |
| 720 |
// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER |
| 721 |
if (ch === "\0") { |
| 722 |
return "\uFFFD"; |
| 723 |
} |
| 724 |
|
| 725 |
// Control characters and (dependent upon position) numbers get escaped as code points |
| 726 |
return ( |
| 727 |
ch.slice(0, -1) + |
| 728 |
"\\" + |
| 729 |
ch.charCodeAt(ch.length - 1).toString(16) + |
| 730 |
" " |
| 731 |
); |
| 732 |
} |
| 733 |
|
| 734 |
// Other potentially-special ASCII characters get backslash-escaped |
| 735 |
return "\\" + ch; |
| 736 |
}, |
| 737 |
// Used for iframes |
| 738 |
// See setDocument() |
| 739 |
// Removing the function wrapper causes a "Permission Denied" |
| 740 |
// error in IE |
| 741 |
unloadHandler = function () { |
| 742 |
setDocument(); |
| 743 |
}, |
| 744 |
inDisabledFieldset = addCombinator( |
| 745 |
function (elem) { |
| 746 |
return ( |
| 747 |
elem.disabled === true && |
| 748 |
elem.nodeName.toLowerCase() === "fieldset" |
| 749 |
); |
| 750 |
}, |
| 751 |
{ dir: "parentNode", next: "legend" } |
| 752 |
); |
| 753 |
|
| 754 |
// Optimize for push.apply( _, NodeList ) |
| 755 |
try { |
| 756 |
push.apply( |
| 757 |
(arr = slice.call(preferredDoc.childNodes)), |
| 758 |
preferredDoc.childNodes |
| 759 |
); |
| 760 |
|
| 761 |
// Support: Android<4.0 |
| 762 |
// Detect silently failing push.apply |
| 763 |
// eslint-disable-next-line no-unused-expressions |
| 764 |
arr[preferredDoc.childNodes.length].nodeType; |
| 765 |
} catch (e) { |
| 766 |
push = { |
| 767 |
apply: arr.length |
| 768 |
? // Leverage slice if possible |
| 769 |
function (target, els) { |
| 770 |
pushNative.apply(target, slice.call(els)); |
| 771 |
} |
| 772 |
: // Support: IE<9 |
| 773 |
// Otherwise append directly |
| 774 |
function (target, els) { |
| 775 |
var j = target.length, |
| 776 |
i = 0; |
| 777 |
|
| 778 |
// Can't trust NodeList.length |
| 779 |
while ((target[j++] = els[i++])) {} |
| 780 |
target.length = j - 1; |
| 781 |
}, |
| 782 |
}; |
| 783 |
} |
| 784 |
|
| 785 |
function Sizzle(selector, context, results, seed) { |
| 786 |
var m, |
| 787 |
i, |
| 788 |
elem, |
| 789 |
nid, |
| 790 |
match, |
| 791 |
groups, |
| 792 |
newSelector, |
| 793 |
newContext = context && context.ownerDocument, |
| 794 |
// nodeType defaults to 9, since context defaults to document |
| 795 |
nodeType = context ? context.nodeType : 9; |
| 796 |
|
| 797 |
results = results || []; |
| 798 |
|
| 799 |
// Return early from calls with invalid selector or context |
| 800 |
if ( |
| 801 |
typeof selector !== "string" || |
| 802 |
!selector || |
| 803 |
(nodeType !== 1 && nodeType !== 9 && nodeType !== 11) |
| 804 |
) { |
| 805 |
return results; |
| 806 |
} |
| 807 |
|
| 808 |
// Try to shortcut find operations (as opposed to filters) in HTML documents |
| 809 |
if (!seed) { |
| 810 |
setDocument(context); |
| 811 |
context = context || document; |
| 812 |
|
| 813 |
if (documentIsHTML) { |
| 814 |
// If the selector is sufficiently simple, try using a "get*By*" DOM method |
| 815 |
// (excepting DocumentFragment context, where the methods don't exist) |
| 816 |
if (nodeType !== 11 && (match = rquickExpr.exec(selector))) { |
| 817 |
// ID selector |
| 818 |
if ((m = match[1])) { |
| 819 |
// Document context |
| 820 |
if (nodeType === 9) { |
| 821 |
if ((elem = context.getElementById(m))) { |
| 822 |
// Support: IE, Opera, Webkit |
| 823 |
// TODO: identify versions |
| 824 |
// getElementById can match elements by name instead of ID |
| 825 |
if (elem.id === m) { |
| 826 |
results.push(elem); |
| 827 |
return results; |
| 828 |
} |
| 829 |
} else { |
| 830 |
return results; |
| 831 |
} |
| 832 |
|
| 833 |
// Element context |
| 834 |
} else { |
| 835 |
// Support: IE, Opera, Webkit |
| 836 |
// TODO: identify versions |
| 837 |
// getElementById can match elements by name instead of ID |
| 838 |
if ( |
| 839 |
newContext && |
| 840 |
(elem = newContext.getElementById(m)) && |
| 841 |
contains(context, elem) && |
| 842 |
elem.id === m |
| 843 |
) { |
| 844 |
results.push(elem); |
| 845 |
return results; |
| 846 |
} |
| 847 |
} |
| 848 |
|
| 849 |
// Type selector |
| 850 |
} else if (match[2]) { |
| 851 |
push.apply(results, context.getElementsByTagName(selector)); |
| 852 |
return results; |
| 853 |
|
| 854 |
// Class selector |
| 855 |
} else if ( |
| 856 |
(m = match[3]) && |
| 857 |
support.getElementsByClassName && |
| 858 |
context.getElementsByClassName |
| 859 |
) { |
| 860 |
push.apply(results, context.getElementsByClassName(m)); |
| 861 |
return results; |
| 862 |
} |
| 863 |
} |
| 864 |
|
| 865 |
// Take advantage of querySelectorAll |
| 866 |
if ( |
| 867 |
support.qsa && |
| 868 |
!nonnativeSelectorCache[selector + " "] && |
| 869 |
(!rbuggyQSA || !rbuggyQSA.test(selector)) && |
| 870 |
// Support: IE 8 only |
| 871 |
// Exclude object elements |
| 872 |
(nodeType !== 1 || context.nodeName.toLowerCase() !== "object") |
| 873 |
) { |
| 874 |
newSelector = selector; |
| 875 |
newContext = context; |
| 876 |
|
| 877 |
// qSA considers elements outside a scoping root when evaluating child or |
| 878 |
// descendant combinators, which is not what we want. |
| 879 |
// In such cases, we work around the behavior by prefixing every selector in the |
| 880 |
// list with an ID selector referencing the scope context. |
| 881 |
// The technique has to be used as well when a leading combinator is used |
| 882 |
// as such selectors are not recognized by querySelectorAll. |
| 883 |
// Thanks to Andrew Dupont for this technique. |
| 884 |
if ( |
| 885 |
nodeType === 1 && |
| 886 |
(rdescend.test(selector) || rcombinators.test(selector)) |
| 887 |
) { |
| 888 |
// Expand context for sibling selectors |
| 889 |
newContext = |
| 890 |
(rsibling.test(selector) && |
| 891 |
testContext(context.parentNode)) || |
| 892 |
context; |
| 893 |
|
| 894 |
// We can use :scope instead of the ID hack if the browser |
| 895 |
// supports it & if we're not changing the context. |
| 896 |
if (newContext !== context || !support.scope) { |
| 897 |
// Capture the context ID, setting it first if necessary |
| 898 |
if ((nid = context.getAttribute("id"))) { |
| 899 |
nid = nid.replace(rcssescape, fcssescape); |
| 900 |
} else { |
| 901 |
context.setAttribute("id", (nid = expando)); |
| 902 |
} |
| 903 |
} |
| 904 |
|
| 905 |
// Prefix every selector in the list |
| 906 |
groups = tokenize(selector); |
| 907 |
i = groups.length; |
| 908 |
while (i--) { |
| 909 |
groups[i] = |
| 910 |
(nid ? "#" + nid : ":scope") + " " + toSelector(groups[i]); |
| 911 |
} |
| 912 |
newSelector = groups.join(","); |
| 913 |
} |
| 914 |
|
| 915 |
try { |
| 916 |
push.apply(results, newContext.querySelectorAll(newSelector)); |
| 917 |
return results; |
| 918 |
} catch (qsaError) { |
| 919 |
nonnativeSelectorCache(selector, true); |
| 920 |
} finally { |
| 921 |
if (nid === expando) { |
| 922 |
context.removeAttribute("id"); |
| 923 |
} |
| 924 |
} |
| 925 |
} |
| 926 |
} |
| 927 |
} |
| 928 |
|
| 929 |
// All others |
| 930 |
return select(selector.replace(rtrim, "$1"), context, results, seed); |
| 931 |
} |
| 932 |
|
| 933 |
/** |
| 934 |
* Create key-value caches of limited size |
| 935 |
* @returns {function(string, object)} Returns the Object data after storing it on itself with |
| 936 |
* property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) |
| 937 |
* deleting the oldest entry |
| 938 |
*/ |
| 939 |
function createCache() { |
| 940 |
var keys = []; |
| 941 |
|
| 942 |
function cache(key, value) { |
| 943 |
// Use (key + " ") to avoid collision with native prototype properties (see Issue #157) |
| 944 |
if (keys.push(key + " ") > Expr.cacheLength) { |
| 945 |
// Only keep the most recent entries |
| 946 |
delete cache[keys.shift()]; |
| 947 |
} |
| 948 |
return (cache[key + " "] = value); |
| 949 |
} |
| 950 |
return cache; |
| 951 |
} |
| 952 |
|
| 953 |
/** |
| 954 |
* Mark a function for special use by Sizzle |
| 955 |
* @param {Function} fn The function to mark |
| 956 |
*/ |
| 957 |
function markFunction(fn) { |
| 958 |
fn[expando] = true; |
| 959 |
return fn; |
| 960 |
} |
| 961 |
|
| 962 |
/** |
| 963 |
* Support testing using an element |
| 964 |
* @param {Function} fn Passed the created element and returns a boolean result |
| 965 |
*/ |
| 966 |
function assert(fn) { |
| 967 |
var el = document.createElement("fieldset"); |
| 968 |
|
| 969 |
try { |
| 970 |
return !!fn(el); |
| 971 |
} catch (e) { |
| 972 |
return false; |
| 973 |
} finally { |
| 974 |
// Remove from its parent by default |
| 975 |
if (el.parentNode) { |
| 976 |
el.parentNode.removeChild(el); |
| 977 |
} |
| 978 |
|
| 979 |
// release memory in IE |
| 980 |
el = null; |
| 981 |
} |
| 982 |
} |
| 983 |
|
| 984 |
/** |
| 985 |
* Adds the same handler for all of the specified attrs |
| 986 |
* @param {String} attrs Pipe-separated list of attributes |
| 987 |
* @param {Function} handler The method that will be applied |
| 988 |
*/ |
| 989 |
function addHandle(attrs, handler) { |
| 990 |
var arr = attrs.split("|"), |
| 991 |
i = arr.length; |
| 992 |
|
| 993 |
while (i--) { |
| 994 |
Expr.attrHandle[arr[i]] = handler; |
| 995 |
} |
| 996 |
} |
| 997 |
|
| 998 |
/** |
| 999 |
* Checks document order of two siblings |
| 1000 |
* @param {Element} a |
| 1001 |
* @param {Element} b |
| 1002 |
* @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b |
| 1003 |
*/ |
| 1004 |
function siblingCheck(a, b) { |
| 1005 |
var cur = b && a, |
| 1006 |
diff = |
| 1007 |
cur && |
| 1008 |
a.nodeType === 1 && |
| 1009 |
b.nodeType === 1 && |
| 1010 |
a.sourceIndex - b.sourceIndex; |
| 1011 |
|
| 1012 |
// Use IE sourceIndex if available on both nodes |
| 1013 |
if (diff) { |
| 1014 |
return diff; |
| 1015 |
} |
| 1016 |
|
| 1017 |
// Check if b follows a |
| 1018 |
if (cur) { |
| 1019 |
while ((cur = cur.nextSibling)) { |
| 1020 |
if (cur === b) { |
| 1021 |
return -1; |
| 1022 |
} |
| 1023 |
} |
| 1024 |
} |
| 1025 |
|
| 1026 |
return a ? 1 : -1; |
| 1027 |
} |
| 1028 |
|
| 1029 |
/** |
| 1030 |
* Returns a function to use in pseudos for input types |
| 1031 |
* @param {String} type |
| 1032 |
*/ |
| 1033 |
function createInputPseudo(type) { |
| 1034 |
return function (elem) { |
| 1035 |
var name = elem.nodeName.toLowerCase(); |
| 1036 |
return name === "input" && elem.type === type; |
| 1037 |
}; |
| 1038 |
} |
| 1039 |
|
| 1040 |
/** |
| 1041 |
* Returns a function to use in pseudos for buttons |
| 1042 |
* @param {String} type |
| 1043 |
*/ |
| 1044 |
function createButtonPseudo(type) { |
| 1045 |
return function (elem) { |
| 1046 |
var name = elem.nodeName.toLowerCase(); |
| 1047 |
return (name === "input" || name === "button") && elem.type === type; |
| 1048 |
}; |
| 1049 |
} |
| 1050 |
|
| 1051 |
/** |
| 1052 |
* Returns a function to use in pseudos for :enabled/:disabled |
| 1053 |
* @param {Boolean} disabled true for :disabled; false for :enabled |
| 1054 |
*/ |
| 1055 |
function createDisabledPseudo(disabled) { |
| 1056 |
// Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable |
| 1057 |
return function (elem) { |
| 1058 |
// Only certain elements can match :enabled or :disabled |
| 1059 |
// https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled |
| 1060 |
// https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled |
| 1061 |
if ("form" in elem) { |
| 1062 |
// Check for inherited disabledness on relevant non-disabled elements: |
| 1063 |
// * listed form-associated elements in a disabled fieldset |
| 1064 |
// https://html.spec.whatwg.org/multipage/forms.html#category-listed |
| 1065 |
// https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled |
| 1066 |
// * option elements in a disabled optgroup |
| 1067 |
// https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled |
| 1068 |
// All such elements have a "form" property. |
| 1069 |
if (elem.parentNode && elem.disabled === false) { |
| 1070 |
// Option elements defer to a parent optgroup if present |
| 1071 |
if ("label" in elem) { |
| 1072 |
if ("label" in elem.parentNode) { |
| 1073 |
return elem.parentNode.disabled === disabled; |
| 1074 |
} else { |
| 1075 |
return elem.disabled === disabled; |
| 1076 |
} |
| 1077 |
} |
| 1078 |
|
| 1079 |
// Support: IE 6 - 11 |
| 1080 |
// Use the isDisabled shortcut property to check for disabled fieldset ancestors |
| 1081 |
return ( |
| 1082 |
elem.isDisabled === disabled || |
| 1083 |
// Where there is no isDisabled, check manually |
| 1084 |
/* jshint -W018 */ |
| 1085 |
(elem.isDisabled !== !disabled && |
| 1086 |
inDisabledFieldset(elem) === disabled) |
| 1087 |
); |
| 1088 |
} |
| 1089 |
|
| 1090 |
return elem.disabled === disabled; |
| 1091 |
|
| 1092 |
// Try to winnow out elements that can't be disabled before trusting the disabled property. |
| 1093 |
// Some victims get caught in our net (label, legend, menu, track), but it shouldn't |
| 1094 |
// even exist on them, let alone have a boolean value. |
| 1095 |
} else if ("label" in elem) { |
| 1096 |
return elem.disabled === disabled; |
| 1097 |
} |
| 1098 |
|
| 1099 |
// Remaining elements are neither :enabled nor :disabled |
| 1100 |
return false; |
| 1101 |
}; |
| 1102 |
} |
| 1103 |
|
| 1104 |
/** |
| 1105 |
* Returns a function to use in pseudos for positionals |
| 1106 |
* @param {Function} fn |
| 1107 |
*/ |
| 1108 |
function createPositionalPseudo(fn) { |
| 1109 |
return markFunction(function (argument) { |
| 1110 |
argument = +argument; |
| 1111 |
return markFunction(function (seed, matches) { |
| 1112 |
var j, |
| 1113 |
matchIndexes = fn([], seed.length, argument), |
| 1114 |
i = matchIndexes.length; |
| 1115 |
|
| 1116 |
// Match elements found at the specified indexes |
| 1117 |
while (i--) { |
| 1118 |
if (seed[(j = matchIndexes[i])]) { |
| 1119 |
seed[j] = !(matches[j] = seed[j]); |
| 1120 |
} |
| 1121 |
} |
| 1122 |
}); |
| 1123 |
}); |
| 1124 |
} |
| 1125 |
|
| 1126 |
/** |
| 1127 |
* Checks a node for validity as a Sizzle context |
| 1128 |
* @param {Element|Object=} context |
| 1129 |
* @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value |
| 1130 |
*/ |
| 1131 |
function testContext(context) { |
| 1132 |
return ( |
| 1133 |
context && |
| 1134 |
typeof context.getElementsByTagName !== "undefined" && |
| 1135 |
context |
| 1136 |
); |
| 1137 |
} |
| 1138 |
|
| 1139 |
// Expose support vars for convenience |
| 1140 |
support = Sizzle.support = {}; |
| 1141 |
|
| 1142 |
/** |
| 1143 |
* Detects XML nodes |
| 1144 |
* @param {Element|Object} elem An element or a document |
| 1145 |
* @returns {Boolean} True iff elem is a non-HTML XML node |
| 1146 |
*/ |
| 1147 |
isXML = Sizzle.isXML = function (elem) { |
| 1148 |
var namespace = elem && elem.namespaceURI, |
| 1149 |
docElem = elem && (elem.ownerDocument || elem).documentElement; |
| 1150 |
|
| 1151 |
// Support: IE <=8 |
| 1152 |
// Assume HTML when documentElement doesn't yet exist, such as inside loading iframes |
| 1153 |
// https://bugs.jquery.com/ticket/4833 |
| 1154 |
return !rhtml.test( |
| 1155 |
namespace || (docElem && docElem.nodeName) || "HTML" |
| 1156 |
); |
| 1157 |
}; |
| 1158 |
|
| 1159 |
/** |
| 1160 |
* Sets document-related variables once based on the current document |
| 1161 |
* @param {Element|Object} [doc] An element or document object to use to set the document |
| 1162 |
* @returns {Object} Returns the current document |
| 1163 |
*/ |
| 1164 |
setDocument = Sizzle.setDocument = function (node) { |
| 1165 |
var hasCompare, |
| 1166 |
subWindow, |
| 1167 |
doc = node ? node.ownerDocument || node : preferredDoc; |
| 1168 |
|
| 1169 |
// Return early if doc is invalid or already selected |
| 1170 |
// Support: IE 11+, Edge 17 - 18+ |
| 1171 |
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
| 1172 |
// two documents; shallow comparisons work. |
| 1173 |
// eslint-disable-next-line eqeqeq |
| 1174 |
if (doc == document || doc.nodeType !== 9 || !doc.documentElement) { |
| 1175 |
return document; |
| 1176 |
} |
| 1177 |
|
| 1178 |
// Update global variables |
| 1179 |
document = doc; |
| 1180 |
docElem = document.documentElement; |
| 1181 |
documentIsHTML = !isXML(document); |
| 1182 |
|
| 1183 |
// Support: IE 9 - 11+, Edge 12 - 18+ |
| 1184 |
// Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) |
| 1185 |
// Support: IE 11+, Edge 17 - 18+ |
| 1186 |
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
| 1187 |
// two documents; shallow comparisons work. |
| 1188 |
// eslint-disable-next-line eqeqeq |
| 1189 |
if ( |
| 1190 |
preferredDoc != document && |
| 1191 |
(subWindow = document.defaultView) && |
| 1192 |
subWindow.top !== subWindow |
| 1193 |
) { |
| 1194 |
// Support: IE 11, Edge |
| 1195 |
if (subWindow.addEventListener) { |
| 1196 |
subWindow.addEventListener("unload", unloadHandler, false); |
| 1197 |
|
| 1198 |
// Support: IE 9 - 10 only |
| 1199 |
} else if (subWindow.attachEvent) { |
| 1200 |
subWindow.attachEvent("onunload", unloadHandler); |
| 1201 |
} |
| 1202 |
} |
| 1203 |
|
| 1204 |
// Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only, |
| 1205 |
// Safari 4 - 5 only, Opera <=11.6 - 12.x only |
| 1206 |
// IE/Edge & older browsers don't support the :scope pseudo-class. |
| 1207 |
// Support: Safari 6.0 only |
| 1208 |
// Safari 6.0 supports :scope but it's an alias of :root there. |
| 1209 |
support.scope = assert(function (el) { |
| 1210 |
docElem.appendChild(el).appendChild(document.createElement("div")); |
| 1211 |
return ( |
| 1212 |
typeof el.querySelectorAll !== "undefined" && |
| 1213 |
!el.querySelectorAll(":scope fieldset div").length |
| 1214 |
); |
| 1215 |
}); |
| 1216 |
|
| 1217 |
/* Attributes |
| 1218 |
---------------------------------------------------------------------- */ |
| 1219 |
|
| 1220 |
// Support: IE<8 |
| 1221 |
// Verify that getAttribute really returns attributes and not properties |
| 1222 |
// (excepting IE8 booleans) |
| 1223 |
support.attributes = assert(function (el) { |
| 1224 |
el.className = "i"; |
| 1225 |
return !el.getAttribute("className"); |
| 1226 |
}); |
| 1227 |
|
| 1228 |
/* getElement(s)By* |
| 1229 |
---------------------------------------------------------------------- */ |
| 1230 |
|
| 1231 |
// Check if getElementsByTagName("*") returns only elements |
| 1232 |
support.getElementsByTagName = assert(function (el) { |
| 1233 |
el.appendChild(document.createComment("")); |
| 1234 |
return !el.getElementsByTagName("*").length; |
| 1235 |
}); |
| 1236 |
|
| 1237 |
// Support: IE<9 |
| 1238 |
support.getElementsByClassName = rnative.test( |
| 1239 |
document.getElementsByClassName |
| 1240 |
); |
| 1241 |
|
| 1242 |
// Support: IE<10 |
| 1243 |
// Check if getElementById returns elements by name |
| 1244 |
// The broken getElementById methods don't pick up programmatically-set names, |
| 1245 |
// so use a roundabout getElementsByName test |
| 1246 |
support.getById = assert(function (el) { |
| 1247 |
docElem.appendChild(el).id = expando; |
| 1248 |
return ( |
| 1249 |
!document.getElementsByName || |
| 1250 |
!document.getElementsByName(expando).length |
| 1251 |
); |
| 1252 |
}); |
| 1253 |
|
| 1254 |
// ID filter and find |
| 1255 |
if (support.getById) { |
| 1256 |
Expr.filter["ID"] = function (id) { |
| 1257 |
var attrId = id.replace(runescape, funescape); |
| 1258 |
return function (elem) { |
| 1259 |
return elem.getAttribute("id") === attrId; |
| 1260 |
}; |
| 1261 |
}; |
| 1262 |
Expr.find["ID"] = function (id, context) { |
| 1263 |
if ( |
| 1264 |
typeof context.getElementById !== "undefined" && |
| 1265 |
documentIsHTML |
| 1266 |
) { |
| 1267 |
var elem = context.getElementById(id); |
| 1268 |
return elem ? [elem] : []; |
| 1269 |
} |
| 1270 |
}; |
| 1271 |
} else { |
| 1272 |
Expr.filter["ID"] = function (id) { |
| 1273 |
var attrId = id.replace(runescape, funescape); |
| 1274 |
return function (elem) { |
| 1275 |
var node = |
| 1276 |
typeof elem.getAttributeNode !== "undefined" && |
| 1277 |
elem.getAttributeNode("id"); |
| 1278 |
return node && node.value === attrId; |
| 1279 |
}; |
| 1280 |
}; |
| 1281 |
|
| 1282 |
// Support: IE 6 - 7 only |
| 1283 |
// getElementById is not reliable as a find shortcut |
| 1284 |
Expr.find["ID"] = function (id, context) { |
| 1285 |
if ( |
| 1286 |
typeof context.getElementById !== "undefined" && |
| 1287 |
documentIsHTML |
| 1288 |
) { |
| 1289 |
var node, |
| 1290 |
i, |
| 1291 |
elems, |
| 1292 |
elem = context.getElementById(id); |
| 1293 |
|
| 1294 |
if (elem) { |
| 1295 |
// Verify the id attribute |
| 1296 |
node = elem.getAttributeNode("id"); |
| 1297 |
if (node && node.value === id) { |
| 1298 |
return [elem]; |
| 1299 |
} |
| 1300 |
|
| 1301 |
// Fall back on getElementsByName |
| 1302 |
elems = context.getElementsByName(id); |
| 1303 |
i = 0; |
| 1304 |
while ((elem = elems[i++])) { |
| 1305 |
node = elem.getAttributeNode("id"); |
| 1306 |
if (node && node.value === id) { |
| 1307 |
return [elem]; |
| 1308 |
} |
| 1309 |
} |
| 1310 |
} |
| 1311 |
|
| 1312 |
return []; |
| 1313 |
} |
| 1314 |
}; |
| 1315 |
} |
| 1316 |
|
| 1317 |
// Tag |
| 1318 |
Expr.find["TAG"] = support.getElementsByTagName |
| 1319 |
? function (tag, context) { |
| 1320 |
if (typeof context.getElementsByTagName !== "undefined") { |
| 1321 |
return context.getElementsByTagName(tag); |
| 1322 |
|
| 1323 |
// DocumentFragment nodes don't have gEBTN |
| 1324 |
} else if (support.qsa) { |
| 1325 |
return context.querySelectorAll(tag); |
| 1326 |
} |
| 1327 |
} |
| 1328 |
: function (tag, context) { |
| 1329 |
var elem, |
| 1330 |
tmp = [], |
| 1331 |
i = 0, |
| 1332 |
// By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too |
| 1333 |
results = context.getElementsByTagName(tag); |
| 1334 |
|
| 1335 |
// Filter out possible comments |
| 1336 |
if (tag === "*") { |
| 1337 |
while ((elem = results[i++])) { |
| 1338 |
if (elem.nodeType === 1) { |
| 1339 |
tmp.push(elem); |
| 1340 |
} |
| 1341 |
} |
| 1342 |
|
| 1343 |
return tmp; |
| 1344 |
} |
| 1345 |
return results; |
| 1346 |
}; |
| 1347 |
|
| 1348 |
// Class |
| 1349 |
Expr.find["CLASS"] = |
| 1350 |
support.getElementsByClassName && |
| 1351 |
function (className, context) { |
| 1352 |
if ( |
| 1353 |
typeof context.getElementsByClassName !== "undefined" && |
| 1354 |
documentIsHTML |
| 1355 |
) { |
| 1356 |
return context.getElementsByClassName(className); |
| 1357 |
} |
| 1358 |
}; |
| 1359 |
|
| 1360 |
/* QSA/matchesSelector |
| 1361 |
---------------------------------------------------------------------- */ |
| 1362 |
|
| 1363 |
// QSA and matchesSelector support |
| 1364 |
|
| 1365 |
// matchesSelector(:active) reports false when true (IE9/Opera 11.5) |
| 1366 |
rbuggyMatches = []; |
| 1367 |
|
| 1368 |
// qSa(:focus) reports false when true (Chrome 21) |
| 1369 |
// We allow this because of a bug in IE8/9 that throws an error |
| 1370 |
// whenever `document.activeElement` is accessed on an iframe |
| 1371 |
// So, we allow :focus to pass through QSA all the time to avoid the IE error |
| 1372 |
// See https://bugs.jquery.com/ticket/13378 |
| 1373 |
rbuggyQSA = []; |
| 1374 |
|
| 1375 |
if ((support.qsa = rnative.test(document.querySelectorAll))) { |
| 1376 |
// Build QSA regex |
| 1377 |
// Regex strategy adopted from Diego Perini |
| 1378 |
assert(function (el) { |
| 1379 |
var input; |
| 1380 |
|
| 1381 |
// Select is set to empty string on purpose |
| 1382 |
// This is to test IE's treatment of not explicitly |
| 1383 |
// setting a boolean content attribute, |
| 1384 |
// since its presence should be enough |
| 1385 |
// https://bugs.jquery.com/ticket/12359 |
| 1386 |
docElem.appendChild(el).innerHTML = |
| 1387 |
"<a id='" + |
| 1388 |
expando + |
| 1389 |
"'></a>" + |
| 1390 |
"<select id='" + |
| 1391 |
expando + |
| 1392 |
"-\r\\' msallowcapture=''>" + |
| 1393 |
"<option selected=''></option></select>"; |
| 1394 |
|
| 1395 |
// Support: IE8, Opera 11-12.16 |
| 1396 |
// Nothing should be selected when empty strings follow ^= or $= or *= |
| 1397 |
// The test attribute must be unknown in Opera but "safe" for WinRT |
| 1398 |
// https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section |
| 1399 |
if (el.querySelectorAll("[msallowcapture^='']").length) { |
| 1400 |
rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")"); |
| 1401 |
} |
| 1402 |
|
| 1403 |
// Support: IE8 |
| 1404 |
// Boolean attributes and "value" are not treated correctly |
| 1405 |
if (!el.querySelectorAll("[selected]").length) { |
| 1406 |
rbuggyQSA.push( |
| 1407 |
"\\[" + whitespace + "*(?:value|" + booleans + ")" |
| 1408 |
); |
| 1409 |
} |
| 1410 |
|
| 1411 |
// Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ |
| 1412 |
if (!el.querySelectorAll("[id~=" + expando + "-]").length) { |
| 1413 |
rbuggyQSA.push("~="); |
| 1414 |
} |
| 1415 |
|
| 1416 |
// Support: IE 11+, Edge 15 - 18+ |
| 1417 |
// IE 11/Edge don't find elements on a `[name='']` query in some cases. |
| 1418 |
// Adding a temporary attribute to the document before the selection works |
| 1419 |
// around the issue. |
| 1420 |
// Interestingly, IE 10 & older don't seem to have the issue. |
| 1421 |
input = document.createElement("input"); |
| 1422 |
input.setAttribute("name", ""); |
| 1423 |
el.appendChild(input); |
| 1424 |
if (!el.querySelectorAll("[name='']").length) { |
| 1425 |
rbuggyQSA.push( |
| 1426 |
"\\[" + |
| 1427 |
whitespace + |
| 1428 |
"*name" + |
| 1429 |
whitespace + |
| 1430 |
"*=" + |
| 1431 |
whitespace + |
| 1432 |
"*(?:''|\"\")" |
| 1433 |
); |
| 1434 |
} |
| 1435 |
|
| 1436 |
// Webkit/Opera - :checked should return selected option elements |
| 1437 |
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked |
| 1438 |
// IE8 throws error here and will not see later tests |
| 1439 |
if (!el.querySelectorAll(":checked").length) { |
| 1440 |
rbuggyQSA.push(":checked"); |
| 1441 |
} |
| 1442 |
|
| 1443 |
// Support: Safari 8+, iOS 8+ |
| 1444 |
// https://bugs.webkit.org/show_bug.cgi?id=136851 |
| 1445 |
// In-page `selector#id sibling-combinator selector` fails |
| 1446 |
if (!el.querySelectorAll("a#" + expando + "+*").length) { |
| 1447 |
rbuggyQSA.push(".#.+[+~]"); |
| 1448 |
} |
| 1449 |
|
| 1450 |
// Support: Firefox <=3.6 - 5 only |
| 1451 |
// Old Firefox doesn't throw on a badly-escaped identifier. |
| 1452 |
el.querySelectorAll("\\\f"); |
| 1453 |
rbuggyQSA.push("[\\r\\n\\f]"); |
| 1454 |
}); |
| 1455 |
|
| 1456 |
assert(function (el) { |
| 1457 |
el.innerHTML = |
| 1458 |
"<a href='' disabled='disabled'></a>" + |
| 1459 |
"<select disabled='disabled'><option/></select>"; |
| 1460 |
|
| 1461 |
// Support: Windows 8 Native Apps |
| 1462 |
// The type and name attributes are restricted during .innerHTML assignment |
| 1463 |
var input = document.createElement("input"); |
| 1464 |
input.setAttribute("type", "hidden"); |
| 1465 |
el.appendChild(input).setAttribute("name", "D"); |
| 1466 |
|
| 1467 |
// Support: IE8 |
| 1468 |
// Enforce case-sensitivity of name attribute |
| 1469 |
if (el.querySelectorAll("[name=d]").length) { |
| 1470 |
rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?="); |
| 1471 |
} |
| 1472 |
|
| 1473 |
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) |
| 1474 |
// IE8 throws error here and will not see later tests |
| 1475 |
if (el.querySelectorAll(":enabled").length !== 2) { |
| 1476 |
rbuggyQSA.push(":enabled", ":disabled"); |
| 1477 |
} |
| 1478 |
|
| 1479 |
// Support: IE9-11+ |
| 1480 |
// IE's :disabled selector does not pick up the children of disabled fieldsets |
| 1481 |
docElem.appendChild(el).disabled = true; |
| 1482 |
if (el.querySelectorAll(":disabled").length !== 2) { |
| 1483 |
rbuggyQSA.push(":enabled", ":disabled"); |
| 1484 |
} |
| 1485 |
|
| 1486 |
// Support: Opera 10 - 11 only |
| 1487 |
// Opera 10-11 does not throw on post-comma invalid pseudos |
| 1488 |
el.querySelectorAll("*,:x"); |
| 1489 |
rbuggyQSA.push(",.*:"); |
| 1490 |
}); |
| 1491 |
} |
| 1492 |
|
| 1493 |
if ( |
| 1494 |
(support.matchesSelector = rnative.test( |
| 1495 |
(matches = |
| 1496 |
docElem.matches || |
| 1497 |
docElem.webkitMatchesSelector || |
| 1498 |
docElem.mozMatchesSelector || |
| 1499 |
docElem.oMatchesSelector || |
| 1500 |
docElem.msMatchesSelector) |
| 1501 |
)) |
| 1502 |
) { |
| 1503 |
assert(function (el) { |
| 1504 |
// Check to see if it's possible to do matchesSelector |
| 1505 |
// on a disconnected node (IE 9) |
| 1506 |
support.disconnectedMatch = matches.call(el, "*"); |
| 1507 |
|
| 1508 |
// This should fail with an exception |
| 1509 |
// Gecko does not error, returns false instead |
| 1510 |
matches.call(el, "[s!='']:x"); |
| 1511 |
rbuggyMatches.push("!=", pseudos); |
| 1512 |
}); |
| 1513 |
} |
| 1514 |
|
| 1515 |
rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|")); |
| 1516 |
rbuggyMatches = |
| 1517 |
rbuggyMatches.length && new RegExp(rbuggyMatches.join("|")); |
| 1518 |
|
| 1519 |
/* Contains |
| 1520 |
---------------------------------------------------------------------- */ |
| 1521 |
hasCompare = rnative.test(docElem.compareDocumentPosition); |
| 1522 |
|
| 1523 |
// Element contains another |
| 1524 |
// Purposefully self-exclusive |
| 1525 |
// As in, an element does not contain itself |
| 1526 |
contains = |
| 1527 |
hasCompare || rnative.test(docElem.contains) |
| 1528 |
? function (a, b) { |
| 1529 |
var adown = a.nodeType === 9 ? a.documentElement : a, |
| 1530 |
bup = b && b.parentNode; |
| 1531 |
return ( |
| 1532 |
a === bup || |
| 1533 |
!!( |
| 1534 |
bup && |
| 1535 |
bup.nodeType === 1 && |
| 1536 |
(adown.contains |
| 1537 |
? adown.contains(bup) |
| 1538 |
: a.compareDocumentPosition && |
| 1539 |
a.compareDocumentPosition(bup) & 16) |
| 1540 |
) |
| 1541 |
); |
| 1542 |
} |
| 1543 |
: function (a, b) { |
| 1544 |
if (b) { |
| 1545 |
while ((b = b.parentNode)) { |
| 1546 |
if (b === a) { |
| 1547 |
return true; |
| 1548 |
} |
| 1549 |
} |
| 1550 |
} |
| 1551 |
return false; |
| 1552 |
}; |
| 1553 |
|
| 1554 |
/* Sorting |
| 1555 |
---------------------------------------------------------------------- */ |
| 1556 |
|
| 1557 |
// Document order sorting |
| 1558 |
sortOrder = hasCompare |
| 1559 |
? function (a, b) { |
| 1560 |
// Flag for duplicate removal |
| 1561 |
if (a === b) { |
| 1562 |
hasDuplicate = true; |
| 1563 |
return 0; |
| 1564 |
} |
| 1565 |
|
| 1566 |
// Sort on method existence if only one input has compareDocumentPosition |
| 1567 |
var compare = |
| 1568 |
!a.compareDocumentPosition - !b.compareDocumentPosition; |
| 1569 |
if (compare) { |
| 1570 |
return compare; |
| 1571 |
} |
| 1572 |
|
| 1573 |
// Calculate position if both inputs belong to the same document |
| 1574 |
// Support: IE 11+, Edge 17 - 18+ |
| 1575 |
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
| 1576 |
// two documents; shallow comparisons work. |
| 1577 |
// eslint-disable-next-line eqeqeq |
| 1578 |
compare = |
| 1579 |
(a.ownerDocument || a) == (b.ownerDocument || b) |
| 1580 |
? a.compareDocumentPosition(b) |
| 1581 |
: // Otherwise we know they are disconnected |
| 1582 |
1; |
| 1583 |
|
| 1584 |
// Disconnected nodes |
| 1585 |
if ( |
| 1586 |
compare & 1 || |
| 1587 |
(!support.sortDetached && |
| 1588 |
b.compareDocumentPosition(a) === compare) |
| 1589 |
) { |
| 1590 |
// Choose the first element that is related to our preferred document |
| 1591 |
// Support: IE 11+, Edge 17 - 18+ |
| 1592 |
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
| 1593 |
// two documents; shallow comparisons work. |
| 1594 |
// eslint-disable-next-line eqeqeq |
| 1595 |
if ( |
| 1596 |
a == document || |
| 1597 |
(a.ownerDocument == preferredDoc && contains(preferredDoc, a)) |
| 1598 |
) { |
| 1599 |
return -1; |
| 1600 |
} |
| 1601 |
|
| 1602 |
// Support: IE 11+, Edge 17 - 18+ |
| 1603 |
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
| 1604 |
// two documents; shallow comparisons work. |
| 1605 |
// eslint-disable-next-line eqeqeq |
| 1606 |
if ( |
| 1607 |
b == document || |
| 1608 |
(b.ownerDocument == preferredDoc && contains(preferredDoc, b)) |
| 1609 |
) { |
| 1610 |
return 1; |
| 1611 |
} |
| 1612 |
|
| 1613 |
// Maintain original order |
| 1614 |
return sortInput |
| 1615 |
? indexOf(sortInput, a) - indexOf(sortInput, b) |
| 1616 |
: 0; |
| 1617 |
} |
| 1618 |
|
| 1619 |
return compare & 4 ? -1 : 1; |
| 1620 |
} |
| 1621 |
: function (a, b) { |
| 1622 |
// Exit early if the nodes are identical |
| 1623 |
if (a === b) { |
| 1624 |
hasDuplicate = true; |
| 1625 |
return 0; |
| 1626 |
} |
| 1627 |
|
| 1628 |
var cur, |
| 1629 |
i = 0, |
| 1630 |
aup = a.parentNode, |
| 1631 |
bup = b.parentNode, |
| 1632 |
ap = [a], |
| 1633 |
bp = [b]; |
| 1634 |
|
| 1635 |
// Parentless nodes are either documents or disconnected |
| 1636 |
if (!aup || !bup) { |
| 1637 |
// Support: IE 11+, Edge 17 - 18+ |
| 1638 |
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
| 1639 |
// two documents; shallow comparisons work. |
| 1640 |
/* eslint-disable eqeqeq */ |
| 1641 |
return a == document |
| 1642 |
? -1 |
| 1643 |
: b == document |
| 1644 |
? 1 |
| 1645 |
: /* eslint-enable eqeqeq */ |
| 1646 |
aup |
| 1647 |
? -1 |
| 1648 |
: bup |
| 1649 |
? 1 |
| 1650 |
: sortInput |
| 1651 |
? indexOf(sortInput, a) - indexOf(sortInput, b) |
| 1652 |
: 0; |
| 1653 |
|
| 1654 |
// If the nodes are siblings, we can do a quick check |
| 1655 |
} else if (aup === bup) { |
| 1656 |
return siblingCheck(a, b); |
| 1657 |
} |
| 1658 |
|
| 1659 |
// Otherwise we need full lists of their ancestors for comparison |
| 1660 |
cur = a; |
| 1661 |
while ((cur = cur.parentNode)) { |
| 1662 |
ap.unshift(cur); |
| 1663 |
} |
| 1664 |
cur = b; |
| 1665 |
while ((cur = cur.parentNode)) { |
| 1666 |
bp.unshift(cur); |
| 1667 |
} |
| 1668 |
|
| 1669 |
// Walk down the tree looking for a discrepancy |
| 1670 |
while (ap[i] === bp[i]) { |
| 1671 |
i++; |
| 1672 |
} |
| 1673 |
|
| 1674 |
return i |
| 1675 |
? // Do a sibling check if the nodes have a common ancestor |
| 1676 |
siblingCheck(ap[i], bp[i]) |
| 1677 |
: // Otherwise nodes in our document sort first |
| 1678 |
// Support: IE 11+, Edge 17 - 18+ |
| 1679 |
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
| 1680 |
// two documents; shallow comparisons work. |
| 1681 |
/* eslint-disable eqeqeq */ |
| 1682 |
ap[i] == preferredDoc |
| 1683 |
? -1 |
| 1684 |
: bp[i] == preferredDoc |
| 1685 |
? 1 |
| 1686 |
: /* eslint-enable eqeqeq */ |
| 1687 |
0; |
| 1688 |
}; |
| 1689 |
|
| 1690 |
return document; |
| 1691 |
}; |
| 1692 |
|
| 1693 |
Sizzle.matches = function (expr, elements) { |
| 1694 |
return Sizzle(expr, null, null, elements); |
| 1695 |
}; |
| 1696 |
|
| 1697 |
Sizzle.matchesSelector = function (elem, expr) { |
| 1698 |
setDocument(elem); |
| 1699 |
|
| 1700 |
if ( |
| 1701 |
support.matchesSelector && |
| 1702 |
documentIsHTML && |
| 1703 |
!nonnativeSelectorCache[expr + " "] && |
| 1704 |
(!rbuggyMatches || !rbuggyMatches.test(expr)) && |
| 1705 |
(!rbuggyQSA || !rbuggyQSA.test(expr)) |
| 1706 |
) { |
| 1707 |
try { |
| 1708 |
var ret = matches.call(elem, expr); |
| 1709 |
|
| 1710 |
// IE 9's matchesSelector returns false on disconnected nodes |
| 1711 |
if ( |
| 1712 |
ret || |
| 1713 |
support.disconnectedMatch || |
| 1714 |
// As well, disconnected nodes are said to be in a document |
| 1715 |
// fragment in IE 9 |
| 1716 |
(elem.document && elem.document.nodeType !== 11) |
| 1717 |
) { |
| 1718 |
return ret; |
| 1719 |
} |
| 1720 |
} catch (e) { |
| 1721 |
nonnativeSelectorCache(expr, true); |
| 1722 |
} |
| 1723 |
} |
| 1724 |
|
| 1725 |
return Sizzle(expr, document, null, [elem]).length > 0; |
| 1726 |
}; |
| 1727 |
|
| 1728 |
Sizzle.contains = function (context, elem) { |
| 1729 |
// Set document vars if needed |
| 1730 |
// Support: IE 11+, Edge 17 - 18+ |
| 1731 |
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
| 1732 |
// two documents; shallow comparisons work. |
| 1733 |
// eslint-disable-next-line eqeqeq |
| 1734 |
if ((context.ownerDocument || context) != document) { |
| 1735 |
setDocument(context); |
| 1736 |
} |
| 1737 |
return contains(context, elem); |
| 1738 |
}; |
| 1739 |
|
| 1740 |
Sizzle.attr = function (elem, name) { |
| 1741 |
// Set document vars if needed |
| 1742 |
// Support: IE 11+, Edge 17 - 18+ |
| 1743 |
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
| 1744 |
// two documents; shallow comparisons work. |
| 1745 |
// eslint-disable-next-line eqeqeq |
| 1746 |
if ((elem.ownerDocument || elem) != document) { |
| 1747 |
setDocument(elem); |
| 1748 |
} |
| 1749 |
|
| 1750 |
var fn = Expr.attrHandle[name.toLowerCase()], |
| 1751 |
// Don't get fooled by Object.prototype properties (jQuery #13807) |
| 1752 |
val = |
| 1753 |
fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) |
| 1754 |
? fn(elem, name, !documentIsHTML) |
| 1755 |
: undefined; |
| 1756 |
|
| 1757 |
return val !== undefined |
| 1758 |
? val |
| 1759 |
: support.attributes || !documentIsHTML |
| 1760 |
? elem.getAttribute(name) |
| 1761 |
: (val = elem.getAttributeNode(name)) && val.specified |
| 1762 |
? val.value |
| 1763 |
: null; |
| 1764 |
}; |
| 1765 |
|
| 1766 |
Sizzle.escape = function (sel) { |
| 1767 |
return (sel + "").replace(rcssescape, fcssescape); |
| 1768 |
}; |
| 1769 |
|
| 1770 |
Sizzle.error = function (msg) { |
| 1771 |
throw new Error("Syntax error, unrecognized expression: " + msg); |
| 1772 |
}; |
| 1773 |
|
| 1774 |
/** |
| 1775 |
* Document sorting and removing duplicates |
| 1776 |
* @param {ArrayLike} results |
| 1777 |
*/ |
| 1778 |
Sizzle.uniqueSort = function (results) { |
| 1779 |
var elem, |
| 1780 |
duplicates = [], |
| 1781 |
j = 0, |
| 1782 |
i = 0; |
| 1783 |
|
| 1784 |
// Unless we *know* we can detect duplicates, assume their presence |
| 1785 |
hasDuplicate = !support.detectDuplicates; |
| 1786 |
sortInput = !support.sortStable && results.slice(0); |
| 1787 |
results.sort(sortOrder); |
| 1788 |
|
| 1789 |
if (hasDuplicate) { |
| 1790 |
while ((elem = results[i++])) { |
| 1791 |
if (elem === results[i]) { |
| 1792 |
j = duplicates.push(i); |
| 1793 |
} |
| 1794 |
} |
| 1795 |
while (j--) { |
| 1796 |
results.splice(duplicates[j], 1); |
| 1797 |
} |
| 1798 |
} |
| 1799 |
|
| 1800 |
// Clear input after sorting to release objects |
| 1801 |
// See https://github.com/jquery/sizzle/pull/225 |
| 1802 |
sortInput = null; |
| 1803 |
|
| 1804 |
return results; |
| 1805 |
}; |
| 1806 |
|
| 1807 |
/** |
| 1808 |
* Utility function for retrieving the text value of an array of DOM nodes |
| 1809 |
* @param {Array|Element} elem |
| 1810 |
*/ |
| 1811 |
getText = Sizzle.getText = function (elem) { |
| 1812 |
var node, |
| 1813 |
ret = "", |
| 1814 |
i = 0, |
| 1815 |
nodeType = elem.nodeType; |
| 1816 |
|
| 1817 |
if (!nodeType) { |
| 1818 |
// If no nodeType, this is expected to be an array |
| 1819 |
while ((node = elem[i++])) { |
| 1820 |
// Do not traverse comment nodes |
| 1821 |
ret += getText(node); |
| 1822 |
} |
| 1823 |
} else if (nodeType === 1 || nodeType === 9 || nodeType === 11) { |
| 1824 |
// Use textContent for elements |
| 1825 |
// innerText usage removed for consistency of new lines (jQuery #11153) |
| 1826 |
if (typeof elem.textContent === "string") { |
| 1827 |
return elem.textContent; |
| 1828 |
} else { |
| 1829 |
// Traverse its children |
| 1830 |
for (elem = elem.firstChild; elem; elem = elem.nextSibling) { |
| 1831 |
ret += getText(elem); |
| 1832 |
} |
| 1833 |
} |
| 1834 |
} else if (nodeType === 3 || nodeType === 4) { |
| 1835 |
return elem.nodeValue; |
| 1836 |
} |
| 1837 |
|
| 1838 |
// Do not include comment or processing instruction nodes |
| 1839 |
|
| 1840 |
return ret; |
| 1841 |
}; |
| 1842 |
|
| 1843 |
Expr = Sizzle.selectors = { |
| 1844 |
// Can be adjusted by the user |
| 1845 |
cacheLength: 50, |
| 1846 |
|
| 1847 |
createPseudo: markFunction, |
| 1848 |
|
| 1849 |
match: matchExpr, |
| 1850 |
|
| 1851 |
attrHandle: {}, |
| 1852 |
|
| 1853 |
find: {}, |
| 1854 |
|
| 1855 |
relative: { |
| 1856 |
">": { dir: "parentNode", first: true }, |
| 1857 |
" ": { dir: "parentNode" }, |
| 1858 |
"+": { dir: "previousSibling", first: true }, |
| 1859 |
"~": { dir: "previousSibling" }, |
| 1860 |
}, |
| 1861 |
|
| 1862 |
preFilter: { |
| 1863 |
ATTR: function (match) { |
| 1864 |
match[1] = match[1].replace(runescape, funescape); |
| 1865 |
|
| 1866 |
// Move the given value to match[3] whether quoted or unquoted |
| 1867 |
match[3] = (match[3] || match[4] || match[5] || "").replace( |
| 1868 |
runescape, |
| 1869 |
funescape |
| 1870 |
); |
| 1871 |
|
| 1872 |
if (match[2] === "~=") { |
| 1873 |
match[3] = " " + match[3] + " "; |
| 1874 |
} |
| 1875 |
|
| 1876 |
return match.slice(0, 4); |
| 1877 |
}, |
| 1878 |
|
| 1879 |
CHILD: function (match) { |
| 1880 |
/* matches from matchExpr["CHILD"] |
| 1881 |
1 type (only|nth|...) |
| 1882 |
2 what (child|of-type) |
| 1883 |
3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) |
| 1884 |
4 xn-component of xn+y argument ([+-]?\d*n|) |
| 1885 |
5 sign of xn-component |
| 1886 |
6 x of xn-component |
| 1887 |
7 sign of y-component |
| 1888 |
8 y of y-component |
| 1889 |
*/ |
| 1890 |
match[1] = match[1].toLowerCase(); |
| 1891 |
|
| 1892 |
if (match[1].slice(0, 3) === "nth") { |
| 1893 |
// nth-* requires argument |
| 1894 |
if (!match[3]) { |
| 1895 |
Sizzle.error(match[0]); |
| 1896 |
} |
| 1897 |
|
| 1898 |
// numeric x and y parameters for Expr.filter.CHILD |
| 1899 |
// remember that false/true cast respectively to 0/1 |
| 1900 |
match[4] = +(match[4] |
| 1901 |
? match[5] + (match[6] || 1) |
| 1902 |
: 2 * (match[3] === "even" || match[3] === "odd")); |
| 1903 |
match[5] = +(match[7] + match[8] || match[3] === "odd"); |
| 1904 |
|
| 1905 |
// other types prohibit arguments |
| 1906 |
} else if (match[3]) { |
| 1907 |
Sizzle.error(match[0]); |
| 1908 |
} |
| 1909 |
|
| 1910 |
return match; |
| 1911 |
}, |
| 1912 |
|
| 1913 |
PSEUDO: function (match) { |
| 1914 |
var excess, |
| 1915 |
unquoted = !match[6] && match[2]; |
| 1916 |
|
| 1917 |
if (matchExpr["CHILD"].test(match[0])) { |
| 1918 |
return null; |
| 1919 |
} |
| 1920 |
|
| 1921 |
// Accept quoted arguments as-is |
| 1922 |
if (match[3]) { |
| 1923 |
match[2] = match[4] || match[5] || ""; |
| 1924 |
|
| 1925 |
// Strip excess characters from unquoted arguments |
| 1926 |
} else if ( |
| 1927 |
unquoted && |
| 1928 |
rpseudo.test(unquoted) && |
| 1929 |
// Get excess from tokenize (recursively) |
| 1930 |
(excess = tokenize(unquoted, true)) && |
| 1931 |
// advance to the next closing parenthesis |
| 1932 |
(excess = |
| 1933 |
unquoted.indexOf(")", unquoted.length - excess) - |
| 1934 |
unquoted.length) |
| 1935 |
) { |
| 1936 |
// excess is a negative index |
| 1937 |
match[0] = match[0].slice(0, excess); |
| 1938 |
match[2] = unquoted.slice(0, excess); |
| 1939 |
} |
| 1940 |
|
| 1941 |
// Return only captures needed by the pseudo filter method (type and argument) |
| 1942 |
return match.slice(0, 3); |
| 1943 |
}, |
| 1944 |
}, |
| 1945 |
|
| 1946 |
filter: { |
| 1947 |
TAG: function (nodeNameSelector) { |
| 1948 |
var nodeName = nodeNameSelector |
| 1949 |
.replace(runescape, funescape) |
| 1950 |
.toLowerCase(); |
| 1951 |
return nodeNameSelector === "*" |
| 1952 |
? function () { |
| 1953 |
return true; |
| 1954 |
} |
| 1955 |
: function (elem) { |
| 1956 |
return ( |
| 1957 |
elem.nodeName && elem.nodeName.toLowerCase() === nodeName |
| 1958 |
); |
| 1959 |
}; |
| 1960 |
}, |
| 1961 |
|
| 1962 |
CLASS: function (className) { |
| 1963 |
var pattern = classCache[className + " "]; |
| 1964 |
|
| 1965 |
return ( |
| 1966 |
pattern || |
| 1967 |
((pattern = new RegExp( |
| 1968 |
"(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" |
| 1969 |
)) && |
| 1970 |
classCache(className, function (elem) { |
| 1971 |
return pattern.test( |
| 1972 |
(typeof elem.className === "string" && elem.className) || |
| 1973 |
(typeof elem.getAttribute !== "undefined" && |
| 1974 |
elem.getAttribute("class")) || |
| 1975 |
"" |
| 1976 |
); |
| 1977 |
})) |
| 1978 |
); |
| 1979 |
}, |
| 1980 |
|
| 1981 |
ATTR: function (name, operator, check) { |
| 1982 |
return function (elem) { |
| 1983 |
var result = Sizzle.attr(elem, name); |
| 1984 |
|
| 1985 |
if (result == null) { |
| 1986 |
return operator === "!="; |
| 1987 |
} |
| 1988 |
if (!operator) { |
| 1989 |
return true; |
| 1990 |
} |
| 1991 |
|
| 1992 |
result += ""; |
| 1993 |
|
| 1994 |
/* eslint-disable max-len */ |
| 1995 |
|
| 1996 |
return operator === "=" |
| 1997 |
? result === check |
| 1998 |
: operator === "!=" |
| 1999 |
? result !== check |
| 2000 |
: operator === "^=" |
| 2001 |
? check && result.indexOf(check) === 0 |
| 2002 |
: operator === "*=" |
| 2003 |
? check && result.indexOf(check) > -1 |
| 2004 |
: operator === "$=" |
| 2005 |
? check && result.slice(-check.length) === check |
| 2006 |
: operator === "~=" |
| 2007 |
? (" " + result.replace(rwhitespace, " ") + " ").indexOf( |
| 2008 |
check |
| 2009 |
) > -1 |
| 2010 |
: operator === "|=" |
| 2011 |
? result === check || |
| 2012 |
result.slice(0, check.length + 1) === check + "-" |
| 2013 |
: false; |
| 2014 |
/* eslint-enable max-len */ |
| 2015 |
}; |
| 2016 |
}, |
| 2017 |
|
| 2018 |
CHILD: function (type, what, _argument, first, last) { |
| 2019 |
var simple = type.slice(0, 3) !== "nth", |
| 2020 |
forward = type.slice(-4) !== "last", |
| 2021 |
ofType = what === "of-type"; |
| 2022 |
|
| 2023 |
return first === 1 && last === 0 |
| 2024 |
? // Shortcut for :nth-*(n) |
| 2025 |
function (elem) { |
| 2026 |
return !!elem.parentNode; |
| 2027 |
} |
| 2028 |
: function (elem, _context, xml) { |
| 2029 |
var cache, |
| 2030 |
uniqueCache, |
| 2031 |
outerCache, |
| 2032 |
node, |
| 2033 |
nodeIndex, |
| 2034 |
start, |
| 2035 |
dir = |
| 2036 |
simple !== forward ? "nextSibling" : "previousSibling", |
| 2037 |
parent = elem.parentNode, |
| 2038 |
name = ofType && elem.nodeName.toLowerCase(), |
| 2039 |
useCache = !xml && !ofType, |
| 2040 |
diff = false; |
| 2041 |
|
| 2042 |
if (parent) { |
| 2043 |
// :(first|last|only)-(child|of-type) |
| 2044 |
if (simple) { |
| 2045 |
while (dir) { |
| 2046 |
node = elem; |
| 2047 |
while ((node = node[dir])) { |
| 2048 |
if ( |
| 2049 |
ofType |
| 2050 |
? node.nodeName.toLowerCase() === name |
| 2051 |
: node.nodeType === 1 |
| 2052 |
) { |
| 2053 |
return false; |
| 2054 |
} |
| 2055 |
} |
| 2056 |
|
| 2057 |
// Reverse direction for :only-* (if we haven't yet done so) |
| 2058 |
start = dir = |
| 2059 |
type === "only" && !start && "nextSibling"; |
| 2060 |
} |
| 2061 |
return true; |
| 2062 |
} |
| 2063 |
|
| 2064 |
start = [forward ? parent.firstChild : parent.lastChild]; |
| 2065 |
|
| 2066 |
// non-xml :nth-child(...) stores cache data on `parent` |
| 2067 |
if (forward && useCache) { |
| 2068 |
// Seek `elem` from a previously-cached index |
| 2069 |
|
| 2070 |
// ...in a gzip-friendly way |
| 2071 |
node = parent; |
| 2072 |
outerCache = node[expando] || (node[expando] = {}); |
| 2073 |
|
| 2074 |
// Support: IE <9 only |
| 2075 |
// Defend against cloned attroperties (jQuery gh-1709) |
| 2076 |
uniqueCache = |
| 2077 |
outerCache[node.uniqueID] || |
| 2078 |
(outerCache[node.uniqueID] = {}); |
| 2079 |
|
| 2080 |
cache = uniqueCache[type] || []; |
| 2081 |
nodeIndex = cache[0] === dirruns && cache[1]; |
| 2082 |
diff = nodeIndex && cache[2]; |
| 2083 |
node = nodeIndex && parent.childNodes[nodeIndex]; |
| 2084 |
|
| 2085 |
while ( |
| 2086 |
(node = |
| 2087 |
(++nodeIndex && node && node[dir]) || |
| 2088 |
// Fallback to seeking `elem` from the start |
| 2089 |
(diff = nodeIndex = 0) || |
| 2090 |
start.pop()) |
| 2091 |
) { |
| 2092 |
// When found, cache indexes on `parent` and break |
| 2093 |
if (node.nodeType === 1 && ++diff && node === elem) { |
| 2094 |
uniqueCache[type] = [dirruns, nodeIndex, diff]; |
| 2095 |
break; |
| 2096 |
} |
| 2097 |
} |
| 2098 |
} else { |
| 2099 |
// Use previously-cached element index if available |
| 2100 |
if (useCache) { |
| 2101 |
// ...in a gzip-friendly way |
| 2102 |
node = elem; |
| 2103 |
outerCache = node[expando] || (node[expando] = {}); |
| 2104 |
|
| 2105 |
// Support: IE <9 only |
| 2106 |
// Defend against cloned attroperties (jQuery gh-1709) |
| 2107 |
uniqueCache = |
| 2108 |
outerCache[node.uniqueID] || |
| 2109 |
(outerCache[node.uniqueID] = {}); |
| 2110 |
|
| 2111 |
cache = uniqueCache[type] || []; |
| 2112 |
nodeIndex = cache[0] === dirruns && cache[1]; |
| 2113 |
diff = nodeIndex; |
| 2114 |
} |
| 2115 |
|
| 2116 |
// xml :nth-child(...) |
| 2117 |
// or :nth-last-child(...) or :nth(-last)?-of-type(...) |
| 2118 |
if (diff === false) { |
| 2119 |
// Use the same loop as above to seek `elem` from the start |
| 2120 |
while ( |
| 2121 |
(node = |
| 2122 |
(++nodeIndex && node && node[dir]) || |
| 2123 |
(diff = nodeIndex = 0) || |
| 2124 |
start.pop()) |
| 2125 |
) { |
| 2126 |
if ( |
| 2127 |
(ofType |
| 2128 |
? node.nodeName.toLowerCase() === name |
| 2129 |
: node.nodeType === 1) && |
| 2130 |
++diff |
| 2131 |
) { |
| 2132 |
// Cache the index of each encountered element |
| 2133 |
if (useCache) { |
| 2134 |
outerCache = |
| 2135 |
node[expando] || (node[expando] = {}); |
| 2136 |
|
| 2137 |
// Support: IE <9 only |
| 2138 |
// Defend against cloned attroperties (jQuery gh-1709) |
| 2139 |
uniqueCache = |
| 2140 |
outerCache[node.uniqueID] || |
| 2141 |
(outerCache[node.uniqueID] = {}); |
| 2142 |
|
| 2143 |
uniqueCache[type] = [dirruns, diff]; |
| 2144 |
} |
| 2145 |
|
| 2146 |
if (node === elem) { |
| 2147 |
break; |
| 2148 |
} |
| 2149 |
} |
| 2150 |
} |
| 2151 |
} |
| 2152 |
} |
| 2153 |
|
| 2154 |
// Incorporate the offset, then check against cycle size |
| 2155 |
diff -= last; |
| 2156 |
return ( |
| 2157 |
diff === first || |
| 2158 |
(diff % first === 0 && diff / first >= 0) |
| 2159 |
); |
| 2160 |
} |
| 2161 |
}; |
| 2162 |
}, |
| 2163 |
|
| 2164 |
PSEUDO: function (pseudo, argument) { |
| 2165 |
// pseudo-class names are case-insensitive |
| 2166 |
// http://www.w3.org/TR/selectors/#pseudo-classes |
| 2167 |
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters |
| 2168 |
// Remember that setFilters inherits from pseudos |
| 2169 |
var args, |
| 2170 |
fn = |
| 2171 |
Expr.pseudos[pseudo] || |
| 2172 |
Expr.setFilters[pseudo.toLowerCase()] || |
| 2173 |
Sizzle.error("unsupported pseudo: " + pseudo); |
| 2174 |
|
| 2175 |
// The user may use createPseudo to indicate that |
| 2176 |
// arguments are needed to create the filter function |
| 2177 |
// just as Sizzle does |
| 2178 |
if (fn[expando]) { |
| 2179 |
return fn(argument); |
| 2180 |
} |
| 2181 |
|
| 2182 |
// But maintain support for old signatures |
| 2183 |
if (fn.length > 1) { |
| 2184 |
args = [pseudo, pseudo, "", argument]; |
| 2185 |
return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) |
| 2186 |
? markFunction(function (seed, matches) { |
| 2187 |
var idx, |
| 2188 |
matched = fn(seed, argument), |
| 2189 |
i = matched.length; |
| 2190 |
while (i--) { |
| 2191 |
idx = indexOf(seed, matched[i]); |
| 2192 |
seed[idx] = !(matches[idx] = matched[i]); |
| 2193 |
} |
| 2194 |
}) |
| 2195 |
: function (elem) { |
| 2196 |
return fn(elem, 0, args); |
| 2197 |
}; |
| 2198 |
} |
| 2199 |
|
| 2200 |
return fn; |
| 2201 |
}, |
| 2202 |
}, |
| 2203 |
|
| 2204 |
pseudos: { |
| 2205 |
// Potentially complex pseudos |
| 2206 |
not: markFunction(function (selector) { |
| 2207 |
// Trim the selector passed to compile |
| 2208 |
// to avoid treating leading and trailing |
| 2209 |
// spaces as combinators |
| 2210 |
var input = [], |
| 2211 |
results = [], |
| 2212 |
matcher = compile(selector.replace(rtrim, "$1")); |
| 2213 |
|
| 2214 |
return matcher[expando] |
| 2215 |
? markFunction(function (seed, matches, _context, xml) { |
| 2216 |
var elem, |
| 2217 |
unmatched = matcher(seed, null, xml, []), |
| 2218 |
i = seed.length; |
| 2219 |
|
| 2220 |
// Match elements unmatched by `matcher` |
| 2221 |
while (i--) { |
| 2222 |
if ((elem = unmatched[i])) { |
| 2223 |
seed[i] = !(matches[i] = elem); |
| 2224 |
} |
| 2225 |
} |
| 2226 |
}) |
| 2227 |
: function (elem, _context, xml) { |
| 2228 |
input[0] = elem; |
| 2229 |
matcher(input, null, xml, results); |
| 2230 |
|
| 2231 |
// Don't keep the element (issue #299) |
| 2232 |
input[0] = null; |
| 2233 |
return !results.pop(); |
| 2234 |
}; |
| 2235 |
}), |
| 2236 |
|
| 2237 |
has: markFunction(function (selector) { |
| 2238 |
return function (elem) { |
| 2239 |
return Sizzle(selector, elem).length > 0; |
| 2240 |
}; |
| 2241 |
}), |
| 2242 |
|
| 2243 |
contains: markFunction(function (text) { |
| 2244 |
text = text.replace(runescape, funescape); |
| 2245 |
return function (elem) { |
| 2246 |
return (elem.textContent || getText(elem)).indexOf(text) > -1; |
| 2247 |
}; |
| 2248 |
}), |
| 2249 |
|
| 2250 |
// "Whether an element is represented by a :lang() selector |
| 2251 |
// is based solely on the element's language value |
| 2252 |
// being equal to the identifier C, |
| 2253 |
// or beginning with the identifier C immediately followed by "-". |
| 2254 |
// The matching of C against the element's language value is performed case-insensitively. |
| 2255 |
// The identifier C does not have to be a valid language name." |
| 2256 |
// http://www.w3.org/TR/selectors/#lang-pseudo |
| 2257 |
lang: markFunction(function (lang) { |
| 2258 |
// lang value must be a valid identifier |
| 2259 |
if (!ridentifier.test(lang || "")) { |
| 2260 |
Sizzle.error("unsupported lang: " + lang); |
| 2261 |
} |
| 2262 |
lang = lang.replace(runescape, funescape).toLowerCase(); |
| 2263 |
return function (elem) { |
| 2264 |
var elemLang; |
| 2265 |
do { |
| 2266 |
if ( |
| 2267 |
(elemLang = documentIsHTML |
| 2268 |
? elem.lang |
| 2269 |
: elem.getAttribute("xml:lang") || |
| 2270 |
elem.getAttribute("lang")) |
| 2271 |
) { |
| 2272 |
elemLang = elemLang.toLowerCase(); |
| 2273 |
return ( |
| 2274 |
elemLang === lang || elemLang.indexOf(lang + "-") === 0 |
| 2275 |
); |
| 2276 |
} |
| 2277 |
} while ((elem = elem.parentNode) && elem.nodeType === 1); |
| 2278 |
return false; |
| 2279 |
}; |
| 2280 |
}), |
| 2281 |
|
| 2282 |
// Miscellaneous |
| 2283 |
target: function (elem) { |
| 2284 |
var hash = window.location && window.location.hash; |
| 2285 |
return hash && hash.slice(1) === elem.id; |
| 2286 |
}, |
| 2287 |
|
| 2288 |
root: function (elem) { |
| 2289 |
return elem === docElem; |
| 2290 |
}, |
| 2291 |
|
| 2292 |
focus: function (elem) { |
| 2293 |
return ( |
| 2294 |
elem === document.activeElement && |
| 2295 |
(!document.hasFocus || document.hasFocus()) && |
| 2296 |
!!(elem.type || elem.href || ~elem.tabIndex) |
| 2297 |
); |
| 2298 |
}, |
| 2299 |
|
| 2300 |
// Boolean properties |
| 2301 |
enabled: createDisabledPseudo(false), |
| 2302 |
disabled: createDisabledPseudo(true), |
| 2303 |
|
| 2304 |
checked: function (elem) { |
| 2305 |
// In CSS3, :checked should return both checked and selected elements |
| 2306 |
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked |
| 2307 |
var nodeName = elem.nodeName.toLowerCase(); |
| 2308 |
return ( |
| 2309 |
(nodeName === "input" && !!elem.checked) || |
| 2310 |
(nodeName === "option" && !!elem.selected) |
| 2311 |
); |
| 2312 |
}, |
| 2313 |
|
| 2314 |
selected: function (elem) { |
| 2315 |
// Accessing this property makes selected-by-default |
| 2316 |
// options in Safari work properly |
| 2317 |
if (elem.parentNode) { |
| 2318 |
// eslint-disable-next-line no-unused-expressions |
| 2319 |
elem.parentNode.selectedIndex; |
| 2320 |
} |
| 2321 |
|
| 2322 |
return elem.selected === true; |
| 2323 |
}, |
| 2324 |
|
| 2325 |
// Contents |
| 2326 |
empty: function (elem) { |
| 2327 |
// http://www.w3.org/TR/selectors/#empty-pseudo |
| 2328 |
// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), |
| 2329 |
// but not by others (comment: 8; processing instruction: 7; etc.) |
| 2330 |
// nodeType < 6 works because attributes (2) do not appear as children |
| 2331 |
for (elem = elem.firstChild; elem; elem = elem.nextSibling) { |
| 2332 |
if (elem.nodeType < 6) { |
| 2333 |
return false; |
| 2334 |
} |
| 2335 |
} |
| 2336 |
return true; |
| 2337 |
}, |
| 2338 |
|
| 2339 |
parent: function (elem) { |
| 2340 |
return !Expr.pseudos["empty"](elem); |
| 2341 |
}, |
| 2342 |
|
| 2343 |
// Element/input types |
| 2344 |
header: function (elem) { |
| 2345 |
return rheader.test(elem.nodeName); |
| 2346 |
}, |
| 2347 |
|
| 2348 |
input: function (elem) { |
| 2349 |
return rinputs.test(elem.nodeName); |
| 2350 |
}, |
| 2351 |
|
| 2352 |
button: function (elem) { |
| 2353 |
var name = elem.nodeName.toLowerCase(); |
| 2354 |
return ( |
| 2355 |
(name === "input" && elem.type === "button") || name === "button" |
| 2356 |
); |
| 2357 |
}, |
| 2358 |
|
| 2359 |
text: function (elem) { |
| 2360 |
var attr; |
| 2361 |
return ( |
| 2362 |
elem.nodeName.toLowerCase() === "input" && |
| 2363 |
elem.type === "text" && |
| 2364 |
// Support: IE<8 |
| 2365 |
// New HTML5 attribute values (e.g., "search") appear with elem.type === "text" |
| 2366 |
((attr = elem.getAttribute("type")) == null || |
| 2367 |
attr.toLowerCase() === "text") |
| 2368 |
); |
| 2369 |
}, |
| 2370 |
|
| 2371 |
// Position-in-collection |
| 2372 |
first: createPositionalPseudo(function () { |
| 2373 |
return [0]; |
| 2374 |
}), |
| 2375 |
|
| 2376 |
last: createPositionalPseudo(function (_matchIndexes, length) { |
| 2377 |
return [length - 1]; |
| 2378 |
}), |
| 2379 |
|
| 2380 |
eq: createPositionalPseudo(function ( |
| 2381 |
_matchIndexes, |
| 2382 |
length, |
| 2383 |
argument |
| 2384 |
) { |
| 2385 |
return [argument < 0 ? argument + length : argument]; |
| 2386 |
}), |
| 2387 |
|
| 2388 |
even: createPositionalPseudo(function (matchIndexes, length) { |
| 2389 |
var i = 0; |
| 2390 |
for (; i < length; i += 2) { |
| 2391 |
matchIndexes.push(i); |
| 2392 |
} |
| 2393 |
return matchIndexes; |
| 2394 |
}), |
| 2395 |
|
| 2396 |
odd: createPositionalPseudo(function (matchIndexes, length) { |
| 2397 |
var i = 1; |
| 2398 |
for (; i < length; i += 2) { |
| 2399 |
matchIndexes.push(i); |
| 2400 |
} |
| 2401 |
return matchIndexes; |
| 2402 |
}), |
| 2403 |
|
| 2404 |
lt: createPositionalPseudo(function (matchIndexes, length, argument) { |
| 2405 |
var i = |
| 2406 |
argument < 0 |
| 2407 |
? argument + length |
| 2408 |
: argument > length |
| 2409 |
? length |
| 2410 |
: argument; |
| 2411 |
for (; --i >= 0; ) { |
| 2412 |
matchIndexes.push(i); |
| 2413 |
} |
| 2414 |
return matchIndexes; |
| 2415 |
}), |
| 2416 |
|
| 2417 |
gt: createPositionalPseudo(function (matchIndexes, length, argument) { |
| 2418 |
var i = argument < 0 ? argument + length : argument; |
| 2419 |
for (; ++i < length; ) { |
| 2420 |
matchIndexes.push(i); |
| 2421 |
} |
| 2422 |
return matchIndexes; |
| 2423 |
}), |
| 2424 |
}, |
| 2425 |
}; |
| 2426 |
|
| 2427 |
Expr.pseudos["nth"] = Expr.pseudos["eq"]; |
| 2428 |
|
| 2429 |
// Add button/input type pseudos |
| 2430 |
for (i in { |
| 2431 |
radio: true, |
| 2432 |
checkbox: true, |
| 2433 |
file: true, |
| 2434 |
password: true, |
| 2435 |
image: true, |
| 2436 |
}) { |
| 2437 |
Expr.pseudos[i] = createInputPseudo(i); |
| 2438 |
} |
| 2439 |
for (i in { submit: true, reset: true }) { |
| 2440 |
Expr.pseudos[i] = createButtonPseudo(i); |
| 2441 |
} |
| 2442 |
|
| 2443 |
// Easy API for creating new setFilters |
| 2444 |
function setFilters() {} |
| 2445 |
setFilters.prototype = Expr.filters = Expr.pseudos; |
| 2446 |
Expr.setFilters = new setFilters(); |
| 2447 |
|
| 2448 |
tokenize = Sizzle.tokenize = function (selector, parseOnly) { |
| 2449 |
var matched, |
| 2450 |
match, |
| 2451 |
tokens, |
| 2452 |
type, |
| 2453 |
soFar, |
| 2454 |
groups, |
| 2455 |
preFilters, |
| 2456 |
cached = tokenCache[selector + " "]; |
| 2457 |
|
| 2458 |
if (cached) { |
| 2459 |
return parseOnly ? 0 : cached.slice(0); |
| 2460 |
} |
| 2461 |
|
| 2462 |
soFar = selector; |
| 2463 |
groups = []; |
| 2464 |
preFilters = Expr.preFilter; |
| 2465 |
|
| 2466 |
while (soFar) { |
| 2467 |
// Comma and first run |
| 2468 |
if (!matched || (match = rcomma.exec(soFar))) { |
| 2469 |
if (match) { |
| 2470 |
// Don't consume trailing commas as valid |
| 2471 |
soFar = soFar.slice(match[0].length) || soFar; |
| 2472 |
} |
| 2473 |
groups.push((tokens = [])); |
| 2474 |
} |
| 2475 |
|
| 2476 |
matched = false; |
| 2477 |
|
| 2478 |
// Combinators |
| 2479 |
if ((match = rcombinators.exec(soFar))) { |
| 2480 |
matched = match.shift(); |
| 2481 |
tokens.push({ |
| 2482 |
value: matched, |
| 2483 |
|
| 2484 |
// Cast descendant combinators to space |
| 2485 |
type: match[0].replace(rtrim, " "), |
| 2486 |
}); |
| 2487 |
soFar = soFar.slice(matched.length); |
| 2488 |
} |
| 2489 |
|
| 2490 |
// Filters |
| 2491 |
for (type in Expr.filter) { |
| 2492 |
if ( |
| 2493 |
(match = matchExpr[type].exec(soFar)) && |
| 2494 |
(!preFilters[type] || (match = preFilters[type](match))) |
| 2495 |
) { |
| 2496 |
matched = match.shift(); |
| 2497 |
tokens.push({ |
| 2498 |
value: matched, |
| 2499 |
type: type, |
| 2500 |
matches: match, |
| 2501 |
}); |
| 2502 |
soFar = soFar.slice(matched.length); |
| 2503 |
} |
| 2504 |
} |
| 2505 |
|
| 2506 |
if (!matched) { |
| 2507 |
break; |
| 2508 |
} |
| 2509 |
} |
| 2510 |
|
| 2511 |
// Return the length of the invalid excess |
| 2512 |
// if we're just parsing |
| 2513 |
// Otherwise, throw an error or return tokens |
| 2514 |
return parseOnly |
| 2515 |
? soFar.length |
| 2516 |
: soFar |
| 2517 |
? Sizzle.error(selector) |
| 2518 |
: // Cache the tokens |
| 2519 |
tokenCache(selector, groups).slice(0); |
| 2520 |
}; |
| 2521 |
|
| 2522 |
function toSelector(tokens) { |
| 2523 |
var i = 0, |
| 2524 |
len = tokens.length, |
| 2525 |
selector = ""; |
| 2526 |
for (; i < len; i++) { |
| 2527 |
selector += tokens[i].value; |
| 2528 |
} |
| 2529 |
return selector; |
| 2530 |
} |
| 2531 |
|
| 2532 |
function addCombinator(matcher, combinator, base) { |
| 2533 |
var dir = combinator.dir, |
| 2534 |
skip = combinator.next, |
| 2535 |
key = skip || dir, |
| 2536 |
checkNonElements = base && key === "parentNode", |
| 2537 |
doneName = done++; |
| 2538 |
|
| 2539 |
return combinator.first |
| 2540 |
? // Check against closest ancestor/preceding element |
| 2541 |
function (elem, context, xml) { |
| 2542 |
while ((elem = elem[dir])) { |
| 2543 |
if (elem.nodeType === 1 || checkNonElements) { |
| 2544 |
return matcher(elem, context, xml); |
| 2545 |
} |
| 2546 |
} |
| 2547 |
return false; |
| 2548 |
} |
| 2549 |
: // Check against all ancestor/preceding elements |
| 2550 |
function (elem, context, xml) { |
| 2551 |
var oldCache, |
| 2552 |
uniqueCache, |
| 2553 |
outerCache, |
| 2554 |
newCache = [dirruns, doneName]; |
| 2555 |
|
| 2556 |
// We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching |
| 2557 |
if (xml) { |
| 2558 |
while ((elem = elem[dir])) { |
| 2559 |
if (elem.nodeType === 1 || checkNonElements) { |
| 2560 |
if (matcher(elem, context, xml)) { |
| 2561 |
return true; |
| 2562 |
} |
| 2563 |
} |
| 2564 |
} |
| 2565 |
} else { |
| 2566 |
while ((elem = elem[dir])) { |
| 2567 |
if (elem.nodeType === 1 || checkNonElements) { |
| 2568 |
outerCache = elem[expando] || (elem[expando] = {}); |
| 2569 |
|
| 2570 |
// Support: IE <9 only |
| 2571 |
// Defend against cloned attroperties (jQuery gh-1709) |
| 2572 |
uniqueCache = |
| 2573 |
outerCache[elem.uniqueID] || |
| 2574 |
(outerCache[elem.uniqueID] = {}); |
| 2575 |
|
| 2576 |
if (skip && skip === elem.nodeName.toLowerCase()) { |
| 2577 |
elem = elem[dir] || elem; |
| 2578 |
} else if ( |
| 2579 |
(oldCache = uniqueCache[key]) && |
| 2580 |
oldCache[0] === dirruns && |
| 2581 |
oldCache[1] === doneName |
| 2582 |
) { |
| 2583 |
// Assign to newCache so results back-propagate to previous elements |
| 2584 |
return (newCache[2] = oldCache[2]); |
| 2585 |
} else { |
| 2586 |
// Reuse newcache so results back-propagate to previous elements |
| 2587 |
uniqueCache[key] = newCache; |
| 2588 |
|
| 2589 |
// A match means we're done; a fail means we have to keep checking |
| 2590 |
if ((newCache[2] = matcher(elem, context, xml))) { |
| 2591 |
return true; |
| 2592 |
} |
| 2593 |
} |
| 2594 |
} |
| 2595 |
} |
| 2596 |
} |
| 2597 |
return false; |
| 2598 |
}; |
| 2599 |
} |
| 2600 |
|
| 2601 |
function elementMatcher(matchers) { |
| 2602 |
return matchers.length > 1 |
| 2603 |
? function (elem, context, xml) { |
| 2604 |
var i = matchers.length; |
| 2605 |
while (i--) { |
| 2606 |
if (!matchers[i](elem, context, xml)) { |
| 2607 |
return false; |
| 2608 |
} |
| 2609 |
} |
| 2610 |
return true; |
| 2611 |
} |
| 2612 |
: matchers[0]; |
| 2613 |
} |
| 2614 |
|
| 2615 |
function multipleContexts(selector, contexts, results) { |
| 2616 |
var i = 0, |
| 2617 |
len = contexts.length; |
| 2618 |
for (; i < len; i++) { |
| 2619 |
Sizzle(selector, contexts[i], results); |
| 2620 |
} |
| 2621 |
return results; |
| 2622 |
} |
| 2623 |
|
| 2624 |
function condense(unmatched, map, filter, context, xml) { |
| 2625 |
var elem, |
| 2626 |
newUnmatched = [], |
| 2627 |
i = 0, |
| 2628 |
len = unmatched.length, |
| 2629 |
mapped = map != null; |
| 2630 |
|
| 2631 |
for (; i < len; i++) { |
| 2632 |
if ((elem = unmatched[i])) { |
| 2633 |
if (!filter || filter(elem, context, xml)) { |
| 2634 |
newUnmatched.push(elem); |
| 2635 |
if (mapped) { |
| 2636 |
map.push(i); |
| 2637 |
} |
| 2638 |
} |
| 2639 |
} |
| 2640 |
} |
| 2641 |
|
| 2642 |
return newUnmatched; |
| 2643 |
} |
| 2644 |
|
| 2645 |
function setMatcher( |
| 2646 |
preFilter, |
| 2647 |
selector, |
| 2648 |
matcher, |
| 2649 |
postFilter, |
| 2650 |
postFinder, |
| 2651 |
postSelector |
| 2652 |
) { |
| 2653 |
if (postFilter && !postFilter[expando]) { |
| 2654 |
postFilter = setMatcher(postFilter); |
| 2655 |
} |
| 2656 |
if (postFinder && !postFinder[expando]) { |
| 2657 |
postFinder = setMatcher(postFinder, postSelector); |
| 2658 |
} |
| 2659 |
return markFunction(function (seed, results, context, xml) { |
| 2660 |
var temp, |
| 2661 |
i, |
| 2662 |
elem, |
| 2663 |
preMap = [], |
| 2664 |
postMap = [], |
| 2665 |
preexisting = results.length, |
| 2666 |
// Get initial elements from seed or context |
| 2667 |
elems = |
| 2668 |
seed || |
| 2669 |
multipleContexts( |
| 2670 |
selector || "*", |
| 2671 |
context.nodeType ? [context] : context, |
| 2672 |
[] |
| 2673 |
), |
| 2674 |
// Prefilter to get matcher input, preserving a map for seed-results synchronization |
| 2675 |
matcherIn = |
| 2676 |
preFilter && (seed || !selector) |
| 2677 |
? condense(elems, preMap, preFilter, context, xml) |
| 2678 |
: elems, |
| 2679 |
matcherOut = matcher |
| 2680 |
? // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, |
| 2681 |
postFinder || (seed ? preFilter : preexisting || postFilter) |
| 2682 |
? // ...intermediate processing is necessary |
| 2683 |
[] |
| 2684 |
: // ...otherwise use results directly |
| 2685 |
results |
| 2686 |
: matcherIn; |
| 2687 |
|
| 2688 |
// Find primary matches |
| 2689 |
if (matcher) { |
| 2690 |
matcher(matcherIn, matcherOut, context, xml); |
| 2691 |
} |
| 2692 |
|
| 2693 |
// Apply postFilter |
| 2694 |
if (postFilter) { |
| 2695 |
temp = condense(matcherOut, postMap); |
| 2696 |
postFilter(temp, [], context, xml); |
| 2697 |
|
| 2698 |
// Un-match failing elements by moving them back to matcherIn |
| 2699 |
i = temp.length; |
| 2700 |
while (i--) { |
| 2701 |
if ((elem = temp[i])) { |
| 2702 |
matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem); |
| 2703 |
} |
| 2704 |
} |
| 2705 |
} |
| 2706 |
|
| 2707 |
if (seed) { |
| 2708 |
if (postFinder || preFilter) { |
| 2709 |
if (postFinder) { |
| 2710 |
// Get the final matcherOut by condensing this intermediate into postFinder contexts |
| 2711 |
temp = []; |
| 2712 |
i = matcherOut.length; |
| 2713 |
while (i--) { |
| 2714 |
if ((elem = matcherOut[i])) { |
| 2715 |
// Restore matcherIn since elem is not yet a final match |
| 2716 |
temp.push((matcherIn[i] = elem)); |
| 2717 |
} |
| 2718 |
} |
| 2719 |
postFinder(null, (matcherOut = []), temp, xml); |
| 2720 |
} |
| 2721 |
|
| 2722 |
// Move matched elements from seed to results to keep them synchronized |
| 2723 |
i = matcherOut.length; |
| 2724 |
while (i--) { |
| 2725 |
if ( |
| 2726 |
(elem = matcherOut[i]) && |
| 2727 |
(temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1 |
| 2728 |
) { |
| 2729 |
seed[temp] = !(results[temp] = elem); |
| 2730 |
} |
| 2731 |
} |
| 2732 |
} |
| 2733 |
|
| 2734 |
// Add elements to results, through postFinder if defined |
| 2735 |
} else { |
| 2736 |
matcherOut = condense( |
| 2737 |
matcherOut === results |
| 2738 |
? matcherOut.splice(preexisting, matcherOut.length) |
| 2739 |
: matcherOut |
| 2740 |
); |
| 2741 |
if (postFinder) { |
| 2742 |
postFinder(null, results, matcherOut, xml); |
| 2743 |
} else { |
| 2744 |
push.apply(results, matcherOut); |
| 2745 |
} |
| 2746 |
} |
| 2747 |
}); |
| 2748 |
} |
| 2749 |
|
| 2750 |
function matcherFromTokens(tokens) { |
| 2751 |
var checkContext, |
| 2752 |
matcher, |
| 2753 |
j, |
| 2754 |
len = tokens.length, |
| 2755 |
leadingRelative = Expr.relative[tokens[0].type], |
| 2756 |
implicitRelative = leadingRelative || Expr.relative[" "], |
| 2757 |
i = leadingRelative ? 1 : 0, |
| 2758 |
// The foundational matcher ensures that elements are reachable from top-level context(s) |
| 2759 |
matchContext = addCombinator( |
| 2760 |
function (elem) { |
| 2761 |
return elem === checkContext; |
| 2762 |
}, |
| 2763 |
implicitRelative, |
| 2764 |
true |
| 2765 |
), |
| 2766 |
matchAnyContext = addCombinator( |
| 2767 |
function (elem) { |
| 2768 |
return indexOf(checkContext, elem) > -1; |
| 2769 |
}, |
| 2770 |
implicitRelative, |
| 2771 |
true |
| 2772 |
), |
| 2773 |
matchers = [ |
| 2774 |
function (elem, context, xml) { |
| 2775 |
var ret = |
| 2776 |
(!leadingRelative && (xml || context !== outermostContext)) || |
| 2777 |
((checkContext = context).nodeType |
| 2778 |
? matchContext(elem, context, xml) |
| 2779 |
: matchAnyContext(elem, context, xml)); |
| 2780 |
|
| 2781 |
// Avoid hanging onto element (issue #299) |
| 2782 |
checkContext = null; |
| 2783 |
return ret; |
| 2784 |
}, |
| 2785 |
]; |
| 2786 |
|
| 2787 |
for (; i < len; i++) { |
| 2788 |
if ((matcher = Expr.relative[tokens[i].type])) { |
| 2789 |
matchers = [addCombinator(elementMatcher(matchers), matcher)]; |
| 2790 |
} else { |
| 2791 |
matcher = Expr.filter[tokens[i].type].apply( |
| 2792 |
null, |
| 2793 |
tokens[i].matches |
| 2794 |
); |
| 2795 |
|
| 2796 |
// Return special upon seeing a positional matcher |
| 2797 |
if (matcher[expando]) { |
| 2798 |
// Find the next relative operator (if any) for proper handling |
| 2799 |
j = ++i; |
| 2800 |
for (; j < len; j++) { |
| 2801 |
if (Expr.relative[tokens[j].type]) { |
| 2802 |
break; |
| 2803 |
} |
| 2804 |
} |
| 2805 |
return setMatcher( |
| 2806 |
i > 1 && elementMatcher(matchers), |
| 2807 |
i > 1 && |
| 2808 |
toSelector( |
| 2809 |
// If the preceding token was a descendant combinator, insert an implicit any-element `*` |
| 2810 |
tokens |
| 2811 |
.slice(0, i - 1) |
| 2812 |
.concat({ value: tokens[i - 2].type === " " ? "*" : "" }) |
| 2813 |
).replace(rtrim, "$1"), |
| 2814 |
matcher, |
| 2815 |
i < j && matcherFromTokens(tokens.slice(i, j)), |
| 2816 |
j < len && matcherFromTokens((tokens = tokens.slice(j))), |
| 2817 |
j < len && toSelector(tokens) |
| 2818 |
); |
| 2819 |
} |
| 2820 |
matchers.push(matcher); |
| 2821 |
} |
| 2822 |
} |
| 2823 |
|
| 2824 |
return elementMatcher(matchers); |
| 2825 |
} |
| 2826 |
|
| 2827 |
function matcherFromGroupMatchers(elementMatchers, setMatchers) { |
| 2828 |
var bySet = setMatchers.length > 0, |
| 2829 |
byElement = elementMatchers.length > 0, |
| 2830 |
superMatcher = function (seed, context, xml, results, outermost) { |
| 2831 |
var elem, |
| 2832 |
j, |
| 2833 |
matcher, |
| 2834 |
matchedCount = 0, |
| 2835 |
i = "0", |
| 2836 |
unmatched = seed && [], |
| 2837 |
setMatched = [], |
| 2838 |
contextBackup = outermostContext, |
| 2839 |
// We must always have either seed elements or outermost context |
| 2840 |
elems = seed || (byElement && Expr.find["TAG"]("*", outermost)), |
| 2841 |
// Use integer dirruns iff this is the outermost matcher |
| 2842 |
dirrunsUnique = (dirruns += |
| 2843 |
contextBackup == null ? 1 : Math.random() || 0.1), |
| 2844 |
len = elems.length; |
| 2845 |
|
| 2846 |
if (outermost) { |
| 2847 |
// Support: IE 11+, Edge 17 - 18+ |
| 2848 |
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
| 2849 |
// two documents; shallow comparisons work. |
| 2850 |
// eslint-disable-next-line eqeqeq |
| 2851 |
outermostContext = context == document || context || outermost; |
| 2852 |
} |
| 2853 |
|
| 2854 |
// Add elements passing elementMatchers directly to results |
| 2855 |
// Support: IE<9, Safari |
| 2856 |
// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id |
| 2857 |
for (; i !== len && (elem = elems[i]) != null; i++) { |
| 2858 |
if (byElement && elem) { |
| 2859 |
j = 0; |
| 2860 |
|
| 2861 |
// Support: IE 11+, Edge 17 - 18+ |
| 2862 |
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
| 2863 |
// two documents; shallow comparisons work. |
| 2864 |
// eslint-disable-next-line eqeqeq |
| 2865 |
if (!context && elem.ownerDocument != document) { |
| 2866 |
setDocument(elem); |
| 2867 |
xml = !documentIsHTML; |
| 2868 |
} |
| 2869 |
while ((matcher = elementMatchers[j++])) { |
| 2870 |
if (matcher(elem, context || document, xml)) { |
| 2871 |
results.push(elem); |
| 2872 |
break; |
| 2873 |
} |
| 2874 |
} |
| 2875 |
if (outermost) { |
| 2876 |
dirruns = dirrunsUnique; |
| 2877 |
} |
| 2878 |
} |
| 2879 |
|
| 2880 |
// Track unmatched elements for set filters |
| 2881 |
if (bySet) { |
| 2882 |
// They will have gone through all possible matchers |
| 2883 |
if ((elem = !matcher && elem)) { |
| 2884 |
matchedCount--; |
| 2885 |
} |
| 2886 |
|
| 2887 |
// Lengthen the array for every element, matched or not |
| 2888 |
if (seed) { |
| 2889 |
unmatched.push(elem); |
| 2890 |
} |
| 2891 |
} |
| 2892 |
} |
| 2893 |
|
| 2894 |
// `i` is now the count of elements visited above, and adding it to `matchedCount` |
| 2895 |
// makes the latter nonnegative. |
| 2896 |
matchedCount += i; |
| 2897 |
|
| 2898 |
// Apply set filters to unmatched elements |
| 2899 |
// NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` |
| 2900 |
// equals `i`), unless we didn't visit _any_ elements in the above loop because we have |
| 2901 |
// no element matchers and no seed. |
| 2902 |
// Incrementing an initially-string "0" `i` allows `i` to remain a string only in that |
| 2903 |
// case, which will result in a "00" `matchedCount` that differs from `i` but is also |
| 2904 |
// numerically zero. |
| 2905 |
if (bySet && i !== matchedCount) { |
| 2906 |
j = 0; |
| 2907 |
while ((matcher = setMatchers[j++])) { |
| 2908 |
matcher(unmatched, setMatched, context, xml); |
| 2909 |
} |
| 2910 |
|
| 2911 |
if (seed) { |
| 2912 |
// Reintegrate element matches to eliminate the need for sorting |
| 2913 |
if (matchedCount > 0) { |
| 2914 |
while (i--) { |
| 2915 |
if (!(unmatched[i] || setMatched[i])) { |
| 2916 |
setMatched[i] = pop.call(results); |
| 2917 |
} |
| 2918 |
} |
| 2919 |
} |
| 2920 |
|
| 2921 |
// Discard index placeholder values to get only actual matches |
| 2922 |
setMatched = condense(setMatched); |
| 2923 |
} |
| 2924 |
|
| 2925 |
// Add matches to results |
| 2926 |
push.apply(results, setMatched); |
| 2927 |
|
| 2928 |
// Seedless set matches succeeding multiple successful matchers stipulate sorting |
| 2929 |
if ( |
| 2930 |
outermost && |
| 2931 |
!seed && |
| 2932 |
setMatched.length > 0 && |
| 2933 |
matchedCount + setMatchers.length > 1 |
| 2934 |
) { |
| 2935 |
Sizzle.uniqueSort(results); |
| 2936 |
} |
| 2937 |
} |
| 2938 |
|
| 2939 |
// Override manipulation of globals by nested matchers |
| 2940 |
if (outermost) { |
| 2941 |
dirruns = dirrunsUnique; |
| 2942 |
outermostContext = contextBackup; |
| 2943 |
} |
| 2944 |
|
| 2945 |
return unmatched; |
| 2946 |
}; |
| 2947 |
|
| 2948 |
return bySet ? markFunction(superMatcher) : superMatcher; |
| 2949 |
} |
| 2950 |
|
| 2951 |
compile = Sizzle.compile = function ( |
| 2952 |
selector, |
| 2953 |
match /* Internal Use Only */ |
| 2954 |
) { |
| 2955 |
var i, |
| 2956 |
setMatchers = [], |
| 2957 |
elementMatchers = [], |
| 2958 |
cached = compilerCache[selector + " "]; |
| 2959 |
|
| 2960 |
if (!cached) { |
| 2961 |
// Generate a function of recursive functions that can be used to check each element |
| 2962 |
if (!match) { |
| 2963 |
match = tokenize(selector); |
| 2964 |
} |
| 2965 |
i = match.length; |
| 2966 |
while (i--) { |
| 2967 |
cached = matcherFromTokens(match[i]); |
| 2968 |
if (cached[expando]) { |
| 2969 |
setMatchers.push(cached); |
| 2970 |
} else { |
| 2971 |
elementMatchers.push(cached); |
| 2972 |
} |
| 2973 |
} |
| 2974 |
|
| 2975 |
// Cache the compiled function |
| 2976 |
cached = compilerCache( |
| 2977 |
selector, |
| 2978 |
matcherFromGroupMatchers(elementMatchers, setMatchers) |
| 2979 |
); |
| 2980 |
|
| 2981 |
// Save selector and tokenization |
| 2982 |
cached.selector = selector; |
| 2983 |
} |
| 2984 |
return cached; |
| 2985 |
}; |
| 2986 |
|
| 2987 |
/** |
| 2988 |
* A low-level selection function that works with Sizzle's compiled |
| 2989 |
* selector functions |
| 2990 |
* @param {String|Function} selector A selector or a pre-compiled |
| 2991 |
* selector function built with Sizzle.compile |
| 2992 |
* @param {Element} context |
| 2993 |
* @param {Array} [results] |
| 2994 |
* @param {Array} [seed] A set of elements to match against |
| 2995 |
*/ |
| 2996 |
select = Sizzle.select = function (selector, context, results, seed) { |
| 2997 |
var i, |
| 2998 |
tokens, |
| 2999 |
token, |
| 3000 |
type, |
| 3001 |
find, |
| 3002 |
compiled = typeof selector === "function" && selector, |
| 3003 |
match = !seed && tokenize((selector = compiled.selector || selector)); |
| 3004 |
|
| 3005 |
results = results || []; |
| 3006 |
|
| 3007 |
// Try to minimize operations if there is only one selector in the list and no seed |
| 3008 |
// (the latter of which guarantees us context) |
| 3009 |
if (match.length === 1) { |
| 3010 |
// Reduce context if the leading compound selector is an ID |
| 3011 |
tokens = match[0] = match[0].slice(0); |
| 3012 |
if ( |
| 3013 |
tokens.length > 2 && |
| 3014 |
(token = tokens[0]).type === "ID" && |
| 3015 |
context.nodeType === 9 && |
| 3016 |
documentIsHTML && |
| 3017 |
Expr.relative[tokens[1].type] |
| 3018 |
) { |
| 3019 |
context = (Expr.find["ID"]( |
| 3020 |
token.matches[0].replace(runescape, funescape), |
| 3021 |
context |
| 3022 |
) || [])[0]; |
| 3023 |
if (!context) { |
| 3024 |
return results; |
| 3025 |
|
| 3026 |
// Precompiled matchers will still verify ancestry, so step up a level |
| 3027 |
} else if (compiled) { |
| 3028 |
context = context.parentNode; |
| 3029 |
} |
| 3030 |
|
| 3031 |
selector = selector.slice(tokens.shift().value.length); |
| 3032 |
} |
| 3033 |
|
| 3034 |
// Fetch a seed set for right-to-left matching |
| 3035 |
i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length; |
| 3036 |
while (i--) { |
| 3037 |
token = tokens[i]; |
| 3038 |
|
| 3039 |
// Abort if we hit a combinator |
| 3040 |
if (Expr.relative[(type = token.type)]) { |
| 3041 |
break; |
| 3042 |
} |
| 3043 |
if ((find = Expr.find[type])) { |
| 3044 |
// Search, expanding context for leading sibling combinators |
| 3045 |
if ( |
| 3046 |
(seed = find( |
| 3047 |
token.matches[0].replace(runescape, funescape), |
| 3048 |
(rsibling.test(tokens[0].type) && |
| 3049 |
testContext(context.parentNode)) || |
| 3050 |
context |
| 3051 |
)) |
| 3052 |
) { |
| 3053 |
// If seed is empty or no tokens remain, we can return early |
| 3054 |
tokens.splice(i, 1); |
| 3055 |
selector = seed.length && toSelector(tokens); |
| 3056 |
if (!selector) { |
| 3057 |
push.apply(results, seed); |
| 3058 |
return results; |
| 3059 |
} |
| 3060 |
|
| 3061 |
break; |
| 3062 |
} |
| 3063 |
} |
| 3064 |
} |
| 3065 |
} |
| 3066 |
|
| 3067 |
// Compile and execute a filtering function if one is not provided |
| 3068 |
// Provide `match` to avoid retokenization if we modified the selector above |
| 3069 |
(compiled || compile(selector, match))( |
| 3070 |
seed, |
| 3071 |
context, |
| 3072 |
!documentIsHTML, |
| 3073 |
results, |
| 3074 |
!context || |
| 3075 |
(rsibling.test(selector) && testContext(context.parentNode)) || |
| 3076 |
context |
| 3077 |
); |
| 3078 |
return results; |
| 3079 |
}; |
| 3080 |
|
| 3081 |
// One-time assignments |
| 3082 |
|
| 3083 |
// Sort stability |
| 3084 |
support.sortStable = |
| 3085 |
expando.split("").sort(sortOrder).join("") === expando; |
| 3086 |
|
| 3087 |
// Support: Chrome 14-35+ |
| 3088 |
// Always assume duplicates if they aren't passed to the comparison function |
| 3089 |
support.detectDuplicates = !!hasDuplicate; |
| 3090 |
|
| 3091 |
// Initialize against the default document |
| 3092 |
setDocument(); |
| 3093 |
|
| 3094 |
// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) |
| 3095 |
// Detached nodes confoundingly follow *each other* |
| 3096 |
support.sortDetached = assert(function (el) { |
| 3097 |
// Should return 1, but returns 4 (following) |
| 3098 |
return ( |
| 3099 |
el.compareDocumentPosition(document.createElement("fieldset")) & 1 |
| 3100 |
); |
| 3101 |
}); |
| 3102 |
|
| 3103 |
// Support: IE<8 |
| 3104 |
// Prevent attribute/property "interpolation" |
| 3105 |
// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx |
| 3106 |
if ( |
| 3107 |
!assert(function (el) { |
| 3108 |
el.innerHTML = "<a href='#'></a>"; |
| 3109 |
return el.firstChild.getAttribute("href") === "#"; |
| 3110 |
}) |
| 3111 |
) { |
| 3112 |
addHandle("type|href|height|width", function (elem, name, isXML) { |
| 3113 |
if (!isXML) { |
| 3114 |
return elem.getAttribute( |
| 3115 |
name, |
| 3116 |
name.toLowerCase() === "type" ? 1 : 2 |
| 3117 |
); |
| 3118 |
} |
| 3119 |
}); |
| 3120 |
} |
| 3121 |
|
| 3122 |
// Support: IE<9 |
| 3123 |
// Use defaultValue in place of getAttribute("value") |
| 3124 |
if ( |
| 3125 |
!support.attributes || |
| 3126 |
!assert(function (el) { |
| 3127 |
el.innerHTML = "<input/>"; |
| 3128 |
el.firstChild.setAttribute("value", ""); |
| 3129 |
return el.firstChild.getAttribute("value") === ""; |
| 3130 |
}) |
| 3131 |
) { |
| 3132 |
addHandle("value", function (elem, _name, isXML) { |
| 3133 |
if (!isXML && elem.nodeName.toLowerCase() === "input") { |
| 3134 |
return elem.defaultValue; |
| 3135 |
} |
| 3136 |
}); |
| 3137 |
} |
| 3138 |
|
| 3139 |
// Support: IE<9 |
| 3140 |
// Use getAttributeNode to fetch booleans when getAttribute lies |
| 3141 |
if ( |
| 3142 |
!assert(function (el) { |
| 3143 |
return el.getAttribute("disabled") == null; |
| 3144 |
}) |
| 3145 |
) { |
| 3146 |
addHandle(booleans, function (elem, name, isXML) { |
| 3147 |
var val; |
| 3148 |
if (!isXML) { |
| 3149 |
return elem[name] === true |
| 3150 |
? name.toLowerCase() |
| 3151 |
: (val = elem.getAttributeNode(name)) && val.specified |
| 3152 |
? val.value |
| 3153 |
: null; |
| 3154 |
} |
| 3155 |
}); |
| 3156 |
} |
| 3157 |
|
| 3158 |
return Sizzle; |
| 3159 |
})(window); |
| 3160 |
|
| 3161 |
jQuery.find = Sizzle; |
| 3162 |
jQuery.expr = Sizzle.selectors; |
| 3163 |
|
| 3164 |
// Deprecated |
| 3165 |
jQuery.expr[":"] = jQuery.expr.pseudos; |
| 3166 |
jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; |
| 3167 |
jQuery.text = Sizzle.getText; |
| 3168 |
jQuery.isXMLDoc = Sizzle.isXML; |
| 3169 |
jQuery.contains = Sizzle.contains; |
| 3170 |
jQuery.escapeSelector = Sizzle.escape; |
| 3171 |
|
| 3172 |
var dir = function (elem, dir, until) { |
| 3173 |
var matched = [], |
| 3174 |
truncate = until !== undefined; |
| 3175 |
|
| 3176 |
while ((elem = elem[dir]) && elem.nodeType !== 9) { |
| 3177 |
if (elem.nodeType === 1) { |
| 3178 |
if (truncate && jQuery(elem).is(until)) { |
| 3179 |
break; |
| 3180 |
} |
| 3181 |
matched.push(elem); |
| 3182 |
} |
| 3183 |
} |
| 3184 |
return matched; |
| 3185 |
}; |
| 3186 |
|
| 3187 |
var siblings = function (n, elem) { |
| 3188 |
var matched = []; |
| 3189 |
|
| 3190 |
for (; n; n = n.nextSibling) { |
| 3191 |
if (n.nodeType === 1 && n !== elem) { |
| 3192 |
matched.push(n); |
| 3193 |
} |
| 3194 |
} |
| 3195 |
|
| 3196 |
return matched; |
| 3197 |
}; |
| 3198 |
|
| 3199 |
var rneedsContext = jQuery.expr.match.needsContext; |
| 3200 |
|
| 3201 |
function nodeName(elem, name) { |
| 3202 |
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); |
| 3203 |
} |
| 3204 |
var rsingleTag = |
| 3205 |
/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i; |
| 3206 |
|
| 3207 |
// Implement the identical functionality for filter and not |
| 3208 |
function winnow(elements, qualifier, not) { |
| 3209 |
if (isFunction(qualifier)) { |
| 3210 |
return jQuery.grep(elements, function (elem, i) { |
| 3211 |
return !!qualifier.call(elem, i, elem) !== not; |
| 3212 |
}); |
| 3213 |
} |
| 3214 |
|
| 3215 |
// Single element |
| 3216 |
if (qualifier.nodeType) { |
| 3217 |
return jQuery.grep(elements, function (elem) { |
| 3218 |
return (elem === qualifier) !== not; |
| 3219 |
}); |
| 3220 |
} |
| 3221 |
|
| 3222 |
// Arraylike of elements (jQuery, arguments, Array) |
| 3223 |
if (typeof qualifier !== "string") { |
| 3224 |
return jQuery.grep(elements, function (elem) { |
| 3225 |
return indexOf.call(qualifier, elem) > -1 !== not; |
| 3226 |
}); |
| 3227 |
} |
| 3228 |
|
| 3229 |
// Filtered directly for both simple and complex selectors |
| 3230 |
return jQuery.filter(qualifier, elements, not); |
| 3231 |
} |
| 3232 |
|
| 3233 |
jQuery.filter = function (expr, elems, not) { |
| 3234 |
var elem = elems[0]; |
| 3235 |
|
| 3236 |
if (not) { |
| 3237 |
expr = ":not(" + expr + ")"; |
| 3238 |
} |
| 3239 |
|
| 3240 |
if (elems.length === 1 && elem.nodeType === 1) { |
| 3241 |
return jQuery.find.matchesSelector(elem, expr) ? [elem] : []; |
| 3242 |
} |
| 3243 |
|
| 3244 |
return jQuery.find.matches( |
| 3245 |
expr, |
| 3246 |
jQuery.grep(elems, function (elem) { |
| 3247 |
return elem.nodeType === 1; |
| 3248 |
}) |
| 3249 |
); |
| 3250 |
}; |
| 3251 |
|
| 3252 |
jQuery.fn.extend({ |
| 3253 |
find: function (selector) { |
| 3254 |
var i, |
| 3255 |
ret, |
| 3256 |
len = this.length, |
| 3257 |
self = this; |
| 3258 |
|
| 3259 |
if (typeof selector !== "string") { |
| 3260 |
return this.pushStack( |
| 3261 |
jQuery(selector).filter(function () { |
| 3262 |
for (i = 0; i < len; i++) { |
| 3263 |
if (jQuery.contains(self[i], this)) { |
| 3264 |
return true; |
| 3265 |
} |
| 3266 |
} |
| 3267 |
}) |
| 3268 |
); |
| 3269 |
} |
| 3270 |
|
| 3271 |
ret = this.pushStack([]); |
| 3272 |
|
| 3273 |
for (i = 0; i < len; i++) { |
| 3274 |
jQuery.find(selector, self[i], ret); |
| 3275 |
} |
| 3276 |
|
| 3277 |
return len > 1 ? jQuery.uniqueSort(ret) : ret; |
| 3278 |
}, |
| 3279 |
filter: function (selector) { |
| 3280 |
return this.pushStack(winnow(this, selector || [], false)); |
| 3281 |
}, |
| 3282 |
not: function (selector) { |
| 3283 |
return this.pushStack(winnow(this, selector || [], true)); |
| 3284 |
}, |
| 3285 |
is: function (selector) { |
| 3286 |
return !!winnow( |
| 3287 |
this, |
| 3288 |
|
| 3289 |
// If this is a positional/relative selector, check membership in the returned set |
| 3290 |
// so $("p:first").is("p:last") won't return true for a doc with two "p". |
| 3291 |
typeof selector === "string" && rneedsContext.test(selector) |
| 3292 |
? jQuery(selector) |
| 3293 |
: selector || [], |
| 3294 |
false |
| 3295 |
).length; |
| 3296 |
}, |
| 3297 |
}); |
| 3298 |
|
| 3299 |
// Initialize a jQuery object |
| 3300 |
|
| 3301 |
// A central reference to the root jQuery(document) |
| 3302 |
var rootjQuery, |
| 3303 |
// A simple way to check for HTML strings |
| 3304 |
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521) |
| 3305 |
// Strict HTML recognition (#11290: must start with <) |
| 3306 |
// Shortcut simple #id case for speed |
| 3307 |
rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, |
| 3308 |
init = (jQuery.fn.init = function (selector, context, root) { |
| 3309 |
var match, elem; |
| 3310 |
|
| 3311 |
// HANDLE: $(""), $(null), $(undefined), $(false) |
| 3312 |
if (!selector) { |
| 3313 |
return this; |
| 3314 |
} |
| 3315 |
|
| 3316 |
// Method init() accepts an alternate rootjQuery |
| 3317 |
// so migrate can support jQuery.sub (gh-2101) |
| 3318 |
root = root || rootjQuery; |
| 3319 |
|
| 3320 |
// Handle HTML strings |
| 3321 |
if (typeof selector === "string") { |
| 3322 |
if ( |
| 3323 |
selector[0] === "<" && |
| 3324 |
selector[selector.length - 1] === ">" && |
| 3325 |
selector.length >= 3 |
| 3326 |
) { |
| 3327 |
// Assume that strings that start and end with <> are HTML and skip the regex check |
| 3328 |
match = [null, selector, null]; |
| 3329 |
} else { |
| 3330 |
match = rquickExpr.exec(selector); |
| 3331 |
} |
| 3332 |
|
| 3333 |
// Match html or make sure no context is specified for #id |
| 3334 |
if (match && (match[1] || !context)) { |
| 3335 |
// HANDLE: $(html) -> $(array) |
| 3336 |
if (match[1]) { |
| 3337 |
context = context instanceof jQuery ? context[0] : context; |
| 3338 |
|
| 3339 |
// Option to run scripts is true for back-compat |
| 3340 |
// Intentionally let the error be thrown if parseHTML is not present |
| 3341 |
jQuery.merge( |
| 3342 |
this, |
| 3343 |
jQuery.parseHTML( |
| 3344 |
match[1], |
| 3345 |
context && context.nodeType |
| 3346 |
? context.ownerDocument || context |
| 3347 |
: document, |
| 3348 |
true |
| 3349 |
) |
| 3350 |
); |
| 3351 |
|
| 3352 |
// HANDLE: $(html, props) |
| 3353 |
if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) { |
| 3354 |
for (match in context) { |
| 3355 |
// Properties of context are called as methods if possible |
| 3356 |
if (isFunction(this[match])) { |
| 3357 |
this[match](context[match]); |
| 3358 |
|
| 3359 |
// ...and otherwise set as attributes |
| 3360 |
} else { |
| 3361 |
this.attr(match, context[match]); |
| 3362 |
} |
| 3363 |
} |
| 3364 |
} |
| 3365 |
|
| 3366 |
return this; |
| 3367 |
|
| 3368 |
// HANDLE: $(#id) |
| 3369 |
} else { |
| 3370 |
elem = document.getElementById(match[2]); |
| 3371 |
|
| 3372 |
if (elem) { |
| 3373 |
// Inject the element directly into the jQuery object |
| 3374 |
this[0] = elem; |
| 3375 |
this.length = 1; |
| 3376 |
} |
| 3377 |
return this; |
| 3378 |
} |
| 3379 |
|
| 3380 |
// HANDLE: $(expr, $(...)) |
| 3381 |
} else if (!context || context.jquery) { |
| 3382 |
return (context || root).find(selector); |
| 3383 |
|
| 3384 |
// HANDLE: $(expr, context) |
| 3385 |
// (which is just equivalent to: $(context).find(expr) |
| 3386 |
} else { |
| 3387 |
return this.constructor(context).find(selector); |
| 3388 |
} |
| 3389 |
|
| 3390 |
// HANDLE: $(DOMElement) |
| 3391 |
} else if (selector.nodeType) { |
| 3392 |
this[0] = selector; |
| 3393 |
this.length = 1; |
| 3394 |
return this; |
| 3395 |
|
| 3396 |
// HANDLE: $(function) |
| 3397 |
// Shortcut for document ready |
| 3398 |
} else if (isFunction(selector)) { |
| 3399 |
return root.ready !== undefined |
| 3400 |
? root.ready(selector) |
| 3401 |
: // Execute immediately if ready is not present |
| 3402 |
selector(jQuery); |
| 3403 |
} |
| 3404 |
|
| 3405 |
return jQuery.makeArray(selector, this); |
| 3406 |
}); |
| 3407 |
|
| 3408 |
// Give the init function the jQuery prototype for later instantiation |
| 3409 |
init.prototype = jQuery.fn; |
| 3410 |
|
| 3411 |
// Initialize central reference |
| 3412 |
rootjQuery = jQuery(document); |
| 3413 |
|
| 3414 |
var rparentsprev = /^(?:parents|prev(?:Until|All))/, |
| 3415 |
// Methods guaranteed to produce a unique set when starting from a unique set |
| 3416 |
guaranteedUnique = { |
| 3417 |
children: true, |
| 3418 |
contents: true, |
| 3419 |
next: true, |
| 3420 |
prev: true, |
| 3421 |
}; |
| 3422 |
|
| 3423 |
jQuery.fn.extend({ |
| 3424 |
has: function (target) { |
| 3425 |
var targets = jQuery(target, this), |
| 3426 |
l = targets.length; |
| 3427 |
|
| 3428 |
return this.filter(function () { |
| 3429 |
var i = 0; |
| 3430 |
for (; i < l; i++) { |
| 3431 |
if (jQuery.contains(this, targets[i])) { |
| 3432 |
return true; |
| 3433 |
} |
| 3434 |
} |
| 3435 |
}); |
| 3436 |
}, |
| 3437 |
|
| 3438 |
closest: function (selectors, context) { |
| 3439 |
var cur, |
| 3440 |
i = 0, |
| 3441 |
l = this.length, |
| 3442 |
matched = [], |
| 3443 |
targets = typeof selectors !== "string" && jQuery(selectors); |
| 3444 |
|
| 3445 |
// Positional selectors never match, since there's no _selection_ context |
| 3446 |
if (!rneedsContext.test(selectors)) { |
| 3447 |
for (; i < l; i++) { |
| 3448 |
for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) { |
| 3449 |
// Always skip document fragments |
| 3450 |
if ( |
| 3451 |
cur.nodeType < 11 && |
| 3452 |
(targets |
| 3453 |
? targets.index(cur) > -1 |
| 3454 |
: // Don't pass non-elements to Sizzle |
| 3455 |
cur.nodeType === 1 && |
| 3456 |
jQuery.find.matchesSelector(cur, selectors)) |
| 3457 |
) { |
| 3458 |
matched.push(cur); |
| 3459 |
break; |
| 3460 |
} |
| 3461 |
} |
| 3462 |
} |
| 3463 |
} |
| 3464 |
|
| 3465 |
return this.pushStack( |
| 3466 |
matched.length > 1 ? jQuery.uniqueSort(matched) : matched |
| 3467 |
); |
| 3468 |
}, |
| 3469 |
|
| 3470 |
// Determine the position of an element within the set |
| 3471 |
index: function (elem) { |
| 3472 |
// No argument, return index in parent |
| 3473 |
if (!elem) { |
| 3474 |
return this[0] && this[0].parentNode |
| 3475 |
? this.first().prevAll().length |
| 3476 |
: -1; |
| 3477 |
} |
| 3478 |
|
| 3479 |
// Index in selector |
| 3480 |
if (typeof elem === "string") { |
| 3481 |
return indexOf.call(jQuery(elem), this[0]); |
| 3482 |
} |
| 3483 |
|
| 3484 |
// Locate the position of the desired element |
| 3485 |
return indexOf.call( |
| 3486 |
this, |
| 3487 |
|
| 3488 |
// If it receives a jQuery object, the first element is used |
| 3489 |
elem.jquery ? elem[0] : elem |
| 3490 |
); |
| 3491 |
}, |
| 3492 |
|
| 3493 |
add: function (selector, context) { |
| 3494 |
return this.pushStack( |
| 3495 |
jQuery.uniqueSort(jQuery.merge(this.get(), jQuery(selector, context))) |
| 3496 |
); |
| 3497 |
}, |
| 3498 |
|
| 3499 |
addBack: function (selector) { |
| 3500 |
return this.add( |
| 3501 |
selector == null ? this.prevObject : this.prevObject.filter(selector) |
| 3502 |
); |
| 3503 |
}, |
| 3504 |
}); |
| 3505 |
|
| 3506 |
function sibling(cur, dir) { |
| 3507 |
while ((cur = cur[dir]) && cur.nodeType !== 1) {} |
| 3508 |
return cur; |
| 3509 |
} |
| 3510 |
|
| 3511 |
jQuery.each( |
| 3512 |
{ |
| 3513 |
parent: function (elem) { |
| 3514 |
var parent = elem.parentNode; |
| 3515 |
return parent && parent.nodeType !== 11 ? parent : null; |
| 3516 |
}, |
| 3517 |
parents: function (elem) { |
| 3518 |
return dir(elem, "parentNode"); |
| 3519 |
}, |
| 3520 |
parentsUntil: function (elem, _i, until) { |
| 3521 |
return dir(elem, "parentNode", until); |
| 3522 |
}, |
| 3523 |
next: function (elem) { |
| 3524 |
return sibling(elem, "nextSibling"); |
| 3525 |
}, |
| 3526 |
prev: function (elem) { |
| 3527 |
return sibling(elem, "previousSibling"); |
| 3528 |
}, |
| 3529 |
nextAll: function (elem) { |
| 3530 |
return dir(elem, "nextSibling"); |
| 3531 |
}, |
| 3532 |
prevAll: function (elem) { |
| 3533 |
return dir(elem, "previousSibling"); |
| 3534 |
}, |
| 3535 |
nextUntil: function (elem, _i, until) { |
| 3536 |
return dir(elem, "nextSibling", until); |
| 3537 |
}, |
| 3538 |
prevUntil: function (elem, _i, until) { |
| 3539 |
return dir(elem, "previousSibling", until); |
| 3540 |
}, |
| 3541 |
siblings: function (elem) { |
| 3542 |
return siblings((elem.parentNode || {}).firstChild, elem); |
| 3543 |
}, |
| 3544 |
children: function (elem) { |
| 3545 |
return siblings(elem.firstChild); |
| 3546 |
}, |
| 3547 |
contents: function (elem) { |
| 3548 |
if ( |
| 3549 |
elem.contentDocument != null && |
| 3550 |
// Support: IE 11+ |
| 3551 |
// <object> elements with no `data` attribute has an object |
| 3552 |
// `contentDocument` with a `null` prototype. |
| 3553 |
getProto(elem.contentDocument) |
| 3554 |
) { |
| 3555 |
return elem.contentDocument; |
| 3556 |
} |
| 3557 |
|
| 3558 |
// Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only |
| 3559 |
// Treat the template element as a regular one in browsers that |
| 3560 |
// don't support it. |
| 3561 |
if (nodeName(elem, "template")) { |
| 3562 |
elem = elem.content || elem; |
| 3563 |
} |
| 3564 |
|
| 3565 |
return jQuery.merge([], elem.childNodes); |
| 3566 |
}, |
| 3567 |
}, |
| 3568 |
function (name, fn) { |
| 3569 |
jQuery.fn[name] = function (until, selector) { |
| 3570 |
var matched = jQuery.map(this, fn, until); |
| 3571 |
|
| 3572 |
if (name.slice(-5) !== "Until") { |
| 3573 |
selector = until; |
| 3574 |
} |
| 3575 |
|
| 3576 |
if (selector && typeof selector === "string") { |
| 3577 |
matched = jQuery.filter(selector, matched); |
| 3578 |
} |
| 3579 |
|
| 3580 |
if (this.length > 1) { |
| 3581 |
// Remove duplicates |
| 3582 |
if (!guaranteedUnique[name]) { |
| 3583 |
jQuery.uniqueSort(matched); |
| 3584 |
} |
| 3585 |
|
| 3586 |
// Reverse order for parents* and prev-derivatives |
| 3587 |
if (rparentsprev.test(name)) { |
| 3588 |
matched.reverse(); |
| 3589 |
} |
| 3590 |
} |
| 3591 |
|
| 3592 |
return this.pushStack(matched); |
| 3593 |
}; |
| 3594 |
} |
| 3595 |
); |
| 3596 |
var rnothtmlwhite = /[^\x20\t\r\n\f]+/g; |
| 3597 |
|
| 3598 |
// Convert String-formatted options into Object-formatted ones |
| 3599 |
function createOptions(options) { |
| 3600 |
var object = {}; |
| 3601 |
jQuery.each(options.match(rnothtmlwhite) || [], function (_, flag) { |
| 3602 |
object[flag] = true; |
| 3603 |
}); |
| 3604 |
return object; |
| 3605 |
} |
| 3606 |
|
| 3607 |
/* |
| 3608 |
* Create a callback list using the following parameters: |
| 3609 |
* |
| 3610 |
* options: an optional list of space-separated options that will change how |
| 3611 |
* the callback list behaves or a more traditional option object |
| 3612 |
* |
| 3613 |
* By default a callback list will act like an event callback list and can be |
| 3614 |
* "fired" multiple times. |
| 3615 |
* |
| 3616 |
* Possible options: |
| 3617 |
* |
| 3618 |
* once: will ensure the callback list can only be fired once (like a Deferred) |
| 3619 |
* |
| 3620 |
* memory: will keep track of previous values and will call any callback added |
| 3621 |
* after the list has been fired right away with the latest "memorized" |
| 3622 |
* values (like a Deferred) |
| 3623 |
* |
| 3624 |
* unique: will ensure a callback can only be added once (no duplicate in the list) |
| 3625 |
* |
| 3626 |
* stopOnFalse: interrupt callings when a callback returns false |
| 3627 |
* |
| 3628 |
*/ |
| 3629 |
jQuery.Callbacks = function (options) { |
| 3630 |
// Convert options from String-formatted to Object-formatted if needed |
| 3631 |
// (we check in cache first) |
| 3632 |
options = |
| 3633 |
typeof options === "string" |
| 3634 |
? createOptions(options) |
| 3635 |
: jQuery.extend({}, options); |
| 3636 |
|
| 3637 |
var // Flag to know if list is currently firing |
| 3638 |
firing, |
| 3639 |
// Last fire value for non-forgettable lists |
| 3640 |
memory, |
| 3641 |
// Flag to know if list was already fired |
| 3642 |
fired, |
| 3643 |
// Flag to prevent firing |
| 3644 |
locked, |
| 3645 |
// Actual callback list |
| 3646 |
list = [], |
| 3647 |
// Queue of execution data for repeatable lists |
| 3648 |
queue = [], |
| 3649 |
// Index of currently firing callback (modified by add/remove as needed) |
| 3650 |
firingIndex = -1, |
| 3651 |
// Fire callbacks |
| 3652 |
fire = function () { |
| 3653 |
// Enforce single-firing |
| 3654 |
locked = locked || options.once; |
| 3655 |
|
| 3656 |
// Execute callbacks for all pending executions, |
| 3657 |
// respecting firingIndex overrides and runtime changes |
| 3658 |
fired = firing = true; |
| 3659 |
for (; queue.length; firingIndex = -1) { |
| 3660 |
memory = queue.shift(); |
| 3661 |
while (++firingIndex < list.length) { |
| 3662 |
// Run callback and check for early termination |
| 3663 |
if ( |
| 3664 |
list[firingIndex].apply(memory[0], memory[1]) === false && |
| 3665 |
options.stopOnFalse |
| 3666 |
) { |
| 3667 |
// Jump to end and forget the data so .add doesn't re-fire |
| 3668 |
firingIndex = list.length; |
| 3669 |
memory = false; |
| 3670 |
} |
| 3671 |
} |
| 3672 |
} |
| 3673 |
|
| 3674 |
// Forget the data if we're done with it |
| 3675 |
if (!options.memory) { |
| 3676 |
memory = false; |
| 3677 |
} |
| 3678 |
|
| 3679 |
firing = false; |
| 3680 |
|
| 3681 |
// Clean up if we're done firing for good |
| 3682 |
if (locked) { |
| 3683 |
// Keep an empty list if we have data for future add calls |
| 3684 |
if (memory) { |
| 3685 |
list = []; |
| 3686 |
|
| 3687 |
// Otherwise, this object is spent |
| 3688 |
} else { |
| 3689 |
list = ""; |
| 3690 |
} |
| 3691 |
} |
| 3692 |
}, |
| 3693 |
// Actual Callbacks object |
| 3694 |
self = { |
| 3695 |
// Add a callback or a collection of callbacks to the list |
| 3696 |
add: function () { |
| 3697 |
if (list) { |
| 3698 |
// If we have memory from a past run, we should fire after adding |
| 3699 |
if (memory && !firing) { |
| 3700 |
firingIndex = list.length - 1; |
| 3701 |
queue.push(memory); |
| 3702 |
} |
| 3703 |
|
| 3704 |
(function add(args) { |
| 3705 |
jQuery.each(args, function (_, arg) { |
| 3706 |
if (isFunction(arg)) { |
| 3707 |
if (!options.unique || !self.has(arg)) { |
| 3708 |
list.push(arg); |
| 3709 |
} |
| 3710 |
} else if (arg && arg.length && toType(arg) !== "string") { |
| 3711 |
// Inspect recursively |
| 3712 |
add(arg); |
| 3713 |
} |
| 3714 |
}); |
| 3715 |
})(arguments); |
| 3716 |
|
| 3717 |
if (memory && !firing) { |
| 3718 |
fire(); |
| 3719 |
} |
| 3720 |
} |
| 3721 |
return this; |
| 3722 |
}, |
| 3723 |
|
| 3724 |
// Remove a callback from the list |
| 3725 |
remove: function () { |
| 3726 |
jQuery.each(arguments, function (_, arg) { |
| 3727 |
var index; |
| 3728 |
while ((index = jQuery.inArray(arg, list, index)) > -1) { |
| 3729 |
list.splice(index, 1); |
| 3730 |
|
| 3731 |
// Handle firing indexes |
| 3732 |
if (index <= firingIndex) { |
| 3733 |
firingIndex--; |
| 3734 |
} |
| 3735 |
} |
| 3736 |
}); |
| 3737 |
return this; |
| 3738 |
}, |
| 3739 |
|
| 3740 |
// Check if a given callback is in the list. |
| 3741 |
// If no argument is given, return whether or not list has callbacks attached. |
| 3742 |
has: function (fn) { |
| 3743 |
return fn ? jQuery.inArray(fn, list) > -1 : list.length > 0; |
| 3744 |
}, |
| 3745 |
|
| 3746 |
// Remove all callbacks from the list |
| 3747 |
empty: function () { |
| 3748 |
if (list) { |
| 3749 |
list = []; |
| 3750 |
} |
| 3751 |
return this; |
| 3752 |
}, |
| 3753 |
|
| 3754 |
// Disable .fire and .add |
| 3755 |
// Abort any current/pending executions |
| 3756 |
// Clear all callbacks and values |
| 3757 |
disable: function () { |
| 3758 |
locked = queue = []; |
| 3759 |
list = memory = ""; |
| 3760 |
return this; |
| 3761 |
}, |
| 3762 |
disabled: function () { |
| 3763 |
return !list; |
| 3764 |
}, |
| 3765 |
|
| 3766 |
// Disable .fire |
| 3767 |
// Also disable .add unless we have memory (since it would have no effect) |
| 3768 |
// Abort any pending executions |
| 3769 |
lock: function () { |
| 3770 |
locked = queue = []; |
| 3771 |
if (!memory && !firing) { |
| 3772 |
list = memory = ""; |
| 3773 |
} |
| 3774 |
return this; |
| 3775 |
}, |
| 3776 |
locked: function () { |
| 3777 |
return !!locked; |
| 3778 |
}, |
| 3779 |
|
| 3780 |
// Call all callbacks with the given context and arguments |
| 3781 |
fireWith: function (context, args) { |
| 3782 |
if (!locked) { |
| 3783 |
args = args || []; |
| 3784 |
args = [context, args.slice ? args.slice() : args]; |
| 3785 |
queue.push(args); |
| 3786 |
if (!firing) { |
| 3787 |
fire(); |
| 3788 |
} |
| 3789 |
} |
| 3790 |
return this; |
| 3791 |
}, |
| 3792 |
|
| 3793 |
// Call all the callbacks with the given arguments |
| 3794 |
fire: function () { |
| 3795 |
self.fireWith(this, arguments); |
| 3796 |
return this; |
| 3797 |
}, |
| 3798 |
|
| 3799 |
// To know if the callbacks have already been called at least once |
| 3800 |
fired: function () { |
| 3801 |
return !!fired; |
| 3802 |
}, |
| 3803 |
}; |
| 3804 |
|
| 3805 |
return self; |
| 3806 |
}; |
| 3807 |
|
| 3808 |
function Identity(v) { |
| 3809 |
return v; |
| 3810 |
} |
| 3811 |
function Thrower(ex) { |
| 3812 |
throw ex; |
| 3813 |
} |
| 3814 |
|
| 3815 |
function adoptValue(value, resolve, reject, noValue) { |
| 3816 |
var method; |
| 3817 |
|
| 3818 |
try { |
| 3819 |
// Check for promise aspect first to privilege synchronous behavior |
| 3820 |
if (value && isFunction((method = value.promise))) { |
| 3821 |
method.call(value).done(resolve).fail(reject); |
| 3822 |
|
| 3823 |
// Other thenables |
| 3824 |
} else if (value && isFunction((method = value.then))) { |
| 3825 |
method.call(value, resolve, reject); |
| 3826 |
|
| 3827 |
// Other non-thenables |
| 3828 |
} else { |
| 3829 |
// Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: |
| 3830 |
// * false: [ value ].slice( 0 ) => resolve( value ) |
| 3831 |
// * true: [ value ].slice( 1 ) => resolve() |
| 3832 |
resolve.apply(undefined, [value].slice(noValue)); |
| 3833 |
} |
| 3834 |
|
| 3835 |
// For Promises/A+, convert exceptions into rejections |
| 3836 |
// Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in |
| 3837 |
// Deferred#then to conditionally suppress rejection. |
| 3838 |
} catch (value) { |
| 3839 |
// Support: Android 4.0 only |
| 3840 |
// Strict mode functions invoked without .call/.apply get global-object context |
| 3841 |
reject.apply(undefined, [value]); |
| 3842 |
} |
| 3843 |
} |
| 3844 |
|
| 3845 |
jQuery.extend({ |
| 3846 |
Deferred: function (func) { |
| 3847 |
var tuples = [ |
| 3848 |
// action, add listener, callbacks, |
| 3849 |
// ... .then handlers, argument index, [final state] |
| 3850 |
[ |
| 3851 |
"notify", |
| 3852 |
"progress", |
| 3853 |
jQuery.Callbacks("memory"), |
| 3854 |
jQuery.Callbacks("memory"), |
| 3855 |
2, |
| 3856 |
], |
| 3857 |
[ |
| 3858 |
"resolve", |
| 3859 |
"done", |
| 3860 |
jQuery.Callbacks("once memory"), |
| 3861 |
jQuery.Callbacks("once memory"), |
| 3862 |
0, |
| 3863 |
"resolved", |
| 3864 |
], |
| 3865 |
[ |
| 3866 |
"reject", |
| 3867 |
"fail", |
| 3868 |
jQuery.Callbacks("once memory"), |
| 3869 |
jQuery.Callbacks("once memory"), |
| 3870 |
1, |
| 3871 |
"rejected", |
| 3872 |
], |
| 3873 |
], |
| 3874 |
state = "pending", |
| 3875 |
promise = { |
| 3876 |
state: function () { |
| 3877 |
return state; |
| 3878 |
}, |
| 3879 |
always: function () { |
| 3880 |
deferred.done(arguments).fail(arguments); |
| 3881 |
return this; |
| 3882 |
}, |
| 3883 |
catch: function (fn) { |
| 3884 |
return promise.then(null, fn); |
| 3885 |
}, |
| 3886 |
|
| 3887 |
// Keep pipe for back-compat |
| 3888 |
pipe: function (/* fnDone, fnFail, fnProgress */) { |
| 3889 |
var fns = arguments; |
| 3890 |
|
| 3891 |
return jQuery |
| 3892 |
.Deferred(function (newDefer) { |
| 3893 |
jQuery.each(tuples, function (_i, tuple) { |
| 3894 |
// Map tuples (progress, done, fail) to arguments (done, fail, progress) |
| 3895 |
var fn = isFunction(fns[tuple[4]]) && fns[tuple[4]]; |
| 3896 |
|
| 3897 |
// deferred.progress(function() { bind to newDefer or newDefer.notify }) |
| 3898 |
// deferred.done(function() { bind to newDefer or newDefer.resolve }) |
| 3899 |
// deferred.fail(function() { bind to newDefer or newDefer.reject }) |
| 3900 |
deferred[tuple[1]](function () { |
| 3901 |
var returned = fn && fn.apply(this, arguments); |
| 3902 |
if (returned && isFunction(returned.promise)) { |
| 3903 |
returned |
| 3904 |
.promise() |
| 3905 |
.progress(newDefer.notify) |
| 3906 |
.done(newDefer.resolve) |
| 3907 |
.fail(newDefer.reject); |
| 3908 |
} else { |
| 3909 |
newDefer[tuple[0] + "With"]( |
| 3910 |
this, |
| 3911 |
fn ? [returned] : arguments |
| 3912 |
); |
| 3913 |
} |
| 3914 |
}); |
| 3915 |
}); |
| 3916 |
fns = null; |
| 3917 |
}) |
| 3918 |
.promise(); |
| 3919 |
}, |
| 3920 |
then: function (onFulfilled, onRejected, onProgress) { |
| 3921 |
var maxDepth = 0; |
| 3922 |
function resolve(depth, deferred, handler, special) { |
| 3923 |
return function () { |
| 3924 |
var that = this, |
| 3925 |
args = arguments, |
| 3926 |
mightThrow = function () { |
| 3927 |
var returned, then; |
| 3928 |
|
| 3929 |
// Support: Promises/A+ section 2.3.3.3.3 |
| 3930 |
// https://promisesaplus.com/#point-59 |
| 3931 |
// Ignore double-resolution attempts |
| 3932 |
if (depth < maxDepth) { |
| 3933 |
return; |
| 3934 |
} |
| 3935 |
|
| 3936 |
returned = handler.apply(that, args); |
| 3937 |
|
| 3938 |
// Support: Promises/A+ section 2.3.1 |
| 3939 |
// https://promisesaplus.com/#point-48 |
| 3940 |
if (returned === deferred.promise()) { |
| 3941 |
throw new TypeError("Thenable self-resolution"); |
| 3942 |
} |
| 3943 |
|
| 3944 |
// Support: Promises/A+ sections 2.3.3.1, 3.5 |
| 3945 |
// https://promisesaplus.com/#point-54 |
| 3946 |
// https://promisesaplus.com/#point-75 |
| 3947 |
// Retrieve `then` only once |
| 3948 |
then = |
| 3949 |
returned && |
| 3950 |
// Support: Promises/A+ section 2.3.4 |
| 3951 |
// https://promisesaplus.com/#point-64 |
| 3952 |
// Only check objects and functions for thenability |
| 3953 |
(typeof returned === "object" || |
| 3954 |
typeof returned === "function") && |
| 3955 |
returned.then; |
| 3956 |
|
| 3957 |
// Handle a returned thenable |
| 3958 |
if (isFunction(then)) { |
| 3959 |
// Special processors (notify) just wait for resolution |
| 3960 |
if (special) { |
| 3961 |
then.call( |
| 3962 |
returned, |
| 3963 |
resolve(maxDepth, deferred, Identity, special), |
| 3964 |
resolve(maxDepth, deferred, Thrower, special) |
| 3965 |
); |
| 3966 |
|
| 3967 |
// Normal processors (resolve) also hook into progress |
| 3968 |
} else { |
| 3969 |
// ...and disregard older resolution values |
| 3970 |
maxDepth++; |
| 3971 |
|
| 3972 |
then.call( |
| 3973 |
returned, |
| 3974 |
resolve(maxDepth, deferred, Identity, special), |
| 3975 |
resolve(maxDepth, deferred, Thrower, special), |
| 3976 |
resolve( |
| 3977 |
maxDepth, |
| 3978 |
deferred, |
| 3979 |
Identity, |
| 3980 |
deferred.notifyWith |
| 3981 |
) |
| 3982 |
); |
| 3983 |
} |
| 3984 |
|
| 3985 |
// Handle all other returned values |
| 3986 |
} else { |
| 3987 |
// Only substitute handlers pass on context |
| 3988 |
// and multiple values (non-spec behavior) |
| 3989 |
if (handler !== Identity) { |
| 3990 |
that = undefined; |
| 3991 |
args = [returned]; |
| 3992 |
} |
| 3993 |
|
| 3994 |
// Process the value(s) |
| 3995 |
// Default process is resolve |
| 3996 |
(special || deferred.resolveWith)(that, args); |
| 3997 |
} |
| 3998 |
}, |
| 3999 |
// Only normal processors (resolve) catch and reject exceptions |
| 4000 |
process = special |
| 4001 |
? mightThrow |
| 4002 |
: function () { |
| 4003 |
try { |
| 4004 |
mightThrow(); |
| 4005 |
} catch (e) { |
| 4006 |
if (jQuery.Deferred.exceptionHook) { |
| 4007 |
jQuery.Deferred.exceptionHook( |
| 4008 |
e, |
| 4009 |
process.stackTrace |
| 4010 |
); |
| 4011 |
} |
| 4012 |
|
| 4013 |
// Support: Promises/A+ section 2.3.3.3.4.1 |
| 4014 |
// https://promisesaplus.com/#point-61 |
| 4015 |
// Ignore post-resolution exceptions |
| 4016 |
if (depth + 1 >= maxDepth) { |
| 4017 |
// Only substitute handlers pass on context |
| 4018 |
// and multiple values (non-spec behavior) |
| 4019 |
if (handler !== Thrower) { |
| 4020 |
that = undefined; |
| 4021 |
args = [e]; |
| 4022 |
} |
| 4023 |
|
| 4024 |
deferred.rejectWith(that, args); |
| 4025 |
} |
| 4026 |
} |
| 4027 |
}; |
| 4028 |
|
| 4029 |
// Support: Promises/A+ section 2.3.3.3.1 |
| 4030 |
// https://promisesaplus.com/#point-57 |
| 4031 |
// Re-resolve promises immediately to dodge false rejection from |
| 4032 |
// subsequent errors |
| 4033 |
if (depth) { |
| 4034 |
process(); |
| 4035 |
} else { |
| 4036 |
// Call an optional hook to record the stack, in case of exception |
| 4037 |
// since it's otherwise lost when execution goes async |
| 4038 |
if (jQuery.Deferred.getStackHook) { |
| 4039 |
process.stackTrace = jQuery.Deferred.getStackHook(); |
| 4040 |
} |
| 4041 |
window.setTimeout(process); |
| 4042 |
} |
| 4043 |
}; |
| 4044 |
} |
| 4045 |
|
| 4046 |
return jQuery |
| 4047 |
.Deferred(function (newDefer) { |
| 4048 |
// progress_handlers.add( ... ) |
| 4049 |
tuples[0][3].add( |
| 4050 |
resolve( |
| 4051 |
0, |
| 4052 |
newDefer, |
| 4053 |
isFunction(onProgress) ? onProgress : Identity, |
| 4054 |
newDefer.notifyWith |
| 4055 |
) |
| 4056 |
); |
| 4057 |
|
| 4058 |
// fulfilled_handlers.add( ... ) |
| 4059 |
tuples[1][3].add( |
| 4060 |
resolve( |
| 4061 |
0, |
| 4062 |
newDefer, |
| 4063 |
isFunction(onFulfilled) ? onFulfilled : Identity |
| 4064 |
) |
| 4065 |
); |
| 4066 |
|
| 4067 |
// rejected_handlers.add( ... ) |
| 4068 |
tuples[2][3].add( |
| 4069 |
resolve( |
| 4070 |
0, |
| 4071 |
newDefer, |
| 4072 |
isFunction(onRejected) ? onRejected : Thrower |
| 4073 |
) |
| 4074 |
); |
| 4075 |
}) |
| 4076 |
.promise(); |
| 4077 |
}, |
| 4078 |
|
| 4079 |
// Get a promise for this deferred |
| 4080 |
// If obj is provided, the promise aspect is added to the object |
| 4081 |
promise: function (obj) { |
| 4082 |
return obj != null ? jQuery.extend(obj, promise) : promise; |
| 4083 |
}, |
| 4084 |
}, |
| 4085 |
deferred = {}; |
| 4086 |
|
| 4087 |
// Add list-specific methods |
| 4088 |
jQuery.each(tuples, function (i, tuple) { |
| 4089 |
var list = tuple[2], |
| 4090 |
stateString = tuple[5]; |
| 4091 |
|
| 4092 |
// promise.progress = list.add |
| 4093 |
// promise.done = list.add |
| 4094 |
// promise.fail = list.add |
| 4095 |
promise[tuple[1]] = list.add; |
| 4096 |
|
| 4097 |
// Handle state |
| 4098 |
if (stateString) { |
| 4099 |
list.add( |
| 4100 |
function () { |
| 4101 |
// state = "resolved" (i.e., fulfilled) |
| 4102 |
// state = "rejected" |
| 4103 |
state = stateString; |
| 4104 |
}, |
| 4105 |
|
| 4106 |
// rejected_callbacks.disable |
| 4107 |
// fulfilled_callbacks.disable |
| 4108 |
tuples[3 - i][2].disable, |
| 4109 |
|
| 4110 |
// rejected_handlers.disable |
| 4111 |
// fulfilled_handlers.disable |
| 4112 |
tuples[3 - i][3].disable, |
| 4113 |
|
| 4114 |
// progress_callbacks.lock |
| 4115 |
tuples[0][2].lock, |
| 4116 |
|
| 4117 |
// progress_handlers.lock |
| 4118 |
tuples[0][3].lock |
| 4119 |
); |
| 4120 |
} |
| 4121 |
|
| 4122 |
// progress_handlers.fire |
| 4123 |
// fulfilled_handlers.fire |
| 4124 |
// rejected_handlers.fire |
| 4125 |
list.add(tuple[3].fire); |
| 4126 |
|
| 4127 |
// deferred.notify = function() { deferred.notifyWith(...) } |
| 4128 |
// deferred.resolve = function() { deferred.resolveWith(...) } |
| 4129 |
// deferred.reject = function() { deferred.rejectWith(...) } |
| 4130 |
deferred[tuple[0]] = function () { |
| 4131 |
deferred[tuple[0] + "With"]( |
| 4132 |
this === deferred ? undefined : this, |
| 4133 |
arguments |
| 4134 |
); |
| 4135 |
return this; |
| 4136 |
}; |
| 4137 |
|
| 4138 |
// deferred.notifyWith = list.fireWith |
| 4139 |
// deferred.resolveWith = list.fireWith |
| 4140 |
// deferred.rejectWith = list.fireWith |
| 4141 |
deferred[tuple[0] + "With"] = list.fireWith; |
| 4142 |
}); |
| 4143 |
|
| 4144 |
// Make the deferred a promise |
| 4145 |
promise.promise(deferred); |
| 4146 |
|
| 4147 |
// Call given func if any |
| 4148 |
if (func) { |
| 4149 |
func.call(deferred, deferred); |
| 4150 |
} |
| 4151 |
|
| 4152 |
// All done! |
| 4153 |
return deferred; |
| 4154 |
}, |
| 4155 |
|
| 4156 |
// Deferred helper |
| 4157 |
when: function (singleValue) { |
| 4158 |
var // count of uncompleted subordinates |
| 4159 |
remaining = arguments.length, |
| 4160 |
// count of unprocessed arguments |
| 4161 |
i = remaining, |
| 4162 |
// subordinate fulfillment data |
| 4163 |
resolveContexts = Array(i), |
| 4164 |
resolveValues = slice.call(arguments), |
| 4165 |
// the primary Deferred |
| 4166 |
primary = jQuery.Deferred(), |
| 4167 |
// subordinate callback factory |
| 4168 |
updateFunc = function (i) { |
| 4169 |
return function (value) { |
| 4170 |
resolveContexts[i] = this; |
| 4171 |
resolveValues[i] = |
| 4172 |
arguments.length > 1 ? slice.call(arguments) : value; |
| 4173 |
if (!--remaining) { |
| 4174 |
primary.resolveWith(resolveContexts, resolveValues); |
| 4175 |
} |
| 4176 |
}; |
| 4177 |
}; |
| 4178 |
|
| 4179 |
// Single- and empty arguments are adopted like Promise.resolve |
| 4180 |
if (remaining <= 1) { |
| 4181 |
adoptValue( |
| 4182 |
singleValue, |
| 4183 |
primary.done(updateFunc(i)).resolve, |
| 4184 |
primary.reject, |
| 4185 |
!remaining |
| 4186 |
); |
| 4187 |
|
| 4188 |
// Use .then() to unwrap secondary thenables (cf. gh-3000) |
| 4189 |
if ( |
| 4190 |
primary.state() === "pending" || |
| 4191 |
isFunction(resolveValues[i] && resolveValues[i].then) |
| 4192 |
) { |
| 4193 |
return primary.then(); |
| 4194 |
} |
| 4195 |
} |
| 4196 |
|
| 4197 |
// Multiple arguments are aggregated like Promise.all array elements |
| 4198 |
while (i--) { |
| 4199 |
adoptValue(resolveValues[i], updateFunc(i), primary.reject); |
| 4200 |
} |
| 4201 |
|
| 4202 |
return primary.promise(); |
| 4203 |
}, |
| 4204 |
}); |
| 4205 |
|
| 4206 |
// These usually indicate a programmer mistake during development, |
| 4207 |
// warn about them ASAP rather than swallowing them by default. |
| 4208 |
var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; |
| 4209 |
|
| 4210 |
jQuery.Deferred.exceptionHook = function (error, stack) { |
| 4211 |
// Support: IE 8 - 9 only |
| 4212 |
// Console exists when dev tools are open, which can happen at any time |
| 4213 |
if ( |
| 4214 |
window.console && |
| 4215 |
window.console.warn && |
| 4216 |
error && |
| 4217 |
rerrorNames.test(error.name) |
| 4218 |
) { |
| 4219 |
window.console.warn( |
| 4220 |
"jQuery.Deferred exception: " + error.message, |
| 4221 |
error.stack, |
| 4222 |
stack |
| 4223 |
); |
| 4224 |
} |
| 4225 |
}; |
| 4226 |
|
| 4227 |
jQuery.readyException = function (error) { |
| 4228 |
window.setTimeout(function () { |
| 4229 |
throw error; |
| 4230 |
}); |
| 4231 |
}; |
| 4232 |
|
| 4233 |
// The deferred used on DOM ready |
| 4234 |
var readyList = jQuery.Deferred(); |
| 4235 |
|
| 4236 |
jQuery.fn.ready = function (fn) { |
| 4237 |
readyList |
| 4238 |
.then(fn) |
| 4239 |
|
| 4240 |
// Wrap jQuery.readyException in a function so that the lookup |
| 4241 |
// happens at the time of error handling instead of callback |
| 4242 |
// registration. |
| 4243 |
.catch(function (error) { |
| 4244 |
jQuery.readyException(error); |
| 4245 |
}); |
| 4246 |
|
| 4247 |
return this; |
| 4248 |
}; |
| 4249 |
|
| 4250 |
jQuery.extend({ |
| 4251 |
// Is the DOM ready to be used? Set to true once it occurs. |
| 4252 |
isReady: false, |
| 4253 |
|
| 4254 |
// A counter to track how many items to wait for before |
| 4255 |
// the ready event fires. See #6781 |
| 4256 |
readyWait: 1, |
| 4257 |
|
| 4258 |
// Handle when the DOM is ready |
| 4259 |
ready: function (wait) { |
| 4260 |
// Abort if there are pending holds or we're already ready |
| 4261 |
if (wait === true ? --jQuery.readyWait : jQuery.isReady) { |
| 4262 |
return; |
| 4263 |
} |
| 4264 |
|
| 4265 |
// Remember that the DOM is ready |
| 4266 |
jQuery.isReady = true; |
| 4267 |
|
| 4268 |
// If a normal DOM Ready event fired, decrement, and wait if need be |
| 4269 |
if (wait !== true && --jQuery.readyWait > 0) { |
| 4270 |
return; |
| 4271 |
} |
| 4272 |
|
| 4273 |
// If there are functions bound, to execute |
| 4274 |
readyList.resolveWith(document, [jQuery]); |
| 4275 |
}, |
| 4276 |
}); |
| 4277 |
|
| 4278 |
jQuery.ready.then = readyList.then; |
| 4279 |
|
| 4280 |
// The ready event handler and self cleanup method |
| 4281 |
function completed() { |
| 4282 |
document.removeEventListener("DOMContentLoaded", completed); |
| 4283 |
window.removeEventListener("load", completed); |
| 4284 |
jQuery.ready(); |
| 4285 |
} |
| 4286 |
|
| 4287 |
// Catch cases where $(document).ready() is called |
| 4288 |
// after the browser event has already occurred. |
| 4289 |
// Support: IE <=9 - 10 only |
| 4290 |
// Older IE sometimes signals "interactive" too soon |
| 4291 |
if ( |
| 4292 |
document.readyState === "complete" || |
| 4293 |
(document.readyState !== "loading" && !document.documentElement.doScroll) |
| 4294 |
) { |
| 4295 |
// Handle it asynchronously to allow scripts the opportunity to delay ready |
| 4296 |
window.setTimeout(jQuery.ready); |
| 4297 |
} else { |
| 4298 |
// Use the handy event callback |
| 4299 |
document.addEventListener("DOMContentLoaded", completed); |
| 4300 |
|
| 4301 |
// A fallback to window.onload, that will always work |
| 4302 |
window.addEventListener("load", completed); |
| 4303 |
} |
| 4304 |
|
| 4305 |
// Multifunctional method to get and set values of a collection |
| 4306 |
// The value/s can optionally be executed if it's a function |
| 4307 |
var access = function (elems, fn, key, value, chainable, emptyGet, raw) { |
| 4308 |
var i = 0, |
| 4309 |
len = elems.length, |
| 4310 |
bulk = key == null; |
| 4311 |
|
| 4312 |
// Sets many values |
| 4313 |
if (toType(key) === "object") { |
| 4314 |
chainable = true; |
| 4315 |
for (i in key) { |
| 4316 |
access(elems, fn, i, key[i], true, emptyGet, raw); |
| 4317 |
} |
| 4318 |
|
| 4319 |
// Sets one value |
| 4320 |
} else if (value !== undefined) { |
| 4321 |
chainable = true; |
| 4322 |
|
| 4323 |
if (!isFunction(value)) { |
| 4324 |
raw = true; |
| 4325 |
} |
| 4326 |
|
| 4327 |
if (bulk) { |
| 4328 |
// Bulk operations run against the entire set |
| 4329 |
if (raw) { |
| 4330 |
fn.call(elems, value); |
| 4331 |
fn = null; |
| 4332 |
|
| 4333 |
// ...except when executing function values |
| 4334 |
} else { |
| 4335 |
bulk = fn; |
| 4336 |
fn = function (elem, _key, value) { |
| 4337 |
return bulk.call(jQuery(elem), value); |
| 4338 |
}; |
| 4339 |
} |
| 4340 |
} |
| 4341 |
|
| 4342 |
if (fn) { |
| 4343 |
for (; i < len; i++) { |
| 4344 |
fn( |
| 4345 |
elems[i], |
| 4346 |
key, |
| 4347 |
raw ? value : value.call(elems[i], i, fn(elems[i], key)) |
| 4348 |
); |
| 4349 |
} |
| 4350 |
} |
| 4351 |
} |
| 4352 |
|
| 4353 |
if (chainable) { |
| 4354 |
return elems; |
| 4355 |
} |
| 4356 |
|
| 4357 |
// Gets |
| 4358 |
if (bulk) { |
| 4359 |
return fn.call(elems); |
| 4360 |
} |
| 4361 |
|
| 4362 |
return len ? fn(elems[0], key) : emptyGet; |
| 4363 |
}; |
| 4364 |
|
| 4365 |
// Matches dashed string for camelizing |
| 4366 |
var rmsPrefix = /^-ms-/, |
| 4367 |
rdashAlpha = /-([a-z])/g; |
| 4368 |
|
| 4369 |
// Used by camelCase as callback to replace() |
| 4370 |
function fcamelCase(_all, letter) { |
| 4371 |
return letter.toUpperCase(); |
| 4372 |
} |
| 4373 |
|
| 4374 |
// Convert dashed to camelCase; used by the css and data modules |
| 4375 |
// Support: IE <=9 - 11, Edge 12 - 15 |
| 4376 |
// Microsoft forgot to hump their vendor prefix (#9572) |
| 4377 |
function camelCase(string) { |
| 4378 |
return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase); |
| 4379 |
} |
| 4380 |
var acceptData = function (owner) { |
| 4381 |
// Accepts only: |
| 4382 |
// - Node |
| 4383 |
// - Node.ELEMENT_NODE |
| 4384 |
// - Node.DOCUMENT_NODE |
| 4385 |
// - Object |
| 4386 |
// - Any |
| 4387 |
return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType; |
| 4388 |
}; |
| 4389 |
|
| 4390 |
function Data() { |
| 4391 |
this.expando = jQuery.expando + Data.uid++; |
| 4392 |
} |
| 4393 |
|
| 4394 |
Data.uid = 1; |
| 4395 |
|
| 4396 |
Data.prototype = { |
| 4397 |
cache: function (owner) { |
| 4398 |
// Check if the owner object already has a cache |
| 4399 |
var value = owner[this.expando]; |
| 4400 |
|
| 4401 |
// If not, create one |
| 4402 |
if (!value) { |
| 4403 |
value = {}; |
| 4404 |
|
| 4405 |
// We can accept data for non-element nodes in modern browsers, |
| 4406 |
// but we should not, see #8335. |
| 4407 |
// Always return an empty object. |
| 4408 |
if (acceptData(owner)) { |
| 4409 |
// If it is a node unlikely to be stringify-ed or looped over |
| 4410 |
// use plain assignment |
| 4411 |
if (owner.nodeType) { |
| 4412 |
owner[this.expando] = value; |
| 4413 |
|
| 4414 |
// Otherwise secure it in a non-enumerable property |
| 4415 |
// configurable must be true to allow the property to be |
| 4416 |
// deleted when data is removed |
| 4417 |
} else { |
| 4418 |
Object.defineProperty(owner, this.expando, { |
| 4419 |
value: value, |
| 4420 |
configurable: true, |
| 4421 |
}); |
| 4422 |
} |
| 4423 |
} |
| 4424 |
} |
| 4425 |
|
| 4426 |
return value; |
| 4427 |
}, |
| 4428 |
set: function (owner, data, value) { |
| 4429 |
var prop, |
| 4430 |
cache = this.cache(owner); |
| 4431 |
|
| 4432 |
// Handle: [ owner, key, value ] args |
| 4433 |
// Always use camelCase key (gh-2257) |
| 4434 |
if (typeof data === "string") { |
| 4435 |
cache[camelCase(data)] = value; |
| 4436 |
|
| 4437 |
// Handle: [ owner, { properties } ] args |
| 4438 |
} else { |
| 4439 |
// Copy the properties one-by-one to the cache object |
| 4440 |
for (prop in data) { |
| 4441 |
cache[camelCase(prop)] = data[prop]; |
| 4442 |
} |
| 4443 |
} |
| 4444 |
return cache; |
| 4445 |
}, |
| 4446 |
get: function (owner, key) { |
| 4447 |
return key === undefined |
| 4448 |
? this.cache(owner) |
| 4449 |
: // Always use camelCase key (gh-2257) |
| 4450 |
owner[this.expando] && owner[this.expando][camelCase(key)]; |
| 4451 |
}, |
| 4452 |
access: function (owner, key, value) { |
| 4453 |
// In cases where either: |
| 4454 |
// |
| 4455 |
// 1. No key was specified |
| 4456 |
// 2. A string key was specified, but no value provided |
| 4457 |
// |
| 4458 |
// Take the "read" path and allow the get method to determine |
| 4459 |
// which value to return, respectively either: |
| 4460 |
// |
| 4461 |
// 1. The entire cache object |
| 4462 |
// 2. The data stored at the key |
| 4463 |
// |
| 4464 |
if ( |
| 4465 |
key === undefined || |
| 4466 |
(key && typeof key === "string" && value === undefined) |
| 4467 |
) { |
| 4468 |
return this.get(owner, key); |
| 4469 |
} |
| 4470 |
|
| 4471 |
// When the key is not a string, or both a key and value |
| 4472 |
// are specified, set or extend (existing objects) with either: |
| 4473 |
// |
| 4474 |
// 1. An object of properties |
| 4475 |
// 2. A key and value |
| 4476 |
// |
| 4477 |
this.set(owner, key, value); |
| 4478 |
|
| 4479 |
// Since the "set" path can have two possible entry points |
| 4480 |
// return the expected data based on which path was taken[*] |
| 4481 |
return value !== undefined ? value : key; |
| 4482 |
}, |
| 4483 |
remove: function (owner, key) { |
| 4484 |
var i, |
| 4485 |
cache = owner[this.expando]; |
| 4486 |
|
| 4487 |
if (cache === undefined) { |
| 4488 |
return; |
| 4489 |
} |
| 4490 |
|
| 4491 |
if (key !== undefined) { |
| 4492 |
// Support array or space separated string of keys |
| 4493 |
if (Array.isArray(key)) { |
| 4494 |
// If key is an array of keys... |
| 4495 |
// We always set camelCase keys, so remove that. |
| 4496 |
key = key.map(camelCase); |
| 4497 |
} else { |
| 4498 |
key = camelCase(key); |
| 4499 |
|
| 4500 |
// If a key with the spaces exists, use it. |
| 4501 |
// Otherwise, create an array by matching non-whitespace |
| 4502 |
key = key in cache ? [key] : key.match(rnothtmlwhite) || []; |
| 4503 |
} |
| 4504 |
|
| 4505 |
i = key.length; |
| 4506 |
|
| 4507 |
while (i--) { |
| 4508 |
delete cache[key[i]]; |
| 4509 |
} |
| 4510 |
} |
| 4511 |
|
| 4512 |
// Remove the expando if there's no more data |
| 4513 |
if (key === undefined || jQuery.isEmptyObject(cache)) { |
| 4514 |
// Support: Chrome <=35 - 45 |
| 4515 |
// Webkit & Blink performance suffers when deleting properties |
| 4516 |
// from DOM nodes, so set to undefined instead |
| 4517 |
// https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) |
| 4518 |
if (owner.nodeType) { |
| 4519 |
owner[this.expando] = undefined; |
| 4520 |
} else { |
| 4521 |
delete owner[this.expando]; |
| 4522 |
} |
| 4523 |
} |
| 4524 |
}, |
| 4525 |
hasData: function (owner) { |
| 4526 |
var cache = owner[this.expando]; |
| 4527 |
return cache !== undefined && !jQuery.isEmptyObject(cache); |
| 4528 |
}, |
| 4529 |
}; |
| 4530 |
var dataPriv = new Data(); |
| 4531 |
|
| 4532 |
var dataUser = new Data(); |
| 4533 |
|
| 4534 |
// Implementation Summary |
| 4535 |
// |
| 4536 |
// 1. Enforce API surface and semantic compatibility with 1.9.x branch |
| 4537 |
// 2. Improve the module's maintainability by reducing the storage |
| 4538 |
// paths to a single mechanism. |
| 4539 |
// 3. Use the same single mechanism to support "private" and "user" data. |
| 4540 |
// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) |
| 4541 |
// 5. Avoid exposing implementation details on user objects (eg. expando properties) |
| 4542 |
// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 |
| 4543 |
|
| 4544 |
var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, |
| 4545 |
rmultiDash = /[A-Z]/g; |
| 4546 |
|
| 4547 |
function getData(data) { |
| 4548 |
if (data === "true") { |
| 4549 |
return true; |
| 4550 |
} |
| 4551 |
|
| 4552 |
if (data === "false") { |
| 4553 |
return false; |
| 4554 |
} |
| 4555 |
|
| 4556 |
if (data === "null") { |
| 4557 |
return null; |
| 4558 |
} |
| 4559 |
|
| 4560 |
// Only convert to a number if it doesn't change the string |
| 4561 |
if (data === +data + "") { |
| 4562 |
return +data; |
| 4563 |
} |
| 4564 |
|
| 4565 |
if (rbrace.test(data)) { |
| 4566 |
return JSON.parse(data); |
| 4567 |
} |
| 4568 |
|
| 4569 |
return data; |
| 4570 |
} |
| 4571 |
|
| 4572 |
function dataAttr(elem, key, data) { |
| 4573 |
var name; |
| 4574 |
|
| 4575 |
// If nothing was found internally, try to fetch any |
| 4576 |
// data from the HTML5 data-* attribute |
| 4577 |
if (data === undefined && elem.nodeType === 1) { |
| 4578 |
name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase(); |
| 4579 |
data = elem.getAttribute(name); |
| 4580 |
|
| 4581 |
if (typeof data === "string") { |
| 4582 |
try { |
| 4583 |
data = getData(data); |
| 4584 |
} catch (e) {} |
| 4585 |
|
| 4586 |
// Make sure we set the data so it isn't changed later |
| 4587 |
dataUser.set(elem, key, data); |
| 4588 |
} else { |
| 4589 |
data = undefined; |
| 4590 |
} |
| 4591 |
} |
| 4592 |
return data; |
| 4593 |
} |
| 4594 |
|
| 4595 |
jQuery.extend({ |
| 4596 |
hasData: function (elem) { |
| 4597 |
return dataUser.hasData(elem) || dataPriv.hasData(elem); |
| 4598 |
}, |
| 4599 |
|
| 4600 |
data: function (elem, name, data) { |
| 4601 |
return dataUser.access(elem, name, data); |
| 4602 |
}, |
| 4603 |
|
| 4604 |
removeData: function (elem, name) { |
| 4605 |
dataUser.remove(elem, name); |
| 4606 |
}, |
| 4607 |
|
| 4608 |
// TODO: Now that all calls to _data and _removeData have been replaced |
| 4609 |
// with direct calls to dataPriv methods, these can be deprecated. |
| 4610 |
_data: function (elem, name, data) { |
| 4611 |
return dataPriv.access(elem, name, data); |
| 4612 |
}, |
| 4613 |
|
| 4614 |
_removeData: function (elem, name) { |
| 4615 |
dataPriv.remove(elem, name); |
| 4616 |
}, |
| 4617 |
}); |
| 4618 |
|
| 4619 |
jQuery.fn.extend({ |
| 4620 |
data: function (key, value) { |
| 4621 |
var i, |
| 4622 |
name, |
| 4623 |
data, |
| 4624 |
elem = this[0], |
| 4625 |
attrs = elem && elem.attributes; |
| 4626 |
|
| 4627 |
// Gets all values |
| 4628 |
if (key === undefined) { |
| 4629 |
if (this.length) { |
| 4630 |
data = dataUser.get(elem); |
| 4631 |
|
| 4632 |
if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) { |
| 4633 |
i = attrs.length; |
| 4634 |
while (i--) { |
| 4635 |
// Support: IE 11 only |
| 4636 |
// The attrs elements can be null (#14894) |
| 4637 |
if (attrs[i]) { |
| 4638 |
name = attrs[i].name; |
| 4639 |
if (name.indexOf("data-") === 0) { |
| 4640 |
name = camelCase(name.slice(5)); |
| 4641 |
dataAttr(elem, name, data[name]); |
| 4642 |
} |
| 4643 |
} |
| 4644 |
} |
| 4645 |
dataPriv.set(elem, "hasDataAttrs", true); |
| 4646 |
} |
| 4647 |
} |
| 4648 |
|
| 4649 |
return data; |
| 4650 |
} |
| 4651 |
|
| 4652 |
// Sets multiple values |
| 4653 |
if (typeof key === "object") { |
| 4654 |
return this.each(function () { |
| 4655 |
dataUser.set(this, key); |
| 4656 |
}); |
| 4657 |
} |
| 4658 |
|
| 4659 |
return access( |
| 4660 |
this, |
| 4661 |
function (value) { |
| 4662 |
var data; |
| 4663 |
|
| 4664 |
// The calling jQuery object (element matches) is not empty |
| 4665 |
// (and therefore has an element appears at this[ 0 ]) and the |
| 4666 |
// `value` parameter was not undefined. An empty jQuery object |
| 4667 |
// will result in `undefined` for elem = this[ 0 ] which will |
| 4668 |
// throw an exception if an attempt to read a data cache is made. |
| 4669 |
if (elem && value === undefined) { |
| 4670 |
// Attempt to get data from the cache |
| 4671 |
// The key will always be camelCased in Data |
| 4672 |
data = dataUser.get(elem, key); |
| 4673 |
if (data !== undefined) { |
| 4674 |
return data; |
| 4675 |
} |
| 4676 |
|
| 4677 |
// Attempt to "discover" the data in |
| 4678 |
// HTML5 custom data-* attrs |
| 4679 |
data = dataAttr(elem, key); |
| 4680 |
if (data !== undefined) { |
| 4681 |
return data; |
| 4682 |
} |
| 4683 |
|
| 4684 |
// We tried really hard, but the data doesn't exist. |
| 4685 |
return; |
| 4686 |
} |
| 4687 |
|
| 4688 |
// Set the data... |
| 4689 |
this.each(function () { |
| 4690 |
// We always store the camelCased key |
| 4691 |
dataUser.set(this, key, value); |
| 4692 |
}); |
| 4693 |
}, |
| 4694 |
null, |
| 4695 |
value, |
| 4696 |
arguments.length > 1, |
| 4697 |
null, |
| 4698 |
true |
| 4699 |
); |
| 4700 |
}, |
| 4701 |
|
| 4702 |
removeData: function (key) { |
| 4703 |
return this.each(function () { |
| 4704 |
dataUser.remove(this, key); |
| 4705 |
}); |
| 4706 |
}, |
| 4707 |
}); |
| 4708 |
|
| 4709 |
jQuery.extend({ |
| 4710 |
queue: function (elem, type, data) { |
| 4711 |
var queue; |
| 4712 |
|
| 4713 |
if (elem) { |
| 4714 |
type = (type || "fx") + "queue"; |
| 4715 |
queue = dataPriv.get(elem, type); |
| 4716 |
|
| 4717 |
// Speed up dequeue by getting out quickly if this is just a lookup |
| 4718 |
if (data) { |
| 4719 |
if (!queue || Array.isArray(data)) { |
| 4720 |
queue = dataPriv.access(elem, type, jQuery.makeArray(data)); |
| 4721 |
} else { |
| 4722 |
queue.push(data); |
| 4723 |
} |
| 4724 |
} |
| 4725 |
return queue || []; |
| 4726 |
} |
| 4727 |
}, |
| 4728 |
|
| 4729 |
dequeue: function (elem, type) { |
| 4730 |
type = type || "fx"; |
| 4731 |
|
| 4732 |
var queue = jQuery.queue(elem, type), |
| 4733 |
startLength = queue.length, |
| 4734 |
fn = queue.shift(), |
| 4735 |
hooks = jQuery._queueHooks(elem, type), |
| 4736 |
next = function () { |
| 4737 |
jQuery.dequeue(elem, type); |
| 4738 |
}; |
| 4739 |
|
| 4740 |
// If the fx queue is dequeued, always remove the progress sentinel |
| 4741 |
if (fn === "inprogress") { |
| 4742 |
fn = queue.shift(); |
| 4743 |
startLength--; |
| 4744 |
} |
| 4745 |
|
| 4746 |
if (fn) { |
| 4747 |
// Add a progress sentinel to prevent the fx queue from being |
| 4748 |
// automatically dequeued |
| 4749 |
if (type === "fx") { |
| 4750 |
queue.unshift("inprogress"); |
| 4751 |
} |
| 4752 |
|
| 4753 |
// Clear up the last queue stop function |
| 4754 |
delete hooks.stop; |
| 4755 |
fn.call(elem, next, hooks); |
| 4756 |
} |
| 4757 |
|
| 4758 |
if (!startLength && hooks) { |
| 4759 |
hooks.empty.fire(); |
| 4760 |
} |
| 4761 |
}, |
| 4762 |
|
| 4763 |
// Not public - generate a queueHooks object, or return the current one |
| 4764 |
_queueHooks: function (elem, type) { |
| 4765 |
var key = type + "queueHooks"; |
| 4766 |
return ( |
| 4767 |
dataPriv.get(elem, key) || |
| 4768 |
dataPriv.access(elem, key, { |
| 4769 |
empty: jQuery.Callbacks("once memory").add(function () { |
| 4770 |
dataPriv.remove(elem, [type + "queue", key]); |
| 4771 |
}), |
| 4772 |
}) |
| 4773 |
); |
| 4774 |
}, |
| 4775 |
}); |
| 4776 |
|
| 4777 |
jQuery.fn.extend({ |
| 4778 |
queue: function (type, data) { |
| 4779 |
var setter = 2; |
| 4780 |
|
| 4781 |
if (typeof type !== "string") { |
| 4782 |
data = type; |
| 4783 |
type = "fx"; |
| 4784 |
setter--; |
| 4785 |
} |
| 4786 |
|
| 4787 |
if (arguments.length < setter) { |
| 4788 |
return jQuery.queue(this[0], type); |
| 4789 |
} |
| 4790 |
|
| 4791 |
return data === undefined |
| 4792 |
? this |
| 4793 |
: this.each(function () { |
| 4794 |
var queue = jQuery.queue(this, type, data); |
| 4795 |
|
| 4796 |
// Ensure a hooks for this queue |
| 4797 |
jQuery._queueHooks(this, type); |
| 4798 |
|
| 4799 |
if (type === "fx" && queue[0] !== "inprogress") { |
| 4800 |
jQuery.dequeue(this, type); |
| 4801 |
} |
| 4802 |
}); |
| 4803 |
}, |
| 4804 |
dequeue: function (type) { |
| 4805 |
return this.each(function () { |
| 4806 |
jQuery.dequeue(this, type); |
| 4807 |
}); |
| 4808 |
}, |
| 4809 |
clearQueue: function (type) { |
| 4810 |
return this.queue(type || "fx", []); |
| 4811 |
}, |
| 4812 |
|
| 4813 |
// Get a promise resolved when queues of a certain type |
| 4814 |
// are emptied (fx is the type by default) |
| 4815 |
promise: function (type, obj) { |
| 4816 |
var tmp, |
| 4817 |
count = 1, |
| 4818 |
defer = jQuery.Deferred(), |
| 4819 |
elements = this, |
| 4820 |
i = this.length, |
| 4821 |
resolve = function () { |
| 4822 |
if (!--count) { |
| 4823 |
defer.resolveWith(elements, [elements]); |
| 4824 |
} |
| 4825 |
}; |
| 4826 |
|
| 4827 |
if (typeof type !== "string") { |
| 4828 |
obj = type; |
| 4829 |
type = undefined; |
| 4830 |
} |
| 4831 |
type = type || "fx"; |
| 4832 |
|
| 4833 |
while (i--) { |
| 4834 |
tmp = dataPriv.get(elements[i], type + "queueHooks"); |
| 4835 |
if (tmp && tmp.empty) { |
| 4836 |
count++; |
| 4837 |
tmp.empty.add(resolve); |
| 4838 |
} |
| 4839 |
} |
| 4840 |
resolve(); |
| 4841 |
return defer.promise(obj); |
| 4842 |
}, |
| 4843 |
}); |
| 4844 |
var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source; |
| 4845 |
|
| 4846 |
var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i"); |
| 4847 |
|
| 4848 |
var cssExpand = ["Top", "Right", "Bottom", "Left"]; |
| 4849 |
|
| 4850 |
var documentElement = document.documentElement; |
| 4851 |
|
| 4852 |
var isAttached = function (elem) { |
| 4853 |
return jQuery.contains(elem.ownerDocument, elem); |
| 4854 |
}, |
| 4855 |
composed = { composed: true }; |
| 4856 |
|
| 4857 |
// Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only |
| 4858 |
// Check attachment across shadow DOM boundaries when possible (gh-3504) |
| 4859 |
// Support: iOS 10.0-10.2 only |
| 4860 |
// Early iOS 10 versions support `attachShadow` but not `getRootNode`, |
| 4861 |
// leading to errors. We need to check for `getRootNode`. |
| 4862 |
if (documentElement.getRootNode) { |
| 4863 |
isAttached = function (elem) { |
| 4864 |
return ( |
| 4865 |
jQuery.contains(elem.ownerDocument, elem) || |
| 4866 |
elem.getRootNode(composed) === elem.ownerDocument |
| 4867 |
); |
| 4868 |
}; |
| 4869 |
} |
| 4870 |
var isHiddenWithinTree = function (elem, el) { |
| 4871 |
// isHiddenWithinTree might be called from jQuery#filter function; |
| 4872 |
// in that case, element will be second argument |
| 4873 |
elem = el || elem; |
| 4874 |
|
| 4875 |
// Inline style trumps all |
| 4876 |
return ( |
| 4877 |
elem.style.display === "none" || |
| 4878 |
(elem.style.display === "" && |
| 4879 |
// Otherwise, check computed style |
| 4880 |
// Support: Firefox <=43 - 45 |
| 4881 |
// Disconnected elements can have computed display: none, so first confirm that elem is |
| 4882 |
// in the document. |
| 4883 |
isAttached(elem) && |
| 4884 |
jQuery.css(elem, "display") === "none") |
| 4885 |
); |
| 4886 |
}; |
| 4887 |
|
| 4888 |
function adjustCSS(elem, prop, valueParts, tween) { |
| 4889 |
var adjusted, |
| 4890 |
scale, |
| 4891 |
maxIterations = 20, |
| 4892 |
currentValue = tween |
| 4893 |
? function () { |
| 4894 |
return tween.cur(); |
| 4895 |
} |
| 4896 |
: function () { |
| 4897 |
return jQuery.css(elem, prop, ""); |
| 4898 |
}, |
| 4899 |
initial = currentValue(), |
| 4900 |
unit = |
| 4901 |
(valueParts && valueParts[3]) || (jQuery.cssNumber[prop] ? "" : "px"), |
| 4902 |
// Starting value computation is required for potential unit mismatches |
| 4903 |
initialInUnit = |
| 4904 |
elem.nodeType && |
| 4905 |
(jQuery.cssNumber[prop] || (unit !== "px" && +initial)) && |
| 4906 |
rcssNum.exec(jQuery.css(elem, prop)); |
| 4907 |
|
| 4908 |
if (initialInUnit && initialInUnit[3] !== unit) { |
| 4909 |
// Support: Firefox <=54 |
| 4910 |
// Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) |
| 4911 |
initial = initial / 2; |
| 4912 |
|
| 4913 |
// Trust units reported by jQuery.css |
| 4914 |
unit = unit || initialInUnit[3]; |
| 4915 |
|
| 4916 |
// Iteratively approximate from a nonzero starting point |
| 4917 |
initialInUnit = +initial || 1; |
| 4918 |
|
| 4919 |
while (maxIterations--) { |
| 4920 |
// Evaluate and update our best guess (doubling guesses that zero out). |
| 4921 |
// Finish if the scale equals or crosses 1 (making the old*new product non-positive). |
| 4922 |
jQuery.style(elem, prop, initialInUnit + unit); |
| 4923 |
if ( |
| 4924 |
(1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= |
| 4925 |
0 |
| 4926 |
) { |
| 4927 |
maxIterations = 0; |
| 4928 |
} |
| 4929 |
initialInUnit = initialInUnit / scale; |
| 4930 |
} |
| 4931 |
|
| 4932 |
initialInUnit = initialInUnit * 2; |
| 4933 |
jQuery.style(elem, prop, initialInUnit + unit); |
| 4934 |
|
| 4935 |
// Make sure we update the tween properties later on |
| 4936 |
valueParts = valueParts || []; |
| 4937 |
} |
| 4938 |
|
| 4939 |
if (valueParts) { |
| 4940 |
initialInUnit = +initialInUnit || +initial || 0; |
| 4941 |
|
| 4942 |
// Apply relative offset (+=/-=) if specified |
| 4943 |
adjusted = valueParts[1] |
| 4944 |
? initialInUnit + (valueParts[1] + 1) * valueParts[2] |
| 4945 |
: +valueParts[2]; |
| 4946 |
if (tween) { |
| 4947 |
tween.unit = unit; |
| 4948 |
tween.start = initialInUnit; |
| 4949 |
tween.end = adjusted; |
| 4950 |
} |
| 4951 |
} |
| 4952 |
return adjusted; |
| 4953 |
} |
| 4954 |
|
| 4955 |
var defaultDisplayMap = {}; |
| 4956 |
|
| 4957 |
function getDefaultDisplay(elem) { |
| 4958 |
var temp, |
| 4959 |
doc = elem.ownerDocument, |
| 4960 |
nodeName = elem.nodeName, |
| 4961 |
display = defaultDisplayMap[nodeName]; |
| 4962 |
|
| 4963 |
if (display) { |
| 4964 |
return display; |
| 4965 |
} |
| 4966 |
|
| 4967 |
temp = doc.body.appendChild(doc.createElement(nodeName)); |
| 4968 |
display = jQuery.css(temp, "display"); |
| 4969 |
|
| 4970 |
temp.parentNode.removeChild(temp); |
| 4971 |
|
| 4972 |
if (display === "none") { |
| 4973 |
display = "block"; |
| 4974 |
} |
| 4975 |
defaultDisplayMap[nodeName] = display; |
| 4976 |
|
| 4977 |
return display; |
| 4978 |
} |
| 4979 |
|
| 4980 |
function showHide(elements, show) { |
| 4981 |
var display, |
| 4982 |
elem, |
| 4983 |
values = [], |
| 4984 |
index = 0, |
| 4985 |
length = elements.length; |
| 4986 |
|
| 4987 |
// Determine new display value for elements that need to change |
| 4988 |
for (; index < length; index++) { |
| 4989 |
elem = elements[index]; |
| 4990 |
if (!elem.style) { |
| 4991 |
continue; |
| 4992 |
} |
| 4993 |
|
| 4994 |
display = elem.style.display; |
| 4995 |
if (show) { |
| 4996 |
// Since we force visibility upon cascade-hidden elements, an immediate (and slow) |
| 4997 |
// check is required in this first loop unless we have a nonempty display value (either |
| 4998 |
// inline or about-to-be-restored) |
| 4999 |
if (display === "none") { |
| 5000 |
values[index] = dataPriv.get(elem, "display") || null; |
| 5001 |
if (!values[index]) { |
| 5002 |
elem.style.display = ""; |
| 5003 |
} |
| 5004 |
} |
| 5005 |
if (elem.style.display === "" && isHiddenWithinTree(elem)) { |
| 5006 |
values[index] = getDefaultDisplay(elem); |
| 5007 |
} |
| 5008 |
} else { |
| 5009 |
if (display !== "none") { |
| 5010 |
values[index] = "none"; |
| 5011 |
|
| 5012 |
// Remember what we're overwriting |
| 5013 |
dataPriv.set(elem, "display", display); |
| 5014 |
} |
| 5015 |
} |
| 5016 |
} |
| 5017 |
|
| 5018 |
// Set the display of the elements in a second loop to avoid constant reflow |
| 5019 |
for (index = 0; index < length; index++) { |
| 5020 |
if (values[index] != null) { |
| 5021 |
elements[index].style.display = values[index]; |
| 5022 |
} |
| 5023 |
} |
| 5024 |
|
| 5025 |
return elements; |
| 5026 |
} |
| 5027 |
|
| 5028 |
jQuery.fn.extend({ |
| 5029 |
show: function () { |
| 5030 |
return showHide(this, true); |
| 5031 |
}, |
| 5032 |
hide: function () { |
| 5033 |
return showHide(this); |
| 5034 |
}, |
| 5035 |
toggle: function (state) { |
| 5036 |
if (typeof state === "boolean") { |
| 5037 |
return state ? this.show() : this.hide(); |
| 5038 |
} |
| 5039 |
|
| 5040 |
return this.each(function () { |
| 5041 |
if (isHiddenWithinTree(this)) { |
| 5042 |
jQuery(this).show(); |
| 5043 |
} else { |
| 5044 |
jQuery(this).hide(); |
| 5045 |
} |
| 5046 |
}); |
| 5047 |
}, |
| 5048 |
}); |
| 5049 |
var rcheckableType = /^(?:checkbox|radio)$/i; |
| 5050 |
|
| 5051 |
var rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]*)/i; |
| 5052 |
|
| 5053 |
var rscriptType = /^$|^module$|\/(?:java|ecma)script/i; |
| 5054 |
|
| 5055 |
(function () { |
| 5056 |
var fragment = document.createDocumentFragment(), |
| 5057 |
div = fragment.appendChild(document.createElement("div")), |
| 5058 |
input = document.createElement("input"); |
| 5059 |
|
| 5060 |
// Support: Android 4.0 - 4.3 only |
| 5061 |
// Check state lost if the name is set (#11217) |
| 5062 |
// Support: Windows Web Apps (WWA) |
| 5063 |
// `name` and `type` must use .setAttribute for WWA (#14901) |
| 5064 |
input.setAttribute("type", "radio"); |
| 5065 |
input.setAttribute("checked", "checked"); |
| 5066 |
input.setAttribute("name", "t"); |
| 5067 |
|
| 5068 |
div.appendChild(input); |
| 5069 |
|
| 5070 |
// Support: Android <=4.1 only |
| 5071 |
// Older WebKit doesn't clone checked state correctly in fragments |
| 5072 |
support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked; |
| 5073 |
|
| 5074 |
// Support: IE <=11 only |
| 5075 |
// Make sure textarea (and checkbox) defaultValue is properly cloned |
| 5076 |
div.innerHTML = "<textarea>x</textarea>"; |
| 5077 |
support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue; |
| 5078 |
|
| 5079 |
// Support: IE <=9 only |
| 5080 |
// IE <=9 replaces <option> tags with their contents when inserted outside of |
| 5081 |
// the select element. |
| 5082 |
div.innerHTML = "<option></option>"; |
| 5083 |
support.option = !!div.lastChild; |
| 5084 |
})(); |
| 5085 |
|
| 5086 |
// We have to close these tags to support XHTML (#13200) |
| 5087 |
var wrapMap = { |
| 5088 |
// XHTML parsers do not magically insert elements in the |
| 5089 |
// same way that tag soup parsers do. So we cannot shorten |
| 5090 |
// this by omitting <tbody> or other required elements. |
| 5091 |
thead: [1, "<table>", "</table>"], |
| 5092 |
col: [2, "<table><colgroup>", "</colgroup></table>"], |
| 5093 |
tr: [2, "<table><tbody>", "</tbody></table>"], |
| 5094 |
td: [3, "<table><tbody><tr>", "</tr></tbody></table>"], |
| 5095 |
|
| 5096 |
_default: [0, "", ""], |
| 5097 |
}; |
| 5098 |
|
| 5099 |
wrapMap.tbody = |
| 5100 |
wrapMap.tfoot = |
| 5101 |
wrapMap.colgroup = |
| 5102 |
wrapMap.caption = |
| 5103 |
wrapMap.thead; |
| 5104 |
wrapMap.th = wrapMap.td; |
| 5105 |
|
| 5106 |
// Support: IE <=9 only |
| 5107 |
if (!support.option) { |
| 5108 |
wrapMap.optgroup = wrapMap.option = [ |
| 5109 |
1, |
| 5110 |
"<select multiple='multiple'>", |
| 5111 |
"</select>", |
| 5112 |
]; |
| 5113 |
} |
| 5114 |
|
| 5115 |
function getAll(context, tag) { |
| 5116 |
// Support: IE <=9 - 11 only |
| 5117 |
// Use typeof to avoid zero-argument method invocation on host objects (#15151) |
| 5118 |
var ret; |
| 5119 |
|
| 5120 |
if (typeof context.getElementsByTagName !== "undefined") { |
| 5121 |
ret = context.getElementsByTagName(tag || "*"); |
| 5122 |
} else if (typeof context.querySelectorAll !== "undefined") { |
| 5123 |
ret = context.querySelectorAll(tag || "*"); |
| 5124 |
} else { |
| 5125 |
ret = []; |
| 5126 |
} |
| 5127 |
|
| 5128 |
if (tag === undefined || (tag && nodeName(context, tag))) { |
| 5129 |
return jQuery.merge([context], ret); |
| 5130 |
} |
| 5131 |
|
| 5132 |
return ret; |
| 5133 |
} |
| 5134 |
|
| 5135 |
// Mark scripts as having already been evaluated |
| 5136 |
function setGlobalEval(elems, refElements) { |
| 5137 |
var i = 0, |
| 5138 |
l = elems.length; |
| 5139 |
|
| 5140 |
for (; i < l; i++) { |
| 5141 |
dataPriv.set( |
| 5142 |
elems[i], |
| 5143 |
"globalEval", |
| 5144 |
!refElements || dataPriv.get(refElements[i], "globalEval") |
| 5145 |
); |
| 5146 |
} |
| 5147 |
} |
| 5148 |
|
| 5149 |
var rhtml = /<|&#?\w+;/; |
| 5150 |
|
| 5151 |
function buildFragment(elems, context, scripts, selection, ignored) { |
| 5152 |
var elem, |
| 5153 |
tmp, |
| 5154 |
tag, |
| 5155 |
wrap, |
| 5156 |
attached, |
| 5157 |
j, |
| 5158 |
fragment = context.createDocumentFragment(), |
| 5159 |
nodes = [], |
| 5160 |
i = 0, |
| 5161 |
l = elems.length; |
| 5162 |
|
| 5163 |
for (; i < l; i++) { |
| 5164 |
elem = elems[i]; |
| 5165 |
|
| 5166 |
if (elem || elem === 0) { |
| 5167 |
// Add nodes directly |
| 5168 |
if (toType(elem) === "object") { |
| 5169 |
// Support: Android <=4.0 only, PhantomJS 1 only |
| 5170 |
// push.apply(_, arraylike) throws on ancient WebKit |
| 5171 |
jQuery.merge(nodes, elem.nodeType ? [elem] : elem); |
| 5172 |
|
| 5173 |
// Convert non-html into a text node |
| 5174 |
} else if (!rhtml.test(elem)) { |
| 5175 |
nodes.push(context.createTextNode(elem)); |
| 5176 |
|
| 5177 |
// Convert html into DOM nodes |
| 5178 |
} else { |
| 5179 |
tmp = tmp || fragment.appendChild(context.createElement("div")); |
| 5180 |
|
| 5181 |
// Deserialize a standard representation |
| 5182 |
tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase(); |
| 5183 |
wrap = wrapMap[tag] || wrapMap._default; |
| 5184 |
tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2]; |
| 5185 |
|
| 5186 |
// Descend through wrappers to the right content |
| 5187 |
j = wrap[0]; |
| 5188 |
while (j--) { |
| 5189 |
tmp = tmp.lastChild; |
| 5190 |
} |
| 5191 |
|
| 5192 |
// Support: Android <=4.0 only, PhantomJS 1 only |
| 5193 |
// push.apply(_, arraylike) throws on ancient WebKit |
| 5194 |
jQuery.merge(nodes, tmp.childNodes); |
| 5195 |
|
| 5196 |
// Remember the top-level container |
| 5197 |
tmp = fragment.firstChild; |
| 5198 |
|
| 5199 |
// Ensure the created nodes are orphaned (#12392) |
| 5200 |
tmp.textContent = ""; |
| 5201 |
} |
| 5202 |
} |
| 5203 |
} |
| 5204 |
|
| 5205 |
// Remove wrapper from fragment |
| 5206 |
fragment.textContent = ""; |
| 5207 |
|
| 5208 |
i = 0; |
| 5209 |
while ((elem = nodes[i++])) { |
| 5210 |
// Skip elements already in the context collection (trac-4087) |
| 5211 |
if (selection && jQuery.inArray(elem, selection) > -1) { |
| 5212 |
if (ignored) { |
| 5213 |
ignored.push(elem); |
| 5214 |
} |
| 5215 |
continue; |
| 5216 |
} |
| 5217 |
|
| 5218 |
attached = isAttached(elem); |
| 5219 |
|
| 5220 |
// Append to fragment |
| 5221 |
tmp = getAll(fragment.appendChild(elem), "script"); |
| 5222 |
|
| 5223 |
// Preserve script evaluation history |
| 5224 |
if (attached) { |
| 5225 |
setGlobalEval(tmp); |
| 5226 |
} |
| 5227 |
|
| 5228 |
// Capture executables |
| 5229 |
if (scripts) { |
| 5230 |
j = 0; |
| 5231 |
while ((elem = tmp[j++])) { |
| 5232 |
if (rscriptType.test(elem.type || "")) { |
| 5233 |
scripts.push(elem); |
| 5234 |
} |
| 5235 |
} |
| 5236 |
} |
| 5237 |
} |
| 5238 |
|
| 5239 |
return fragment; |
| 5240 |
} |
| 5241 |
|
| 5242 |
var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; |
| 5243 |
|
| 5244 |
function returnTrue() { |
| 5245 |
return true; |
| 5246 |
} |
| 5247 |
|
| 5248 |
function returnFalse() { |
| 5249 |
return false; |
| 5250 |
} |
| 5251 |
|
| 5252 |
// Support: IE <=9 - 11+ |
| 5253 |
// focus() and blur() are asynchronous, except when they are no-op. |
| 5254 |
// So expect focus to be synchronous when the element is already active, |
| 5255 |
// and blur to be synchronous when the element is not already active. |
| 5256 |
// (focus and blur are always synchronous in other supported browsers, |
| 5257 |
// this just defines when we can count on it). |
| 5258 |
function expectSync(elem, type) { |
| 5259 |
return (elem === safeActiveElement()) === (type === "focus"); |
| 5260 |
} |
| 5261 |
|
| 5262 |
// Support: IE <=9 only |
| 5263 |
// Accessing document.activeElement can throw unexpectedly |
| 5264 |
// https://bugs.jquery.com/ticket/13393 |
| 5265 |
function safeActiveElement() { |
| 5266 |
try { |
| 5267 |
return document.activeElement; |
| 5268 |
} catch (err) {} |
| 5269 |
} |
| 5270 |
|
| 5271 |
function on(elem, types, selector, data, fn, one) { |
| 5272 |
var origFn, type; |
| 5273 |
|
| 5274 |
// Types can be a map of types/handlers |
| 5275 |
if (typeof types === "object") { |
| 5276 |
// ( types-Object, selector, data ) |
| 5277 |
if (typeof selector !== "string") { |
| 5278 |
// ( types-Object, data ) |
| 5279 |
data = data || selector; |
| 5280 |
selector = undefined; |
| 5281 |
} |
| 5282 |
for (type in types) { |
| 5283 |
on(elem, type, selector, data, types[type], one); |
| 5284 |
} |
| 5285 |
return elem; |
| 5286 |
} |
| 5287 |
|
| 5288 |
if (data == null && fn == null) { |
| 5289 |
// ( types, fn ) |
| 5290 |
fn = selector; |
| 5291 |
data = selector = undefined; |
| 5292 |
} else if (fn == null) { |
| 5293 |
if (typeof selector === "string") { |
| 5294 |
// ( types, selector, fn ) |
| 5295 |
fn = data; |
| 5296 |
data = undefined; |
| 5297 |
} else { |
| 5298 |
// ( types, data, fn ) |
| 5299 |
fn = data; |
| 5300 |
data = selector; |
| 5301 |
selector = undefined; |
| 5302 |
} |
| 5303 |
} |
| 5304 |
if (fn === false) { |
| 5305 |
fn = returnFalse; |
| 5306 |
} else if (!fn) { |
| 5307 |
return elem; |
| 5308 |
} |
| 5309 |
|
| 5310 |
if (one === 1) { |
| 5311 |
origFn = fn; |
| 5312 |
fn = function (event) { |
| 5313 |
// Can use an empty set, since event contains the info |
| 5314 |
jQuery().off(event); |
| 5315 |
return origFn.apply(this, arguments); |
| 5316 |
}; |
| 5317 |
|
| 5318 |
// Use same guid so caller can remove using origFn |
| 5319 |
fn.guid = origFn.guid || (origFn.guid = jQuery.guid++); |
| 5320 |
} |
| 5321 |
return elem.each(function () { |
| 5322 |
jQuery.event.add(this, types, fn, data, selector); |
| 5323 |
}); |
| 5324 |
} |
| 5325 |
|
| 5326 |
/* |
| 5327 |
* Helper functions for managing events -- not part of the public interface. |
| 5328 |
* Props to Dean Edwards' addEvent library for many of the ideas. |
| 5329 |
*/ |
| 5330 |
jQuery.event = { |
| 5331 |
global: {}, |
| 5332 |
|
| 5333 |
add: function (elem, types, handler, data, selector) { |
| 5334 |
var handleObjIn, |
| 5335 |
eventHandle, |
| 5336 |
tmp, |
| 5337 |
events, |
| 5338 |
t, |
| 5339 |
handleObj, |
| 5340 |
special, |
| 5341 |
handlers, |
| 5342 |
type, |
| 5343 |
namespaces, |
| 5344 |
origType, |
| 5345 |
elemData = dataPriv.get(elem); |
| 5346 |
|
| 5347 |
// Only attach events to objects that accept data |
| 5348 |
if (!acceptData(elem)) { |
| 5349 |
return; |
| 5350 |
} |
| 5351 |
|
| 5352 |
// Caller can pass in an object of custom data in lieu of the handler |
| 5353 |
if (handler.handler) { |
| 5354 |
handleObjIn = handler; |
| 5355 |
handler = handleObjIn.handler; |
| 5356 |
selector = handleObjIn.selector; |
| 5357 |
} |
| 5358 |
|
| 5359 |
// Ensure that invalid selectors throw exceptions at attach time |
| 5360 |
// Evaluate against documentElement in case elem is a non-element node (e.g., document) |
| 5361 |
if (selector) { |
| 5362 |
jQuery.find.matchesSelector(documentElement, selector); |
| 5363 |
} |
| 5364 |
|
| 5365 |
// Make sure that the handler has a unique ID, used to find/remove it later |
| 5366 |
if (!handler.guid) { |
| 5367 |
handler.guid = jQuery.guid++; |
| 5368 |
} |
| 5369 |
|
| 5370 |
// Init the element's event structure and main handler, if this is the first |
| 5371 |
if (!(events = elemData.events)) { |
| 5372 |
events = elemData.events = Object.create(null); |
| 5373 |
} |
| 5374 |
if (!(eventHandle = elemData.handle)) { |
| 5375 |
eventHandle = elemData.handle = function (e) { |
| 5376 |
// Discard the second event of a jQuery.event.trigger() and |
| 5377 |
// when an event is called after a page has unloaded |
| 5378 |
return typeof jQuery !== "undefined" && |
| 5379 |
jQuery.event.triggered !== e.type |
| 5380 |
? jQuery.event.dispatch.apply(elem, arguments) |
| 5381 |
: undefined; |
| 5382 |
}; |
| 5383 |
} |
| 5384 |
|
| 5385 |
// Handle multiple events separated by a space |
| 5386 |
types = (types || "").match(rnothtmlwhite) || [""]; |
| 5387 |
t = types.length; |
| 5388 |
while (t--) { |
| 5389 |
tmp = rtypenamespace.exec(types[t]) || []; |
| 5390 |
type = origType = tmp[1]; |
| 5391 |
namespaces = (tmp[2] || "").split(".").sort(); |
| 5392 |
|
| 5393 |
// There *must* be a type, no attaching namespace-only handlers |
| 5394 |
if (!type) { |
| 5395 |
continue; |
| 5396 |
} |
| 5397 |
|
| 5398 |
// If event changes its type, use the special event handlers for the changed type |
| 5399 |
special = jQuery.event.special[type] || {}; |
| 5400 |
|
| 5401 |
// If selector defined, determine special event api type, otherwise given type |
| 5402 |
type = (selector ? special.delegateType : special.bindType) || type; |
| 5403 |
|
| 5404 |
// Update special based on newly reset type |
| 5405 |
special = jQuery.event.special[type] || {}; |
| 5406 |
|
| 5407 |
// handleObj is passed to all event handlers |
| 5408 |
handleObj = jQuery.extend( |
| 5409 |
{ |
| 5410 |
type: type, |
| 5411 |
origType: origType, |
| 5412 |
data: data, |
| 5413 |
handler: handler, |
| 5414 |
guid: handler.guid, |
| 5415 |
selector: selector, |
| 5416 |
needsContext: |
| 5417 |
selector && jQuery.expr.match.needsContext.test(selector), |
| 5418 |
namespace: namespaces.join("."), |
| 5419 |
}, |
| 5420 |
handleObjIn |
| 5421 |
); |
| 5422 |
|
| 5423 |
// Init the event handler queue if we're the first |
| 5424 |
if (!(handlers = events[type])) { |
| 5425 |
handlers = events[type] = []; |
| 5426 |
handlers.delegateCount = 0; |
| 5427 |
|
| 5428 |
// Only use addEventListener if the special events handler returns false |
| 5429 |
if ( |
| 5430 |
!special.setup || |
| 5431 |
special.setup.call(elem, data, namespaces, eventHandle) === false |
| 5432 |
) { |
| 5433 |
if (elem.addEventListener) { |
| 5434 |
elem.addEventListener(type, eventHandle); |
| 5435 |
} |
| 5436 |
} |
| 5437 |
} |
| 5438 |
|
| 5439 |
if (special.add) { |
| 5440 |
special.add.call(elem, handleObj); |
| 5441 |
|
| 5442 |
if (!handleObj.handler.guid) { |
| 5443 |
handleObj.handler.guid = handler.guid; |
| 5444 |
} |
| 5445 |
} |
| 5446 |
|
| 5447 |
// Add to the element's handler list, delegates in front |
| 5448 |
if (selector) { |
| 5449 |
handlers.splice(handlers.delegateCount++, 0, handleObj); |
| 5450 |
} else { |
| 5451 |
handlers.push(handleObj); |
| 5452 |
} |
| 5453 |
|
| 5454 |
// Keep track of which events have ever been used, for event optimization |
| 5455 |
jQuery.event.global[type] = true; |
| 5456 |
} |
| 5457 |
}, |
| 5458 |
|
| 5459 |
// Detach an event or set of events from an element |
| 5460 |
remove: function (elem, types, handler, selector, mappedTypes) { |
| 5461 |
var j, |
| 5462 |
origCount, |
| 5463 |
tmp, |
| 5464 |
events, |
| 5465 |
t, |
| 5466 |
handleObj, |
| 5467 |
special, |
| 5468 |
handlers, |
| 5469 |
type, |
| 5470 |
namespaces, |
| 5471 |
origType, |
| 5472 |
elemData = dataPriv.hasData(elem) && dataPriv.get(elem); |
| 5473 |
|
| 5474 |
if (!elemData || !(events = elemData.events)) { |
| 5475 |
return; |
| 5476 |
} |
| 5477 |
|
| 5478 |
// Once for each type.namespace in types; type may be omitted |
| 5479 |
types = (types || "").match(rnothtmlwhite) || [""]; |
| 5480 |
t = types.length; |
| 5481 |
while (t--) { |
| 5482 |
tmp = rtypenamespace.exec(types[t]) || []; |
| 5483 |
type = origType = tmp[1]; |
| 5484 |
namespaces = (tmp[2] || "").split(".").sort(); |
| 5485 |
|
| 5486 |
// Unbind all events (on this namespace, if provided) for the element |
| 5487 |
if (!type) { |
| 5488 |
for (type in events) { |
| 5489 |
jQuery.event.remove(elem, type + types[t], handler, selector, true); |
| 5490 |
} |
| 5491 |
continue; |
| 5492 |
} |
| 5493 |
|
| 5494 |
special = jQuery.event.special[type] || {}; |
| 5495 |
type = (selector ? special.delegateType : special.bindType) || type; |
| 5496 |
handlers = events[type] || []; |
| 5497 |
tmp = |
| 5498 |
tmp[2] && |
| 5499 |
new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)"); |
| 5500 |
|
| 5501 |
// Remove matching events |
| 5502 |
origCount = j = handlers.length; |
| 5503 |
while (j--) { |
| 5504 |
handleObj = handlers[j]; |
| 5505 |
|
| 5506 |
if ( |
| 5507 |
(mappedTypes || origType === handleObj.origType) && |
| 5508 |
(!handler || handler.guid === handleObj.guid) && |
| 5509 |
(!tmp || tmp.test(handleObj.namespace)) && |
| 5510 |
(!selector || |
| 5511 |
selector === handleObj.selector || |
| 5512 |
(selector === "**" && handleObj.selector)) |
| 5513 |
) { |
| 5514 |
handlers.splice(j, 1); |
| 5515 |
|
| 5516 |
if (handleObj.selector) { |
| 5517 |
handlers.delegateCount--; |
| 5518 |
} |
| 5519 |
if (special.remove) { |
| 5520 |
special.remove.call(elem, handleObj); |
| 5521 |
} |
| 5522 |
} |
| 5523 |
} |
| 5524 |
|
| 5525 |
// Remove generic event handler if we removed something and no more handlers exist |
| 5526 |
// (avoids potential for endless recursion during removal of special event handlers) |
| 5527 |
if (origCount && !handlers.length) { |
| 5528 |
if ( |
| 5529 |
!special.teardown || |
| 5530 |
special.teardown.call(elem, namespaces, elemData.handle) === false |
| 5531 |
) { |
| 5532 |
jQuery.removeEvent(elem, type, elemData.handle); |
| 5533 |
} |
| 5534 |
|
| 5535 |
delete events[type]; |
| 5536 |
} |
| 5537 |
} |
| 5538 |
|
| 5539 |
// Remove data and the expando if it's no longer used |
| 5540 |
if (jQuery.isEmptyObject(events)) { |
| 5541 |
dataPriv.remove(elem, "handle events"); |
| 5542 |
} |
| 5543 |
}, |
| 5544 |
|
| 5545 |
dispatch: function (nativeEvent) { |
| 5546 |
var i, |
| 5547 |
j, |
| 5548 |
ret, |
| 5549 |
matched, |
| 5550 |
handleObj, |
| 5551 |
handlerQueue, |
| 5552 |
args = new Array(arguments.length), |
| 5553 |
// Make a writable jQuery.Event from the native event object |
| 5554 |
event = jQuery.event.fix(nativeEvent), |
| 5555 |
handlers = |
| 5556 |
(dataPriv.get(this, "events") || Object.create(null))[event.type] || |
| 5557 |
[], |
| 5558 |
special = jQuery.event.special[event.type] || {}; |
| 5559 |
|
| 5560 |
// Use the fix-ed jQuery.Event rather than the (read-only) native event |
| 5561 |
args[0] = event; |
| 5562 |
|
| 5563 |
for (i = 1; i < arguments.length; i++) { |
| 5564 |
args[i] = arguments[i]; |
| 5565 |
} |
| 5566 |
|
| 5567 |
event.delegateTarget = this; |
| 5568 |
|
| 5569 |
// Call the preDispatch hook for the mapped type, and let it bail if desired |
| 5570 |
if ( |
| 5571 |
special.preDispatch && |
| 5572 |
special.preDispatch.call(this, event) === false |
| 5573 |
) { |
| 5574 |
return; |
| 5575 |
} |
| 5576 |
|
| 5577 |
// Determine handlers |
| 5578 |
handlerQueue = jQuery.event.handlers.call(this, event, handlers); |
| 5579 |
|
| 5580 |
// Run delegates first; they may want to stop propagation beneath us |
| 5581 |
i = 0; |
| 5582 |
while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) { |
| 5583 |
event.currentTarget = matched.elem; |
| 5584 |
|
| 5585 |
j = 0; |
| 5586 |
while ( |
| 5587 |
(handleObj = matched.handlers[j++]) && |
| 5588 |
!event.isImmediatePropagationStopped() |
| 5589 |
) { |
| 5590 |
// If the event is namespaced, then each handler is only invoked if it is |
| 5591 |
// specially universal or its namespaces are a superset of the event's. |
| 5592 |
if ( |
| 5593 |
!event.rnamespace || |
| 5594 |
handleObj.namespace === false || |
| 5595 |
event.rnamespace.test(handleObj.namespace) |
| 5596 |
) { |
| 5597 |
event.handleObj = handleObj; |
| 5598 |
event.data = handleObj.data; |
| 5599 |
|
| 5600 |
ret = ( |
| 5601 |
(jQuery.event.special[handleObj.origType] || {}).handle || |
| 5602 |
handleObj.handler |
| 5603 |
).apply(matched.elem, args); |
| 5604 |
|
| 5605 |
if (ret !== undefined) { |
| 5606 |
if ((event.result = ret) === false) { |
| 5607 |
event.preventDefault(); |
| 5608 |
event.stopPropagation(); |
| 5609 |
} |
| 5610 |
} |
| 5611 |
} |
| 5612 |
} |
| 5613 |
} |
| 5614 |
|
| 5615 |
// Call the postDispatch hook for the mapped type |
| 5616 |
if (special.postDispatch) { |
| 5617 |
special.postDispatch.call(this, event); |
| 5618 |
} |
| 5619 |
|
| 5620 |
return event.result; |
| 5621 |
}, |
| 5622 |
|
| 5623 |
handlers: function (event, handlers) { |
| 5624 |
var i, |
| 5625 |
handleObj, |
| 5626 |
sel, |
| 5627 |
matchedHandlers, |
| 5628 |
matchedSelectors, |
| 5629 |
handlerQueue = [], |
| 5630 |
delegateCount = handlers.delegateCount, |
| 5631 |
cur = event.target; |
| 5632 |
|
| 5633 |
// Find delegate handlers |
| 5634 |
if ( |
| 5635 |
delegateCount && |
| 5636 |
// Support: IE <=9 |
| 5637 |
// Black-hole SVG <use> instance trees (trac-13180) |
| 5638 |
cur.nodeType && |
| 5639 |
// Support: Firefox <=42 |
| 5640 |
// Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) |
| 5641 |
// https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click |
| 5642 |
// Support: IE 11 only |
| 5643 |
// ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) |
| 5644 |
!(event.type === "click" && event.button >= 1) |
| 5645 |
) { |
| 5646 |
for (; cur !== this; cur = cur.parentNode || this) { |
| 5647 |
// Don't check non-elements (#13208) |
| 5648 |
// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) |
| 5649 |
if ( |
| 5650 |
cur.nodeType === 1 && |
| 5651 |
!(event.type === "click" && cur.disabled === true) |
| 5652 |
) { |
| 5653 |
matchedHandlers = []; |
| 5654 |
matchedSelectors = {}; |
| 5655 |
for (i = 0; i < delegateCount; i++) { |
| 5656 |
handleObj = handlers[i]; |
| 5657 |
|
| 5658 |
// Don't conflict with Object.prototype properties (#13203) |
| 5659 |
sel = handleObj.selector + " "; |
| 5660 |
|
| 5661 |
if (matchedSelectors[sel] === undefined) { |
| 5662 |
matchedSelectors[sel] = handleObj.needsContext |
| 5663 |
? jQuery(sel, this).index(cur) > -1 |
| 5664 |
: jQuery.find(sel, this, null, [cur]).length; |
| 5665 |
} |
| 5666 |
if (matchedSelectors[sel]) { |
| 5667 |
matchedHandlers.push(handleObj); |
| 5668 |
} |
| 5669 |
} |
| 5670 |
if (matchedHandlers.length) { |
| 5671 |
handlerQueue.push({ elem: cur, handlers: matchedHandlers }); |
| 5672 |
} |
| 5673 |
} |
| 5674 |
} |
| 5675 |
} |
| 5676 |
|
| 5677 |
// Add the remaining (directly-bound) handlers |
| 5678 |
cur = this; |
| 5679 |
if (delegateCount < handlers.length) { |
| 5680 |
handlerQueue.push({ |
| 5681 |
elem: cur, |
| 5682 |
handlers: handlers.slice(delegateCount), |
| 5683 |
}); |
| 5684 |
} |
| 5685 |
|
| 5686 |
return handlerQueue; |
| 5687 |
}, |
| 5688 |
|
| 5689 |
addProp: function (name, hook) { |
| 5690 |
Object.defineProperty(jQuery.Event.prototype, name, { |
| 5691 |
enumerable: true, |
| 5692 |
configurable: true, |
| 5693 |
|
| 5694 |
get: isFunction(hook) |
| 5695 |
? function () { |
| 5696 |
if (this.originalEvent) { |
| 5697 |
return hook(this.originalEvent); |
| 5698 |
} |
| 5699 |
} |
| 5700 |
: function () { |
| 5701 |
if (this.originalEvent) { |
| 5702 |
return this.originalEvent[name]; |
| 5703 |
} |
| 5704 |
}, |
| 5705 |
|
| 5706 |
set: function (value) { |
| 5707 |
Object.defineProperty(this, name, { |
| 5708 |
enumerable: true, |
| 5709 |
configurable: true, |
| 5710 |
writable: true, |
| 5711 |
value: value, |
| 5712 |
}); |
| 5713 |
}, |
| 5714 |
}); |
| 5715 |
}, |
| 5716 |
|
| 5717 |
fix: function (originalEvent) { |
| 5718 |
return originalEvent[jQuery.expando] |
| 5719 |
? originalEvent |
| 5720 |
: new jQuery.Event(originalEvent); |
| 5721 |
}, |
| 5722 |
|
| 5723 |
special: { |
| 5724 |
load: { |
| 5725 |
// Prevent triggered image.load events from bubbling to window.load |
| 5726 |
noBubble: true, |
| 5727 |
}, |
| 5728 |
click: { |
| 5729 |
// Utilize native event to ensure correct state for checkable inputs |
| 5730 |
setup: function (data) { |
| 5731 |
// For mutual compressibility with _default, replace `this` access with a local var. |
| 5732 |
// `|| data` is dead code meant only to preserve the variable through minification. |
| 5733 |
var el = this || data; |
| 5734 |
|
| 5735 |
// Claim the first handler |
| 5736 |
if ( |
| 5737 |
rcheckableType.test(el.type) && |
| 5738 |
el.click && |
| 5739 |
nodeName(el, "input") |
| 5740 |
) { |
| 5741 |
// dataPriv.set( el, "click", ... ) |
| 5742 |
leverageNative(el, "click", returnTrue); |
| 5743 |
} |
| 5744 |
|
| 5745 |
// Return false to allow normal processing in the caller |
| 5746 |
return false; |
| 5747 |
}, |
| 5748 |
trigger: function (data) { |
| 5749 |
// For mutual compressibility with _default, replace `this` access with a local var. |
| 5750 |
// `|| data` is dead code meant only to preserve the variable through minification. |
| 5751 |
var el = this || data; |
| 5752 |
|
| 5753 |
// Force setup before triggering a click |
| 5754 |
if ( |
| 5755 |
rcheckableType.test(el.type) && |
| 5756 |
el.click && |
| 5757 |
nodeName(el, "input") |
| 5758 |
) { |
| 5759 |
leverageNative(el, "click"); |
| 5760 |
} |
| 5761 |
|
| 5762 |
// Return non-false to allow normal event-path propagation |
| 5763 |
return true; |
| 5764 |
}, |
| 5765 |
|
| 5766 |
// For cross-browser consistency, suppress native .click() on links |
| 5767 |
// Also prevent it if we're currently inside a leveraged native-event stack |
| 5768 |
_default: function (event) { |
| 5769 |
var target = event.target; |
| 5770 |
return ( |
| 5771 |
(rcheckableType.test(target.type) && |
| 5772 |
target.click && |
| 5773 |
nodeName(target, "input") && |
| 5774 |
dataPriv.get(target, "click")) || |
| 5775 |
nodeName(target, "a") |
| 5776 |
); |
| 5777 |
}, |
| 5778 |
}, |
| 5779 |
|
| 5780 |
beforeunload: { |
| 5781 |
postDispatch: function (event) { |
| 5782 |
// Support: Firefox 20+ |
| 5783 |
// Firefox doesn't alert if the returnValue field is not set. |
| 5784 |
if (event.result !== undefined && event.originalEvent) { |
| 5785 |
event.originalEvent.returnValue = event.result; |
| 5786 |
} |
| 5787 |
}, |
| 5788 |
}, |
| 5789 |
}, |
| 5790 |
}; |
| 5791 |
|
| 5792 |
// Ensure the presence of an event listener that handles manually-triggered |
| 5793 |
// synthetic events by interrupting progress until reinvoked in response to |
| 5794 |
// *native* events that it fires directly, ensuring that state changes have |
| 5795 |
// already occurred before other listeners are invoked. |
| 5796 |
function leverageNative(el, type, expectSync) { |
| 5797 |
// Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add |
| 5798 |
if (!expectSync) { |
| 5799 |
if (dataPriv.get(el, type) === undefined) { |
| 5800 |
jQuery.event.add(el, type, returnTrue); |
| 5801 |
} |
| 5802 |
return; |
| 5803 |
} |
| 5804 |
|
| 5805 |
// Register the controller as a special universal handler for all event namespaces |
| 5806 |
dataPriv.set(el, type, false); |
| 5807 |
jQuery.event.add(el, type, { |
| 5808 |
namespace: false, |
| 5809 |
handler: function (event) { |
| 5810 |
var notAsync, |
| 5811 |
result, |
| 5812 |
saved = dataPriv.get(this, type); |
| 5813 |
|
| 5814 |
if (event.isTrigger & 1 && this[type]) { |
| 5815 |
// Interrupt processing of the outer synthetic .trigger()ed event |
| 5816 |
// Saved data should be false in such cases, but might be a leftover capture object |
| 5817 |
// from an async native handler (gh-4350) |
| 5818 |
if (!saved.length) { |
| 5819 |
// Store arguments for use when handling the inner native event |
| 5820 |
// There will always be at least one argument (an event object), so this array |
| 5821 |
// will not be confused with a leftover capture object. |
| 5822 |
saved = slice.call(arguments); |
| 5823 |
dataPriv.set(this, type, saved); |
| 5824 |
|
| 5825 |
// Trigger the native event and capture its result |
| 5826 |
// Support: IE <=9 - 11+ |
| 5827 |
// focus() and blur() are asynchronous |
| 5828 |
notAsync = expectSync(this, type); |
| 5829 |
this[type](); |
| 5830 |
result = dataPriv.get(this, type); |
| 5831 |
if (saved !== result || notAsync) { |
| 5832 |
dataPriv.set(this, type, false); |
| 5833 |
} else { |
| 5834 |
result = {}; |
| 5835 |
} |
| 5836 |
if (saved !== result) { |
| 5837 |
// Cancel the outer synthetic event |
| 5838 |
event.stopImmediatePropagation(); |
| 5839 |
event.preventDefault(); |
| 5840 |
|
| 5841 |
// Support: Chrome 86+ |
| 5842 |
// In Chrome, if an element having a focusout handler is blurred by |
| 5843 |
// clicking outside of it, it invokes the handler synchronously. If |
| 5844 |
// that handler calls `.remove()` on the element, the data is cleared, |
| 5845 |
// leaving `result` undefined. We need to guard against this. |
| 5846 |
return result && result.value; |
| 5847 |
} |
| 5848 |
|
| 5849 |
// If this is an inner synthetic event for an event with a bubbling surrogate |
| 5850 |
// (focus or blur), assume that the surrogate already propagated from triggering the |
| 5851 |
// native event and prevent that from happening again here. |
| 5852 |
// This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the |
| 5853 |
// bubbling surrogate propagates *after* the non-bubbling base), but that seems |
| 5854 |
// less bad than duplication. |
| 5855 |
} else if ((jQuery.event.special[type] || {}).delegateType) { |
| 5856 |
event.stopPropagation(); |
| 5857 |
} |
| 5858 |
|
| 5859 |
// If this is a native event triggered above, everything is now in order |
| 5860 |
// Fire an inner synthetic event with the original arguments |
| 5861 |
} else if (saved.length) { |
| 5862 |
// ...and capture the result |
| 5863 |
dataPriv.set(this, type, { |
| 5864 |
value: jQuery.event.trigger( |
| 5865 |
// Support: IE <=9 - 11+ |
| 5866 |
// Extend with the prototype to reset the above stopImmediatePropagation() |
| 5867 |
jQuery.extend(saved[0], jQuery.Event.prototype), |
| 5868 |
saved.slice(1), |
| 5869 |
this |
| 5870 |
), |
| 5871 |
}); |
| 5872 |
|
| 5873 |
// Abort handling of the native event |
| 5874 |
event.stopImmediatePropagation(); |
| 5875 |
} |
| 5876 |
}, |
| 5877 |
}); |
| 5878 |
} |
| 5879 |
|
| 5880 |
jQuery.removeEvent = function (elem, type, handle) { |
| 5881 |
// This "if" is needed for plain objects |
| 5882 |
if (elem.removeEventListener) { |
| 5883 |
elem.removeEventListener(type, handle); |
| 5884 |
} |
| 5885 |
}; |
| 5886 |
|
| 5887 |
jQuery.Event = function (src, props) { |
| 5888 |
// Allow instantiation without the 'new' keyword |
| 5889 |
if (!(this instanceof jQuery.Event)) { |
| 5890 |
return new jQuery.Event(src, props); |
| 5891 |
} |
| 5892 |
|
| 5893 |
// Event object |
| 5894 |
if (src && src.type) { |
| 5895 |
this.originalEvent = src; |
| 5896 |
this.type = src.type; |
| 5897 |
|
| 5898 |
// Events bubbling up the document may have been marked as prevented |
| 5899 |
// by a handler lower down the tree; reflect the correct value. |
| 5900 |
this.isDefaultPrevented = |
| 5901 |
src.defaultPrevented || |
| 5902 |
(src.defaultPrevented === undefined && |
| 5903 |
// Support: Android <=2.3 only |
| 5904 |
src.returnValue === false) |
| 5905 |
? returnTrue |
| 5906 |
: returnFalse; |
| 5907 |
|
| 5908 |
// Create target properties |
| 5909 |
// Support: Safari <=6 - 7 only |
| 5910 |
// Target should not be a text node (#504, #13143) |
| 5911 |
this.target = |
| 5912 |
src.target && src.target.nodeType === 3 |
| 5913 |
? src.target.parentNode |
| 5914 |
: src.target; |
| 5915 |
|
| 5916 |
this.currentTarget = src.currentTarget; |
| 5917 |
this.relatedTarget = src.relatedTarget; |
| 5918 |
|
| 5919 |
// Event type |
| 5920 |
} else { |
| 5921 |
this.type = src; |
| 5922 |
} |
| 5923 |
|
| 5924 |
// Put explicitly provided properties onto the event object |
| 5925 |
if (props) { |
| 5926 |
jQuery.extend(this, props); |
| 5927 |
} |
| 5928 |
|
| 5929 |
// Create a timestamp if incoming event doesn't have one |
| 5930 |
this.timeStamp = (src && src.timeStamp) || Date.now(); |
| 5931 |
|
| 5932 |
// Mark it as fixed |
| 5933 |
this[jQuery.expando] = true; |
| 5934 |
}; |
| 5935 |
|
| 5936 |
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding |
| 5937 |
// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html |
| 5938 |
jQuery.Event.prototype = { |
| 5939 |
constructor: jQuery.Event, |
| 5940 |
isDefaultPrevented: returnFalse, |
| 5941 |
isPropagationStopped: returnFalse, |
| 5942 |
isImmediatePropagationStopped: returnFalse, |
| 5943 |
isSimulated: false, |
| 5944 |
|
| 5945 |
preventDefault: function () { |
| 5946 |
var e = this.originalEvent; |
| 5947 |
|
| 5948 |
this.isDefaultPrevented = returnTrue; |
| 5949 |
|
| 5950 |
if (e && !this.isSimulated) { |
| 5951 |
e.preventDefault(); |
| 5952 |
} |
| 5953 |
}, |
| 5954 |
stopPropagation: function () { |
| 5955 |
var e = this.originalEvent; |
| 5956 |
|
| 5957 |
this.isPropagationStopped = returnTrue; |
| 5958 |
|
| 5959 |
if (e && !this.isSimulated) { |
| 5960 |
e.stopPropagation(); |
| 5961 |
} |
| 5962 |
}, |
| 5963 |
stopImmediatePropagation: function () { |
| 5964 |
var e = this.originalEvent; |
| 5965 |
|
| 5966 |
this.isImmediatePropagationStopped = returnTrue; |
| 5967 |
|
| 5968 |
if (e && !this.isSimulated) { |
| 5969 |
e.stopImmediatePropagation(); |
| 5970 |
} |
| 5971 |
|
| 5972 |
this.stopPropagation(); |
| 5973 |
}, |
| 5974 |
}; |
| 5975 |
|
| 5976 |
// Includes all common event props including KeyEvent and MouseEvent specific props |
| 5977 |
jQuery.each( |
| 5978 |
{ |
| 5979 |
altKey: true, |
| 5980 |
bubbles: true, |
| 5981 |
cancelable: true, |
| 5982 |
changedTouches: true, |
| 5983 |
ctrlKey: true, |
| 5984 |
detail: true, |
| 5985 |
eventPhase: true, |
| 5986 |
metaKey: true, |
| 5987 |
pageX: true, |
| 5988 |
pageY: true, |
| 5989 |
shiftKey: true, |
| 5990 |
view: true, |
| 5991 |
char: true, |
| 5992 |
code: true, |
| 5993 |
charCode: true, |
| 5994 |
key: true, |
| 5995 |
keyCode: true, |
| 5996 |
button: true, |
| 5997 |
buttons: true, |
| 5998 |
clientX: true, |
| 5999 |
clientY: true, |
| 6000 |
offsetX: true, |
| 6001 |
offsetY: true, |
| 6002 |
pointerId: true, |
| 6003 |
pointerType: true, |
| 6004 |
screenX: true, |
| 6005 |
screenY: true, |
| 6006 |
targetTouches: true, |
| 6007 |
toElement: true, |
| 6008 |
touches: true, |
| 6009 |
which: true, |
| 6010 |
}, |
| 6011 |
jQuery.event.addProp |
| 6012 |
); |
| 6013 |
|
| 6014 |
jQuery.each( |
| 6015 |
{ focus: "focusin", blur: "focusout" }, |
| 6016 |
function (type, delegateType) { |
| 6017 |
jQuery.event.special[type] = { |
| 6018 |
// Utilize native event if possible so blur/focus sequence is correct |
| 6019 |
setup: function () { |
| 6020 |
// Claim the first handler |
| 6021 |
// dataPriv.set( this, "focus", ... ) |
| 6022 |
// dataPriv.set( this, "blur", ... ) |
| 6023 |
leverageNative(this, type, expectSync); |
| 6024 |
|
| 6025 |
// Return false to allow normal processing in the caller |
| 6026 |
return false; |
| 6027 |
}, |
| 6028 |
trigger: function () { |
| 6029 |
// Force setup before trigger |
| 6030 |
leverageNative(this, type); |
| 6031 |
|
| 6032 |
// Return non-false to allow normal event-path propagation |
| 6033 |
return true; |
| 6034 |
}, |
| 6035 |
|
| 6036 |
// Suppress native focus or blur as it's already being fired |
| 6037 |
// in leverageNative. |
| 6038 |
_default: function () { |
| 6039 |
return true; |
| 6040 |
}, |
| 6041 |
|
| 6042 |
delegateType: delegateType, |
| 6043 |
}; |
| 6044 |
} |
| 6045 |
); |
| 6046 |
|
| 6047 |
// Create mouseenter/leave events using mouseover/out and event-time checks |
| 6048 |
// so that event delegation works in jQuery. |
| 6049 |
// Do the same for pointerenter/pointerleave and pointerover/pointerout |
| 6050 |
// |
| 6051 |
// Support: Safari 7 only |
| 6052 |
// Safari sends mouseenter too often; see: |
| 6053 |
// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 |
| 6054 |
// for the description of the bug (it existed in older Chrome versions as well). |
| 6055 |
jQuery.each( |
| 6056 |
{ |
| 6057 |
mouseenter: "mouseover", |
| 6058 |
mouseleave: "mouseout", |
| 6059 |
pointerenter: "pointerover", |
| 6060 |
pointerleave: "pointerout", |
| 6061 |
}, |
| 6062 |
function (orig, fix) { |
| 6063 |
jQuery.event.special[orig] = { |
| 6064 |
delegateType: fix, |
| 6065 |
bindType: fix, |
| 6066 |
|
| 6067 |
handle: function (event) { |
| 6068 |
var ret, |
| 6069 |
target = this, |
| 6070 |
related = event.relatedTarget, |
| 6071 |
handleObj = event.handleObj; |
| 6072 |
|
| 6073 |
// For mouseenter/leave call the handler if related is outside the target. |
| 6074 |
// NB: No relatedTarget if the mouse left/entered the browser window |
| 6075 |
if ( |
| 6076 |
!related || |
| 6077 |
(related !== target && !jQuery.contains(target, related)) |
| 6078 |
) { |
| 6079 |
event.type = handleObj.origType; |
| 6080 |
ret = handleObj.handler.apply(this, arguments); |
| 6081 |
event.type = fix; |
| 6082 |
} |
| 6083 |
return ret; |
| 6084 |
}, |
| 6085 |
}; |
| 6086 |
} |
| 6087 |
); |
| 6088 |
|
| 6089 |
jQuery.fn.extend({ |
| 6090 |
on: function (types, selector, data, fn) { |
| 6091 |
return on(this, types, selector, data, fn); |
| 6092 |
}, |
| 6093 |
one: function (types, selector, data, fn) { |
| 6094 |
return on(this, types, selector, data, fn, 1); |
| 6095 |
}, |
| 6096 |
off: function (types, selector, fn) { |
| 6097 |
var handleObj, type; |
| 6098 |
if (types && types.preventDefault && types.handleObj) { |
| 6099 |
// ( event ) dispatched jQuery.Event |
| 6100 |
handleObj = types.handleObj; |
| 6101 |
jQuery(types.delegateTarget).off( |
| 6102 |
handleObj.namespace |
| 6103 |
? handleObj.origType + "." + handleObj.namespace |
| 6104 |
: handleObj.origType, |
| 6105 |
handleObj.selector, |
| 6106 |
handleObj.handler |
| 6107 |
); |
| 6108 |
return this; |
| 6109 |
} |
| 6110 |
if (typeof types === "object") { |
| 6111 |
// ( types-object [, selector] ) |
| 6112 |
for (type in types) { |
| 6113 |
this.off(type, selector, types[type]); |
| 6114 |
} |
| 6115 |
return this; |
| 6116 |
} |
| 6117 |
if (selector === false || typeof selector === "function") { |
| 6118 |
// ( types [, fn] ) |
| 6119 |
fn = selector; |
| 6120 |
selector = undefined; |
| 6121 |
} |
| 6122 |
if (fn === false) { |
| 6123 |
fn = returnFalse; |
| 6124 |
} |
| 6125 |
return this.each(function () { |
| 6126 |
jQuery.event.remove(this, types, fn, selector); |
| 6127 |
}); |
| 6128 |
}, |
| 6129 |
}); |
| 6130 |
|
| 6131 |
var // Support: IE <=10 - 11, Edge 12 - 13 only |
| 6132 |
// In IE/Edge using regex groups here causes severe slowdowns. |
| 6133 |
// See https://connect.microsoft.com/IE/feedback/details/1736512/ |
| 6134 |
rnoInnerhtml = /<script|<style|<link/i, |
| 6135 |
// checked="checked" or checked |
| 6136 |
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, |
| 6137 |
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; |
| 6138 |
|
| 6139 |
// Prefer a tbody over its parent table for containing new rows |
| 6140 |
function manipulationTarget(elem, content) { |
| 6141 |
if ( |
| 6142 |
nodeName(elem, "table") && |
| 6143 |
nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr") |
| 6144 |
) { |
| 6145 |
return jQuery(elem).children("tbody")[0] || elem; |
| 6146 |
} |
| 6147 |
|
| 6148 |
return elem; |
| 6149 |
} |
| 6150 |
|
| 6151 |
// Replace/restore the type attribute of script elements for safe DOM manipulation |
| 6152 |
function disableScript(elem) { |
| 6153 |
elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type; |
| 6154 |
return elem; |
| 6155 |
} |
| 6156 |
function restoreScript(elem) { |
| 6157 |
if ((elem.type || "").slice(0, 5) === "true/") { |
| 6158 |
elem.type = elem.type.slice(5); |
| 6159 |
} else { |
| 6160 |
elem.removeAttribute("type"); |
| 6161 |
} |
| 6162 |
|
| 6163 |
return elem; |
| 6164 |
} |
| 6165 |
|
| 6166 |
function cloneCopyEvent(src, dest) { |
| 6167 |
var i, l, type, pdataOld, udataOld, udataCur, events; |
| 6168 |
|
| 6169 |
if (dest.nodeType !== 1) { |
| 6170 |
return; |
| 6171 |
} |
| 6172 |
|
| 6173 |
// 1. Copy private data: events, handlers, etc. |
| 6174 |
if (dataPriv.hasData(src)) { |
| 6175 |
pdataOld = dataPriv.get(src); |
| 6176 |
events = pdataOld.events; |
| 6177 |
|
| 6178 |
if (events) { |
| 6179 |
dataPriv.remove(dest, "handle events"); |
| 6180 |
|
| 6181 |
for (type in events) { |
| 6182 |
for (i = 0, l = events[type].length; i < l; i++) { |
| 6183 |
jQuery.event.add(dest, type, events[type][i]); |
| 6184 |
} |
| 6185 |
} |
| 6186 |
} |
| 6187 |
} |
| 6188 |
|
| 6189 |
// 2. Copy user data |
| 6190 |
if (dataUser.hasData(src)) { |
| 6191 |
udataOld = dataUser.access(src); |
| 6192 |
udataCur = jQuery.extend({}, udataOld); |
| 6193 |
|
| 6194 |
dataUser.set(dest, udataCur); |
| 6195 |
} |
| 6196 |
} |
| 6197 |
|
| 6198 |
// Fix IE bugs, see support tests |
| 6199 |
function fixInput(src, dest) { |
| 6200 |
var nodeName = dest.nodeName.toLowerCase(); |
| 6201 |
|
| 6202 |
// Fails to persist the checked state of a cloned checkbox or radio button. |
| 6203 |
if (nodeName === "input" && rcheckableType.test(src.type)) { |
| 6204 |
dest.checked = src.checked; |
| 6205 |
|
| 6206 |
// Fails to return the selected option to the default selected state when cloning options |
| 6207 |
} else if (nodeName === "input" || nodeName === "textarea") { |
| 6208 |
dest.defaultValue = src.defaultValue; |
| 6209 |
} |
| 6210 |
} |
| 6211 |
|
| 6212 |
function domManip(collection, args, callback, ignored) { |
| 6213 |
// Flatten any nested arrays |
| 6214 |
args = flat(args); |
| 6215 |
|
| 6216 |
var fragment, |
| 6217 |
first, |
| 6218 |
scripts, |
| 6219 |
hasScripts, |
| 6220 |
node, |
| 6221 |
doc, |
| 6222 |
i = 0, |
| 6223 |
l = collection.length, |
| 6224 |
iNoClone = l - 1, |
| 6225 |
value = args[0], |
| 6226 |
valueIsFunction = isFunction(value); |
| 6227 |
|
| 6228 |
// We can't cloneNode fragments that contain checked, in WebKit |
| 6229 |
if ( |
| 6230 |
valueIsFunction || |
| 6231 |
(l > 1 && |
| 6232 |
typeof value === "string" && |
| 6233 |
!support.checkClone && |
| 6234 |
rchecked.test(value)) |
| 6235 |
) { |
| 6236 |
return collection.each(function (index) { |
| 6237 |
var self = collection.eq(index); |
| 6238 |
if (valueIsFunction) { |
| 6239 |
args[0] = value.call(this, index, self.html()); |
| 6240 |
} |
| 6241 |
domManip(self, args, callback, ignored); |
| 6242 |
}); |
| 6243 |
} |
| 6244 |
|
| 6245 |
if (l) { |
| 6246 |
fragment = buildFragment( |
| 6247 |
args, |
| 6248 |
collection[0].ownerDocument, |
| 6249 |
false, |
| 6250 |
collection, |
| 6251 |
ignored |
| 6252 |
); |
| 6253 |
first = fragment.firstChild; |
| 6254 |
|
| 6255 |
if (fragment.childNodes.length === 1) { |
| 6256 |
fragment = first; |
| 6257 |
} |
| 6258 |
|
| 6259 |
// Require either new content or an interest in ignored elements to invoke the callback |
| 6260 |
if (first || ignored) { |
| 6261 |
scripts = jQuery.map(getAll(fragment, "script"), disableScript); |
| 6262 |
hasScripts = scripts.length; |
| 6263 |
|
| 6264 |
// Use the original fragment for the last item |
| 6265 |
// instead of the first because it can end up |
| 6266 |
// being emptied incorrectly in certain situations (#8070). |
| 6267 |
for (; i < l; i++) { |
| 6268 |
node = fragment; |
| 6269 |
|
| 6270 |
if (i !== iNoClone) { |
| 6271 |
node = jQuery.clone(node, true, true); |
| 6272 |
|
| 6273 |
// Keep references to cloned scripts for later restoration |
| 6274 |
if (hasScripts) { |
| 6275 |
// Support: Android <=4.0 only, PhantomJS 1 only |
| 6276 |
// push.apply(_, arraylike) throws on ancient WebKit |
| 6277 |
jQuery.merge(scripts, getAll(node, "script")); |
| 6278 |
} |
| 6279 |
} |
| 6280 |
|
| 6281 |
callback.call(collection[i], node, i); |
| 6282 |
} |
| 6283 |
|
| 6284 |
if (hasScripts) { |
| 6285 |
doc = scripts[scripts.length - 1].ownerDocument; |
| 6286 |
|
| 6287 |
// Reenable scripts |
| 6288 |
jQuery.map(scripts, restoreScript); |
| 6289 |
|
| 6290 |
// Evaluate executable scripts on first document insertion |
| 6291 |
for (i = 0; i < hasScripts; i++) { |
| 6292 |
node = scripts[i]; |
| 6293 |
if ( |
| 6294 |
rscriptType.test(node.type || "") && |
| 6295 |
!dataPriv.access(node, "globalEval") && |
| 6296 |
jQuery.contains(doc, node) |
| 6297 |
) { |
| 6298 |
if (node.src && (node.type || "").toLowerCase() !== "module") { |
| 6299 |
// Optional AJAX dependency, but won't run scripts if not present |
| 6300 |
if (jQuery._evalUrl && !node.noModule) { |
| 6301 |
jQuery._evalUrl( |
| 6302 |
node.src, |
| 6303 |
{ |
| 6304 |
nonce: node.nonce || node.getAttribute("nonce"), |
| 6305 |
}, |
| 6306 |
doc |
| 6307 |
); |
| 6308 |
} |
| 6309 |
} else { |
| 6310 |
DOMEval(node.textContent.replace(rcleanScript, ""), node, doc); |
| 6311 |
} |
| 6312 |
} |
| 6313 |
} |
| 6314 |
} |
| 6315 |
} |
| 6316 |
} |
| 6317 |
|
| 6318 |
return collection; |
| 6319 |
} |
| 6320 |
|
| 6321 |
function remove(elem, selector, keepData) { |
| 6322 |
var node, |
| 6323 |
nodes = selector ? jQuery.filter(selector, elem) : elem, |
| 6324 |
i = 0; |
| 6325 |
|
| 6326 |
for (; (node = nodes[i]) != null; i++) { |
| 6327 |
if (!keepData && node.nodeType === 1) { |
| 6328 |
jQuery.cleanData(getAll(node)); |
| 6329 |
} |
| 6330 |
|
| 6331 |
if (node.parentNode) { |
| 6332 |
if (keepData && isAttached(node)) { |
| 6333 |
setGlobalEval(getAll(node, "script")); |
| 6334 |
} |
| 6335 |
node.parentNode.removeChild(node); |
| 6336 |
} |
| 6337 |
} |
| 6338 |
|
| 6339 |
return elem; |
| 6340 |
} |
| 6341 |
|
| 6342 |
jQuery.extend({ |
| 6343 |
htmlPrefilter: function (html) { |
| 6344 |
return html; |
| 6345 |
}, |
| 6346 |
|
| 6347 |
clone: function (elem, dataAndEvents, deepDataAndEvents) { |
| 6348 |
var i, |
| 6349 |
l, |
| 6350 |
srcElements, |
| 6351 |
destElements, |
| 6352 |
clone = elem.cloneNode(true), |
| 6353 |
inPage = isAttached(elem); |
| 6354 |
|
| 6355 |
// Fix IE cloning issues |
| 6356 |
if ( |
| 6357 |
!support.noCloneChecked && |
| 6358 |
(elem.nodeType === 1 || elem.nodeType === 11) && |
| 6359 |
!jQuery.isXMLDoc(elem) |
| 6360 |
) { |
| 6361 |
// We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 |
| 6362 |
destElements = getAll(clone); |
| 6363 |
srcElements = getAll(elem); |
| 6364 |
|
| 6365 |
for (i = 0, l = srcElements.length; i < l; i++) { |
| 6366 |
fixInput(srcElements[i], destElements[i]); |
| 6367 |
} |
| 6368 |
} |
| 6369 |
|
| 6370 |
// Copy the events from the original to the clone |
| 6371 |
if (dataAndEvents) { |
| 6372 |
if (deepDataAndEvents) { |
| 6373 |
srcElements = srcElements || getAll(elem); |
| 6374 |
destElements = destElements || getAll(clone); |
| 6375 |
|
| 6376 |
for (i = 0, l = srcElements.length; i < l; i++) { |
| 6377 |
cloneCopyEvent(srcElements[i], destElements[i]); |
| 6378 |
} |
| 6379 |
} else { |
| 6380 |
cloneCopyEvent(elem, clone); |
| 6381 |
} |
| 6382 |
} |
| 6383 |
|
| 6384 |
// Preserve script evaluation history |
| 6385 |
destElements = getAll(clone, "script"); |
| 6386 |
if (destElements.length > 0) { |
| 6387 |
setGlobalEval(destElements, !inPage && getAll(elem, "script")); |
| 6388 |
} |
| 6389 |
|
| 6390 |
// Return the cloned set |
| 6391 |
return clone; |
| 6392 |
}, |
| 6393 |
|
| 6394 |
cleanData: function (elems) { |
| 6395 |
var data, |
| 6396 |
elem, |
| 6397 |
type, |
| 6398 |
special = jQuery.event.special, |
| 6399 |
i = 0; |
| 6400 |
|
| 6401 |
for (; (elem = elems[i]) !== undefined; i++) { |
| 6402 |
if (acceptData(elem)) { |
| 6403 |
if ((data = elem[dataPriv.expando])) { |
| 6404 |
if (data.events) { |
| 6405 |
for (type in data.events) { |
| 6406 |
if (special[type]) { |
| 6407 |
jQuery.event.remove(elem, type); |
| 6408 |
|
| 6409 |
// This is a shortcut to avoid jQuery.event.remove's overhead |
| 6410 |
} else { |
| 6411 |
jQuery.removeEvent(elem, type, data.handle); |
| 6412 |
} |
| 6413 |
} |
| 6414 |
} |
| 6415 |
|
| 6416 |
// Support: Chrome <=35 - 45+ |
| 6417 |
// Assign undefined instead of using delete, see Data#remove |
| 6418 |
elem[dataPriv.expando] = undefined; |
| 6419 |
} |
| 6420 |
if (elem[dataUser.expando]) { |
| 6421 |
// Support: Chrome <=35 - 45+ |
| 6422 |
// Assign undefined instead of using delete, see Data#remove |
| 6423 |
elem[dataUser.expando] = undefined; |
| 6424 |
} |
| 6425 |
} |
| 6426 |
} |
| 6427 |
}, |
| 6428 |
}); |
| 6429 |
|
| 6430 |
jQuery.fn.extend({ |
| 6431 |
detach: function (selector) { |
| 6432 |
return remove(this, selector, true); |
| 6433 |
}, |
| 6434 |
|
| 6435 |
remove: function (selector) { |
| 6436 |
return remove(this, selector); |
| 6437 |
}, |
| 6438 |
|
| 6439 |
text: function (value) { |
| 6440 |
return access( |
| 6441 |
this, |
| 6442 |
function (value) { |
| 6443 |
return value === undefined |
| 6444 |
? jQuery.text(this) |
| 6445 |
: this.empty().each(function () { |
| 6446 |
if ( |
| 6447 |
this.nodeType === 1 || |
| 6448 |
this.nodeType === 11 || |
| 6449 |
this.nodeType === 9 |
| 6450 |
) { |
| 6451 |
this.textContent = value; |
| 6452 |
} |
| 6453 |
}); |
| 6454 |
}, |
| 6455 |
null, |
| 6456 |
value, |
| 6457 |
arguments.length |
| 6458 |
); |
| 6459 |
}, |
| 6460 |
|
| 6461 |
append: function () { |
| 6462 |
return domManip(this, arguments, function (elem) { |
| 6463 |
if ( |
| 6464 |
this.nodeType === 1 || |
| 6465 |
this.nodeType === 11 || |
| 6466 |
this.nodeType === 9 |
| 6467 |
) { |
| 6468 |
var target = manipulationTarget(this, elem); |
| 6469 |
target.appendChild(elem); |
| 6470 |
} |
| 6471 |
}); |
| 6472 |
}, |
| 6473 |
|
| 6474 |
prepend: function () { |
| 6475 |
return domManip(this, arguments, function (elem) { |
| 6476 |
if ( |
| 6477 |
this.nodeType === 1 || |
| 6478 |
this.nodeType === 11 || |
| 6479 |
this.nodeType === 9 |
| 6480 |
) { |
| 6481 |
var target = manipulationTarget(this, elem); |
| 6482 |
target.insertBefore(elem, target.firstChild); |
| 6483 |
} |
| 6484 |
}); |
| 6485 |
}, |
| 6486 |
|
| 6487 |
before: function () { |
| 6488 |
return domManip(this, arguments, function (elem) { |
| 6489 |
if (this.parentNode) { |
| 6490 |
this.parentNode.insertBefore(elem, this); |
| 6491 |
} |
| 6492 |
}); |
| 6493 |
}, |
| 6494 |
|
| 6495 |
after: function () { |
| 6496 |
return domManip(this, arguments, function (elem) { |
| 6497 |
if (this.parentNode) { |
| 6498 |
this.parentNode.insertBefore(elem, this.nextSibling); |
| 6499 |
} |
| 6500 |
}); |
| 6501 |
}, |
| 6502 |
|
| 6503 |
empty: function () { |
| 6504 |
var elem, |
| 6505 |
i = 0; |
| 6506 |
|
| 6507 |
for (; (elem = this[i]) != null; i++) { |
| 6508 |
if (elem.nodeType === 1) { |
| 6509 |
// Prevent memory leaks |
| 6510 |
jQuery.cleanData(getAll(elem, false)); |
| 6511 |
|
| 6512 |
// Remove any remaining nodes |
| 6513 |
elem.textContent = ""; |
| 6514 |
} |
| 6515 |
} |
| 6516 |
|
| 6517 |
return this; |
| 6518 |
}, |
| 6519 |
|
| 6520 |
clone: function (dataAndEvents, deepDataAndEvents) { |
| 6521 |
dataAndEvents = dataAndEvents == null ? false : dataAndEvents; |
| 6522 |
deepDataAndEvents = |
| 6523 |
deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; |
| 6524 |
|
| 6525 |
return this.map(function () { |
| 6526 |
return jQuery.clone(this, dataAndEvents, deepDataAndEvents); |
| 6527 |
}); |
| 6528 |
}, |
| 6529 |
|
| 6530 |
html: function (value) { |
| 6531 |
return access( |
| 6532 |
this, |
| 6533 |
function (value) { |
| 6534 |
var elem = this[0] || {}, |
| 6535 |
i = 0, |
| 6536 |
l = this.length; |
| 6537 |
|
| 6538 |
if (value === undefined && elem.nodeType === 1) { |
| 6539 |
return elem.innerHTML; |
| 6540 |
} |
| 6541 |
|
| 6542 |
// See if we can take a shortcut and just use innerHTML |
| 6543 |
if ( |
| 6544 |
typeof value === "string" && |
| 6545 |
!rnoInnerhtml.test(value) && |
| 6546 |
!wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()] |
| 6547 |
) { |
| 6548 |
value = jQuery.htmlPrefilter(value); |
| 6549 |
|
| 6550 |
try { |
| 6551 |
for (; i < l; i++) { |
| 6552 |
elem = this[i] || {}; |
| 6553 |
|
| 6554 |
// Remove element nodes and prevent memory leaks |
| 6555 |
if (elem.nodeType === 1) { |
| 6556 |
jQuery.cleanData(getAll(elem, false)); |
| 6557 |
elem.innerHTML = value; |
| 6558 |
} |
| 6559 |
} |
| 6560 |
|
| 6561 |
elem = 0; |
| 6562 |
|
| 6563 |
// If using innerHTML throws an exception, use the fallback method |
| 6564 |
} catch (e) {} |
| 6565 |
} |
| 6566 |
|
| 6567 |
if (elem) { |
| 6568 |
this.empty().append(value); |
| 6569 |
} |
| 6570 |
}, |
| 6571 |
null, |
| 6572 |
value, |
| 6573 |
arguments.length |
| 6574 |
); |
| 6575 |
}, |
| 6576 |
|
| 6577 |
replaceWith: function () { |
| 6578 |
var ignored = []; |
| 6579 |
|
| 6580 |
// Make the changes, replacing each non-ignored context element with the new content |
| 6581 |
return domManip( |
| 6582 |
this, |
| 6583 |
arguments, |
| 6584 |
function (elem) { |
| 6585 |
var parent = this.parentNode; |
| 6586 |
|
| 6587 |
if (jQuery.inArray(this, ignored) < 0) { |
| 6588 |
jQuery.cleanData(getAll(this)); |
| 6589 |
if (parent) { |
| 6590 |
parent.replaceChild(elem, this); |
| 6591 |
} |
| 6592 |
} |
| 6593 |
|
| 6594 |
// Force callback invocation |
| 6595 |
}, |
| 6596 |
ignored |
| 6597 |
); |
| 6598 |
}, |
| 6599 |
}); |
| 6600 |
|
| 6601 |
jQuery.each( |
| 6602 |
{ |
| 6603 |
appendTo: "append", |
| 6604 |
prependTo: "prepend", |
| 6605 |
insertBefore: "before", |
| 6606 |
insertAfter: "after", |
| 6607 |
replaceAll: "replaceWith", |
| 6608 |
}, |
| 6609 |
function (name, original) { |
| 6610 |
jQuery.fn[name] = function (selector) { |
| 6611 |
var elems, |
| 6612 |
ret = [], |
| 6613 |
insert = jQuery(selector), |
| 6614 |
last = insert.length - 1, |
| 6615 |
i = 0; |
| 6616 |
|
| 6617 |
for (; i <= last; i++) { |
| 6618 |
elems = i === last ? this : this.clone(true); |
| 6619 |
jQuery(insert[i])[original](elems); |
| 6620 |
|
| 6621 |
// Support: Android <=4.0 only, PhantomJS 1 only |
| 6622 |
// .get() because push.apply(_, arraylike) throws on ancient WebKit |
| 6623 |
push.apply(ret, elems.get()); |
| 6624 |
} |
| 6625 |
|
| 6626 |
return this.pushStack(ret); |
| 6627 |
}; |
| 6628 |
} |
| 6629 |
); |
| 6630 |
var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i"); |
| 6631 |
|
| 6632 |
var getStyles = function (elem) { |
| 6633 |
// Support: IE <=11 only, Firefox <=30 (#15098, #14150) |
| 6634 |
// IE throws on elements created in popups |
| 6635 |
// FF meanwhile throws on frame elements through "defaultView.getComputedStyle" |
| 6636 |
var view = elem.ownerDocument.defaultView; |
| 6637 |
|
| 6638 |
if (!view || !view.opener) { |
| 6639 |
view = window; |
| 6640 |
} |
| 6641 |
|
| 6642 |
return view.getComputedStyle(elem); |
| 6643 |
}; |
| 6644 |
|
| 6645 |
var swap = function (elem, options, callback) { |
| 6646 |
var ret, |
| 6647 |
name, |
| 6648 |
old = {}; |
| 6649 |
|
| 6650 |
// Remember the old values, and insert the new ones |
| 6651 |
for (name in options) { |
| 6652 |
old[name] = elem.style[name]; |
| 6653 |
elem.style[name] = options[name]; |
| 6654 |
} |
| 6655 |
|
| 6656 |
ret = callback.call(elem); |
| 6657 |
|
| 6658 |
// Revert the old values |
| 6659 |
for (name in options) { |
| 6660 |
elem.style[name] = old[name]; |
| 6661 |
} |
| 6662 |
|
| 6663 |
return ret; |
| 6664 |
}; |
| 6665 |
|
| 6666 |
var rboxStyle = new RegExp(cssExpand.join("|"), "i"); |
| 6667 |
|
| 6668 |
(function () { |
| 6669 |
// Executing both pixelPosition & boxSizingReliable tests require only one layout |
| 6670 |
// so they're executed at the same time to save the second computation. |
| 6671 |
function computeStyleTests() { |
| 6672 |
// This is a singleton, we need to execute it only once |
| 6673 |
if (!div) { |
| 6674 |
return; |
| 6675 |
} |
| 6676 |
|
| 6677 |
container.style.cssText = |
| 6678 |
"position:absolute;left:-11111px;width:60px;" + |
| 6679 |
"margin-top:1px;padding:0;border:0"; |
| 6680 |
div.style.cssText = |
| 6681 |
"position:relative;display:block;box-sizing:border-box;overflow:scroll;" + |
| 6682 |
"margin:auto;border:1px;padding:1px;" + |
| 6683 |
"width:60%;top:1%"; |
| 6684 |
documentElement.appendChild(container).appendChild(div); |
| 6685 |
|
| 6686 |
var divStyle = window.getComputedStyle(div); |
| 6687 |
pixelPositionVal = divStyle.top !== "1%"; |
| 6688 |
|
| 6689 |
// Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 |
| 6690 |
reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12; |
| 6691 |
|
| 6692 |
// Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 |
| 6693 |
// Some styles come back with percentage values, even though they shouldn't |
| 6694 |
div.style.right = "60%"; |
| 6695 |
pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36; |
| 6696 |
|
| 6697 |
// Support: IE 9 - 11 only |
| 6698 |
// Detect misreporting of content dimensions for box-sizing:border-box elements |
| 6699 |
boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36; |
| 6700 |
|
| 6701 |
// Support: IE 9 only |
| 6702 |
// Detect overflow:scroll screwiness (gh-3699) |
| 6703 |
// Support: Chrome <=64 |
| 6704 |
// Don't get tricked when zoom affects offsetWidth (gh-4029) |
| 6705 |
div.style.position = "absolute"; |
| 6706 |
scrollboxSizeVal = roundPixelMeasures(div.offsetWidth / 3) === 12; |
| 6707 |
|
| 6708 |
documentElement.removeChild(container); |
| 6709 |
|
| 6710 |
// Nullify the div so it wouldn't be stored in the memory and |
| 6711 |
// it will also be a sign that checks already performed |
| 6712 |
div = null; |
| 6713 |
} |
| 6714 |
|
| 6715 |
function roundPixelMeasures(measure) { |
| 6716 |
return Math.round(parseFloat(measure)); |
| 6717 |
} |
| 6718 |
|
| 6719 |
var pixelPositionVal, |
| 6720 |
boxSizingReliableVal, |
| 6721 |
scrollboxSizeVal, |
| 6722 |
pixelBoxStylesVal, |
| 6723 |
reliableTrDimensionsVal, |
| 6724 |
reliableMarginLeftVal, |
| 6725 |
container = document.createElement("div"), |
| 6726 |
div = document.createElement("div"); |
| 6727 |
|
| 6728 |
// Finish early in limited (non-browser) environments |
| 6729 |
if (!div.style) { |
| 6730 |
return; |
| 6731 |
} |
| 6732 |
|
| 6733 |
// Support: IE <=9 - 11 only |
| 6734 |
// Style of cloned element affects source element cloned (#8908) |
| 6735 |
div.style.backgroundClip = "content-box"; |
| 6736 |
div.cloneNode(true).style.backgroundClip = ""; |
| 6737 |
support.clearCloneStyle = div.style.backgroundClip === "content-box"; |
| 6738 |
|
| 6739 |
jQuery.extend(support, { |
| 6740 |
boxSizingReliable: function () { |
| 6741 |
computeStyleTests(); |
| 6742 |
return boxSizingReliableVal; |
| 6743 |
}, |
| 6744 |
pixelBoxStyles: function () { |
| 6745 |
computeStyleTests(); |
| 6746 |
return pixelBoxStylesVal; |
| 6747 |
}, |
| 6748 |
pixelPosition: function () { |
| 6749 |
computeStyleTests(); |
| 6750 |
return pixelPositionVal; |
| 6751 |
}, |
| 6752 |
reliableMarginLeft: function () { |
| 6753 |
computeStyleTests(); |
| 6754 |
return reliableMarginLeftVal; |
| 6755 |
}, |
| 6756 |
scrollboxSize: function () { |
| 6757 |
computeStyleTests(); |
| 6758 |
return scrollboxSizeVal; |
| 6759 |
}, |
| 6760 |
|
| 6761 |
// Support: IE 9 - 11+, Edge 15 - 18+ |
| 6762 |
// IE/Edge misreport `getComputedStyle` of table rows with width/height |
| 6763 |
// set in CSS while `offset*` properties report correct values. |
| 6764 |
// Behavior in IE 9 is more subtle than in newer versions & it passes |
| 6765 |
// some versions of this test; make sure not to make it pass there! |
| 6766 |
// |
| 6767 |
// Support: Firefox 70+ |
| 6768 |
// Only Firefox includes border widths |
| 6769 |
// in computed dimensions. (gh-4529) |
| 6770 |
reliableTrDimensions: function () { |
| 6771 |
var table, tr, trChild, trStyle; |
| 6772 |
if (reliableTrDimensionsVal == null) { |
| 6773 |
table = document.createElement("table"); |
| 6774 |
tr = document.createElement("tr"); |
| 6775 |
trChild = document.createElement("div"); |
| 6776 |
|
| 6777 |
table.style.cssText = |
| 6778 |
"position:absolute;left:-11111px;border-collapse:separate"; |
| 6779 |
tr.style.cssText = "border:1px solid"; |
| 6780 |
|
| 6781 |
// Support: Chrome 86+ |
| 6782 |
// Height set through cssText does not get applied. |
| 6783 |
// Computed height then comes back as 0. |
| 6784 |
tr.style.height = "1px"; |
| 6785 |
trChild.style.height = "9px"; |
| 6786 |
|
| 6787 |
// Support: Android 8 Chrome 86+ |
| 6788 |
// In our bodyBackground.html iframe, |
| 6789 |
// display for all div elements is set to "inline", |
| 6790 |
// which causes a problem only in Android 8 Chrome 86. |
| 6791 |
// Ensuring the div is display: block |
| 6792 |
// gets around this issue. |
| 6793 |
trChild.style.display = "block"; |
| 6794 |
|
| 6795 |
documentElement |
| 6796 |
.appendChild(table) |
| 6797 |
.appendChild(tr) |
| 6798 |
.appendChild(trChild); |
| 6799 |
|
| 6800 |
trStyle = window.getComputedStyle(tr); |
| 6801 |
reliableTrDimensionsVal = |
| 6802 |
parseInt(trStyle.height, 10) + |
| 6803 |
parseInt(trStyle.borderTopWidth, 10) + |
| 6804 |
parseInt(trStyle.borderBottomWidth, 10) === |
| 6805 |
tr.offsetHeight; |
| 6806 |
|
| 6807 |
documentElement.removeChild(table); |
| 6808 |
} |
| 6809 |
return reliableTrDimensionsVal; |
| 6810 |
}, |
| 6811 |
}); |
| 6812 |
})(); |
| 6813 |
|
| 6814 |
function curCSS(elem, name, computed) { |
| 6815 |
var width, |
| 6816 |
minWidth, |
| 6817 |
maxWidth, |
| 6818 |
ret, |
| 6819 |
// Support: Firefox 51+ |
| 6820 |
// Retrieving style before computed somehow |
| 6821 |
// fixes an issue with getting wrong values |
| 6822 |
// on detached elements |
| 6823 |
style = elem.style; |
| 6824 |
|
| 6825 |
computed = computed || getStyles(elem); |
| 6826 |
|
| 6827 |
// getPropertyValue is needed for: |
| 6828 |
// .css('filter') (IE 9 only, #12537) |
| 6829 |
// .css('--customProperty) (#3144) |
| 6830 |
if (computed) { |
| 6831 |
ret = computed.getPropertyValue(name) || computed[name]; |
| 6832 |
|
| 6833 |
if (ret === "" && !isAttached(elem)) { |
| 6834 |
ret = jQuery.style(elem, name); |
| 6835 |
} |
| 6836 |
|
| 6837 |
// A tribute to the "awesome hack by Dean Edwards" |
| 6838 |
// Android Browser returns percentage for some values, |
| 6839 |
// but width seems to be reliably pixels. |
| 6840 |
// This is against the CSSOM draft spec: |
| 6841 |
// https://drafts.csswg.org/cssom/#resolved-values |
| 6842 |
if ( |
| 6843 |
!support.pixelBoxStyles() && |
| 6844 |
rnumnonpx.test(ret) && |
| 6845 |
rboxStyle.test(name) |
| 6846 |
) { |
| 6847 |
// Remember the original values |
| 6848 |
width = style.width; |
| 6849 |
minWidth = style.minWidth; |
| 6850 |
maxWidth = style.maxWidth; |
| 6851 |
|
| 6852 |
// Put in the new values to get a computed value out |
| 6853 |
style.minWidth = style.maxWidth = style.width = ret; |
| 6854 |
ret = computed.width; |
| 6855 |
|
| 6856 |
// Revert the changed values |
| 6857 |
style.width = width; |
| 6858 |
style.minWidth = minWidth; |
| 6859 |
style.maxWidth = maxWidth; |
| 6860 |
} |
| 6861 |
} |
| 6862 |
|
| 6863 |
return ret !== undefined |
| 6864 |
? // Support: IE <=9 - 11 only |
| 6865 |
// IE returns zIndex value as an integer. |
| 6866 |
ret + "" |
| 6867 |
: ret; |
| 6868 |
} |
| 6869 |
|
| 6870 |
function addGetHookIf(conditionFn, hookFn) { |
| 6871 |
// Define the hook, we'll check on the first run if it's really needed. |
| 6872 |
return { |
| 6873 |
get: function () { |
| 6874 |
if (conditionFn()) { |
| 6875 |
// Hook not needed (or it's not possible to use it due |
| 6876 |
// to missing dependency), remove it. |
| 6877 |
delete this.get; |
| 6878 |
return; |
| 6879 |
} |
| 6880 |
|
| 6881 |
// Hook needed; redefine it so that the support test is not executed again. |
| 6882 |
return (this.get = hookFn).apply(this, arguments); |
| 6883 |
}, |
| 6884 |
}; |
| 6885 |
} |
| 6886 |
|
| 6887 |
var cssPrefixes = ["Webkit", "Moz", "ms"], |
| 6888 |
emptyStyle = document.createElement("div").style, |
| 6889 |
vendorProps = {}; |
| 6890 |
|
| 6891 |
// Return a vendor-prefixed property or undefined |
| 6892 |
function vendorPropName(name) { |
| 6893 |
// Check for vendor prefixed names |
| 6894 |
var capName = name[0].toUpperCase() + name.slice(1), |
| 6895 |
i = cssPrefixes.length; |
| 6896 |
|
| 6897 |
while (i--) { |
| 6898 |
name = cssPrefixes[i] + capName; |
| 6899 |
if (name in emptyStyle) { |
| 6900 |
return name; |
| 6901 |
} |
| 6902 |
} |
| 6903 |
} |
| 6904 |
|
| 6905 |
// Return a potentially-mapped jQuery.cssProps or vendor prefixed property |
| 6906 |
function finalPropName(name) { |
| 6907 |
var final = jQuery.cssProps[name] || vendorProps[name]; |
| 6908 |
|
| 6909 |
if (final) { |
| 6910 |
return final; |
| 6911 |
} |
| 6912 |
if (name in emptyStyle) { |
| 6913 |
return name; |
| 6914 |
} |
| 6915 |
return (vendorProps[name] = vendorPropName(name) || name); |
| 6916 |
} |
| 6917 |
|
| 6918 |
var // Swappable if display is none or starts with table |
| 6919 |
// except "table", "table-cell", or "table-caption" |
| 6920 |
// See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display |
| 6921 |
rdisplayswap = /^(none|table(?!-c[ea]).+)/, |
| 6922 |
rcustomProp = /^--/, |
| 6923 |
cssShow = { position: "absolute", visibility: "hidden", display: "block" }, |
| 6924 |
cssNormalTransform = { |
| 6925 |
letterSpacing: "0", |
| 6926 |
fontWeight: "400", |
| 6927 |
}; |
| 6928 |
|
| 6929 |
function setPositiveNumber(_elem, value, subtract) { |
| 6930 |
// Any relative (+/-) values have already been |
| 6931 |
// normalized at this point |
| 6932 |
var matches = rcssNum.exec(value); |
| 6933 |
return matches |
| 6934 |
? // Guard against undefined "subtract", e.g., when used as in cssHooks |
| 6935 |
Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") |
| 6936 |
: value; |
| 6937 |
} |
| 6938 |
|
| 6939 |
function boxModelAdjustment( |
| 6940 |
elem, |
| 6941 |
dimension, |
| 6942 |
box, |
| 6943 |
isBorderBox, |
| 6944 |
styles, |
| 6945 |
computedVal |
| 6946 |
) { |
| 6947 |
var i = dimension === "width" ? 1 : 0, |
| 6948 |
extra = 0, |
| 6949 |
delta = 0; |
| 6950 |
|
| 6951 |
// Adjustment may not be necessary |
| 6952 |
if (box === (isBorderBox ? "border" : "content")) { |
| 6953 |
return 0; |
| 6954 |
} |
| 6955 |
|
| 6956 |
for (; i < 4; i += 2) { |
| 6957 |
// Both box models exclude margin |
| 6958 |
if (box === "margin") { |
| 6959 |
delta += jQuery.css(elem, box + cssExpand[i], true, styles); |
| 6960 |
} |
| 6961 |
|
| 6962 |
// If we get here with a content-box, we're seeking "padding" or "border" or "margin" |
| 6963 |
if (!isBorderBox) { |
| 6964 |
// Add padding |
| 6965 |
delta += jQuery.css(elem, "padding" + cssExpand[i], true, styles); |
| 6966 |
|
| 6967 |
// For "border" or "margin", add border |
| 6968 |
if (box !== "padding") { |
| 6969 |
delta += jQuery.css( |
| 6970 |
elem, |
| 6971 |
"border" + cssExpand[i] + "Width", |
| 6972 |
true, |
| 6973 |
styles |
| 6974 |
); |
| 6975 |
|
| 6976 |
// But still keep track of it otherwise |
| 6977 |
} else { |
| 6978 |
extra += jQuery.css( |
| 6979 |
elem, |
| 6980 |
"border" + cssExpand[i] + "Width", |
| 6981 |
true, |
| 6982 |
styles |
| 6983 |
); |
| 6984 |
} |
| 6985 |
|
| 6986 |
// If we get here with a border-box (content + padding + border), we're seeking "content" or |
| 6987 |
// "padding" or "margin" |
| 6988 |
} else { |
| 6989 |
// For "content", subtract padding |
| 6990 |
if (box === "content") { |
| 6991 |
delta -= jQuery.css(elem, "padding" + cssExpand[i], true, styles); |
| 6992 |
} |
| 6993 |
|
| 6994 |
// For "content" or "padding", subtract border |
| 6995 |
if (box !== "margin") { |
| 6996 |
delta -= jQuery.css( |
| 6997 |
elem, |
| 6998 |
"border" + cssExpand[i] + "Width", |
| 6999 |
true, |
| 7000 |
styles |
| 7001 |
); |
| 7002 |
} |
| 7003 |
} |
| 7004 |
} |
| 7005 |
|
| 7006 |
// Account for positive content-box scroll gutter when requested by providing computedVal |
| 7007 |
if (!isBorderBox && computedVal >= 0) { |
| 7008 |
// offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border |
| 7009 |
// Assuming integer scroll gutter, subtract the rest and round down |
| 7010 |
delta += |
| 7011 |
Math.max( |
| 7012 |
0, |
| 7013 |
Math.ceil( |
| 7014 |
elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - |
| 7015 |
computedVal - |
| 7016 |
delta - |
| 7017 |
extra - |
| 7018 |
0.5 |
| 7019 |
|
| 7020 |
// If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter |
| 7021 |
// Use an explicit zero to avoid NaN (gh-3964) |
| 7022 |
) |
| 7023 |
) || 0; |
| 7024 |
} |
| 7025 |
|
| 7026 |
return delta; |
| 7027 |
} |
| 7028 |
|
| 7029 |
function getWidthOrHeight(elem, dimension, extra) { |
| 7030 |
// Start with computed style |
| 7031 |
var styles = getStyles(elem), |
| 7032 |
// To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). |
| 7033 |
// Fake content-box until we know it's needed to know the true value. |
| 7034 |
boxSizingNeeded = !support.boxSizingReliable() || extra, |
| 7035 |
isBorderBox = |
| 7036 |
boxSizingNeeded && |
| 7037 |
jQuery.css(elem, "boxSizing", false, styles) === "border-box", |
| 7038 |
valueIsBorderBox = isBorderBox, |
| 7039 |
val = curCSS(elem, dimension, styles), |
| 7040 |
offsetProp = "offset" + dimension[0].toUpperCase() + dimension.slice(1); |
| 7041 |
|
| 7042 |
// Support: Firefox <=54 |
| 7043 |
// Return a confounding non-pixel value or feign ignorance, as appropriate. |
| 7044 |
if (rnumnonpx.test(val)) { |
| 7045 |
if (!extra) { |
| 7046 |
return val; |
| 7047 |
} |
| 7048 |
val = "auto"; |
| 7049 |
} |
| 7050 |
|
| 7051 |
// Support: IE 9 - 11 only |
| 7052 |
// Use offsetWidth/offsetHeight for when box sizing is unreliable. |
| 7053 |
// In those cases, the computed value can be trusted to be border-box. |
| 7054 |
if ( |
| 7055 |
((!support.boxSizingReliable() && isBorderBox) || |
| 7056 |
// Support: IE 10 - 11+, Edge 15 - 18+ |
| 7057 |
// IE/Edge misreport `getComputedStyle` of table rows with width/height |
| 7058 |
// set in CSS while `offset*` properties report correct values. |
| 7059 |
// Interestingly, in some cases IE 9 doesn't suffer from this issue. |
| 7060 |
(!support.reliableTrDimensions() && nodeName(elem, "tr")) || |
| 7061 |
// Fall back to offsetWidth/offsetHeight when value is "auto" |
| 7062 |
// This happens for inline elements with no explicit setting (gh-3571) |
| 7063 |
val === "auto" || |
| 7064 |
// Support: Android <=4.1 - 4.3 only |
| 7065 |
// Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) |
| 7066 |
(!parseFloat(val) && |
| 7067 |
jQuery.css(elem, "display", false, styles) === "inline")) && |
| 7068 |
// Make sure the element is visible & connected |
| 7069 |
elem.getClientRects().length |
| 7070 |
) { |
| 7071 |
isBorderBox = |
| 7072 |
jQuery.css(elem, "boxSizing", false, styles) === "border-box"; |
| 7073 |
|
| 7074 |
// Where available, offsetWidth/offsetHeight approximate border box dimensions. |
| 7075 |
// Where not available (e.g., SVG), assume unreliable box-sizing and interpret the |
| 7076 |
// retrieved value as a content box dimension. |
| 7077 |
valueIsBorderBox = offsetProp in elem; |
| 7078 |
if (valueIsBorderBox) { |
| 7079 |
val = elem[offsetProp]; |
| 7080 |
} |
| 7081 |
} |
| 7082 |
|
| 7083 |
// Normalize "" and auto |
| 7084 |
val = parseFloat(val) || 0; |
| 7085 |
|
| 7086 |
// Adjust for the element's box model |
| 7087 |
return ( |
| 7088 |
val + |
| 7089 |
boxModelAdjustment( |
| 7090 |
elem, |
| 7091 |
dimension, |
| 7092 |
extra || (isBorderBox ? "border" : "content"), |
| 7093 |
valueIsBorderBox, |
| 7094 |
styles, |
| 7095 |
|
| 7096 |
// Provide the current computed size to request scroll gutter calculation (gh-3589) |
| 7097 |
val |
| 7098 |
) + |
| 7099 |
"px" |
| 7100 |
); |
| 7101 |
} |
| 7102 |
|
| 7103 |
jQuery.extend({ |
| 7104 |
// Add in style property hooks for overriding the default |
| 7105 |
// behavior of getting and setting a style property |
| 7106 |
cssHooks: { |
| 7107 |
opacity: { |
| 7108 |
get: function (elem, computed) { |
| 7109 |
if (computed) { |
| 7110 |
// We should always get a number back from opacity |
| 7111 |
var ret = curCSS(elem, "opacity"); |
| 7112 |
return ret === "" ? "1" : ret; |
| 7113 |
} |
| 7114 |
}, |
| 7115 |
}, |
| 7116 |
}, |
| 7117 |
|
| 7118 |
// Don't automatically add "px" to these possibly-unitless properties |
| 7119 |
cssNumber: { |
| 7120 |
animationIterationCount: true, |
| 7121 |
columnCount: true, |
| 7122 |
fillOpacity: true, |
| 7123 |
flexGrow: true, |
| 7124 |
flexShrink: true, |
| 7125 |
fontWeight: true, |
| 7126 |
gridArea: true, |
| 7127 |
gridColumn: true, |
| 7128 |
gridColumnEnd: true, |
| 7129 |
gridColumnStart: true, |
| 7130 |
gridRow: true, |
| 7131 |
gridRowEnd: true, |
| 7132 |
gridRowStart: true, |
| 7133 |
lineHeight: true, |
| 7134 |
opacity: true, |
| 7135 |
order: true, |
| 7136 |
orphans: true, |
| 7137 |
widows: true, |
| 7138 |
zIndex: true, |
| 7139 |
zoom: true, |
| 7140 |
}, |
| 7141 |
|
| 7142 |
// Add in properties whose names you wish to fix before |
| 7143 |
// setting or getting the value |
| 7144 |
cssProps: {}, |
| 7145 |
|
| 7146 |
// Get and set the style property on a DOM Node |
| 7147 |
style: function (elem, name, value, extra) { |
| 7148 |
// Don't set styles on text and comment nodes |
| 7149 |
if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) { |
| 7150 |
return; |
| 7151 |
} |
| 7152 |
|
| 7153 |
// Make sure that we're working with the right name |
| 7154 |
var ret, |
| 7155 |
type, |
| 7156 |
hooks, |
| 7157 |
origName = camelCase(name), |
| 7158 |
isCustomProp = rcustomProp.test(name), |
| 7159 |
style = elem.style; |
| 7160 |
|
| 7161 |
// Make sure that we're working with the right name. We don't |
| 7162 |
// want to query the value if it is a CSS custom property |
| 7163 |
// since they are user-defined. |
| 7164 |
if (!isCustomProp) { |
| 7165 |
name = finalPropName(origName); |
| 7166 |
} |
| 7167 |
|
| 7168 |
// Gets hook for the prefixed version, then unprefixed version |
| 7169 |
hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName]; |
| 7170 |
|
| 7171 |
// Check if we're setting a value |
| 7172 |
if (value !== undefined) { |
| 7173 |
type = typeof value; |
| 7174 |
|
| 7175 |
// Convert "+=" or "-=" to relative numbers (#7345) |
| 7176 |
if (type === "string" && (ret = rcssNum.exec(value)) && ret[1]) { |
| 7177 |
value = adjustCSS(elem, name, ret); |
| 7178 |
|
| 7179 |
// Fixes bug #9237 |
| 7180 |
type = "number"; |
| 7181 |
} |
| 7182 |
|
| 7183 |
// Make sure that null and NaN values aren't set (#7116) |
| 7184 |
if (value == null || value !== value) { |
| 7185 |
return; |
| 7186 |
} |
| 7187 |
|
| 7188 |
// If a number was passed in, add the unit (except for certain CSS properties) |
| 7189 |
// The isCustomProp check can be removed in jQuery 4.0 when we only auto-append |
| 7190 |
// "px" to a few hardcoded values. |
| 7191 |
if (type === "number" && !isCustomProp) { |
| 7192 |
value += (ret && ret[3]) || (jQuery.cssNumber[origName] ? "" : "px"); |
| 7193 |
} |
| 7194 |
|
| 7195 |
// background-* props affect original clone's values |
| 7196 |
if ( |
| 7197 |
!support.clearCloneStyle && |
| 7198 |
value === "" && |
| 7199 |
name.indexOf("background") === 0 |
| 7200 |
) { |
| 7201 |
style[name] = "inherit"; |
| 7202 |
} |
| 7203 |
|
| 7204 |
// If a hook was provided, use that value, otherwise just set the specified value |
| 7205 |
if ( |
| 7206 |
!hooks || |
| 7207 |
!("set" in hooks) || |
| 7208 |
(value = hooks.set(elem, value, extra)) !== undefined |
| 7209 |
) { |
| 7210 |
if (isCustomProp) { |
| 7211 |
style.setProperty(name, value); |
| 7212 |
} else { |
| 7213 |
style[name] = value; |
| 7214 |
} |
| 7215 |
} |
| 7216 |
} else { |
| 7217 |
// If a hook was provided get the non-computed value from there |
| 7218 |
if ( |
| 7219 |
hooks && |
| 7220 |
"get" in hooks && |
| 7221 |
(ret = hooks.get(elem, false, extra)) !== undefined |
| 7222 |
) { |
| 7223 |
return ret; |
| 7224 |
} |
| 7225 |
|
| 7226 |
// Otherwise just get the value from the style object |
| 7227 |
return style[name]; |
| 7228 |
} |
| 7229 |
}, |
| 7230 |
|
| 7231 |
css: function (elem, name, extra, styles) { |
| 7232 |
var val, |
| 7233 |
num, |
| 7234 |
hooks, |
| 7235 |
origName = camelCase(name), |
| 7236 |
isCustomProp = rcustomProp.test(name); |
| 7237 |
|
| 7238 |
// Make sure that we're working with the right name. We don't |
| 7239 |
// want to modify the value if it is a CSS custom property |
| 7240 |
// since they are user-defined. |
| 7241 |
if (!isCustomProp) { |
| 7242 |
name = finalPropName(origName); |
| 7243 |
} |
| 7244 |
|
| 7245 |
// Try prefixed name followed by the unprefixed name |
| 7246 |
hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName]; |
| 7247 |
|
| 7248 |
// If a hook was provided get the computed value from there |
| 7249 |
if (hooks && "get" in hooks) { |
| 7250 |
val = hooks.get(elem, true, extra); |
| 7251 |
} |
| 7252 |
|
| 7253 |
// Otherwise, if a way to get the computed value exists, use that |
| 7254 |
if (val === undefined) { |
| 7255 |
val = curCSS(elem, name, styles); |
| 7256 |
} |
| 7257 |
|
| 7258 |
// Convert "normal" to computed value |
| 7259 |
if (val === "normal" && name in cssNormalTransform) { |
| 7260 |
val = cssNormalTransform[name]; |
| 7261 |
} |
| 7262 |
|
| 7263 |
// Make numeric if forced or a qualifier was provided and val looks numeric |
| 7264 |
if (extra === "" || extra) { |
| 7265 |
num = parseFloat(val); |
| 7266 |
return extra === true || isFinite(num) ? num || 0 : val; |
| 7267 |
} |
| 7268 |
|
| 7269 |
return val; |
| 7270 |
}, |
| 7271 |
}); |
| 7272 |
|
| 7273 |
jQuery.each(["height", "width"], function (_i, dimension) { |
| 7274 |
jQuery.cssHooks[dimension] = { |
| 7275 |
get: function (elem, computed, extra) { |
| 7276 |
if (computed) { |
| 7277 |
// Certain elements can have dimension info if we invisibly show them |
| 7278 |
// but it must have a current display style that would benefit |
| 7279 |
return rdisplayswap.test(jQuery.css(elem, "display")) && |
| 7280 |
// Support: Safari 8+ |
| 7281 |
// Table columns in Safari have non-zero offsetWidth & zero |
| 7282 |
// getBoundingClientRect().width unless display is changed. |
| 7283 |
// Support: IE <=11 only |
| 7284 |
// Running getBoundingClientRect on a disconnected node |
| 7285 |
// in IE throws an error. |
| 7286 |
(!elem.getClientRects().length || |
| 7287 |
!elem.getBoundingClientRect().width) |
| 7288 |
? swap(elem, cssShow, function () { |
| 7289 |
return getWidthOrHeight(elem, dimension, extra); |
| 7290 |
}) |
| 7291 |
: getWidthOrHeight(elem, dimension, extra); |
| 7292 |
} |
| 7293 |
}, |
| 7294 |
|
| 7295 |
set: function (elem, value, extra) { |
| 7296 |
var matches, |
| 7297 |
styles = getStyles(elem), |
| 7298 |
// Only read styles.position if the test has a chance to fail |
| 7299 |
// to avoid forcing a reflow. |
| 7300 |
scrollboxSizeBuggy = |
| 7301 |
!support.scrollboxSize() && styles.position === "absolute", |
| 7302 |
// To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) |
| 7303 |
boxSizingNeeded = scrollboxSizeBuggy || extra, |
| 7304 |
isBorderBox = |
| 7305 |
boxSizingNeeded && |
| 7306 |
jQuery.css(elem, "boxSizing", false, styles) === "border-box", |
| 7307 |
subtract = extra |
| 7308 |
? boxModelAdjustment(elem, dimension, extra, isBorderBox, styles) |
| 7309 |
: 0; |
| 7310 |
|
| 7311 |
// Account for unreliable border-box dimensions by comparing offset* to computed and |
| 7312 |
// faking a content-box to get border and padding (gh-3699) |
| 7313 |
if (isBorderBox && scrollboxSizeBuggy) { |
| 7314 |
subtract -= Math.ceil( |
| 7315 |
elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - |
| 7316 |
parseFloat(styles[dimension]) - |
| 7317 |
boxModelAdjustment(elem, dimension, "border", false, styles) - |
| 7318 |
0.5 |
| 7319 |
); |
| 7320 |
} |
| 7321 |
|
| 7322 |
// Convert to pixels if value adjustment is needed |
| 7323 |
if ( |
| 7324 |
subtract && |
| 7325 |
(matches = rcssNum.exec(value)) && |
| 7326 |
(matches[3] || "px") !== "px" |
| 7327 |
) { |
| 7328 |
elem.style[dimension] = value; |
| 7329 |
value = jQuery.css(elem, dimension); |
| 7330 |
} |
| 7331 |
|
| 7332 |
return setPositiveNumber(elem, value, subtract); |
| 7333 |
}, |
| 7334 |
}; |
| 7335 |
}); |
| 7336 |
|
| 7337 |
jQuery.cssHooks.marginLeft = addGetHookIf( |
| 7338 |
support.reliableMarginLeft, |
| 7339 |
function (elem, computed) { |
| 7340 |
if (computed) { |
| 7341 |
return ( |
| 7342 |
(parseFloat(curCSS(elem, "marginLeft")) || |
| 7343 |
elem.getBoundingClientRect().left - |
| 7344 |
swap(elem, { marginLeft: 0 }, function () { |
| 7345 |
return elem.getBoundingClientRect().left; |
| 7346 |
})) + "px" |
| 7347 |
); |
| 7348 |
} |
| 7349 |
} |
| 7350 |
); |
| 7351 |
|
| 7352 |
// These hooks are used by animate to expand properties |
| 7353 |
jQuery.each( |
| 7354 |
{ |
| 7355 |
margin: "", |
| 7356 |
padding: "", |
| 7357 |
border: "Width", |
| 7358 |
}, |
| 7359 |
function (prefix, suffix) { |
| 7360 |
jQuery.cssHooks[prefix + suffix] = { |
| 7361 |
expand: function (value) { |
| 7362 |
var i = 0, |
| 7363 |
expanded = {}, |
| 7364 |
// Assumes a single number if not a string |
| 7365 |
parts = typeof value === "string" ? value.split(" ") : [value]; |
| 7366 |
|
| 7367 |
for (; i < 4; i++) { |
| 7368 |
expanded[prefix + cssExpand[i] + suffix] = |
| 7369 |
parts[i] || parts[i - 2] || parts[0]; |
| 7370 |
} |
| 7371 |
|
| 7372 |
return expanded; |
| 7373 |
}, |
| 7374 |
}; |
| 7375 |
|
| 7376 |
if (prefix !== "margin") { |
| 7377 |
jQuery.cssHooks[prefix + suffix].set = setPositiveNumber; |
| 7378 |
} |
| 7379 |
} |
| 7380 |
); |
| 7381 |
|
| 7382 |
jQuery.fn.extend({ |
| 7383 |
css: function (name, value) { |
| 7384 |
return access( |
| 7385 |
this, |
| 7386 |
function (elem, name, value) { |
| 7387 |
var styles, |
| 7388 |
len, |
| 7389 |
map = {}, |
| 7390 |
i = 0; |
| 7391 |
|
| 7392 |
if (Array.isArray(name)) { |
| 7393 |
styles = getStyles(elem); |
| 7394 |
len = name.length; |
| 7395 |
|
| 7396 |
for (; i < len; i++) { |
| 7397 |
map[name[i]] = jQuery.css(elem, name[i], false, styles); |
| 7398 |
} |
| 7399 |
|
| 7400 |
return map; |
| 7401 |
} |
| 7402 |
|
| 7403 |
return value !== undefined |
| 7404 |
? jQuery.style(elem, name, value) |
| 7405 |
: jQuery.css(elem, name); |
| 7406 |
}, |
| 7407 |
name, |
| 7408 |
value, |
| 7409 |
arguments.length > 1 |
| 7410 |
); |
| 7411 |
}, |
| 7412 |
}); |
| 7413 |
|
| 7414 |
function Tween(elem, options, prop, end, easing) { |
| 7415 |
return new Tween.prototype.init(elem, options, prop, end, easing); |
| 7416 |
} |
| 7417 |
jQuery.Tween = Tween; |
| 7418 |
|
| 7419 |
Tween.prototype = { |
| 7420 |
constructor: Tween, |
| 7421 |
init: function (elem, options, prop, end, easing, unit) { |
| 7422 |
this.elem = elem; |
| 7423 |
this.prop = prop; |
| 7424 |
this.easing = easing || jQuery.easing._default; |
| 7425 |
this.options = options; |
| 7426 |
this.start = this.now = this.cur(); |
| 7427 |
this.end = end; |
| 7428 |
this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px"); |
| 7429 |
}, |
| 7430 |
cur: function () { |
| 7431 |
var hooks = Tween.propHooks[this.prop]; |
| 7432 |
|
| 7433 |
return hooks && hooks.get |
| 7434 |
? hooks.get(this) |
| 7435 |
: Tween.propHooks._default.get(this); |
| 7436 |
}, |
| 7437 |
run: function (percent) { |
| 7438 |
var eased, |
| 7439 |
hooks = Tween.propHooks[this.prop]; |
| 7440 |
|
| 7441 |
if (this.options.duration) { |
| 7442 |
this.pos = eased = jQuery.easing[this.easing]( |
| 7443 |
percent, |
| 7444 |
this.options.duration * percent, |
| 7445 |
0, |
| 7446 |
1, |
| 7447 |
this.options.duration |
| 7448 |
); |
| 7449 |
} else { |
| 7450 |
this.pos = eased = percent; |
| 7451 |
} |
| 7452 |
this.now = (this.end - this.start) * eased + this.start; |
| 7453 |
|
| 7454 |
if (this.options.step) { |
| 7455 |
this.options.step.call(this.elem, this.now, this); |
| 7456 |
} |
| 7457 |
|
| 7458 |
if (hooks && hooks.set) { |
| 7459 |
hooks.set(this); |
| 7460 |
} else { |
| 7461 |
Tween.propHooks._default.set(this); |
| 7462 |
} |
| 7463 |
return this; |
| 7464 |
}, |
| 7465 |
}; |
| 7466 |
|
| 7467 |
Tween.prototype.init.prototype = Tween.prototype; |
| 7468 |
|
| 7469 |
Tween.propHooks = { |
| 7470 |
_default: { |
| 7471 |
get: function (tween) { |
| 7472 |
var result; |
| 7473 |
|
| 7474 |
// Use a property on the element directly when it is not a DOM element, |
| 7475 |
// or when there is no matching style property that exists. |
| 7476 |
if ( |
| 7477 |
tween.elem.nodeType !== 1 || |
| 7478 |
(tween.elem[tween.prop] != null && |
| 7479 |
tween.elem.style[tween.prop] == null) |
| 7480 |
) { |
| 7481 |
return tween.elem[tween.prop]; |
| 7482 |
} |
| 7483 |
|
| 7484 |
// Passing an empty string as a 3rd parameter to .css will automatically |
| 7485 |
// attempt a parseFloat and fallback to a string if the parse fails. |
| 7486 |
// Simple values such as "10px" are parsed to Float; |
| 7487 |
// complex values such as "rotate(1rad)" are returned as-is. |
| 7488 |
result = jQuery.css(tween.elem, tween.prop, ""); |
| 7489 |
|
| 7490 |
// Empty strings, null, undefined and "auto" are converted to 0. |
| 7491 |
return !result || result === "auto" ? 0 : result; |
| 7492 |
}, |
| 7493 |
set: function (tween) { |
| 7494 |
// Use step hook for back compat. |
| 7495 |
// Use cssHook if its there. |
| 7496 |
// Use .style if available and use plain properties where available. |
| 7497 |
if (jQuery.fx.step[tween.prop]) { |
| 7498 |
jQuery.fx.step[tween.prop](tween); |
| 7499 |
} else if ( |
| 7500 |
tween.elem.nodeType === 1 && |
| 7501 |
(jQuery.cssHooks[tween.prop] || |
| 7502 |
tween.elem.style[finalPropName(tween.prop)] != null) |
| 7503 |
) { |
| 7504 |
jQuery.style(tween.elem, tween.prop, tween.now + tween.unit); |
| 7505 |
} else { |
| 7506 |
tween.elem[tween.prop] = tween.now; |
| 7507 |
} |
| 7508 |
}, |
| 7509 |
}, |
| 7510 |
}; |
| 7511 |
|
| 7512 |
// Support: IE <=9 only |
| 7513 |
// Panic based approach to setting things on disconnected nodes |
| 7514 |
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { |
| 7515 |
set: function (tween) { |
| 7516 |
if (tween.elem.nodeType && tween.elem.parentNode) { |
| 7517 |
tween.elem[tween.prop] = tween.now; |
| 7518 |
} |
| 7519 |
}, |
| 7520 |
}; |
| 7521 |
|
| 7522 |
jQuery.easing = { |
| 7523 |
linear: function (p) { |
| 7524 |
return p; |
| 7525 |
}, |
| 7526 |
swing: function (p) { |
| 7527 |
return 0.5 - Math.cos(p * Math.PI) / 2; |
| 7528 |
}, |
| 7529 |
_default: "swing", |
| 7530 |
}; |
| 7531 |
|
| 7532 |
jQuery.fx = Tween.prototype.init; |
| 7533 |
|
| 7534 |
// Back compat <1.8 extension point |
| 7535 |
jQuery.fx.step = {}; |
| 7536 |
|
| 7537 |
var fxNow, |
| 7538 |
inProgress, |
| 7539 |
rfxtypes = /^(?:toggle|show|hide)$/, |
| 7540 |
rrun = /queueHooks$/; |
| 7541 |
|
| 7542 |
function schedule() { |
| 7543 |
if (inProgress) { |
| 7544 |
if (document.hidden === false && window.requestAnimationFrame) { |
| 7545 |
window.requestAnimationFrame(schedule); |
| 7546 |
} else { |
| 7547 |
window.setTimeout(schedule, jQuery.fx.interval); |
| 7548 |
} |
| 7549 |
|
| 7550 |
jQuery.fx.tick(); |
| 7551 |
} |
| 7552 |
} |
| 7553 |
|
| 7554 |
// Animations created synchronously will run synchronously |
| 7555 |
function createFxNow() { |
| 7556 |
window.setTimeout(function () { |
| 7557 |
fxNow = undefined; |
| 7558 |
}); |
| 7559 |
return (fxNow = Date.now()); |
| 7560 |
} |
| 7561 |
|
| 7562 |
// Generate parameters to create a standard animation |
| 7563 |
function genFx(type, includeWidth) { |
| 7564 |
var which, |
| 7565 |
i = 0, |
| 7566 |
attrs = { height: type }; |
| 7567 |
|
| 7568 |
// If we include width, step value is 1 to do all cssExpand values, |
| 7569 |
// otherwise step value is 2 to skip over Left and Right |
| 7570 |
includeWidth = includeWidth ? 1 : 0; |
| 7571 |
for (; i < 4; i += 2 - includeWidth) { |
| 7572 |
which = cssExpand[i]; |
| 7573 |
attrs["margin" + which] = attrs["padding" + which] = type; |
| 7574 |
} |
| 7575 |
|
| 7576 |
if (includeWidth) { |
| 7577 |
attrs.opacity = attrs.width = type; |
| 7578 |
} |
| 7579 |
|
| 7580 |
return attrs; |
| 7581 |
} |
| 7582 |
|
| 7583 |
function createTween(value, prop, animation) { |
| 7584 |
var tween, |
| 7585 |
collection = (Animation.tweeners[prop] || []).concat( |
| 7586 |
Animation.tweeners["*"] |
| 7587 |
), |
| 7588 |
index = 0, |
| 7589 |
length = collection.length; |
| 7590 |
for (; index < length; index++) { |
| 7591 |
if ((tween = collection[index].call(animation, prop, value))) { |
| 7592 |
// We're done with this property |
| 7593 |
return tween; |
| 7594 |
} |
| 7595 |
} |
| 7596 |
} |
| 7597 |
|
| 7598 |
function defaultPrefilter(elem, props, opts) { |
| 7599 |
var prop, |
| 7600 |
value, |
| 7601 |
toggle, |
| 7602 |
hooks, |
| 7603 |
oldfire, |
| 7604 |
propTween, |
| 7605 |
restoreDisplay, |
| 7606 |
display, |
| 7607 |
isBox = "width" in props || "height" in props, |
| 7608 |
anim = this, |
| 7609 |
orig = {}, |
| 7610 |
style = elem.style, |
| 7611 |
hidden = elem.nodeType && isHiddenWithinTree(elem), |
| 7612 |
dataShow = dataPriv.get(elem, "fxshow"); |
| 7613 |
|
| 7614 |
// Queue-skipping animations hijack the fx hooks |
| 7615 |
if (!opts.queue) { |
| 7616 |
hooks = jQuery._queueHooks(elem, "fx"); |
| 7617 |
if (hooks.unqueued == null) { |
| 7618 |
hooks.unqueued = 0; |
| 7619 |
oldfire = hooks.empty.fire; |
| 7620 |
hooks.empty.fire = function () { |
| 7621 |
if (!hooks.unqueued) { |
| 7622 |
oldfire(); |
| 7623 |
} |
| 7624 |
}; |
| 7625 |
} |
| 7626 |
hooks.unqueued++; |
| 7627 |
|
| 7628 |
anim.always(function () { |
| 7629 |
// Ensure the complete handler is called before this completes |
| 7630 |
anim.always(function () { |
| 7631 |
hooks.unqueued--; |
| 7632 |
if (!jQuery.queue(elem, "fx").length) { |
| 7633 |
hooks.empty.fire(); |
| 7634 |
} |
| 7635 |
}); |
| 7636 |
}); |
| 7637 |
} |
| 7638 |
|
| 7639 |
// Detect show/hide animations |
| 7640 |
for (prop in props) { |
| 7641 |
value = props[prop]; |
| 7642 |
if (rfxtypes.test(value)) { |
| 7643 |
delete props[prop]; |
| 7644 |
toggle = toggle || value === "toggle"; |
| 7645 |
if (value === (hidden ? "hide" : "show")) { |
| 7646 |
// Pretend to be hidden if this is a "show" and |
| 7647 |
// there is still data from a stopped show/hide |
| 7648 |
if (value === "show" && dataShow && dataShow[prop] !== undefined) { |
| 7649 |
hidden = true; |
| 7650 |
|
| 7651 |
// Ignore all other no-op show/hide data |
| 7652 |
} else { |
| 7653 |
continue; |
| 7654 |
} |
| 7655 |
} |
| 7656 |
orig[prop] = (dataShow && dataShow[prop]) || jQuery.style(elem, prop); |
| 7657 |
} |
| 7658 |
} |
| 7659 |
|
| 7660 |
// Bail out if this is a no-op like .hide().hide() |
| 7661 |
propTween = !jQuery.isEmptyObject(props); |
| 7662 |
if (!propTween && jQuery.isEmptyObject(orig)) { |
| 7663 |
return; |
| 7664 |
} |
| 7665 |
|
| 7666 |
// Restrict "overflow" and "display" styles during box animations |
| 7667 |
if (isBox && elem.nodeType === 1) { |
| 7668 |
// Support: IE <=9 - 11, Edge 12 - 15 |
| 7669 |
// Record all 3 overflow attributes because IE does not infer the shorthand |
| 7670 |
// from identically-valued overflowX and overflowY and Edge just mirrors |
| 7671 |
// the overflowX value there. |
| 7672 |
opts.overflow = [style.overflow, style.overflowX, style.overflowY]; |
| 7673 |
|
| 7674 |
// Identify a display type, preferring old show/hide data over the CSS cascade |
| 7675 |
restoreDisplay = dataShow && dataShow.display; |
| 7676 |
if (restoreDisplay == null) { |
| 7677 |
restoreDisplay = dataPriv.get(elem, "display"); |
| 7678 |
} |
| 7679 |
display = jQuery.css(elem, "display"); |
| 7680 |
if (display === "none") { |
| 7681 |
if (restoreDisplay) { |
| 7682 |
display = restoreDisplay; |
| 7683 |
} else { |
| 7684 |
// Get nonempty value(s) by temporarily forcing visibility |
| 7685 |
showHide([elem], true); |
| 7686 |
restoreDisplay = elem.style.display || restoreDisplay; |
| 7687 |
display = jQuery.css(elem, "display"); |
| 7688 |
showHide([elem]); |
| 7689 |
} |
| 7690 |
} |
| 7691 |
|
| 7692 |
// Animate inline elements as inline-block |
| 7693 |
if ( |
| 7694 |
display === "inline" || |
| 7695 |
(display === "inline-block" && restoreDisplay != null) |
| 7696 |
) { |
| 7697 |
if (jQuery.css(elem, "float") === "none") { |
| 7698 |
// Restore the original display value at the end of pure show/hide animations |
| 7699 |
if (!propTween) { |
| 7700 |
anim.done(function () { |
| 7701 |
style.display = restoreDisplay; |
| 7702 |
}); |
| 7703 |
if (restoreDisplay == null) { |
| 7704 |
display = style.display; |
| 7705 |
restoreDisplay = display === "none" ? "" : display; |
| 7706 |
} |
| 7707 |
} |
| 7708 |
style.display = "inline-block"; |
| 7709 |
} |
| 7710 |
} |
| 7711 |
} |
| 7712 |
|
| 7713 |
if (opts.overflow) { |
| 7714 |
style.overflow = "hidden"; |
| 7715 |
anim.always(function () { |
| 7716 |
style.overflow = opts.overflow[0]; |
| 7717 |
style.overflowX = opts.overflow[1]; |
| 7718 |
style.overflowY = opts.overflow[2]; |
| 7719 |
}); |
| 7720 |
} |
| 7721 |
|
| 7722 |
// Implement show/hide animations |
| 7723 |
propTween = false; |
| 7724 |
for (prop in orig) { |
| 7725 |
// General show/hide setup for this element animation |
| 7726 |
if (!propTween) { |
| 7727 |
if (dataShow) { |
| 7728 |
if ("hidden" in dataShow) { |
| 7729 |
hidden = dataShow.hidden; |
| 7730 |
} |
| 7731 |
} else { |
| 7732 |
dataShow = dataPriv.access(elem, "fxshow", { |
| 7733 |
display: restoreDisplay, |
| 7734 |
}); |
| 7735 |
} |
| 7736 |
|
| 7737 |
// Store hidden/visible for toggle so `.stop().toggle()` "reverses" |
| 7738 |
if (toggle) { |
| 7739 |
dataShow.hidden = !hidden; |
| 7740 |
} |
| 7741 |
|
| 7742 |
// Show elements before animating them |
| 7743 |
if (hidden) { |
| 7744 |
showHide([elem], true); |
| 7745 |
} |
| 7746 |
|
| 7747 |
/* eslint-disable no-loop-func */ |
| 7748 |
|
| 7749 |
anim.done(function () { |
| 7750 |
/* eslint-enable no-loop-func */ |
| 7751 |
|
| 7752 |
// The final step of a "hide" animation is actually hiding the element |
| 7753 |
if (!hidden) { |
| 7754 |
showHide([elem]); |
| 7755 |
} |
| 7756 |
dataPriv.remove(elem, "fxshow"); |
| 7757 |
for (prop in orig) { |
| 7758 |
jQuery.style(elem, prop, orig[prop]); |
| 7759 |
} |
| 7760 |
}); |
| 7761 |
} |
| 7762 |
|
| 7763 |
// Per-property setup |
| 7764 |
propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim); |
| 7765 |
if (!(prop in dataShow)) { |
| 7766 |
dataShow[prop] = propTween.start; |
| 7767 |
if (hidden) { |
| 7768 |
propTween.end = propTween.start; |
| 7769 |
propTween.start = 0; |
| 7770 |
} |
| 7771 |
} |
| 7772 |
} |
| 7773 |
} |
| 7774 |
|
| 7775 |
function propFilter(props, specialEasing) { |
| 7776 |
var index, name, easing, value, hooks; |
| 7777 |
|
| 7778 |
// camelCase, specialEasing and expand cssHook pass |
| 7779 |
for (index in props) { |
| 7780 |
name = camelCase(index); |
| 7781 |
easing = specialEasing[name]; |
| 7782 |
value = props[index]; |
| 7783 |
if (Array.isArray(value)) { |
| 7784 |
easing = value[1]; |
| 7785 |
value = props[index] = value[0]; |
| 7786 |
} |
| 7787 |
|
| 7788 |
if (index !== name) { |
| 7789 |
props[name] = value; |
| 7790 |
delete props[index]; |
| 7791 |
} |
| 7792 |
|
| 7793 |
hooks = jQuery.cssHooks[name]; |
| 7794 |
if (hooks && "expand" in hooks) { |
| 7795 |
value = hooks.expand(value); |
| 7796 |
delete props[name]; |
| 7797 |
|
| 7798 |
// Not quite $.extend, this won't overwrite existing keys. |
| 7799 |
// Reusing 'index' because we have the correct "name" |
| 7800 |
for (index in value) { |
| 7801 |
if (!(index in props)) { |
| 7802 |
props[index] = value[index]; |
| 7803 |
specialEasing[index] = easing; |
| 7804 |
} |
| 7805 |
} |
| 7806 |
} else { |
| 7807 |
specialEasing[name] = easing; |
| 7808 |
} |
| 7809 |
} |
| 7810 |
} |
| 7811 |
|
| 7812 |
function Animation(elem, properties, options) { |
| 7813 |
var result, |
| 7814 |
stopped, |
| 7815 |
index = 0, |
| 7816 |
length = Animation.prefilters.length, |
| 7817 |
deferred = jQuery.Deferred().always(function () { |
| 7818 |
// Don't match elem in the :animated selector |
| 7819 |
delete tick.elem; |
| 7820 |
}), |
| 7821 |
tick = function () { |
| 7822 |
if (stopped) { |
| 7823 |
return false; |
| 7824 |
} |
| 7825 |
var currentTime = fxNow || createFxNow(), |
| 7826 |
remaining = Math.max( |
| 7827 |
0, |
| 7828 |
animation.startTime + animation.duration - currentTime |
| 7829 |
), |
| 7830 |
// Support: Android 2.3 only |
| 7831 |
// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) |
| 7832 |
temp = remaining / animation.duration || 0, |
| 7833 |
percent = 1 - temp, |
| 7834 |
index = 0, |
| 7835 |
length = animation.tweens.length; |
| 7836 |
|
| 7837 |
for (; index < length; index++) { |
| 7838 |
animation.tweens[index].run(percent); |
| 7839 |
} |
| 7840 |
|
| 7841 |
deferred.notifyWith(elem, [animation, percent, remaining]); |
| 7842 |
|
| 7843 |
// If there's more to do, yield |
| 7844 |
if (percent < 1 && length) { |
| 7845 |
return remaining; |
| 7846 |
} |
| 7847 |
|
| 7848 |
// If this was an empty animation, synthesize a final progress notification |
| 7849 |
if (!length) { |
| 7850 |
deferred.notifyWith(elem, [animation, 1, 0]); |
| 7851 |
} |
| 7852 |
|
| 7853 |
// Resolve the animation and report its conclusion |
| 7854 |
deferred.resolveWith(elem, [animation]); |
| 7855 |
return false; |
| 7856 |
}, |
| 7857 |
animation = deferred.promise({ |
| 7858 |
elem: elem, |
| 7859 |
props: jQuery.extend({}, properties), |
| 7860 |
opts: jQuery.extend( |
| 7861 |
true, |
| 7862 |
{ |
| 7863 |
specialEasing: {}, |
| 7864 |
easing: jQuery.easing._default, |
| 7865 |
}, |
| 7866 |
options |
| 7867 |
), |
| 7868 |
originalProperties: properties, |
| 7869 |
originalOptions: options, |
| 7870 |
startTime: fxNow || createFxNow(), |
| 7871 |
duration: options.duration, |
| 7872 |
tweens: [], |
| 7873 |
createTween: function (prop, end) { |
| 7874 |
var tween = jQuery.Tween( |
| 7875 |
elem, |
| 7876 |
animation.opts, |
| 7877 |
prop, |
| 7878 |
end, |
| 7879 |
animation.opts.specialEasing[prop] || animation.opts.easing |
| 7880 |
); |
| 7881 |
animation.tweens.push(tween); |
| 7882 |
return tween; |
| 7883 |
}, |
| 7884 |
stop: function (gotoEnd) { |
| 7885 |
var index = 0, |
| 7886 |
// If we are going to the end, we want to run all the tweens |
| 7887 |
// otherwise we skip this part |
| 7888 |
length = gotoEnd ? animation.tweens.length : 0; |
| 7889 |
if (stopped) { |
| 7890 |
return this; |
| 7891 |
} |
| 7892 |
stopped = true; |
| 7893 |
for (; index < length; index++) { |
| 7894 |
animation.tweens[index].run(1); |
| 7895 |
} |
| 7896 |
|
| 7897 |
// Resolve when we played the last frame; otherwise, reject |
| 7898 |
if (gotoEnd) { |
| 7899 |
deferred.notifyWith(elem, [animation, 1, 0]); |
| 7900 |
deferred.resolveWith(elem, [animation, gotoEnd]); |
| 7901 |
} else { |
| 7902 |
deferred.rejectWith(elem, [animation, gotoEnd]); |
| 7903 |
} |
| 7904 |
return this; |
| 7905 |
}, |
| 7906 |
}), |
| 7907 |
props = animation.props; |
| 7908 |
|
| 7909 |
propFilter(props, animation.opts.specialEasing); |
| 7910 |
|
| 7911 |
for (; index < length; index++) { |
| 7912 |
result = Animation.prefilters[index].call( |
| 7913 |
animation, |
| 7914 |
elem, |
| 7915 |
props, |
| 7916 |
animation.opts |
| 7917 |
); |
| 7918 |
if (result) { |
| 7919 |
if (isFunction(result.stop)) { |
| 7920 |
jQuery._queueHooks(animation.elem, animation.opts.queue).stop = |
| 7921 |
result.stop.bind(result); |
| 7922 |
} |
| 7923 |
return result; |
| 7924 |
} |
| 7925 |
} |
| 7926 |
|
| 7927 |
jQuery.map(props, createTween, animation); |
| 7928 |
|
| 7929 |
if (isFunction(animation.opts.start)) { |
| 7930 |
animation.opts.start.call(elem, animation); |
| 7931 |
} |
| 7932 |
|
| 7933 |
// Attach callbacks from options |
| 7934 |
animation |
| 7935 |
.progress(animation.opts.progress) |
| 7936 |
.done(animation.opts.done, animation.opts.complete) |
| 7937 |
.fail(animation.opts.fail) |
| 7938 |
.always(animation.opts.always); |
| 7939 |
|
| 7940 |
jQuery.fx.timer( |
| 7941 |
jQuery.extend(tick, { |
| 7942 |
elem: elem, |
| 7943 |
anim: animation, |
| 7944 |
queue: animation.opts.queue, |
| 7945 |
}) |
| 7946 |
); |
| 7947 |
|
| 7948 |
return animation; |
| 7949 |
} |
| 7950 |
|
| 7951 |
jQuery.Animation = jQuery.extend(Animation, { |
| 7952 |
tweeners: { |
| 7953 |
"*": [ |
| 7954 |
function (prop, value) { |
| 7955 |
var tween = this.createTween(prop, value); |
| 7956 |
adjustCSS(tween.elem, prop, rcssNum.exec(value), tween); |
| 7957 |
return tween; |
| 7958 |
}, |
| 7959 |
], |
| 7960 |
}, |
| 7961 |
|
| 7962 |
tweener: function (props, callback) { |
| 7963 |
if (isFunction(props)) { |
| 7964 |
callback = props; |
| 7965 |
props = ["*"]; |
| 7966 |
} else { |
| 7967 |
props = props.match(rnothtmlwhite); |
| 7968 |
} |
| 7969 |
|
| 7970 |
var prop, |
| 7971 |
index = 0, |
| 7972 |
length = props.length; |
| 7973 |
|
| 7974 |
for (; index < length; index++) { |
| 7975 |
prop = props[index]; |
| 7976 |
Animation.tweeners[prop] = Animation.tweeners[prop] || []; |
| 7977 |
Animation.tweeners[prop].unshift(callback); |
| 7978 |
} |
| 7979 |
}, |
| 7980 |
|
| 7981 |
prefilters: [defaultPrefilter], |
| 7982 |
|
| 7983 |
prefilter: function (callback, prepend) { |
| 7984 |
if (prepend) { |
| 7985 |
Animation.prefilters.unshift(callback); |
| 7986 |
} else { |
| 7987 |
Animation.prefilters.push(callback); |
| 7988 |
} |
| 7989 |
}, |
| 7990 |
}); |
| 7991 |
|
| 7992 |
jQuery.speed = function (speed, easing, fn) { |
| 7993 |
var opt = |
| 7994 |
speed && typeof speed === "object" |
| 7995 |
? jQuery.extend({}, speed) |
| 7996 |
: { |
| 7997 |
complete: fn || (!fn && easing) || (isFunction(speed) && speed), |
| 7998 |
duration: speed, |
| 7999 |
easing: (fn && easing) || (easing && !isFunction(easing) && easing), |
| 8000 |
}; |
| 8001 |
|
| 8002 |
// Go to the end state if fx are off |
| 8003 |
if (jQuery.fx.off) { |
| 8004 |
opt.duration = 0; |
| 8005 |
} else { |
| 8006 |
if (typeof opt.duration !== "number") { |
| 8007 |
if (opt.duration in jQuery.fx.speeds) { |
| 8008 |
opt.duration = jQuery.fx.speeds[opt.duration]; |
| 8009 |
} else { |
| 8010 |
opt.duration = jQuery.fx.speeds._default; |
| 8011 |
} |
| 8012 |
} |
| 8013 |
} |
| 8014 |
|
| 8015 |
// Normalize opt.queue - true/undefined/null -> "fx" |
| 8016 |
if (opt.queue == null || opt.queue === true) { |
| 8017 |
opt.queue = "fx"; |
| 8018 |
} |
| 8019 |
|
| 8020 |
// Queueing |
| 8021 |
opt.old = opt.complete; |
| 8022 |
|
| 8023 |
opt.complete = function () { |
| 8024 |
if (isFunction(opt.old)) { |
| 8025 |
opt.old.call(this); |
| 8026 |
} |
| 8027 |
|
| 8028 |
if (opt.queue) { |
| 8029 |
jQuery.dequeue(this, opt.queue); |
| 8030 |
} |
| 8031 |
}; |
| 8032 |
|
| 8033 |
return opt; |
| 8034 |
}; |
| 8035 |
|
| 8036 |
jQuery.fn.extend({ |
| 8037 |
fadeTo: function (speed, to, easing, callback) { |
| 8038 |
// Show any hidden elements after setting opacity to 0 |
| 8039 |
return ( |
| 8040 |
this.filter(isHiddenWithinTree) |
| 8041 |
.css("opacity", 0) |
| 8042 |
.show() |
| 8043 |
|
| 8044 |
// Animate to the value specified |
| 8045 |
.end() |
| 8046 |
.animate({ opacity: to }, speed, easing, callback) |
| 8047 |
); |
| 8048 |
}, |
| 8049 |
animate: function (prop, speed, easing, callback) { |
| 8050 |
var empty = jQuery.isEmptyObject(prop), |
| 8051 |
optall = jQuery.speed(speed, easing, callback), |
| 8052 |
doAnimation = function () { |
| 8053 |
// Operate on a copy of prop so per-property easing won't be lost |
| 8054 |
var anim = Animation(this, jQuery.extend({}, prop), optall); |
| 8055 |
|
| 8056 |
// Empty animations, or finishing resolves immediately |
| 8057 |
if (empty || dataPriv.get(this, "finish")) { |
| 8058 |
anim.stop(true); |
| 8059 |
} |
| 8060 |
}; |
| 8061 |
|
| 8062 |
doAnimation.finish = doAnimation; |
| 8063 |
|
| 8064 |
return empty || optall.queue === false |
| 8065 |
? this.each(doAnimation) |
| 8066 |
: this.queue(optall.queue, doAnimation); |
| 8067 |
}, |
| 8068 |
stop: function (type, clearQueue, gotoEnd) { |
| 8069 |
var stopQueue = function (hooks) { |
| 8070 |
var stop = hooks.stop; |
| 8071 |
delete hooks.stop; |
| 8072 |
stop(gotoEnd); |
| 8073 |
}; |
| 8074 |
|
| 8075 |
if (typeof type !== "string") { |
| 8076 |
gotoEnd = clearQueue; |
| 8077 |
clearQueue = type; |
| 8078 |
type = undefined; |
| 8079 |
} |
| 8080 |
if (clearQueue) { |
| 8081 |
this.queue(type || "fx", []); |
| 8082 |
} |
| 8083 |
|
| 8084 |
return this.each(function () { |
| 8085 |
var dequeue = true, |
| 8086 |
index = type != null && type + "queueHooks", |
| 8087 |
timers = jQuery.timers, |
| 8088 |
data = dataPriv.get(this); |
| 8089 |
|
| 8090 |
if (index) { |
| 8091 |
if (data[index] && data[index].stop) { |
| 8092 |
stopQueue(data[index]); |
| 8093 |
} |
| 8094 |
} else { |
| 8095 |
for (index in data) { |
| 8096 |
if (data[index] && data[index].stop && rrun.test(index)) { |
| 8097 |
stopQueue(data[index]); |
| 8098 |
} |
| 8099 |
} |
| 8100 |
} |
| 8101 |
|
| 8102 |
for (index = timers.length; index--; ) { |
| 8103 |
if ( |
| 8104 |
timers[index].elem === this && |
| 8105 |
(type == null || timers[index].queue === type) |
| 8106 |
) { |
| 8107 |
timers[index].anim.stop(gotoEnd); |
| 8108 |
dequeue = false; |
| 8109 |
timers.splice(index, 1); |
| 8110 |
} |
| 8111 |
} |
| 8112 |
|
| 8113 |
// Start the next in the queue if the last step wasn't forced. |
| 8114 |
// Timers currently will call their complete callbacks, which |
| 8115 |
// will dequeue but only if they were gotoEnd. |
| 8116 |
if (dequeue || !gotoEnd) { |
| 8117 |
jQuery.dequeue(this, type); |
| 8118 |
} |
| 8119 |
}); |
| 8120 |
}, |
| 8121 |
finish: function (type) { |
| 8122 |
if (type !== false) { |
| 8123 |
type = type || "fx"; |
| 8124 |
} |
| 8125 |
return this.each(function () { |
| 8126 |
var index, |
| 8127 |
data = dataPriv.get(this), |
| 8128 |
queue = data[type + "queue"], |
| 8129 |
hooks = data[type + "queueHooks"], |
| 8130 |
timers = jQuery.timers, |
| 8131 |
length = queue ? queue.length : 0; |
| 8132 |
|
| 8133 |
// Enable finishing flag on private data |
| 8134 |
data.finish = true; |
| 8135 |
|
| 8136 |
// Empty the queue first |
| 8137 |
jQuery.queue(this, type, []); |
| 8138 |
|
| 8139 |
if (hooks && hooks.stop) { |
| 8140 |
hooks.stop.call(this, true); |
| 8141 |
} |
| 8142 |
|
| 8143 |
// Look for any active animations, and finish them |
| 8144 |
for (index = timers.length; index--; ) { |
| 8145 |
if (timers[index].elem === this && timers[index].queue === type) { |
| 8146 |
timers[index].anim.stop(true); |
| 8147 |
timers.splice(index, 1); |
| 8148 |
} |
| 8149 |
} |
| 8150 |
|
| 8151 |
// Look for any animations in the old queue and finish them |
| 8152 |
for (index = 0; index < length; index++) { |
| 8153 |
if (queue[index] && queue[index].finish) { |
| 8154 |
queue[index].finish.call(this); |
| 8155 |
} |
| 8156 |
} |
| 8157 |
|
| 8158 |
// Turn off finishing flag |
| 8159 |
delete data.finish; |
| 8160 |
}); |
| 8161 |
}, |
| 8162 |
}); |
| 8163 |
|
| 8164 |
jQuery.each(["toggle", "show", "hide"], function (_i, name) { |
| 8165 |
var cssFn = jQuery.fn[name]; |
| 8166 |
jQuery.fn[name] = function (speed, easing, callback) { |
| 8167 |
return speed == null || typeof speed === "boolean" |
| 8168 |
? cssFn.apply(this, arguments) |
| 8169 |
: this.animate(genFx(name, true), speed, easing, callback); |
| 8170 |
}; |
| 8171 |
}); |
| 8172 |
|
| 8173 |
// Generate shortcuts for custom animations |
| 8174 |
jQuery.each( |
| 8175 |
{ |
| 8176 |
slideDown: genFx("show"), |
| 8177 |
slideUp: genFx("hide"), |
| 8178 |
slideToggle: genFx("toggle"), |
| 8179 |
fadeIn: { opacity: "show" }, |
| 8180 |
fadeOut: { opacity: "hide" }, |
| 8181 |
fadeToggle: { opacity: "toggle" }, |
| 8182 |
}, |
| 8183 |
function (name, props) { |
| 8184 |
jQuery.fn[name] = function (speed, easing, callback) { |
| 8185 |
return this.animate(props, speed, easing, callback); |
| 8186 |
}; |
| 8187 |
} |
| 8188 |
); |
| 8189 |
|
| 8190 |
jQuery.timers = []; |
| 8191 |
jQuery.fx.tick = function () { |
| 8192 |
var timer, |
| 8193 |
i = 0, |
| 8194 |
timers = jQuery.timers; |
| 8195 |
|
| 8196 |
fxNow = Date.now(); |
| 8197 |
|
| 8198 |
for (; i < timers.length; i++) { |
| 8199 |
timer = timers[i]; |
| 8200 |
|
| 8201 |
// Run the timer and safely remove it when done (allowing for external removal) |
| 8202 |
if (!timer() && timers[i] === timer) { |
| 8203 |
timers.splice(i--, 1); |
| 8204 |
} |
| 8205 |
} |
| 8206 |
|
| 8207 |
if (!timers.length) { |
| 8208 |
jQuery.fx.stop(); |
| 8209 |
} |
| 8210 |
fxNow = undefined; |
| 8211 |
}; |
| 8212 |
|
| 8213 |
jQuery.fx.timer = function (timer) { |
| 8214 |
jQuery.timers.push(timer); |
| 8215 |
jQuery.fx.start(); |
| 8216 |
}; |
| 8217 |
|
| 8218 |
jQuery.fx.interval = 13; |
| 8219 |
jQuery.fx.start = function () { |
| 8220 |
if (inProgress) { |
| 8221 |
return; |
| 8222 |
} |
| 8223 |
|
| 8224 |
inProgress = true; |
| 8225 |
schedule(); |
| 8226 |
}; |
| 8227 |
|
| 8228 |
jQuery.fx.stop = function () { |
| 8229 |
inProgress = null; |
| 8230 |
}; |
| 8231 |
|
| 8232 |
jQuery.fx.speeds = { |
| 8233 |
slow: 600, |
| 8234 |
fast: 200, |
| 8235 |
|
| 8236 |
// Default speed |
| 8237 |
_default: 400, |
| 8238 |
}; |
| 8239 |
|
| 8240 |
// Based off of the plugin by Clint Helfers, with permission. |
| 8241 |
// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ |
| 8242 |
jQuery.fn.delay = function (time, type) { |
| 8243 |
time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; |
| 8244 |
type = type || "fx"; |
| 8245 |
|
| 8246 |
return this.queue(type, function (next, hooks) { |
| 8247 |
var timeout = window.setTimeout(next, time); |
| 8248 |
hooks.stop = function () { |
| 8249 |
window.clearTimeout(timeout); |
| 8250 |
}; |
| 8251 |
}); |
| 8252 |
}; |
| 8253 |
|
| 8254 |
(function () { |
| 8255 |
var input = document.createElement("input"), |
| 8256 |
select = document.createElement("select"), |
| 8257 |
opt = select.appendChild(document.createElement("option")); |
| 8258 |
|
| 8259 |
input.type = "checkbox"; |
| 8260 |
|
| 8261 |
// Support: Android <=4.3 only |
| 8262 |
// Default value for a checkbox should be "on" |
| 8263 |
support.checkOn = input.value !== ""; |
| 8264 |
|
| 8265 |
// Support: IE <=11 only |
| 8266 |
// Must access selectedIndex to make default options select |
| 8267 |
support.optSelected = opt.selected; |
| 8268 |
|
| 8269 |
// Support: IE <=11 only |
| 8270 |
// An input loses its value after becoming a radio |
| 8271 |
input = document.createElement("input"); |
| 8272 |
input.value = "t"; |
| 8273 |
input.type = "radio"; |
| 8274 |
support.radioValue = input.value === "t"; |
| 8275 |
})(); |
| 8276 |
|
| 8277 |
var boolHook, |
| 8278 |
attrHandle = jQuery.expr.attrHandle; |
| 8279 |
|
| 8280 |
jQuery.fn.extend({ |
| 8281 |
attr: function (name, value) { |
| 8282 |
return access(this, jQuery.attr, name, value, arguments.length > 1); |
| 8283 |
}, |
| 8284 |
|
| 8285 |
removeAttr: function (name) { |
| 8286 |
return this.each(function () { |
| 8287 |
jQuery.removeAttr(this, name); |
| 8288 |
}); |
| 8289 |
}, |
| 8290 |
}); |
| 8291 |
|
| 8292 |
jQuery.extend({ |
| 8293 |
attr: function (elem, name, value) { |
| 8294 |
var ret, |
| 8295 |
hooks, |
| 8296 |
nType = elem.nodeType; |
| 8297 |
|
| 8298 |
// Don't get/set attributes on text, comment and attribute nodes |
| 8299 |
if (nType === 3 || nType === 8 || nType === 2) { |
| 8300 |
return; |
| 8301 |
} |
| 8302 |
|
| 8303 |
// Fallback to prop when attributes are not supported |
| 8304 |
if (typeof elem.getAttribute === "undefined") { |
| 8305 |
return jQuery.prop(elem, name, value); |
| 8306 |
} |
| 8307 |
|
| 8308 |
// Attribute hooks are determined by the lowercase version |
| 8309 |
// Grab necessary hook if one is defined |
| 8310 |
if (nType !== 1 || !jQuery.isXMLDoc(elem)) { |
| 8311 |
hooks = |
| 8312 |
jQuery.attrHooks[name.toLowerCase()] || |
| 8313 |
(jQuery.expr.match.bool.test(name) ? boolHook : undefined); |
| 8314 |
} |
| 8315 |
|
| 8316 |
if (value !== undefined) { |
| 8317 |
if (value === null) { |
| 8318 |
jQuery.removeAttr(elem, name); |
| 8319 |
return; |
| 8320 |
} |
| 8321 |
|
| 8322 |
if ( |
| 8323 |
hooks && |
| 8324 |
"set" in hooks && |
| 8325 |
(ret = hooks.set(elem, value, name)) !== undefined |
| 8326 |
) { |
| 8327 |
return ret; |
| 8328 |
} |
| 8329 |
|
| 8330 |
elem.setAttribute(name, value + ""); |
| 8331 |
return value; |
| 8332 |
} |
| 8333 |
|
| 8334 |
if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) { |
| 8335 |
return ret; |
| 8336 |
} |
| 8337 |
|
| 8338 |
ret = jQuery.find.attr(elem, name); |
| 8339 |
|
| 8340 |
// Non-existent attributes return null, we normalize to undefined |
| 8341 |
return ret == null ? undefined : ret; |
| 8342 |
}, |
| 8343 |
|
| 8344 |
attrHooks: { |
| 8345 |
type: { |
| 8346 |
set: function (elem, value) { |
| 8347 |
if ( |
| 8348 |
!support.radioValue && |
| 8349 |
value === "radio" && |
| 8350 |
nodeName(elem, "input") |
| 8351 |
) { |
| 8352 |
var val = elem.value; |
| 8353 |
elem.setAttribute("type", value); |
| 8354 |
if (val) { |
| 8355 |
elem.value = val; |
| 8356 |
} |
| 8357 |
return value; |
| 8358 |
} |
| 8359 |
}, |
| 8360 |
}, |
| 8361 |
}, |
| 8362 |
|
| 8363 |
removeAttr: function (elem, value) { |
| 8364 |
var name, |
| 8365 |
i = 0, |
| 8366 |
// Attribute names can contain non-HTML whitespace characters |
| 8367 |
// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 |
| 8368 |
attrNames = value && value.match(rnothtmlwhite); |
| 8369 |
|
| 8370 |
if (attrNames && elem.nodeType === 1) { |
| 8371 |
while ((name = attrNames[i++])) { |
| 8372 |
elem.removeAttribute(name); |
| 8373 |
} |
| 8374 |
} |
| 8375 |
}, |
| 8376 |
}); |
| 8377 |
|
| 8378 |
// Hooks for boolean attributes |
| 8379 |
boolHook = { |
| 8380 |
set: function (elem, value, name) { |
| 8381 |
if (value === false) { |
| 8382 |
// Remove boolean attributes when set to false |
| 8383 |
jQuery.removeAttr(elem, name); |
| 8384 |
} else { |
| 8385 |
elem.setAttribute(name, name); |
| 8386 |
} |
| 8387 |
return name; |
| 8388 |
}, |
| 8389 |
}; |
| 8390 |
|
| 8391 |
jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function (_i, name) { |
| 8392 |
var getter = attrHandle[name] || jQuery.find.attr; |
| 8393 |
|
| 8394 |
attrHandle[name] = function (elem, name, isXML) { |
| 8395 |
var ret, |
| 8396 |
handle, |
| 8397 |
lowercaseName = name.toLowerCase(); |
| 8398 |
|
| 8399 |
if (!isXML) { |
| 8400 |
// Avoid an infinite loop by temporarily removing this function from the getter |
| 8401 |
handle = attrHandle[lowercaseName]; |
| 8402 |
attrHandle[lowercaseName] = ret; |
| 8403 |
ret = getter(elem, name, isXML) != null ? lowercaseName : null; |
| 8404 |
attrHandle[lowercaseName] = handle; |
| 8405 |
} |
| 8406 |
return ret; |
| 8407 |
}; |
| 8408 |
}); |
| 8409 |
|
| 8410 |
var rfocusable = /^(?:input|select|textarea|button)$/i, |
| 8411 |
rclickable = /^(?:a|area)$/i; |
| 8412 |
|
| 8413 |
jQuery.fn.extend({ |
| 8414 |
prop: function (name, value) { |
| 8415 |
return access(this, jQuery.prop, name, value, arguments.length > 1); |
| 8416 |
}, |
| 8417 |
|
| 8418 |
removeProp: function (name) { |
| 8419 |
return this.each(function () { |
| 8420 |
delete this[jQuery.propFix[name] || name]; |
| 8421 |
}); |
| 8422 |
}, |
| 8423 |
}); |
| 8424 |
|
| 8425 |
jQuery.extend({ |
| 8426 |
prop: function (elem, name, value) { |
| 8427 |
var ret, |
| 8428 |
hooks, |
| 8429 |
nType = elem.nodeType; |
| 8430 |
|
| 8431 |
// Don't get/set properties on text, comment and attribute nodes |
| 8432 |
if (nType === 3 || nType === 8 || nType === 2) { |
| 8433 |
return; |
| 8434 |
} |
| 8435 |
|
| 8436 |
if (nType !== 1 || !jQuery.isXMLDoc(elem)) { |
| 8437 |
// Fix name and attach hooks |
| 8438 |
name = jQuery.propFix[name] || name; |
| 8439 |
hooks = jQuery.propHooks[name]; |
| 8440 |
} |
| 8441 |
|
| 8442 |
if (value !== undefined) { |
| 8443 |
if ( |
| 8444 |
hooks && |
| 8445 |
"set" in hooks && |
| 8446 |
(ret = hooks.set(elem, value, name)) !== undefined |
| 8447 |
) { |
| 8448 |
return ret; |
| 8449 |
} |
| 8450 |
|
| 8451 |
return (elem[name] = value); |
| 8452 |
} |
| 8453 |
|
| 8454 |
if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) { |
| 8455 |
return ret; |
| 8456 |
} |
| 8457 |
|
| 8458 |
return elem[name]; |
| 8459 |
}, |
| 8460 |
|
| 8461 |
propHooks: { |
| 8462 |
tabIndex: { |
| 8463 |
get: function (elem) { |
| 8464 |
// Support: IE <=9 - 11 only |
| 8465 |
// elem.tabIndex doesn't always return the |
| 8466 |
// correct value when it hasn't been explicitly set |
| 8467 |
// https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ |
| 8468 |
// Use proper attribute retrieval(#12072) |
| 8469 |
var tabindex = jQuery.find.attr(elem, "tabindex"); |
| 8470 |
|
| 8471 |
if (tabindex) { |
| 8472 |
return parseInt(tabindex, 10); |
| 8473 |
} |
| 8474 |
|
| 8475 |
if ( |
| 8476 |
rfocusable.test(elem.nodeName) || |
| 8477 |
(rclickable.test(elem.nodeName) && elem.href) |
| 8478 |
) { |
| 8479 |
return 0; |
| 8480 |
} |
| 8481 |
|
| 8482 |
return -1; |
| 8483 |
}, |
| 8484 |
}, |
| 8485 |
}, |
| 8486 |
|
| 8487 |
propFix: { |
| 8488 |
for: "htmlFor", |
| 8489 |
class: "className", |
| 8490 |
}, |
| 8491 |
}); |
| 8492 |
|
| 8493 |
// Support: IE <=11 only |
| 8494 |
// Accessing the selectedIndex property |
| 8495 |
// forces the browser to respect setting selected |
| 8496 |
// on the option |
| 8497 |
// The getter ensures a default option is selected |
| 8498 |
// when in an optgroup |
| 8499 |
// eslint rule "no-unused-expressions" is disabled for this code |
| 8500 |
// since it considers such accessions noop |
| 8501 |
if (!support.optSelected) { |
| 8502 |
jQuery.propHooks.selected = { |
| 8503 |
get: function (elem) { |
| 8504 |
/* eslint no-unused-expressions: "off" */ |
| 8505 |
|
| 8506 |
var parent = elem.parentNode; |
| 8507 |
if (parent && parent.parentNode) { |
| 8508 |
parent.parentNode.selectedIndex; |
| 8509 |
} |
| 8510 |
return null; |
| 8511 |
}, |
| 8512 |
set: function (elem) { |
| 8513 |
/* eslint no-unused-expressions: "off" */ |
| 8514 |
|
| 8515 |
var parent = elem.parentNode; |
| 8516 |
if (parent) { |
| 8517 |
parent.selectedIndex; |
| 8518 |
|
| 8519 |
if (parent.parentNode) { |
| 8520 |
parent.parentNode.selectedIndex; |
| 8521 |
} |
| 8522 |
} |
| 8523 |
}, |
| 8524 |
}; |
| 8525 |
} |
| 8526 |
|
| 8527 |
jQuery.each( |
| 8528 |
[ |
| 8529 |
"tabIndex", |
| 8530 |
"readOnly", |
| 8531 |
"maxLength", |
| 8532 |
"cellSpacing", |
| 8533 |
"cellPadding", |
| 8534 |
"rowSpan", |
| 8535 |
"colSpan", |
| 8536 |
"useMap", |
| 8537 |
"frameBorder", |
| 8538 |
"contentEditable", |
| 8539 |
], |
| 8540 |
function () { |
| 8541 |
jQuery.propFix[this.toLowerCase()] = this; |
| 8542 |
} |
| 8543 |
); |
| 8544 |
|
| 8545 |
// Strip and collapse whitespace according to HTML spec |
| 8546 |
// https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace |
| 8547 |
function stripAndCollapse(value) { |
| 8548 |
var tokens = value.match(rnothtmlwhite) || []; |
| 8549 |
return tokens.join(" "); |
| 8550 |
} |
| 8551 |
|
| 8552 |
function getClass(elem) { |
| 8553 |
return (elem.getAttribute && elem.getAttribute("class")) || ""; |
| 8554 |
} |
| 8555 |
|
| 8556 |
function classesToArray(value) { |
| 8557 |
if (Array.isArray(value)) { |
| 8558 |
return value; |
| 8559 |
} |
| 8560 |
if (typeof value === "string") { |
| 8561 |
return value.match(rnothtmlwhite) || []; |
| 8562 |
} |
| 8563 |
return []; |
| 8564 |
} |
| 8565 |
|
| 8566 |
jQuery.fn.extend({ |
| 8567 |
addClass: function (value) { |
| 8568 |
var classes, |
| 8569 |
elem, |
| 8570 |
cur, |
| 8571 |
curValue, |
| 8572 |
clazz, |
| 8573 |
j, |
| 8574 |
finalValue, |
| 8575 |
i = 0; |
| 8576 |
|
| 8577 |
if (isFunction(value)) { |
| 8578 |
return this.each(function (j) { |
| 8579 |
jQuery(this).addClass(value.call(this, j, getClass(this))); |
| 8580 |
}); |
| 8581 |
} |
| 8582 |
|
| 8583 |
classes = classesToArray(value); |
| 8584 |
|
| 8585 |
if (classes.length) { |
| 8586 |
while ((elem = this[i++])) { |
| 8587 |
curValue = getClass(elem); |
| 8588 |
cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " "; |
| 8589 |
|
| 8590 |
if (cur) { |
| 8591 |
j = 0; |
| 8592 |
while ((clazz = classes[j++])) { |
| 8593 |
if (cur.indexOf(" " + clazz + " ") < 0) { |
| 8594 |
cur += clazz + " "; |
| 8595 |
} |
| 8596 |
} |
| 8597 |
|
| 8598 |
// Only assign if different to avoid unneeded rendering. |
| 8599 |
finalValue = stripAndCollapse(cur); |
| 8600 |
if (curValue !== finalValue) { |
| 8601 |
elem.setAttribute("class", finalValue); |
| 8602 |
} |
| 8603 |
} |
| 8604 |
} |
| 8605 |
} |
| 8606 |
|
| 8607 |
return this; |
| 8608 |
}, |
| 8609 |
|
| 8610 |
removeClass: function (value) { |
| 8611 |
var classes, |
| 8612 |
elem, |
| 8613 |
cur, |
| 8614 |
curValue, |
| 8615 |
clazz, |
| 8616 |
j, |
| 8617 |
finalValue, |
| 8618 |
i = 0; |
| 8619 |
|
| 8620 |
if (isFunction(value)) { |
| 8621 |
return this.each(function (j) { |
| 8622 |
jQuery(this).removeClass(value.call(this, j, getClass(this))); |
| 8623 |
}); |
| 8624 |
} |
| 8625 |
|
| 8626 |
if (!arguments.length) { |
| 8627 |
return this.attr("class", ""); |
| 8628 |
} |
| 8629 |
|
| 8630 |
classes = classesToArray(value); |
| 8631 |
|
| 8632 |
if (classes.length) { |
| 8633 |
while ((elem = this[i++])) { |
| 8634 |
curValue = getClass(elem); |
| 8635 |
|
| 8636 |
// This expression is here for better compressibility (see addClass) |
| 8637 |
cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " "; |
| 8638 |
|
| 8639 |
if (cur) { |
| 8640 |
j = 0; |
| 8641 |
while ((clazz = classes[j++])) { |
| 8642 |
// Remove *all* instances |
| 8643 |
while (cur.indexOf(" " + clazz + " ") > -1) { |
| 8644 |
cur = cur.replace(" " + clazz + " ", " "); |
| 8645 |
} |
| 8646 |
} |
| 8647 |
|
| 8648 |
// Only assign if different to avoid unneeded rendering. |
| 8649 |
finalValue = stripAndCollapse(cur); |
| 8650 |
if (curValue !== finalValue) { |
| 8651 |
elem.setAttribute("class", finalValue); |
| 8652 |
} |
| 8653 |
} |
| 8654 |
} |
| 8655 |
} |
| 8656 |
|
| 8657 |
return this; |
| 8658 |
}, |
| 8659 |
|
| 8660 |
toggleClass: function (value, stateVal) { |
| 8661 |
var type = typeof value, |
| 8662 |
isValidValue = type === "string" || Array.isArray(value); |
| 8663 |
|
| 8664 |
if (typeof stateVal === "boolean" && isValidValue) { |
| 8665 |
return stateVal ? this.addClass(value) : this.removeClass(value); |
| 8666 |
} |
| 8667 |
|
| 8668 |
if (isFunction(value)) { |
| 8669 |
return this.each(function (i) { |
| 8670 |
jQuery(this).toggleClass( |
| 8671 |
value.call(this, i, getClass(this), stateVal), |
| 8672 |
stateVal |
| 8673 |
); |
| 8674 |
}); |
| 8675 |
} |
| 8676 |
|
| 8677 |
return this.each(function () { |
| 8678 |
var className, i, self, classNames; |
| 8679 |
|
| 8680 |
if (isValidValue) { |
| 8681 |
// Toggle individual class names |
| 8682 |
i = 0; |
| 8683 |
self = jQuery(this); |
| 8684 |
classNames = classesToArray(value); |
| 8685 |
|
| 8686 |
while ((className = classNames[i++])) { |
| 8687 |
// Check each className given, space separated list |
| 8688 |
if (self.hasClass(className)) { |
| 8689 |
self.removeClass(className); |
| 8690 |
} else { |
| 8691 |
self.addClass(className); |
| 8692 |
} |
| 8693 |
} |
| 8694 |
|
| 8695 |
// Toggle whole class name |
| 8696 |
} else if (value === undefined || type === "boolean") { |
| 8697 |
className = getClass(this); |
| 8698 |
if (className) { |
| 8699 |
// Store className if set |
| 8700 |
dataPriv.set(this, "__className__", className); |
| 8701 |
} |
| 8702 |
|
| 8703 |
// If the element has a class name or if we're passed `false`, |
| 8704 |
// then remove the whole classname (if there was one, the above saved it). |
| 8705 |
// Otherwise bring back whatever was previously saved (if anything), |
| 8706 |
// falling back to the empty string if nothing was stored. |
| 8707 |
if (this.setAttribute) { |
| 8708 |
this.setAttribute( |
| 8709 |
"class", |
| 8710 |
className || value === false |
| 8711 |
? "" |
| 8712 |
: dataPriv.get(this, "__className__") || "" |
| 8713 |
); |
| 8714 |
} |
| 8715 |
} |
| 8716 |
}); |
| 8717 |
}, |
| 8718 |
|
| 8719 |
hasClass: function (selector) { |
| 8720 |
var className, |
| 8721 |
elem, |
| 8722 |
i = 0; |
| 8723 |
|
| 8724 |
className = " " + selector + " "; |
| 8725 |
while ((elem = this[i++])) { |
| 8726 |
if ( |
| 8727 |
elem.nodeType === 1 && |
| 8728 |
(" " + stripAndCollapse(getClass(elem)) + " ").indexOf(className) > -1 |
| 8729 |
) { |
| 8730 |
return true; |
| 8731 |
} |
| 8732 |
} |
| 8733 |
|
| 8734 |
return false; |
| 8735 |
}, |
| 8736 |
}); |
| 8737 |
|
| 8738 |
var rreturn = /\r/g; |
| 8739 |
|
| 8740 |
jQuery.fn.extend({ |
| 8741 |
val: function (value) { |
| 8742 |
var hooks, |
| 8743 |
ret, |
| 8744 |
valueIsFunction, |
| 8745 |
elem = this[0]; |
| 8746 |
|
| 8747 |
if (!arguments.length) { |
| 8748 |
if (elem) { |
| 8749 |
hooks = |
| 8750 |
jQuery.valHooks[elem.type] || |
| 8751 |
jQuery.valHooks[elem.nodeName.toLowerCase()]; |
| 8752 |
|
| 8753 |
if ( |
| 8754 |
hooks && |
| 8755 |
"get" in hooks && |
| 8756 |
(ret = hooks.get(elem, "value")) !== undefined |
| 8757 |
) { |
| 8758 |
return ret; |
| 8759 |
} |
| 8760 |
|
| 8761 |
ret = elem.value; |
| 8762 |
|
| 8763 |
// Handle most common string cases |
| 8764 |
if (typeof ret === "string") { |
| 8765 |
return ret.replace(rreturn, ""); |
| 8766 |
} |
| 8767 |
|
| 8768 |
// Handle cases where value is null/undef or number |
| 8769 |
return ret == null ? "" : ret; |
| 8770 |
} |
| 8771 |
|
| 8772 |
return; |
| 8773 |
} |
| 8774 |
|
| 8775 |
valueIsFunction = isFunction(value); |
| 8776 |
|
| 8777 |
return this.each(function (i) { |
| 8778 |
var val; |
| 8779 |
|
| 8780 |
if (this.nodeType !== 1) { |
| 8781 |
return; |
| 8782 |
} |
| 8783 |
|
| 8784 |
if (valueIsFunction) { |
| 8785 |
val = value.call(this, i, jQuery(this).val()); |
| 8786 |
} else { |
| 8787 |
val = value; |
| 8788 |
} |
| 8789 |
|
| 8790 |
// Treat null/undefined as ""; convert numbers to string |
| 8791 |
if (val == null) { |
| 8792 |
val = ""; |
| 8793 |
} else if (typeof val === "number") { |
| 8794 |
val += ""; |
| 8795 |
} else if (Array.isArray(val)) { |
| 8796 |
val = jQuery.map(val, function (value) { |
| 8797 |
return value == null ? "" : value + ""; |
| 8798 |
}); |
| 8799 |
} |
| 8800 |
|
| 8801 |
hooks = |
| 8802 |
jQuery.valHooks[this.type] || |
| 8803 |
jQuery.valHooks[this.nodeName.toLowerCase()]; |
| 8804 |
|
| 8805 |
// If set returns undefined, fall back to normal setting |
| 8806 |
if ( |
| 8807 |
!hooks || |
| 8808 |
!("set" in hooks) || |
| 8809 |
hooks.set(this, val, "value") === undefined |
| 8810 |
) { |
| 8811 |
this.value = val; |
| 8812 |
} |
| 8813 |
}); |
| 8814 |
}, |
| 8815 |
}); |
| 8816 |
|
| 8817 |
jQuery.extend({ |
| 8818 |
valHooks: { |
| 8819 |
option: { |
| 8820 |
get: function (elem) { |
| 8821 |
var val = jQuery.find.attr(elem, "value"); |
| 8822 |
return val != null |
| 8823 |
? val |
| 8824 |
: // Support: IE <=10 - 11 only |
| 8825 |
// option.text throws exceptions (#14686, #14858) |
| 8826 |
// Strip and collapse whitespace |
| 8827 |
// https://html.spec.whatwg.org/#strip-and-collapse-whitespace |
| 8828 |
stripAndCollapse(jQuery.text(elem)); |
| 8829 |
}, |
| 8830 |
}, |
| 8831 |
select: { |
| 8832 |
get: function (elem) { |
| 8833 |
var value, |
| 8834 |
option, |
| 8835 |
i, |
| 8836 |
options = elem.options, |
| 8837 |
index = elem.selectedIndex, |
| 8838 |
one = elem.type === "select-one", |
| 8839 |
values = one ? null : [], |
| 8840 |
max = one ? index + 1 : options.length; |
| 8841 |
|
| 8842 |
if (index < 0) { |
| 8843 |
i = max; |
| 8844 |
} else { |
| 8845 |
i = one ? index : 0; |
| 8846 |
} |
| 8847 |
|
| 8848 |
// Loop through all the selected options |
| 8849 |
for (; i < max; i++) { |
| 8850 |
option = options[i]; |
| 8851 |
|
| 8852 |
// Support: IE <=9 only |
| 8853 |
// IE8-9 doesn't update selected after form reset (#2551) |
| 8854 |
if ( |
| 8855 |
(option.selected || i === index) && |
| 8856 |
// Don't return options that are disabled or in a disabled optgroup |
| 8857 |
!option.disabled && |
| 8858 |
(!option.parentNode.disabled || |
| 8859 |
!nodeName(option.parentNode, "optgroup")) |
| 8860 |
) { |
| 8861 |
// Get the specific value for the option |
| 8862 |
value = jQuery(option).val(); |
| 8863 |
|
| 8864 |
// We don't need an array for one selects |
| 8865 |
if (one) { |
| 8866 |
return value; |
| 8867 |
} |
| 8868 |
|
| 8869 |
// Multi-Selects return an array |
| 8870 |
values.push(value); |
| 8871 |
} |
| 8872 |
} |
| 8873 |
|
| 8874 |
return values; |
| 8875 |
}, |
| 8876 |
|
| 8877 |
set: function (elem, value) { |
| 8878 |
var optionSet, |
| 8879 |
option, |
| 8880 |
options = elem.options, |
| 8881 |
values = jQuery.makeArray(value), |
| 8882 |
i = options.length; |
| 8883 |
|
| 8884 |
while (i--) { |
| 8885 |
option = options[i]; |
| 8886 |
|
| 8887 |
/* eslint-disable no-cond-assign */ |
| 8888 |
|
| 8889 |
if ( |
| 8890 |
(option.selected = |
| 8891 |
jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1) |
| 8892 |
) { |
| 8893 |
optionSet = true; |
| 8894 |
} |
| 8895 |
|
| 8896 |
/* eslint-enable no-cond-assign */ |
| 8897 |
} |
| 8898 |
|
| 8899 |
// Force browsers to behave consistently when non-matching value is set |
| 8900 |
if (!optionSet) { |
| 8901 |
elem.selectedIndex = -1; |
| 8902 |
} |
| 8903 |
return values; |
| 8904 |
}, |
| 8905 |
}, |
| 8906 |
}, |
| 8907 |
}); |
| 8908 |
|
| 8909 |
// Radios and checkboxes getter/setter |
| 8910 |
jQuery.each(["radio", "checkbox"], function () { |
| 8911 |
jQuery.valHooks[this] = { |
| 8912 |
set: function (elem, value) { |
| 8913 |
if (Array.isArray(value)) { |
| 8914 |
return (elem.checked = |
| 8915 |
jQuery.inArray(jQuery(elem).val(), value) > -1); |
| 8916 |
} |
| 8917 |
}, |
| 8918 |
}; |
| 8919 |
if (!support.checkOn) { |
| 8920 |
jQuery.valHooks[this].get = function (elem) { |
| 8921 |
return elem.getAttribute("value") === null ? "on" : elem.value; |
| 8922 |
}; |
| 8923 |
} |
| 8924 |
}); |
| 8925 |
|
| 8926 |
// Return jQuery for attributes-only inclusion |
| 8927 |
|
| 8928 |
support.focusin = "onfocusin" in window; |
| 8929 |
|
| 8930 |
var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, |
| 8931 |
stopPropagationCallback = function (e) { |
| 8932 |
e.stopPropagation(); |
| 8933 |
}; |
| 8934 |
|
| 8935 |
jQuery.extend(jQuery.event, { |
| 8936 |
trigger: function (event, data, elem, onlyHandlers) { |
| 8937 |
var i, |
| 8938 |
cur, |
| 8939 |
tmp, |
| 8940 |
bubbleType, |
| 8941 |
ontype, |
| 8942 |
handle, |
| 8943 |
special, |
| 8944 |
lastElement, |
| 8945 |
eventPath = [elem || document], |
| 8946 |
type = hasOwn.call(event, "type") ? event.type : event, |
| 8947 |
namespaces = hasOwn.call(event, "namespace") |
| 8948 |
? event.namespace.split(".") |
| 8949 |
: []; |
| 8950 |
|
| 8951 |
cur = lastElement = tmp = elem = elem || document; |
| 8952 |
|
| 8953 |
// Don't do events on text and comment nodes |
| 8954 |
if (elem.nodeType === 3 || elem.nodeType === 8) { |
| 8955 |
return; |
| 8956 |
} |
| 8957 |
|
| 8958 |
// focus/blur morphs to focusin/out; ensure we're not firing them right now |
| 8959 |
if (rfocusMorph.test(type + jQuery.event.triggered)) { |
| 8960 |
return; |
| 8961 |
} |
| 8962 |
|
| 8963 |
if (type.indexOf(".") > -1) { |
| 8964 |
// Namespaced trigger; create a regexp to match event type in handle() |
| 8965 |
namespaces = type.split("."); |
| 8966 |
type = namespaces.shift(); |
| 8967 |
namespaces.sort(); |
| 8968 |
} |
| 8969 |
ontype = type.indexOf(":") < 0 && "on" + type; |
| 8970 |
|
| 8971 |
// Caller can pass in a jQuery.Event object, Object, or just an event type string |
| 8972 |
event = event[jQuery.expando] |
| 8973 |
? event |
| 8974 |
: new jQuery.Event(type, typeof event === "object" && event); |
| 8975 |
|
| 8976 |
// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) |
| 8977 |
event.isTrigger = onlyHandlers ? 2 : 3; |
| 8978 |
event.namespace = namespaces.join("."); |
| 8979 |
event.rnamespace = event.namespace |
| 8980 |
? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") |
| 8981 |
: null; |
| 8982 |
|
| 8983 |
// Clean up the event in case it is being reused |
| 8984 |
event.result = undefined; |
| 8985 |
if (!event.target) { |
| 8986 |
event.target = elem; |
| 8987 |
} |
| 8988 |
|
| 8989 |
// Clone any incoming data and prepend the event, creating the handler arg list |
| 8990 |
data = data == null ? [event] : jQuery.makeArray(data, [event]); |
| 8991 |
|
| 8992 |
// Allow special events to draw outside the lines |
| 8993 |
special = jQuery.event.special[type] || {}; |
| 8994 |
if ( |
| 8995 |
!onlyHandlers && |
| 8996 |
special.trigger && |
| 8997 |
special.trigger.apply(elem, data) === false |
| 8998 |
) { |
| 8999 |
return; |
| 9000 |
} |
| 9001 |
|
| 9002 |
// Determine event propagation path in advance, per W3C events spec (#9951) |
| 9003 |
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724) |
| 9004 |
if (!onlyHandlers && !special.noBubble && !isWindow(elem)) { |
| 9005 |
bubbleType = special.delegateType || type; |
| 9006 |
if (!rfocusMorph.test(bubbleType + type)) { |
| 9007 |
cur = cur.parentNode; |
| 9008 |
} |
| 9009 |
for (; cur; cur = cur.parentNode) { |
| 9010 |
eventPath.push(cur); |
| 9011 |
tmp = cur; |
| 9012 |
} |
| 9013 |
|
| 9014 |
// Only add window if we got to document (e.g., not plain obj or detached DOM) |
| 9015 |
if (tmp === (elem.ownerDocument || document)) { |
| 9016 |
eventPath.push(tmp.defaultView || tmp.parentWindow || window); |
| 9017 |
} |
| 9018 |
} |
| 9019 |
|
| 9020 |
// Fire handlers on the event path |
| 9021 |
i = 0; |
| 9022 |
while ((cur = eventPath[i++]) && !event.isPropagationStopped()) { |
| 9023 |
lastElement = cur; |
| 9024 |
event.type = i > 1 ? bubbleType : special.bindType || type; |
| 9025 |
|
| 9026 |
// jQuery handler |
| 9027 |
handle = |
| 9028 |
(dataPriv.get(cur, "events") || Object.create(null))[event.type] && |
| 9029 |
dataPriv.get(cur, "handle"); |
| 9030 |
if (handle) { |
| 9031 |
handle.apply(cur, data); |
| 9032 |
} |
| 9033 |
|
| 9034 |
// Native handler |
| 9035 |
handle = ontype && cur[ontype]; |
| 9036 |
if (handle && handle.apply && acceptData(cur)) { |
| 9037 |
event.result = handle.apply(cur, data); |
| 9038 |
if (event.result === false) { |
| 9039 |
event.preventDefault(); |
| 9040 |
} |
| 9041 |
} |
| 9042 |
} |
| 9043 |
event.type = type; |
| 9044 |
|
| 9045 |
// If nobody prevented the default action, do it now |
| 9046 |
if (!onlyHandlers && !event.isDefaultPrevented()) { |
| 9047 |
if ( |
| 9048 |
(!special._default || |
| 9049 |
special._default.apply(eventPath.pop(), data) === false) && |
| 9050 |
acceptData(elem) |
| 9051 |
) { |
| 9052 |
// Call a native DOM method on the target with the same name as the event. |
| 9053 |
// Don't do default actions on window, that's where global variables be (#6170) |
| 9054 |
if (ontype && isFunction(elem[type]) && !isWindow(elem)) { |
| 9055 |
// Don't re-trigger an onFOO event when we call its FOO() method |
| 9056 |
tmp = elem[ontype]; |
| 9057 |
|
| 9058 |
if (tmp) { |
| 9059 |
elem[ontype] = null; |
| 9060 |
} |
| 9061 |
|
| 9062 |
// Prevent re-triggering of the same event, since we already bubbled it above |
| 9063 |
jQuery.event.triggered = type; |
| 9064 |
|
| 9065 |
if (event.isPropagationStopped()) { |
| 9066 |
lastElement.addEventListener(type, stopPropagationCallback); |
| 9067 |
} |
| 9068 |
|
| 9069 |
elem[type](); |
| 9070 |
|
| 9071 |
if (event.isPropagationStopped()) { |
| 9072 |
lastElement.removeEventListener(type, stopPropagationCallback); |
| 9073 |
} |
| 9074 |
|
| 9075 |
jQuery.event.triggered = undefined; |
| 9076 |
|
| 9077 |
if (tmp) { |
| 9078 |
elem[ontype] = tmp; |
| 9079 |
} |
| 9080 |
} |
| 9081 |
} |
| 9082 |
} |
| 9083 |
|
| 9084 |
return event.result; |
| 9085 |
}, |
| 9086 |
|
| 9087 |
// Piggyback on a donor event to simulate a different one |
| 9088 |
// Used only for `focus(in | out)` events |
| 9089 |
simulate: function (type, elem, event) { |
| 9090 |
var e = jQuery.extend(new jQuery.Event(), event, { |
| 9091 |
type: type, |
| 9092 |
isSimulated: true, |
| 9093 |
}); |
| 9094 |
|
| 9095 |
jQuery.event.trigger(e, null, elem); |
| 9096 |
}, |
| 9097 |
}); |
| 9098 |
|
| 9099 |
jQuery.fn.extend({ |
| 9100 |
trigger: function (type, data) { |
| 9101 |
return this.each(function () { |
| 9102 |
jQuery.event.trigger(type, data, this); |
| 9103 |
}); |
| 9104 |
}, |
| 9105 |
triggerHandler: function (type, data) { |
| 9106 |
var elem = this[0]; |
| 9107 |
if (elem) { |
| 9108 |
return jQuery.event.trigger(type, data, elem, true); |
| 9109 |
} |
| 9110 |
}, |
| 9111 |
}); |
| 9112 |
|
| 9113 |
// Support: Firefox <=44 |
| 9114 |
// Firefox doesn't have focus(in | out) events |
| 9115 |
// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 |
| 9116 |
// |
| 9117 |
// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 |
| 9118 |
// focus(in | out) events fire after focus & blur events, |
| 9119 |
// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order |
| 9120 |
// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 |
| 9121 |
if (!support.focusin) { |
| 9122 |
jQuery.each({ focus: "focusin", blur: "focusout" }, function (orig, fix) { |
| 9123 |
// Attach a single capturing handler on the document while someone wants focusin/focusout |
| 9124 |
var handler = function (event) { |
| 9125 |
jQuery.event.simulate(fix, event.target, jQuery.event.fix(event)); |
| 9126 |
}; |
| 9127 |
|
| 9128 |
jQuery.event.special[fix] = { |
| 9129 |
setup: function () { |
| 9130 |
// Handle: regular nodes (via `this.ownerDocument`), window |
| 9131 |
// (via `this.document`) & document (via `this`). |
| 9132 |
var doc = this.ownerDocument || this.document || this, |
| 9133 |
attaches = dataPriv.access(doc, fix); |
| 9134 |
|
| 9135 |
if (!attaches) { |
| 9136 |
doc.addEventListener(orig, handler, true); |
| 9137 |
} |
| 9138 |
dataPriv.access(doc, fix, (attaches || 0) + 1); |
| 9139 |
}, |
| 9140 |
teardown: function () { |
| 9141 |
var doc = this.ownerDocument || this.document || this, |
| 9142 |
attaches = dataPriv.access(doc, fix) - 1; |
| 9143 |
|
| 9144 |
if (!attaches) { |
| 9145 |
doc.removeEventListener(orig, handler, true); |
| 9146 |
dataPriv.remove(doc, fix); |
| 9147 |
} else { |
| 9148 |
dataPriv.access(doc, fix, attaches); |
| 9149 |
} |
| 9150 |
}, |
| 9151 |
}; |
| 9152 |
}); |
| 9153 |
} |
| 9154 |
var location = window.location; |
| 9155 |
|
| 9156 |
var nonce = { guid: Date.now() }; |
| 9157 |
|
| 9158 |
var rquery = /\?/; |
| 9159 |
|
| 9160 |
// Cross-browser xml parsing |
| 9161 |
jQuery.parseXML = function (data) { |
| 9162 |
var xml, parserErrorElem; |
| 9163 |
if (!data || typeof data !== "string") { |
| 9164 |
return null; |
| 9165 |
} |
| 9166 |
|
| 9167 |
// Support: IE 9 - 11 only |
| 9168 |
// IE throws on parseFromString with invalid input. |
| 9169 |
try { |
| 9170 |
xml = new window.DOMParser().parseFromString(data, "text/xml"); |
| 9171 |
} catch (e) {} |
| 9172 |
|
| 9173 |
parserErrorElem = xml && xml.getElementsByTagName("parsererror")[0]; |
| 9174 |
if (!xml || parserErrorElem) { |
| 9175 |
jQuery.error( |
| 9176 |
"Invalid XML: " + |
| 9177 |
(parserErrorElem |
| 9178 |
? jQuery |
| 9179 |
.map(parserErrorElem.childNodes, function (el) { |
| 9180 |
return el.textContent; |
| 9181 |
}) |
| 9182 |
.join("\n") |
| 9183 |
: data) |
| 9184 |
); |
| 9185 |
} |
| 9186 |
return xml; |
| 9187 |
}; |
| 9188 |
|
| 9189 |
var rbracket = /\[\]$/, |
| 9190 |
rCRLF = /\r?\n/g, |
| 9191 |
rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, |
| 9192 |
rsubmittable = /^(?:input|select|textarea|keygen)/i; |
| 9193 |
|
| 9194 |
function buildParams(prefix, obj, traditional, add) { |
| 9195 |
var name; |
| 9196 |
|
| 9197 |
if (Array.isArray(obj)) { |
| 9198 |
// Serialize array item. |
| 9199 |
jQuery.each(obj, function (i, v) { |
| 9200 |
if (traditional || rbracket.test(prefix)) { |
| 9201 |
// Treat each array item as a scalar. |
| 9202 |
add(prefix, v); |
| 9203 |
} else { |
| 9204 |
// Item is non-scalar (array or object), encode its numeric index. |
| 9205 |
buildParams( |
| 9206 |
prefix + "[" + (typeof v === "object" && v != null ? i : "") + "]", |
| 9207 |
v, |
| 9208 |
traditional, |
| 9209 |
add |
| 9210 |
); |
| 9211 |
} |
| 9212 |
}); |
| 9213 |
} else if (!traditional && toType(obj) === "object") { |
| 9214 |
// Serialize object item. |
| 9215 |
for (name in obj) { |
| 9216 |
buildParams(prefix + "[" + name + "]", obj[name], traditional, add); |
| 9217 |
} |
| 9218 |
} else { |
| 9219 |
// Serialize scalar item. |
| 9220 |
add(prefix, obj); |
| 9221 |
} |
| 9222 |
} |
| 9223 |
|
| 9224 |
// Serialize an array of form elements or a set of |
| 9225 |
// key/values into a query string |
| 9226 |
jQuery.param = function (a, traditional) { |
| 9227 |
var prefix, |
| 9228 |
s = [], |
| 9229 |
add = function (key, valueOrFunction) { |
| 9230 |
// If value is a function, invoke it and use its return value |
| 9231 |
var value = isFunction(valueOrFunction) |
| 9232 |
? valueOrFunction() |
| 9233 |
: valueOrFunction; |
| 9234 |
|
| 9235 |
s[s.length] = |
| 9236 |
encodeURIComponent(key) + |
| 9237 |
"=" + |
| 9238 |
encodeURIComponent(value == null ? "" : value); |
| 9239 |
}; |
| 9240 |
|
| 9241 |
if (a == null) { |
| 9242 |
return ""; |
| 9243 |
} |
| 9244 |
|
| 9245 |
// If an array was passed in, assume that it is an array of form elements. |
| 9246 |
if (Array.isArray(a) || (a.jquery && !jQuery.isPlainObject(a))) { |
| 9247 |
// Serialize the form elements |
| 9248 |
jQuery.each(a, function () { |
| 9249 |
add(this.name, this.value); |
| 9250 |
}); |
| 9251 |
} else { |
| 9252 |
// If traditional, encode the "old" way (the way 1.3.2 or older |
| 9253 |
// did it), otherwise encode params recursively. |
| 9254 |
for (prefix in a) { |
| 9255 |
buildParams(prefix, a[prefix], traditional, add); |
| 9256 |
} |
| 9257 |
} |
| 9258 |
|
| 9259 |
// Return the resulting serialization |
| 9260 |
return s.join("&"); |
| 9261 |
}; |
| 9262 |
|
| 9263 |
jQuery.fn.extend({ |
| 9264 |
serialize: function () { |
| 9265 |
return jQuery.param(this.serializeArray()); |
| 9266 |
}, |
| 9267 |
serializeArray: function () { |
| 9268 |
return this.map(function () { |
| 9269 |
// Can add propHook for "elements" to filter or add form elements |
| 9270 |
var elements = jQuery.prop(this, "elements"); |
| 9271 |
return elements ? jQuery.makeArray(elements) : this; |
| 9272 |
}) |
| 9273 |
.filter(function () { |
| 9274 |
var type = this.type; |
| 9275 |
|
| 9276 |
// Use .is( ":disabled" ) so that fieldset[disabled] works |
| 9277 |
return ( |
| 9278 |
this.name && |
| 9279 |
!jQuery(this).is(":disabled") && |
| 9280 |
rsubmittable.test(this.nodeName) && |
| 9281 |
!rsubmitterTypes.test(type) && |
| 9282 |
(this.checked || !rcheckableType.test(type)) |
| 9283 |
); |
| 9284 |
}) |
| 9285 |
.map(function (_i, elem) { |
| 9286 |
var val = jQuery(this).val(); |
| 9287 |
|
| 9288 |
if (val == null) { |
| 9289 |
return null; |
| 9290 |
} |
| 9291 |
|
| 9292 |
if (Array.isArray(val)) { |
| 9293 |
return jQuery.map(val, function (val) { |
| 9294 |
return { name: elem.name, value: val.replace(rCRLF, "\r\n") }; |
| 9295 |
}); |
| 9296 |
} |
| 9297 |
|
| 9298 |
return { name: elem.name, value: val.replace(rCRLF, "\r\n") }; |
| 9299 |
}) |
| 9300 |
.get(); |
| 9301 |
}, |
| 9302 |
}); |
| 9303 |
|
| 9304 |
var r20 = /%20/g, |
| 9305 |
rhash = /#.*$/, |
| 9306 |
rantiCache = /([?&])_=[^&]*/, |
| 9307 |
rheaders = /^(.*?):[ \t]*([^\r\n]*)$/gm, |
| 9308 |
// #7653, #8125, #8152: local protocol detection |
| 9309 |
rlocalProtocol = |
| 9310 |
/^(?:about|app|app-storage|.+-extension|file|res|widget):$/, |
| 9311 |
rnoContent = /^(?:GET|HEAD)$/, |
| 9312 |
rprotocol = /^\/\//, |
| 9313 |
/* Prefilters |
| 9314 |
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) |
| 9315 |
* 2) These are called: |
| 9316 |
* - BEFORE asking for a transport |
| 9317 |
* - AFTER param serialization (s.data is a string if s.processData is true) |
| 9318 |
* 3) key is the dataType |
| 9319 |
* 4) the catchall symbol "*" can be used |
| 9320 |
* 5) execution will start with transport dataType and THEN continue down to "*" if needed |
| 9321 |
*/ |
| 9322 |
prefilters = {}, |
| 9323 |
/* Transports bindings |
| 9324 |
* 1) key is the dataType |
| 9325 |
* 2) the catchall symbol "*" can be used |
| 9326 |
* 3) selection will start with transport dataType and THEN go to "*" if needed |
| 9327 |
*/ |
| 9328 |
transports = {}, |
| 9329 |
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression |
| 9330 |
allTypes = "*/".concat("*"), |
| 9331 |
// Anchor tag for parsing the document origin |
| 9332 |
originAnchor = document.createElement("a"); |
| 9333 |
|
| 9334 |
originAnchor.href = location.href; |
| 9335 |
|
| 9336 |
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport |
| 9337 |
function addToPrefiltersOrTransports(structure) { |
| 9338 |
// dataTypeExpression is optional and defaults to "*" |
| 9339 |
return function (dataTypeExpression, func) { |
| 9340 |
if (typeof dataTypeExpression !== "string") { |
| 9341 |
func = dataTypeExpression; |
| 9342 |
dataTypeExpression = "*"; |
| 9343 |
} |
| 9344 |
|
| 9345 |
var dataType, |
| 9346 |
i = 0, |
| 9347 |
dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || []; |
| 9348 |
|
| 9349 |
if (isFunction(func)) { |
| 9350 |
// For each dataType in the dataTypeExpression |
| 9351 |
while ((dataType = dataTypes[i++])) { |
| 9352 |
// Prepend if requested |
| 9353 |
if (dataType[0] === "+") { |
| 9354 |
dataType = dataType.slice(1) || "*"; |
| 9355 |
(structure[dataType] = structure[dataType] || []).unshift(func); |
| 9356 |
|
| 9357 |
// Otherwise append |
| 9358 |
} else { |
| 9359 |
(structure[dataType] = structure[dataType] || []).push(func); |
| 9360 |
} |
| 9361 |
} |
| 9362 |
} |
| 9363 |
}; |
| 9364 |
} |
| 9365 |
|
| 9366 |
// Base inspection function for prefilters and transports |
| 9367 |
function inspectPrefiltersOrTransports( |
| 9368 |
structure, |
| 9369 |
options, |
| 9370 |
originalOptions, |
| 9371 |
jqXHR |
| 9372 |
) { |
| 9373 |
var inspected = {}, |
| 9374 |
seekingTransport = structure === transports; |
| 9375 |
|
| 9376 |
function inspect(dataType) { |
| 9377 |
var selected; |
| 9378 |
inspected[dataType] = true; |
| 9379 |
jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) { |
| 9380 |
var dataTypeOrTransport = prefilterOrFactory( |
| 9381 |
options, |
| 9382 |
originalOptions, |
| 9383 |
jqXHR |
| 9384 |
); |
| 9385 |
if ( |
| 9386 |
typeof dataTypeOrTransport === "string" && |
| 9387 |
!seekingTransport && |
| 9388 |
!inspected[dataTypeOrTransport] |
| 9389 |
) { |
| 9390 |
options.dataTypes.unshift(dataTypeOrTransport); |
| 9391 |
inspect(dataTypeOrTransport); |
| 9392 |
return false; |
| 9393 |
} else if (seekingTransport) { |
| 9394 |
return !(selected = dataTypeOrTransport); |
| 9395 |
} |
| 9396 |
}); |
| 9397 |
return selected; |
| 9398 |
} |
| 9399 |
|
| 9400 |
return inspect(options.dataTypes[0]) || (!inspected["*"] && inspect("*")); |
| 9401 |
} |
| 9402 |
|
| 9403 |
// A special extend for ajax options |
| 9404 |
// that takes "flat" options (not to be deep extended) |
| 9405 |
// Fixes #9887 |
| 9406 |
function ajaxExtend(target, src) { |
| 9407 |
var key, |
| 9408 |
deep, |
| 9409 |
flatOptions = jQuery.ajaxSettings.flatOptions || {}; |
| 9410 |
|
| 9411 |
for (key in src) { |
| 9412 |
if (src[key] !== undefined) { |
| 9413 |
(flatOptions[key] ? target : deep || (deep = {}))[key] = src[key]; |
| 9414 |
} |
| 9415 |
} |
| 9416 |
if (deep) { |
| 9417 |
jQuery.extend(true, target, deep); |
| 9418 |
} |
| 9419 |
|
| 9420 |
return target; |
| 9421 |
} |
| 9422 |
|
| 9423 |
/* Handles responses to an ajax request: |
| 9424 |
* - finds the right dataType (mediates between content-type and expected dataType) |
| 9425 |
* - returns the corresponding response |
| 9426 |
*/ |
| 9427 |
function ajaxHandleResponses(s, jqXHR, responses) { |
| 9428 |
var ct, |
| 9429 |
type, |
| 9430 |
finalDataType, |
| 9431 |
firstDataType, |
| 9432 |
contents = s.contents, |
| 9433 |
dataTypes = s.dataTypes; |
| 9434 |
|
| 9435 |
// Remove auto dataType and get content-type in the process |
| 9436 |
while (dataTypes[0] === "*") { |
| 9437 |
dataTypes.shift(); |
| 9438 |
if (ct === undefined) { |
| 9439 |
ct = s.mimeType || jqXHR.getResponseHeader("Content-Type"); |
| 9440 |
} |
| 9441 |
} |
| 9442 |
|
| 9443 |
// Check if we're dealing with a known content-type |
| 9444 |
if (ct) { |
| 9445 |
for (type in contents) { |
| 9446 |
if (contents[type] && contents[type].test(ct)) { |
| 9447 |
dataTypes.unshift(type); |
| 9448 |
break; |
| 9449 |
} |
| 9450 |
} |
| 9451 |
} |
| 9452 |
|
| 9453 |
// Check to see if we have a response for the expected dataType |
| 9454 |
if (dataTypes[0] in responses) { |
| 9455 |
finalDataType = dataTypes[0]; |
| 9456 |
} else { |
| 9457 |
// Try convertible dataTypes |
| 9458 |
for (type in responses) { |
| 9459 |
if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) { |
| 9460 |
finalDataType = type; |
| 9461 |
break; |
| 9462 |
} |
| 9463 |
if (!firstDataType) { |
| 9464 |
firstDataType = type; |
| 9465 |
} |
| 9466 |
} |
| 9467 |
|
| 9468 |
// Or just use first one |
| 9469 |
finalDataType = finalDataType || firstDataType; |
| 9470 |
} |
| 9471 |
|
| 9472 |
// If we found a dataType |
| 9473 |
// We add the dataType to the list if needed |
| 9474 |
// and return the corresponding response |
| 9475 |
if (finalDataType) { |
| 9476 |
if (finalDataType !== dataTypes[0]) { |
| 9477 |
dataTypes.unshift(finalDataType); |
| 9478 |
} |
| 9479 |
return responses[finalDataType]; |
| 9480 |
} |
| 9481 |
} |
| 9482 |
|
| 9483 |
/* Chain conversions given the request and the original response |
| 9484 |
* Also sets the responseXXX fields on the jqXHR instance |
| 9485 |
*/ |
| 9486 |
function ajaxConvert(s, response, jqXHR, isSuccess) { |
| 9487 |
var conv2, |
| 9488 |
current, |
| 9489 |
conv, |
| 9490 |
tmp, |
| 9491 |
prev, |
| 9492 |
converters = {}, |
| 9493 |
// Work with a copy of dataTypes in case we need to modify it for conversion |
| 9494 |
dataTypes = s.dataTypes.slice(); |
| 9495 |
|
| 9496 |
// Create converters map with lowercased keys |
| 9497 |
if (dataTypes[1]) { |
| 9498 |
for (conv in s.converters) { |
| 9499 |
converters[conv.toLowerCase()] = s.converters[conv]; |
| 9500 |
} |
| 9501 |
} |
| 9502 |
|
| 9503 |
current = dataTypes.shift(); |
| 9504 |
|
| 9505 |
// Convert to each sequential dataType |
| 9506 |
while (current) { |
| 9507 |
if (s.responseFields[current]) { |
| 9508 |
jqXHR[s.responseFields[current]] = response; |
| 9509 |
} |
| 9510 |
|
| 9511 |
// Apply the dataFilter if provided |
| 9512 |
if (!prev && isSuccess && s.dataFilter) { |
| 9513 |
response = s.dataFilter(response, s.dataType); |
| 9514 |
} |
| 9515 |
|
| 9516 |
prev = current; |
| 9517 |
current = dataTypes.shift(); |
| 9518 |
|
| 9519 |
if (current) { |
| 9520 |
// There's only work to do if current dataType is non-auto |
| 9521 |
if (current === "*") { |
| 9522 |
current = prev; |
| 9523 |
|
| 9524 |
// Convert response if prev dataType is non-auto and differs from current |
| 9525 |
} else if (prev !== "*" && prev !== current) { |
| 9526 |
// Seek a direct converter |
| 9527 |
conv = converters[prev + " " + current] || converters["* " + current]; |
| 9528 |
|
| 9529 |
// If none found, seek a pair |
| 9530 |
if (!conv) { |
| 9531 |
for (conv2 in converters) { |
| 9532 |
// If conv2 outputs current |
| 9533 |
tmp = conv2.split(" "); |
| 9534 |
if (tmp[1] === current) { |
| 9535 |
// If prev can be converted to accepted input |
| 9536 |
conv = |
| 9537 |
converters[prev + " " + tmp[0]] || converters["* " + tmp[0]]; |
| 9538 |
if (conv) { |
| 9539 |
// Condense equivalence converters |
| 9540 |
if (conv === true) { |
| 9541 |
conv = converters[conv2]; |
| 9542 |
|
| 9543 |
// Otherwise, insert the intermediate dataType |
| 9544 |
} else if (converters[conv2] !== true) { |
| 9545 |
current = tmp[0]; |
| 9546 |
dataTypes.unshift(tmp[1]); |
| 9547 |
} |
| 9548 |
break; |
| 9549 |
} |
| 9550 |
} |
| 9551 |
} |
| 9552 |
} |
| 9553 |
|
| 9554 |
// Apply converter (if not an equivalence) |
| 9555 |
if (conv !== true) { |
| 9556 |
// Unless errors are allowed to bubble, catch and return them |
| 9557 |
if (conv && s.throws) { |
| 9558 |
response = conv(response); |
| 9559 |
} else { |
| 9560 |
try { |
| 9561 |
response = conv(response); |
| 9562 |
} catch (e) { |
| 9563 |
return { |
| 9564 |
state: "parsererror", |
| 9565 |
error: conv |
| 9566 |
? e |
| 9567 |
: "No conversion from " + prev + " to " + current, |
| 9568 |
}; |
| 9569 |
} |
| 9570 |
} |
| 9571 |
} |
| 9572 |
} |
| 9573 |
} |
| 9574 |
} |
| 9575 |
|
| 9576 |
return { state: "success", data: response }; |
| 9577 |
} |
| 9578 |
|
| 9579 |
jQuery.extend({ |
| 9580 |
// Counter for holding the number of active queries |
| 9581 |
active: 0, |
| 9582 |
|
| 9583 |
// Last-Modified header cache for next request |
| 9584 |
lastModified: {}, |
| 9585 |
etag: {}, |
| 9586 |
|
| 9587 |
ajaxSettings: { |
| 9588 |
url: location.href, |
| 9589 |
type: "GET", |
| 9590 |
isLocal: rlocalProtocol.test(location.protocol), |
| 9591 |
global: true, |
| 9592 |
processData: true, |
| 9593 |
async: true, |
| 9594 |
contentType: "application/x-www-form-urlencoded; charset=UTF-8", |
| 9595 |
|
| 9596 |
/* |
| 9597 |
timeout: 0, |
| 9598 |
data: null, |
| 9599 |
dataType: null, |
| 9600 |
username: null, |
| 9601 |
password: null, |
| 9602 |
cache: null, |
| 9603 |
throws: false, |
| 9604 |
traditional: false, |
| 9605 |
headers: {}, |
| 9606 |
*/ |
| 9607 |
|
| 9608 |
accepts: { |
| 9609 |
"*": allTypes, |
| 9610 |
text: "text/plain", |
| 9611 |
html: "text/html", |
| 9612 |
xml: "application/xml, text/xml", |
| 9613 |
json: "application/json, text/javascript", |
| 9614 |
}, |
| 9615 |
|
| 9616 |
contents: { |
| 9617 |
xml: /\bxml\b/, |
| 9618 |
html: /\bhtml/, |
| 9619 |
json: /\bjson\b/, |
| 9620 |
}, |
| 9621 |
|
| 9622 |
responseFields: { |
| 9623 |
xml: "responseXML", |
| 9624 |
text: "responseText", |
| 9625 |
json: "responseJSON", |
| 9626 |
}, |
| 9627 |
|
| 9628 |
// Data converters |
| 9629 |
// Keys separate source (or catchall "*") and destination types with a single space |
| 9630 |
converters: { |
| 9631 |
// Convert anything to text |
| 9632 |
"* text": String, |
| 9633 |
|
| 9634 |
// Text to html (true = no transformation) |
| 9635 |
"text html": true, |
| 9636 |
|
| 9637 |
// Evaluate text as a json expression |
| 9638 |
"text json": JSON.parse, |
| 9639 |
|
| 9640 |
// Parse text as xml |
| 9641 |
"text xml": jQuery.parseXML, |
| 9642 |
}, |
| 9643 |
|
| 9644 |
// For options that shouldn't be deep extended: |
| 9645 |
// you can add your own custom options here if |
| 9646 |
// and when you create one that shouldn't be |
| 9647 |
// deep extended (see ajaxExtend) |
| 9648 |
flatOptions: { |
| 9649 |
url: true, |
| 9650 |
context: true, |
| 9651 |
}, |
| 9652 |
}, |
| 9653 |
|
| 9654 |
// Creates a full fledged settings object into target |
| 9655 |
// with both ajaxSettings and settings fields. |
| 9656 |
// If target is omitted, writes into ajaxSettings. |
| 9657 |
ajaxSetup: function (target, settings) { |
| 9658 |
return settings |
| 9659 |
? // Building a settings object |
| 9660 |
ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) |
| 9661 |
: // Extending ajaxSettings |
| 9662 |
ajaxExtend(jQuery.ajaxSettings, target); |
| 9663 |
}, |
| 9664 |
|
| 9665 |
ajaxPrefilter: addToPrefiltersOrTransports(prefilters), |
| 9666 |
ajaxTransport: addToPrefiltersOrTransports(transports), |
| 9667 |
|
| 9668 |
// Main method |
| 9669 |
ajax: function (url, options) { |
| 9670 |
// If url is an object, simulate pre-1.5 signature |
| 9671 |
if (typeof url === "object") { |
| 9672 |
options = url; |
| 9673 |
url = undefined; |
| 9674 |
} |
| 9675 |
|
| 9676 |
// Force options to be an object |
| 9677 |
options = options || {}; |
| 9678 |
|
| 9679 |
var transport, |
| 9680 |
// URL without anti-cache param |
| 9681 |
cacheURL, |
| 9682 |
// Response headers |
| 9683 |
responseHeadersString, |
| 9684 |
responseHeaders, |
| 9685 |
// timeout handle |
| 9686 |
timeoutTimer, |
| 9687 |
// Url cleanup var |
| 9688 |
urlAnchor, |
| 9689 |
// Request state (becomes false upon send and true upon completion) |
| 9690 |
completed, |
| 9691 |
// To know if global events are to be dispatched |
| 9692 |
fireGlobals, |
| 9693 |
// Loop variable |
| 9694 |
i, |
| 9695 |
// uncached part of the url |
| 9696 |
uncached, |
| 9697 |
// Create the final options object |
| 9698 |
s = jQuery.ajaxSetup({}, options), |
| 9699 |
// Callbacks context |
| 9700 |
callbackContext = s.context || s, |
| 9701 |
// Context for global events is callbackContext if it is a DOM node or jQuery collection |
| 9702 |
globalEventContext = |
| 9703 |
s.context && (callbackContext.nodeType || callbackContext.jquery) |
| 9704 |
? jQuery(callbackContext) |
| 9705 |
: jQuery.event, |
| 9706 |
// Deferreds |
| 9707 |
deferred = jQuery.Deferred(), |
| 9708 |
completeDeferred = jQuery.Callbacks("once memory"), |
| 9709 |
// Status-dependent callbacks |
| 9710 |
statusCode = s.statusCode || {}, |
| 9711 |
// Headers (they are sent all at once) |
| 9712 |
requestHeaders = {}, |
| 9713 |
requestHeadersNames = {}, |
| 9714 |
// Default abort message |
| 9715 |
strAbort = "canceled", |
| 9716 |
// Fake xhr |
| 9717 |
jqXHR = { |
| 9718 |
readyState: 0, |
| 9719 |
|
| 9720 |
// Builds headers hashtable if needed |
| 9721 |
getResponseHeader: function (key) { |
| 9722 |
var match; |
| 9723 |
if (completed) { |
| 9724 |
if (!responseHeaders) { |
| 9725 |
responseHeaders = {}; |
| 9726 |
while ((match = rheaders.exec(responseHeadersString))) { |
| 9727 |
responseHeaders[match[1].toLowerCase() + " "] = ( |
| 9728 |
responseHeaders[match[1].toLowerCase() + " "] || [] |
| 9729 |
).concat(match[2]); |
| 9730 |
} |
| 9731 |
} |
| 9732 |
match = responseHeaders[key.toLowerCase() + " "]; |
| 9733 |
} |
| 9734 |
return match == null ? null : match.join(", "); |
| 9735 |
}, |
| 9736 |
|
| 9737 |
// Raw string |
| 9738 |
getAllResponseHeaders: function () { |
| 9739 |
return completed ? responseHeadersString : null; |
| 9740 |
}, |
| 9741 |
|
| 9742 |
// Caches the header |
| 9743 |
setRequestHeader: function (name, value) { |
| 9744 |
if (completed == null) { |
| 9745 |
name = requestHeadersNames[name.toLowerCase()] = |
| 9746 |
requestHeadersNames[name.toLowerCase()] || name; |
| 9747 |
requestHeaders[name] = value; |
| 9748 |
} |
| 9749 |
return this; |
| 9750 |
}, |
| 9751 |
|
| 9752 |
// Overrides response content-type header |
| 9753 |
overrideMimeType: function (type) { |
| 9754 |
if (completed == null) { |
| 9755 |
s.mimeType = type; |
| 9756 |
} |
| 9757 |
return this; |
| 9758 |
}, |
| 9759 |
|
| 9760 |
// Status-dependent callbacks |
| 9761 |
statusCode: function (map) { |
| 9762 |
var code; |
| 9763 |
if (map) { |
| 9764 |
if (completed) { |
| 9765 |
// Execute the appropriate callbacks |
| 9766 |
jqXHR.always(map[jqXHR.status]); |
| 9767 |
} else { |
| 9768 |
// Lazy-add the new callbacks in a way that preserves old ones |
| 9769 |
for (code in map) { |
| 9770 |
statusCode[code] = [statusCode[code], map[code]]; |
| 9771 |
} |
| 9772 |
} |
| 9773 |
} |
| 9774 |
return this; |
| 9775 |
}, |
| 9776 |
|
| 9777 |
// Cancel the request |
| 9778 |
abort: function (statusText) { |
| 9779 |
var finalText = statusText || strAbort; |
| 9780 |
if (transport) { |
| 9781 |
transport.abort(finalText); |
| 9782 |
} |
| 9783 |
done(0, finalText); |
| 9784 |
return this; |
| 9785 |
}, |
| 9786 |
}; |
| 9787 |
|
| 9788 |
// Attach deferreds |
| 9789 |
deferred.promise(jqXHR); |
| 9790 |
|
| 9791 |
// Add protocol if not provided (prefilters might expect it) |
| 9792 |
// Handle falsy url in the settings object (#10093: consistency with old signature) |
| 9793 |
// We also use the url parameter if available |
| 9794 |
s.url = ((url || s.url || location.href) + "").replace( |
| 9795 |
rprotocol, |
| 9796 |
location.protocol + "//" |
| 9797 |
); |
| 9798 |
|
| 9799 |
// Alias method option to type as per ticket #12004 |
| 9800 |
s.type = options.method || options.type || s.method || s.type; |
| 9801 |
|
| 9802 |
// Extract dataTypes list |
| 9803 |
s.dataTypes = (s.dataType || "*").toLowerCase().match(rnothtmlwhite) || [ |
| 9804 |
"", |
| 9805 |
]; |
| 9806 |
|
| 9807 |
// A cross-domain request is in order when the origin doesn't match the current origin. |
| 9808 |
if (s.crossDomain == null) { |
| 9809 |
urlAnchor = document.createElement("a"); |
| 9810 |
|
| 9811 |
// Support: IE <=8 - 11, Edge 12 - 15 |
| 9812 |
// IE throws exception on accessing the href property if url is malformed, |
| 9813 |
// e.g. http://example.com:80x/ |
| 9814 |
try { |
| 9815 |
urlAnchor.href = s.url; |
| 9816 |
|
| 9817 |
// Support: IE <=8 - 11 only |
| 9818 |
// Anchor's host property isn't correctly set when s.url is relative |
| 9819 |
urlAnchor.href = urlAnchor.href; |
| 9820 |
s.crossDomain = |
| 9821 |
originAnchor.protocol + "//" + originAnchor.host !== |
| 9822 |
urlAnchor.protocol + "//" + urlAnchor.host; |
| 9823 |
} catch (e) { |
| 9824 |
// If there is an error parsing the URL, assume it is crossDomain, |
| 9825 |
// it can be rejected by the transport if it is invalid |
| 9826 |
s.crossDomain = true; |
| 9827 |
} |
| 9828 |
} |
| 9829 |
|
| 9830 |
// Convert data if not already a string |
| 9831 |
if (s.data && s.processData && typeof s.data !== "string") { |
| 9832 |
s.data = jQuery.param(s.data, s.traditional); |
| 9833 |
} |
| 9834 |
|
| 9835 |
// Apply prefilters |
| 9836 |
inspectPrefiltersOrTransports(prefilters, s, options, jqXHR); |
| 9837 |
|
| 9838 |
// If request was aborted inside a prefilter, stop there |
| 9839 |
if (completed) { |
| 9840 |
return jqXHR; |
| 9841 |
} |
| 9842 |
|
| 9843 |
// We can fire global events as of now if asked to |
| 9844 |
// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) |
| 9845 |
fireGlobals = jQuery.event && s.global; |
| 9846 |
|
| 9847 |
// Watch for a new set of requests |
| 9848 |
if (fireGlobals && jQuery.active++ === 0) { |
| 9849 |
jQuery.event.trigger("ajaxStart"); |
| 9850 |
} |
| 9851 |
|
| 9852 |
// Uppercase the type |
| 9853 |
s.type = s.type.toUpperCase(); |
| 9854 |
|
| 9855 |
// Determine if request has content |
| 9856 |
s.hasContent = !rnoContent.test(s.type); |
| 9857 |
|
| 9858 |
// Save the URL in case we're toying with the If-Modified-Since |
| 9859 |
// and/or If-None-Match header later on |
| 9860 |
// Remove hash to simplify url manipulation |
| 9861 |
cacheURL = s.url.replace(rhash, ""); |
| 9862 |
|
| 9863 |
// More options handling for requests with no content |
| 9864 |
if (!s.hasContent) { |
| 9865 |
// Remember the hash so we can put it back |
| 9866 |
uncached = s.url.slice(cacheURL.length); |
| 9867 |
|
| 9868 |
// If data is available and should be processed, append data to url |
| 9869 |
if (s.data && (s.processData || typeof s.data === "string")) { |
| 9870 |
cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s.data; |
| 9871 |
|
| 9872 |
// #9682: remove data so that it's not used in an eventual retry |
| 9873 |
delete s.data; |
| 9874 |
} |
| 9875 |
|
| 9876 |
// Add or update anti-cache param if needed |
| 9877 |
if (s.cache === false) { |
| 9878 |
cacheURL = cacheURL.replace(rantiCache, "$1"); |
| 9879 |
uncached = |
| 9880 |
(rquery.test(cacheURL) ? "&" : "?") + |
| 9881 |
"_=" + |
| 9882 |
nonce.guid++ + |
| 9883 |
uncached; |
| 9884 |
} |
| 9885 |
|
| 9886 |
// Put hash and anti-cache on the URL that will be requested (gh-1732) |
| 9887 |
s.url = cacheURL + uncached; |
| 9888 |
|
| 9889 |
// Change '%20' to '+' if this is encoded form body content (gh-2658) |
| 9890 |
} else if ( |
| 9891 |
s.data && |
| 9892 |
s.processData && |
| 9893 |
(s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0 |
| 9894 |
) { |
| 9895 |
s.data = s.data.replace(r20, "+"); |
| 9896 |
} |
| 9897 |
|
| 9898 |
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. |
| 9899 |
if (s.ifModified) { |
| 9900 |
if (jQuery.lastModified[cacheURL]) { |
| 9901 |
jqXHR.setRequestHeader( |
| 9902 |
"If-Modified-Since", |
| 9903 |
jQuery.lastModified[cacheURL] |
| 9904 |
); |
| 9905 |
} |
| 9906 |
if (jQuery.etag[cacheURL]) { |
| 9907 |
jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]); |
| 9908 |
} |
| 9909 |
} |
| 9910 |
|
| 9911 |
// Set the correct header, if data is being sent |
| 9912 |
if ( |
| 9913 |
(s.data && s.hasContent && s.contentType !== false) || |
| 9914 |
options.contentType |
| 9915 |
) { |
| 9916 |
jqXHR.setRequestHeader("Content-Type", s.contentType); |
| 9917 |
} |
| 9918 |
|
| 9919 |
// Set the Accepts header for the server, depending on the dataType |
| 9920 |
jqXHR.setRequestHeader( |
| 9921 |
"Accept", |
| 9922 |
s.dataTypes[0] && s.accepts[s.dataTypes[0]] |
| 9923 |
? s.accepts[s.dataTypes[0]] + |
| 9924 |
(s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") |
| 9925 |
: s.accepts["*"] |
| 9926 |
); |
| 9927 |
|
| 9928 |
// Check for headers option |
| 9929 |
for (i in s.headers) { |
| 9930 |
jqXHR.setRequestHeader(i, s.headers[i]); |
| 9931 |
} |
| 9932 |
|
| 9933 |
// Allow custom headers/mimetypes and early abort |
| 9934 |
if ( |
| 9935 |
s.beforeSend && |
| 9936 |
(s.beforeSend.call(callbackContext, jqXHR, s) === false || completed) |
| 9937 |
) { |
| 9938 |
// Abort if not done already and return |
| 9939 |
return jqXHR.abort(); |
| 9940 |
} |
| 9941 |
|
| 9942 |
// Aborting is no longer a cancellation |
| 9943 |
strAbort = "abort"; |
| 9944 |
|
| 9945 |
// Install callbacks on deferreds |
| 9946 |
completeDeferred.add(s.complete); |
| 9947 |
jqXHR.done(s.success); |
| 9948 |
jqXHR.fail(s.error); |
| 9949 |
|
| 9950 |
// Get transport |
| 9951 |
transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR); |
| 9952 |
|
| 9953 |
// If no transport, we auto-abort |
| 9954 |
if (!transport) { |
| 9955 |
done(-1, "No Transport"); |
| 9956 |
} else { |
| 9957 |
jqXHR.readyState = 1; |
| 9958 |
|
| 9959 |
// Send global event |
| 9960 |
if (fireGlobals) { |
| 9961 |
globalEventContext.trigger("ajaxSend", [jqXHR, s]); |
| 9962 |
} |
| 9963 |
|
| 9964 |
// If request was aborted inside ajaxSend, stop there |
| 9965 |
if (completed) { |
| 9966 |
return jqXHR; |
| 9967 |
} |
| 9968 |
|
| 9969 |
// Timeout |
| 9970 |
if (s.async && s.timeout > 0) { |
| 9971 |
timeoutTimer = window.setTimeout(function () { |
| 9972 |
jqXHR.abort("timeout"); |
| 9973 |
}, s.timeout); |
| 9974 |
} |
| 9975 |
|
| 9976 |
try { |
| 9977 |
completed = false; |
| 9978 |
transport.send(requestHeaders, done); |
| 9979 |
} catch (e) { |
| 9980 |
// Rethrow post-completion exceptions |
| 9981 |
if (completed) { |
| 9982 |
throw e; |
| 9983 |
} |
| 9984 |
|
| 9985 |
// Propagate others as results |
| 9986 |
done(-1, e); |
| 9987 |
} |
| 9988 |
} |
| 9989 |
|
| 9990 |
// Callback for when everything is done |
| 9991 |
function done(status, nativeStatusText, responses, headers) { |
| 9992 |
var isSuccess, |
| 9993 |
success, |
| 9994 |
error, |
| 9995 |
response, |
| 9996 |
modified, |
| 9997 |
statusText = nativeStatusText; |
| 9998 |
|
| 9999 |
// Ignore repeat invocations |
| 10000 |
if (completed) { |
| 10001 |
return; |
| 10002 |
} |
| 10003 |
|
| 10004 |
completed = true; |
| 10005 |
|
| 10006 |
// Clear timeout if it exists |
| 10007 |
if (timeoutTimer) { |
| 10008 |
window.clearTimeout(timeoutTimer); |
| 10009 |
} |
| 10010 |
|
| 10011 |
// Dereference transport for early garbage collection |
| 10012 |
// (no matter how long the jqXHR object will be used) |
| 10013 |
transport = undefined; |
| 10014 |
|
| 10015 |
// Cache response headers |
| 10016 |
responseHeadersString = headers || ""; |
| 10017 |
|
| 10018 |
// Set readyState |
| 10019 |
jqXHR.readyState = status > 0 ? 4 : 0; |
| 10020 |
|
| 10021 |
// Determine if successful |
| 10022 |
isSuccess = (status >= 200 && status < 300) || status === 304; |
| 10023 |
|
| 10024 |
// Get response data |
| 10025 |
if (responses) { |
| 10026 |
response = ajaxHandleResponses(s, jqXHR, responses); |
| 10027 |
} |
| 10028 |
|
| 10029 |
// Use a noop converter for missing script but not if jsonp |
| 10030 |
if ( |
| 10031 |
!isSuccess && |
| 10032 |
jQuery.inArray("script", s.dataTypes) > -1 && |
| 10033 |
jQuery.inArray("json", s.dataTypes) < 0 |
| 10034 |
) { |
| 10035 |
s.converters["text script"] = function () {}; |
| 10036 |
} |
| 10037 |
|
| 10038 |
// Convert no matter what (that way responseXXX fields are always set) |
| 10039 |
response = ajaxConvert(s, response, jqXHR, isSuccess); |
| 10040 |
|
| 10041 |
// If successful, handle type chaining |
| 10042 |
if (isSuccess) { |
| 10043 |
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. |
| 10044 |
if (s.ifModified) { |
| 10045 |
modified = jqXHR.getResponseHeader("Last-Modified"); |
| 10046 |
if (modified) { |
| 10047 |
jQuery.lastModified[cacheURL] = modified; |
| 10048 |
} |
| 10049 |
modified = jqXHR.getResponseHeader("etag"); |
| 10050 |
if (modified) { |
| 10051 |
jQuery.etag[cacheURL] = modified; |
| 10052 |
} |
| 10053 |
} |
| 10054 |
|
| 10055 |
// if no content |
| 10056 |
if (status === 204 || s.type === "HEAD") { |
| 10057 |
statusText = "nocontent"; |
| 10058 |
|
| 10059 |
// if not modified |
| 10060 |
} else if (status === 304) { |
| 10061 |
statusText = "notmodified"; |
| 10062 |
|
| 10063 |
// If we have data, let's convert it |
| 10064 |
} else { |
| 10065 |
statusText = response.state; |
| 10066 |
success = response.data; |
| 10067 |
error = response.error; |
| 10068 |
isSuccess = !error; |
| 10069 |
} |
| 10070 |
} else { |
| 10071 |
// Extract error from statusText and normalize for non-aborts |
| 10072 |
error = statusText; |
| 10073 |
if (status || !statusText) { |
| 10074 |
statusText = "error"; |
| 10075 |
if (status < 0) { |
| 10076 |
status = 0; |
| 10077 |
} |
| 10078 |
} |
| 10079 |
} |
| 10080 |
|
| 10081 |
// Set data for the fake xhr object |
| 10082 |
jqXHR.status = status; |
| 10083 |
jqXHR.statusText = (nativeStatusText || statusText) + ""; |
| 10084 |
|
| 10085 |
// Success/Error |
| 10086 |
if (isSuccess) { |
| 10087 |
deferred.resolveWith(callbackContext, [success, statusText, jqXHR]); |
| 10088 |
} else { |
| 10089 |
deferred.rejectWith(callbackContext, [jqXHR, statusText, error]); |
| 10090 |
} |
| 10091 |
|
| 10092 |
// Status-dependent callbacks |
| 10093 |
jqXHR.statusCode(statusCode); |
| 10094 |
statusCode = undefined; |
| 10095 |
|
| 10096 |
if (fireGlobals) { |
| 10097 |
globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [ |
| 10098 |
jqXHR, |
| 10099 |
s, |
| 10100 |
isSuccess ? success : error, |
| 10101 |
]); |
| 10102 |
} |
| 10103 |
|
| 10104 |
// Complete |
| 10105 |
completeDeferred.fireWith(callbackContext, [jqXHR, statusText]); |
| 10106 |
|
| 10107 |
if (fireGlobals) { |
| 10108 |
globalEventContext.trigger("ajaxComplete", [jqXHR, s]); |
| 10109 |
|
| 10110 |
// Handle the global AJAX counter |
| 10111 |
if (!--jQuery.active) { |
| 10112 |
jQuery.event.trigger("ajaxStop"); |
| 10113 |
} |
| 10114 |
} |
| 10115 |
} |
| 10116 |
|
| 10117 |
return jqXHR; |
| 10118 |
}, |
| 10119 |
|
| 10120 |
getJSON: function (url, data, callback) { |
| 10121 |
return jQuery.get(url, data, callback, "json"); |
| 10122 |
}, |
| 10123 |
|
| 10124 |
getScript: function (url, callback) { |
| 10125 |
return jQuery.get(url, undefined, callback, "script"); |
| 10126 |
}, |
| 10127 |
}); |
| 10128 |
|
| 10129 |
jQuery.each(["get", "post"], function (_i, method) { |
| 10130 |
jQuery[method] = function (url, data, callback, type) { |
| 10131 |
// Shift arguments if data argument was omitted |
| 10132 |
if (isFunction(data)) { |
| 10133 |
type = type || callback; |
| 10134 |
callback = data; |
| 10135 |
data = undefined; |
| 10136 |
} |
| 10137 |
|
| 10138 |
// The url can be an options object (which then must have .url) |
| 10139 |
return jQuery.ajax( |
| 10140 |
jQuery.extend( |
| 10141 |
{ |
| 10142 |
url: url, |
| 10143 |
type: method, |
| 10144 |
dataType: type, |
| 10145 |
data: data, |
| 10146 |
success: callback, |
| 10147 |
}, |
| 10148 |
jQuery.isPlainObject(url) && url |
| 10149 |
) |
| 10150 |
); |
| 10151 |
}; |
| 10152 |
}); |
| 10153 |
|
| 10154 |
jQuery.ajaxPrefilter(function (s) { |
| 10155 |
var i; |
| 10156 |
for (i in s.headers) { |
| 10157 |
if (i.toLowerCase() === "content-type") { |
| 10158 |
s.contentType = s.headers[i] || ""; |
| 10159 |
} |
| 10160 |
} |
| 10161 |
}); |
| 10162 |
|
| 10163 |
jQuery._evalUrl = function (url, options, doc) { |
| 10164 |
return jQuery.ajax({ |
| 10165 |
url: url, |
| 10166 |
|
| 10167 |
// Make this explicit, since user can override this through ajaxSetup (#11264) |
| 10168 |
type: "GET", |
| 10169 |
dataType: "script", |
| 10170 |
cache: true, |
| 10171 |
async: false, |
| 10172 |
global: false, |
| 10173 |
|
| 10174 |
// Only evaluate the response if it is successful (gh-4126) |
| 10175 |
// dataFilter is not invoked for failure responses, so using it instead |
| 10176 |
// of the default converter is kludgy but it works. |
| 10177 |
converters: { |
| 10178 |
"text script": function () {}, |
| 10179 |
}, |
| 10180 |
dataFilter: function (response) { |
| 10181 |
jQuery.globalEval(response, options, doc); |
| 10182 |
}, |
| 10183 |
}); |
| 10184 |
}; |
| 10185 |
|
| 10186 |
jQuery.fn.extend({ |
| 10187 |
wrapAll: function (html) { |
| 10188 |
var wrap; |
| 10189 |
|
| 10190 |
if (this[0]) { |
| 10191 |
if (isFunction(html)) { |
| 10192 |
html = html.call(this[0]); |
| 10193 |
} |
| 10194 |
|
| 10195 |
// The elements to wrap the target around |
| 10196 |
wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true); |
| 10197 |
|
| 10198 |
if (this[0].parentNode) { |
| 10199 |
wrap.insertBefore(this[0]); |
| 10200 |
} |
| 10201 |
|
| 10202 |
wrap |
| 10203 |
.map(function () { |
| 10204 |
var elem = this; |
| 10205 |
|
| 10206 |
while (elem.firstElementChild) { |
| 10207 |
elem = elem.firstElementChild; |
| 10208 |
} |
| 10209 |
|
| 10210 |
return elem; |
| 10211 |
}) |
| 10212 |
.append(this); |
| 10213 |
} |
| 10214 |
|
| 10215 |
return this; |
| 10216 |
}, |
| 10217 |
|
| 10218 |
wrapInner: function (html) { |
| 10219 |
if (isFunction(html)) { |
| 10220 |
return this.each(function (i) { |
| 10221 |
jQuery(this).wrapInner(html.call(this, i)); |
| 10222 |
}); |
| 10223 |
} |
| 10224 |
|
| 10225 |
return this.each(function () { |
| 10226 |
var self = jQuery(this), |
| 10227 |
contents = self.contents(); |
| 10228 |
|
| 10229 |
if (contents.length) { |
| 10230 |
contents.wrapAll(html); |
| 10231 |
} else { |
| 10232 |
self.append(html); |
| 10233 |
} |
| 10234 |
}); |
| 10235 |
}, |
| 10236 |
|
| 10237 |
wrap: function (html) { |
| 10238 |
var htmlIsFunction = isFunction(html); |
| 10239 |
|
| 10240 |
return this.each(function (i) { |
| 10241 |
jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i) : html); |
| 10242 |
}); |
| 10243 |
}, |
| 10244 |
|
| 10245 |
unwrap: function (selector) { |
| 10246 |
this.parent(selector) |
| 10247 |
.not("body") |
| 10248 |
.each(function () { |
| 10249 |
jQuery(this).replaceWith(this.childNodes); |
| 10250 |
}); |
| 10251 |
return this; |
| 10252 |
}, |
| 10253 |
}); |
| 10254 |
|
| 10255 |
jQuery.expr.pseudos.hidden = function (elem) { |
| 10256 |
return !jQuery.expr.pseudos.visible(elem); |
| 10257 |
}; |
| 10258 |
jQuery.expr.pseudos.visible = function (elem) { |
| 10259 |
return !!( |
| 10260 |
elem.offsetWidth || |
| 10261 |
elem.offsetHeight || |
| 10262 |
elem.getClientRects().length |
| 10263 |
); |
| 10264 |
}; |
| 10265 |
|
| 10266 |
jQuery.ajaxSettings.xhr = function () { |
| 10267 |
try { |
| 10268 |
return new window.XMLHttpRequest(); |
| 10269 |
} catch (e) {} |
| 10270 |
}; |
| 10271 |
|
| 10272 |
var xhrSuccessStatus = { |
| 10273 |
// File protocol always yields status code 0, assume 200 |
| 10274 |
0: 200, |
| 10275 |
|
| 10276 |
// Support: IE <=9 only |
| 10277 |
// #1450: sometimes IE returns 1223 when it should be 204 |
| 10278 |
1223: 204, |
| 10279 |
}, |
| 10280 |
xhrSupported = jQuery.ajaxSettings.xhr(); |
| 10281 |
|
| 10282 |
support.cors = !!xhrSupported && "withCredentials" in xhrSupported; |
| 10283 |
support.ajax = xhrSupported = !!xhrSupported; |
| 10284 |
|
| 10285 |
jQuery.ajaxTransport(function (options) { |
| 10286 |
var callback, errorCallback; |
| 10287 |
|
| 10288 |
// Cross domain only allowed if supported through XMLHttpRequest |
| 10289 |
if (support.cors || (xhrSupported && !options.crossDomain)) { |
| 10290 |
return { |
| 10291 |
send: function (headers, complete) { |
| 10292 |
var i, |
| 10293 |
xhr = options.xhr(); |
| 10294 |
|
| 10295 |
xhr.open( |
| 10296 |
options.type, |
| 10297 |
options.url, |
| 10298 |
options.async, |
| 10299 |
options.username, |
| 10300 |
options.password |
| 10301 |
); |
| 10302 |
|
| 10303 |
// Apply custom fields if provided |
| 10304 |
if (options.xhrFields) { |
| 10305 |
for (i in options.xhrFields) { |
| 10306 |
xhr[i] = options.xhrFields[i]; |
| 10307 |
} |
| 10308 |
} |
| 10309 |
|
| 10310 |
// Override mime type if needed |
| 10311 |
if (options.mimeType && xhr.overrideMimeType) { |
| 10312 |
xhr.overrideMimeType(options.mimeType); |
| 10313 |
} |
| 10314 |
|
| 10315 |
// X-Requested-With header |
| 10316 |
// For cross-domain requests, seeing as conditions for a preflight are |
| 10317 |
// akin to a jigsaw puzzle, we simply never set it to be sure. |
| 10318 |
// (it can always be set on a per-request basis or even using ajaxSetup) |
| 10319 |
// For same-domain requests, won't change header if already provided. |
| 10320 |
if (!options.crossDomain && !headers["X-Requested-With"]) { |
| 10321 |
headers["X-Requested-With"] = "XMLHttpRequest"; |
| 10322 |
} |
| 10323 |
|
| 10324 |
// Set headers |
| 10325 |
for (i in headers) { |
| 10326 |
xhr.setRequestHeader(i, headers[i]); |
| 10327 |
} |
| 10328 |
|
| 10329 |
// Callback |
| 10330 |
callback = function (type) { |
| 10331 |
return function () { |
| 10332 |
if (callback) { |
| 10333 |
callback = |
| 10334 |
errorCallback = |
| 10335 |
xhr.onload = |
| 10336 |
xhr.onerror = |
| 10337 |
xhr.onabort = |
| 10338 |
xhr.ontimeout = |
| 10339 |
xhr.onreadystatechange = |
| 10340 |
null; |
| 10341 |
|
| 10342 |
if (type === "abort") { |
| 10343 |
xhr.abort(); |
| 10344 |
} else if (type === "error") { |
| 10345 |
// Support: IE <=9 only |
| 10346 |
// On a manual native abort, IE9 throws |
| 10347 |
// errors on any property access that is not readyState |
| 10348 |
if (typeof xhr.status !== "number") { |
| 10349 |
complete(0, "error"); |
| 10350 |
} else { |
| 10351 |
complete( |
| 10352 |
// File: protocol always yields status 0; see #8605, #14207 |
| 10353 |
xhr.status, |
| 10354 |
xhr.statusText |
| 10355 |
); |
| 10356 |
} |
| 10357 |
} else { |
| 10358 |
complete( |
| 10359 |
xhrSuccessStatus[xhr.status] || xhr.status, |
| 10360 |
xhr.statusText, |
| 10361 |
|
| 10362 |
// Support: IE <=9 only |
| 10363 |
// IE9 has no XHR2 but throws on binary (trac-11426) |
| 10364 |
// For XHR2 non-text, let the caller handle it (gh-2498) |
| 10365 |
(xhr.responseType || "text") !== "text" || |
| 10366 |
typeof xhr.responseText !== "string" |
| 10367 |
? { binary: xhr.response } |
| 10368 |
: { text: xhr.responseText }, |
| 10369 |
xhr.getAllResponseHeaders() |
| 10370 |
); |
| 10371 |
} |
| 10372 |
} |
| 10373 |
}; |
| 10374 |
}; |
| 10375 |
|
| 10376 |
// Listen to events |
| 10377 |
xhr.onload = callback(); |
| 10378 |
errorCallback = xhr.onerror = xhr.ontimeout = callback("error"); |
| 10379 |
|
| 10380 |
// Support: IE 9 only |
| 10381 |
// Use onreadystatechange to replace onabort |
| 10382 |
// to handle uncaught aborts |
| 10383 |
if (xhr.onabort !== undefined) { |
| 10384 |
xhr.onabort = errorCallback; |
| 10385 |
} else { |
| 10386 |
xhr.onreadystatechange = function () { |
| 10387 |
// Check readyState before timeout as it changes |
| 10388 |
if (xhr.readyState === 4) { |
| 10389 |
// Allow onerror to be called first, |
| 10390 |
// but that will not handle a native abort |
| 10391 |
// Also, save errorCallback to a variable |
| 10392 |
// as xhr.onerror cannot be accessed |
| 10393 |
window.setTimeout(function () { |
| 10394 |
if (callback) { |
| 10395 |
errorCallback(); |
| 10396 |
} |
| 10397 |
}); |
| 10398 |
} |
| 10399 |
}; |
| 10400 |
} |
| 10401 |
|
| 10402 |
// Create the abort callback |
| 10403 |
callback = callback("abort"); |
| 10404 |
|
| 10405 |
try { |
| 10406 |
// Do send the request (this may raise an exception) |
| 10407 |
xhr.send((options.hasContent && options.data) || null); |
| 10408 |
} catch (e) { |
| 10409 |
// #14683: Only rethrow if this hasn't been notified as an error yet |
| 10410 |
if (callback) { |
| 10411 |
throw e; |
| 10412 |
} |
| 10413 |
} |
| 10414 |
}, |
| 10415 |
|
| 10416 |
abort: function () { |
| 10417 |
if (callback) { |
| 10418 |
callback(); |
| 10419 |
} |
| 10420 |
}, |
| 10421 |
}; |
| 10422 |
} |
| 10423 |
}); |
| 10424 |
|
| 10425 |
// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) |
| 10426 |
jQuery.ajaxPrefilter(function (s) { |
| 10427 |
if (s.crossDomain) { |
| 10428 |
s.contents.script = false; |
| 10429 |
} |
| 10430 |
}); |
| 10431 |
|
| 10432 |
// Install script dataType |
| 10433 |
jQuery.ajaxSetup({ |
| 10434 |
accepts: { |
| 10435 |
script: |
| 10436 |
"text/javascript, application/javascript, " + |
| 10437 |
"application/ecmascript, application/x-ecmascript", |
| 10438 |
}, |
| 10439 |
contents: { |
| 10440 |
script: /\b(?:java|ecma)script\b/, |
| 10441 |
}, |
| 10442 |
converters: { |
| 10443 |
"text script": function (text) { |
| 10444 |
jQuery.globalEval(text); |
| 10445 |
return text; |
| 10446 |
}, |
| 10447 |
}, |
| 10448 |
}); |
| 10449 |
|
| 10450 |
// Handle cache's special case and crossDomain |
| 10451 |
jQuery.ajaxPrefilter("script", function (s) { |
| 10452 |
if (s.cache === undefined) { |
| 10453 |
s.cache = false; |
| 10454 |
} |
| 10455 |
if (s.crossDomain) { |
| 10456 |
s.type = "GET"; |
| 10457 |
} |
| 10458 |
}); |
| 10459 |
|
| 10460 |
// Bind script tag hack transport |
| 10461 |
jQuery.ajaxTransport("script", function (s) { |
| 10462 |
// This transport only deals with cross domain or forced-by-attrs requests |
| 10463 |
if (s.crossDomain || s.scriptAttrs) { |
| 10464 |
var script, callback; |
| 10465 |
return { |
| 10466 |
send: function (_, complete) { |
| 10467 |
script = jQuery("<script>") |
| 10468 |
.attr(s.scriptAttrs || {}) |
| 10469 |
.prop({ charset: s.scriptCharset, src: s.url }) |
| 10470 |
.on( |
| 10471 |
"load error", |
| 10472 |
(callback = function (evt) { |
| 10473 |
script.remove(); |
| 10474 |
callback = null; |
| 10475 |
if (evt) { |
| 10476 |
complete(evt.type === "error" ? 404 : 200, evt.type); |
| 10477 |
} |
| 10478 |
}) |
| 10479 |
); |
| 10480 |
|
| 10481 |
// Use native DOM manipulation to avoid our domManip AJAX trickery |
| 10482 |
document.head.appendChild(script[0]); |
| 10483 |
}, |
| 10484 |
abort: function () { |
| 10485 |
if (callback) { |
| 10486 |
callback(); |
| 10487 |
} |
| 10488 |
}, |
| 10489 |
}; |
| 10490 |
} |
| 10491 |
}); |
| 10492 |
|
| 10493 |
var oldCallbacks = [], |
| 10494 |
rjsonp = /(=)\?(?=&|$)|\?\?/; |
| 10495 |
|
| 10496 |
// Default jsonp settings |
| 10497 |
jQuery.ajaxSetup({ |
| 10498 |
jsonp: "callback", |
| 10499 |
jsonpCallback: function () { |
| 10500 |
var callback = oldCallbacks.pop() || jQuery.expando + "_" + nonce.guid++; |
| 10501 |
this[callback] = true; |
| 10502 |
return callback; |
| 10503 |
}, |
| 10504 |
}); |
| 10505 |
|
| 10506 |
// Detect, normalize options and install callbacks for jsonp requests |
| 10507 |
jQuery.ajaxPrefilter("json jsonp", function (s, originalSettings, jqXHR) { |
| 10508 |
var callbackName, |
| 10509 |
overwritten, |
| 10510 |
responseContainer, |
| 10511 |
jsonProp = |
| 10512 |
s.jsonp !== false && |
| 10513 |
(rjsonp.test(s.url) |
| 10514 |
? "url" |
| 10515 |
: typeof s.data === "string" && |
| 10516 |
(s.contentType || "").indexOf( |
| 10517 |
"application/x-www-form-urlencoded" |
| 10518 |
) === 0 && |
| 10519 |
rjsonp.test(s.data) && |
| 10520 |
"data"); |
| 10521 |
|
| 10522 |
// Handle iff the expected data type is "jsonp" or we have a parameter to set |
| 10523 |
if (jsonProp || s.dataTypes[0] === "jsonp") { |
| 10524 |
// Get callback name, remembering preexisting value associated with it |
| 10525 |
callbackName = s.jsonpCallback = isFunction(s.jsonpCallback) |
| 10526 |
? s.jsonpCallback() |
| 10527 |
: s.jsonpCallback; |
| 10528 |
|
| 10529 |
// Insert callback into url or form data |
| 10530 |
if (jsonProp) { |
| 10531 |
s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName); |
| 10532 |
} else if (s.jsonp !== false) { |
| 10533 |
s.url += |
| 10534 |
(rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName; |
| 10535 |
} |
| 10536 |
|
| 10537 |
// Use data converter to retrieve json after script execution |
| 10538 |
s.converters["script json"] = function () { |
| 10539 |
if (!responseContainer) { |
| 10540 |
jQuery.error(callbackName + " was not called"); |
| 10541 |
} |
| 10542 |
return responseContainer[0]; |
| 10543 |
}; |
| 10544 |
|
| 10545 |
// Force json dataType |
| 10546 |
s.dataTypes[0] = "json"; |
| 10547 |
|
| 10548 |
// Install callback |
| 10549 |
overwritten = window[callbackName]; |
| 10550 |
window[callbackName] = function () { |
| 10551 |
responseContainer = arguments; |
| 10552 |
}; |
| 10553 |
|
| 10554 |
// Clean-up function (fires after converters) |
| 10555 |
jqXHR.always(function () { |
| 10556 |
// If previous value didn't exist - remove it |
| 10557 |
if (overwritten === undefined) { |
| 10558 |
jQuery(window).removeProp(callbackName); |
| 10559 |
|
| 10560 |
// Otherwise restore preexisting value |
| 10561 |
} else { |
| 10562 |
window[callbackName] = overwritten; |
| 10563 |
} |
| 10564 |
|
| 10565 |
// Save back as free |
| 10566 |
if (s[callbackName]) { |
| 10567 |
// Make sure that re-using the options doesn't screw things around |
| 10568 |
s.jsonpCallback = originalSettings.jsonpCallback; |
| 10569 |
|
| 10570 |
// Save the callback name for future use |
| 10571 |
oldCallbacks.push(callbackName); |
| 10572 |
} |
| 10573 |
|
| 10574 |
// Call if it was a function and we have a response |
| 10575 |
if (responseContainer && isFunction(overwritten)) { |
| 10576 |
overwritten(responseContainer[0]); |
| 10577 |
} |
| 10578 |
|
| 10579 |
responseContainer = overwritten = undefined; |
| 10580 |
}); |
| 10581 |
|
| 10582 |
// Delegate to script |
| 10583 |
return "script"; |
| 10584 |
} |
| 10585 |
}); |
| 10586 |
|
| 10587 |
// Support: Safari 8 only |
| 10588 |
// In Safari 8 documents created via document.implementation.createHTMLDocument |
| 10589 |
// collapse sibling forms: the second one becomes a child of the first one. |
| 10590 |
// Because of that, this security measure has to be disabled in Safari 8. |
| 10591 |
// https://bugs.webkit.org/show_bug.cgi?id=137337 |
| 10592 |
support.createHTMLDocument = (function () { |
| 10593 |
var body = document.implementation.createHTMLDocument("").body; |
| 10594 |
body.innerHTML = "<form></form><form></form>"; |
| 10595 |
return body.childNodes.length === 2; |
| 10596 |
})(); |
| 10597 |
|
| 10598 |
// Argument "data" should be string of html |
| 10599 |
// context (optional): If specified, the fragment will be created in this context, |
| 10600 |
// defaults to document |
| 10601 |
// keepScripts (optional): If true, will include scripts passed in the html string |
| 10602 |
jQuery.parseHTML = function (data, context, keepScripts) { |
| 10603 |
if (typeof data !== "string") { |
| 10604 |
return []; |
| 10605 |
} |
| 10606 |
if (typeof context === "boolean") { |
| 10607 |
keepScripts = context; |
| 10608 |
context = false; |
| 10609 |
} |
| 10610 |
|
| 10611 |
var base, parsed, scripts; |
| 10612 |
|
| 10613 |
if (!context) { |
| 10614 |
// Stop scripts or inline event handlers from being executed immediately |
| 10615 |
// by using document.implementation |
| 10616 |
if (support.createHTMLDocument) { |
| 10617 |
context = document.implementation.createHTMLDocument(""); |
| 10618 |
|
| 10619 |
// Set the base href for the created document |
| 10620 |
// so any parsed elements with URLs |
| 10621 |
// are based on the document's URL (gh-2965) |
| 10622 |
base = context.createElement("base"); |
| 10623 |
base.href = document.location.href; |
| 10624 |
context.head.appendChild(base); |
| 10625 |
} else { |
| 10626 |
context = document; |
| 10627 |
} |
| 10628 |
} |
| 10629 |
|
| 10630 |
parsed = rsingleTag.exec(data); |
| 10631 |
scripts = !keepScripts && []; |
| 10632 |
|
| 10633 |
// Single tag |
| 10634 |
if (parsed) { |
| 10635 |
return [context.createElement(parsed[1])]; |
| 10636 |
} |
| 10637 |
|
| 10638 |
parsed = buildFragment([data], context, scripts); |
| 10639 |
|
| 10640 |
if (scripts && scripts.length) { |
| 10641 |
jQuery(scripts).remove(); |
| 10642 |
} |
| 10643 |
|
| 10644 |
return jQuery.merge([], parsed.childNodes); |
| 10645 |
}; |
| 10646 |
|
| 10647 |
/** |
| 10648 |
* Load a url into a page |
| 10649 |
*/ |
| 10650 |
jQuery.fn.load = function (url, params, callback) { |
| 10651 |
var selector, |
| 10652 |
type, |
| 10653 |
response, |
| 10654 |
self = this, |
| 10655 |
off = url.indexOf(" "); |
| 10656 |
|
| 10657 |
if (off > -1) { |
| 10658 |
selector = stripAndCollapse(url.slice(off)); |
| 10659 |
url = url.slice(0, off); |
| 10660 |
} |
| 10661 |
|
| 10662 |
// If it's a function |
| 10663 |
if (isFunction(params)) { |
| 10664 |
// We assume that it's the callback |
| 10665 |
callback = params; |
| 10666 |
params = undefined; |
| 10667 |
|
| 10668 |
// Otherwise, build a param string |
| 10669 |
} else if (params && typeof params === "object") { |
| 10670 |
type = "POST"; |
| 10671 |
} |
| 10672 |
|
| 10673 |
// If we have elements to modify, make the request |
| 10674 |
if (self.length > 0) { |
| 10675 |
jQuery |
| 10676 |
.ajax({ |
| 10677 |
url: url, |
| 10678 |
|
| 10679 |
// If "type" variable is undefined, then "GET" method will be used. |
| 10680 |
// Make value of this field explicit since |
| 10681 |
// user can override it through ajaxSetup method |
| 10682 |
type: type || "GET", |
| 10683 |
dataType: "html", |
| 10684 |
data: params, |
| 10685 |
}) |
| 10686 |
.done(function (responseText) { |
| 10687 |
// Save response for use in complete callback |
| 10688 |
response = arguments; |
| 10689 |
|
| 10690 |
self.html( |
| 10691 |
selector |
| 10692 |
? // If a selector was specified, locate the right elements in a dummy div |
| 10693 |
// Exclude scripts to avoid IE 'Permission Denied' errors |
| 10694 |
jQuery("<div>") |
| 10695 |
.append(jQuery.parseHTML(responseText)) |
| 10696 |
.find(selector) |
| 10697 |
: // Otherwise use the full result |
| 10698 |
responseText |
| 10699 |
); |
| 10700 |
|
| 10701 |
// If the request succeeds, this function gets "data", "status", "jqXHR" |
| 10702 |
// but they are ignored because response was set above. |
| 10703 |
// If it fails, this function gets "jqXHR", "status", "error" |
| 10704 |
}) |
| 10705 |
.always( |
| 10706 |
callback && |
| 10707 |
function (jqXHR, status) { |
| 10708 |
self.each(function () { |
| 10709 |
callback.apply( |
| 10710 |
this, |
| 10711 |
response || [jqXHR.responseText, status, jqXHR] |
| 10712 |
); |
| 10713 |
}); |
| 10714 |
} |
| 10715 |
); |
| 10716 |
} |
| 10717 |
|
| 10718 |
return this; |
| 10719 |
}; |
| 10720 |
|
| 10721 |
jQuery.expr.pseudos.animated = function (elem) { |
| 10722 |
return jQuery.grep(jQuery.timers, function (fn) { |
| 10723 |
return elem === fn.elem; |
| 10724 |
}).length; |
| 10725 |
}; |
| 10726 |
|
| 10727 |
jQuery.offset = { |
| 10728 |
setOffset: function (elem, options, i) { |
| 10729 |
var curPosition, |
| 10730 |
curLeft, |
| 10731 |
curCSSTop, |
| 10732 |
curTop, |
| 10733 |
curOffset, |
| 10734 |
curCSSLeft, |
| 10735 |
calculatePosition, |
| 10736 |
position = jQuery.css(elem, "position"), |
| 10737 |
curElem = jQuery(elem), |
| 10738 |
props = {}; |
| 10739 |
|
| 10740 |
// Set position first, in-case top/left are set even on static elem |
| 10741 |
if (position === "static") { |
| 10742 |
elem.style.position = "relative"; |
| 10743 |
} |
| 10744 |
|
| 10745 |
curOffset = curElem.offset(); |
| 10746 |
curCSSTop = jQuery.css(elem, "top"); |
| 10747 |
curCSSLeft = jQuery.css(elem, "left"); |
| 10748 |
calculatePosition = |
| 10749 |
(position === "absolute" || position === "fixed") && |
| 10750 |
(curCSSTop + curCSSLeft).indexOf("auto") > -1; |
| 10751 |
|
| 10752 |
// Need to be able to calculate position if either |
| 10753 |
// top or left is auto and position is either absolute or fixed |
| 10754 |
if (calculatePosition) { |
| 10755 |
curPosition = curElem.position(); |
| 10756 |
curTop = curPosition.top; |
| 10757 |
curLeft = curPosition.left; |
| 10758 |
} else { |
| 10759 |
curTop = parseFloat(curCSSTop) || 0; |
| 10760 |
curLeft = parseFloat(curCSSLeft) || 0; |
| 10761 |
} |
| 10762 |
|
| 10763 |
if (isFunction(options)) { |
| 10764 |
// Use jQuery.extend here to allow modification of coordinates argument (gh-1848) |
| 10765 |
options = options.call(elem, i, jQuery.extend({}, curOffset)); |
| 10766 |
} |
| 10767 |
|
| 10768 |
if (options.top != null) { |
| 10769 |
props.top = options.top - curOffset.top + curTop; |
| 10770 |
} |
| 10771 |
if (options.left != null) { |
| 10772 |
props.left = options.left - curOffset.left + curLeft; |
| 10773 |
} |
| 10774 |
|
| 10775 |
if ("using" in options) { |
| 10776 |
options.using.call(elem, props); |
| 10777 |
} else { |
| 10778 |
curElem.css(props); |
| 10779 |
} |
| 10780 |
}, |
| 10781 |
}; |
| 10782 |
|
| 10783 |
jQuery.fn.extend({ |
| 10784 |
// offset() relates an element's border box to the document origin |
| 10785 |
offset: function (options) { |
| 10786 |
// Preserve chaining for setter |
| 10787 |
if (arguments.length) { |
| 10788 |
return options === undefined |
| 10789 |
? this |
| 10790 |
: this.each(function (i) { |
| 10791 |
jQuery.offset.setOffset(this, options, i); |
| 10792 |
}); |
| 10793 |
} |
| 10794 |
|
| 10795 |
var rect, |
| 10796 |
win, |
| 10797 |
elem = this[0]; |
| 10798 |
|
| 10799 |
if (!elem) { |
| 10800 |
return; |
| 10801 |
} |
| 10802 |
|
| 10803 |
// Return zeros for disconnected and hidden (display: none) elements (gh-2310) |
| 10804 |
// Support: IE <=11 only |
| 10805 |
// Running getBoundingClientRect on a |
| 10806 |
// disconnected node in IE throws an error |
| 10807 |
if (!elem.getClientRects().length) { |
| 10808 |
return { top: 0, left: 0 }; |
| 10809 |
} |
| 10810 |
|
| 10811 |
// Get document-relative position by adding viewport scroll to viewport-relative gBCR |
| 10812 |
rect = elem.getBoundingClientRect(); |
| 10813 |
win = elem.ownerDocument.defaultView; |
| 10814 |
return { |
| 10815 |
top: rect.top + win.pageYOffset, |
| 10816 |
left: rect.left + win.pageXOffset, |
| 10817 |
}; |
| 10818 |
}, |
| 10819 |
|
| 10820 |
// position() relates an element's margin box to its offset parent's padding box |
| 10821 |
// This corresponds to the behavior of CSS absolute positioning |
| 10822 |
position: function () { |
| 10823 |
if (!this[0]) { |
| 10824 |
return; |
| 10825 |
} |
| 10826 |
|
| 10827 |
var offsetParent, |
| 10828 |
offset, |
| 10829 |
doc, |
| 10830 |
elem = this[0], |
| 10831 |
parentOffset = { top: 0, left: 0 }; |
| 10832 |
|
| 10833 |
// position:fixed elements are offset from the viewport, which itself always has zero offset |
| 10834 |
if (jQuery.css(elem, "position") === "fixed") { |
| 10835 |
// Assume position:fixed implies availability of getBoundingClientRect |
| 10836 |
offset = elem.getBoundingClientRect(); |
| 10837 |
} else { |
| 10838 |
offset = this.offset(); |
| 10839 |
|
| 10840 |
// Account for the *real* offset parent, which can be the document or its root element |
| 10841 |
// when a statically positioned element is identified |
| 10842 |
doc = elem.ownerDocument; |
| 10843 |
offsetParent = elem.offsetParent || doc.documentElement; |
| 10844 |
while ( |
| 10845 |
offsetParent && |
| 10846 |
(offsetParent === doc.body || offsetParent === doc.documentElement) && |
| 10847 |
jQuery.css(offsetParent, "position") === "static" |
| 10848 |
) { |
| 10849 |
offsetParent = offsetParent.parentNode; |
| 10850 |
} |
| 10851 |
if ( |
| 10852 |
offsetParent && |
| 10853 |
offsetParent !== elem && |
| 10854 |
offsetParent.nodeType === 1 |
| 10855 |
) { |
| 10856 |
// Incorporate borders into its offset, since they are outside its content origin |
| 10857 |
parentOffset = jQuery(offsetParent).offset(); |
| 10858 |
parentOffset.top += jQuery.css(offsetParent, "borderTopWidth", true); |
| 10859 |
parentOffset.left += jQuery.css( |
| 10860 |
offsetParent, |
| 10861 |
"borderLeftWidth", |
| 10862 |
true |
| 10863 |
); |
| 10864 |
} |
| 10865 |
} |
| 10866 |
|
| 10867 |
// Subtract parent offsets and element margins |
| 10868 |
return { |
| 10869 |
top: |
| 10870 |
offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true), |
| 10871 |
left: |
| 10872 |
offset.left - |
| 10873 |
parentOffset.left - |
| 10874 |
jQuery.css(elem, "marginLeft", true), |
| 10875 |
}; |
| 10876 |
}, |
| 10877 |
|
| 10878 |
// This method will return documentElement in the following cases: |
| 10879 |
// 1) For the element inside the iframe without offsetParent, this method will return |
| 10880 |
// documentElement of the parent window |
| 10881 |
// 2) For the hidden or detached element |
| 10882 |
// 3) For body or html element, i.e. in case of the html node - it will return itself |
| 10883 |
// |
| 10884 |
// but those exceptions were never presented as a real life use-cases |
| 10885 |
// and might be considered as more preferable results. |
| 10886 |
// |
| 10887 |
// This logic, however, is not guaranteed and can change at any point in the future |
| 10888 |
offsetParent: function () { |
| 10889 |
return this.map(function () { |
| 10890 |
var offsetParent = this.offsetParent; |
| 10891 |
|
| 10892 |
while ( |
| 10893 |
offsetParent && |
| 10894 |
jQuery.css(offsetParent, "position") === "static" |
| 10895 |
) { |
| 10896 |
offsetParent = offsetParent.offsetParent; |
| 10897 |
} |
| 10898 |
|
| 10899 |
return offsetParent || documentElement; |
| 10900 |
}); |
| 10901 |
}, |
| 10902 |
}); |
| 10903 |
|
| 10904 |
// Create scrollLeft and scrollTop methods |
| 10905 |
jQuery.each( |
| 10906 |
{ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, |
| 10907 |
function (method, prop) { |
| 10908 |
var top = "pageYOffset" === prop; |
| 10909 |
|
| 10910 |
jQuery.fn[method] = function (val) { |
| 10911 |
return access( |
| 10912 |
this, |
| 10913 |
function (elem, method, val) { |
| 10914 |
// Coalesce documents and windows |
| 10915 |
var win; |
| 10916 |
if (isWindow(elem)) { |
| 10917 |
win = elem; |
| 10918 |
} else if (elem.nodeType === 9) { |
| 10919 |
win = elem.defaultView; |
| 10920 |
} |
| 10921 |
|
| 10922 |
if (val === undefined) { |
| 10923 |
return win ? win[prop] : elem[method]; |
| 10924 |
} |
| 10925 |
|
| 10926 |
if (win) { |
| 10927 |
win.scrollTo( |
| 10928 |
!top ? val : win.pageXOffset, |
| 10929 |
top ? val : win.pageYOffset |
| 10930 |
); |
| 10931 |
} else { |
| 10932 |
elem[method] = val; |
| 10933 |
} |
| 10934 |
}, |
| 10935 |
method, |
| 10936 |
val, |
| 10937 |
arguments.length |
| 10938 |
); |
| 10939 |
}; |
| 10940 |
} |
| 10941 |
); |
| 10942 |
|
| 10943 |
// Support: Safari <=7 - 9.1, Chrome <=37 - 49 |
| 10944 |
// Add the top/left cssHooks using jQuery.fn.position |
| 10945 |
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 |
| 10946 |
// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 |
| 10947 |
// getComputedStyle returns percent when specified for top/left/bottom/right; |
| 10948 |
// rather than make the css module depend on the offset module, just check for it here |
| 10949 |
jQuery.each(["top", "left"], function (_i, prop) { |
| 10950 |
jQuery.cssHooks[prop] = addGetHookIf( |
| 10951 |
support.pixelPosition, |
| 10952 |
function (elem, computed) { |
| 10953 |
if (computed) { |
| 10954 |
computed = curCSS(elem, prop); |
| 10955 |
|
| 10956 |
// If curCSS returns percentage, fallback to offset |
| 10957 |
return rnumnonpx.test(computed) |
| 10958 |
? jQuery(elem).position()[prop] + "px" |
| 10959 |
: computed; |
| 10960 |
} |
| 10961 |
} |
| 10962 |
); |
| 10963 |
}); |
| 10964 |
|
| 10965 |
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods |
| 10966 |
jQuery.each({ Height: "height", Width: "width" }, function (name, type) { |
| 10967 |
jQuery.each( |
| 10968 |
{ |
| 10969 |
padding: "inner" + name, |
| 10970 |
content: type, |
| 10971 |
"": "outer" + name, |
| 10972 |
}, |
| 10973 |
function (defaultExtra, funcName) { |
| 10974 |
// Margin is only for outerHeight, outerWidth |
| 10975 |
jQuery.fn[funcName] = function (margin, value) { |
| 10976 |
var chainable = |
| 10977 |
arguments.length && (defaultExtra || typeof margin !== "boolean"), |
| 10978 |
extra = |
| 10979 |
defaultExtra || |
| 10980 |
(margin === true || value === true ? "margin" : "border"); |
| 10981 |
|
| 10982 |
return access( |
| 10983 |
this, |
| 10984 |
function (elem, type, value) { |
| 10985 |
var doc; |
| 10986 |
|
| 10987 |
if (isWindow(elem)) { |
| 10988 |
// $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) |
| 10989 |
return funcName.indexOf("outer") === 0 |
| 10990 |
? elem["inner" + name] |
| 10991 |
: elem.document.documentElement["client" + name]; |
| 10992 |
} |
| 10993 |
|
| 10994 |
// Get document width or height |
| 10995 |
if (elem.nodeType === 9) { |
| 10996 |
doc = elem.documentElement; |
| 10997 |
|
| 10998 |
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], |
| 10999 |
// whichever is greatest |
| 11000 |
return Math.max( |
| 11001 |
elem.body["scroll" + name], |
| 11002 |
doc["scroll" + name], |
| 11003 |
elem.body["offset" + name], |
| 11004 |
doc["offset" + name], |
| 11005 |
doc["client" + name] |
| 11006 |
); |
| 11007 |
} |
| 11008 |
|
| 11009 |
return value === undefined |
| 11010 |
? // Get width or height on the element, requesting but not forcing parseFloat |
| 11011 |
jQuery.css(elem, type, extra) |
| 11012 |
: // Set width or height on the element |
| 11013 |
jQuery.style(elem, type, value, extra); |
| 11014 |
}, |
| 11015 |
type, |
| 11016 |
chainable ? margin : undefined, |
| 11017 |
chainable |
| 11018 |
); |
| 11019 |
}; |
| 11020 |
} |
| 11021 |
); |
| 11022 |
}); |
| 11023 |
|
| 11024 |
jQuery.each( |
| 11025 |
[ |
| 11026 |
"ajaxStart", |
| 11027 |
"ajaxStop", |
| 11028 |
"ajaxComplete", |
| 11029 |
"ajaxError", |
| 11030 |
"ajaxSuccess", |
| 11031 |
"ajaxSend", |
| 11032 |
], |
| 11033 |
function (_i, type) { |
| 11034 |
jQuery.fn[type] = function (fn) { |
| 11035 |
return this.on(type, fn); |
| 11036 |
}; |
| 11037 |
} |
| 11038 |
); |
| 11039 |
|
| 11040 |
jQuery.fn.extend({ |
| 11041 |
bind: function (types, data, fn) { |
| 11042 |
return this.on(types, null, data, fn); |
| 11043 |
}, |
| 11044 |
unbind: function (types, fn) { |
| 11045 |
return this.off(types, null, fn); |
| 11046 |
}, |
| 11047 |
|
| 11048 |
delegate: function (selector, types, data, fn) { |
| 11049 |
return this.on(types, selector, data, fn); |
| 11050 |
}, |
| 11051 |
undelegate: function (selector, types, fn) { |
| 11052 |
// ( namespace ) or ( selector, types [, fn] ) |
| 11053 |
return arguments.length === 1 |
| 11054 |
? this.off(selector, "**") |
| 11055 |
: this.off(types, selector || "**", fn); |
| 11056 |
}, |
| 11057 |
|
| 11058 |
hover: function (fnOver, fnOut) { |
| 11059 |
return this.mouseenter(fnOver).mouseleave(fnOut || fnOver); |
| 11060 |
}, |
| 11061 |
}); |
| 11062 |
|
| 11063 |
jQuery.each( |
| 11064 |
( |
| 11065 |
"blur focus focusin focusout resize scroll click dblclick " + |
| 11066 |
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + |
| 11067 |
"change select submit keydown keypress keyup contextmenu" |
| 11068 |
).split(" "), |
| 11069 |
function (_i, name) { |
| 11070 |
// Handle event binding |
| 11071 |
jQuery.fn[name] = function (data, fn) { |
| 11072 |
return arguments.length > 0 |
| 11073 |
? this.on(name, null, data, fn) |
| 11074 |
: this.trigger(name); |
| 11075 |
}; |
| 11076 |
} |
| 11077 |
); |
| 11078 |
|
| 11079 |
// Support: Android <=4.0 only |
| 11080 |
// Make sure we trim BOM and NBSP |
| 11081 |
var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; |
| 11082 |
|
| 11083 |
// Bind a function to a context, optionally partially applying any |
| 11084 |
// arguments. |
| 11085 |
// jQuery.proxy is deprecated to promote standards (specifically Function#bind) |
| 11086 |
// However, it is not slated for removal any time soon |
| 11087 |
jQuery.proxy = function (fn, context) { |
| 11088 |
var tmp, args, proxy; |
| 11089 |
|
| 11090 |
if (typeof context === "string") { |
| 11091 |
tmp = fn[context]; |
| 11092 |
context = fn; |
| 11093 |
fn = tmp; |
| 11094 |
} |
| 11095 |
|
| 11096 |
// Quick check to determine if target is callable, in the spec |
| 11097 |
// this throws a TypeError, but we will just return undefined. |
| 11098 |
if (!isFunction(fn)) { |
| 11099 |
return undefined; |
| 11100 |
} |
| 11101 |
|
| 11102 |
// Simulated bind |
| 11103 |
args = slice.call(arguments, 2); |
| 11104 |
proxy = function () { |
| 11105 |
return fn.apply(context || this, args.concat(slice.call(arguments))); |
| 11106 |
}; |
| 11107 |
|
| 11108 |
// Set the guid of unique handler to the same of original handler, so it can be removed |
| 11109 |
proxy.guid = fn.guid = fn.guid || jQuery.guid++; |
| 11110 |
|
| 11111 |
return proxy; |
| 11112 |
}; |
| 11113 |
|
| 11114 |
jQuery.holdReady = function (hold) { |
| 11115 |
if (hold) { |
| 11116 |
jQuery.readyWait++; |
| 11117 |
} else { |
| 11118 |
jQuery.ready(true); |
| 11119 |
} |
| 11120 |
}; |
| 11121 |
jQuery.isArray = Array.isArray; |
| 11122 |
jQuery.parseJSON = JSON.parse; |
| 11123 |
jQuery.nodeName = nodeName; |
| 11124 |
jQuery.isFunction = isFunction; |
| 11125 |
jQuery.isWindow = isWindow; |
| 11126 |
jQuery.camelCase = camelCase; |
| 11127 |
jQuery.type = toType; |
| 11128 |
|
| 11129 |
jQuery.now = Date.now; |
| 11130 |
|
| 11131 |
jQuery.isNumeric = function (obj) { |
| 11132 |
// As of jQuery 3.0, isNumeric is limited to |
| 11133 |
// strings and numbers (primitives or objects) |
| 11134 |
// that can be coerced to finite numbers (gh-2662) |
| 11135 |
var type = jQuery.type(obj); |
| 11136 |
return ( |
| 11137 |
(type === "number" || type === "string") && |
| 11138 |
// parseFloat NaNs numeric-cast false positives ("") |
| 11139 |
// ...but misinterprets leading-number strings, particularly hex literals ("0x...") |
| 11140 |
// subtraction forces infinities to NaN |
| 11141 |
!isNaN(obj - parseFloat(obj)) |
| 11142 |
); |
| 11143 |
}; |
| 11144 |
|
| 11145 |
jQuery.trim = function (text) { |
| 11146 |
return text == null ? "" : (text + "").replace(rtrim, ""); |
| 11147 |
}; |
| 11148 |
|
| 11149 |
// Register as a named AMD module, since jQuery can be concatenated with other |
| 11150 |
// files that may use define, but not via a proper concatenation script that |
| 11151 |
// understands anonymous AMD modules. A named AMD is safest and most robust |
| 11152 |
// way to register. Lowercase jquery is used because AMD module names are |
| 11153 |
// derived from file names, and jQuery is normally delivered in a lowercase |
| 11154 |
// file name. Do this after creating the global so that if an AMD module wants |
| 11155 |
// to call noConflict to hide this version of jQuery, it will work. |
| 11156 |
|
| 11157 |
// Note that for maximum portability, libraries that are not jQuery should |
| 11158 |
// declare themselves as anonymous modules, and avoid setting a global if an |
| 11159 |
// AMD loader is present. jQuery is a special case. For more information, see |
| 11160 |
// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon |
| 11161 |
|
| 11162 |
if (typeof define === "function" && define.amd) { |
| 11163 |
define("jquery", [], function () { |
| 11164 |
return jQuery; |
| 11165 |
}); |
| 11166 |
} |
| 11167 |
|
| 11168 |
var // Map over jQuery in case of overwrite |
| 11169 |
_jQuery = window.jQuery, |
| 11170 |
// Map over the $ in case of overwrite |
| 11171 |
_$ = window.$; |
| 11172 |
|
| 11173 |
jQuery.noConflict = function (deep) { |
| 11174 |
if (window.$ === jQuery) { |
| 11175 |
window.$ = _$; |
| 11176 |
} |
| 11177 |
|
| 11178 |
if (deep && window.jQuery === jQuery) { |
| 11179 |
window.jQuery = _jQuery; |
| 11180 |
} |
| 11181 |
|
| 11182 |
return jQuery; |
| 11183 |
}; |
| 11184 |
|
| 11185 |
// Expose jQuery and $ identifiers, even in AMD |
| 11186 |
// (#7102#comment:10, https://github.com/jquery/jquery/pull/557) |
| 11187 |
// and CommonJS for browser emulators (#13566) |
| 11188 |
if (typeof noGlobal === "undefined") { |
| 11189 |
window.jQuery = window.$ = jQuery; |
| 11190 |
} |
| 11191 |
|
| 11192 |
return jQuery; |
| 11193 |
}); |