annotate jquery-2.1.4.js @ 1505:a667f80c417e

Added screen shots, edited bib. Some edits to intro, abstract and conclusion.
author Nicholas Jillings <nickjillings@users.noreply.github.com>
date Thu, 15 Oct 2015 21:17:14 +0100
parents 82f43919f385
children
rev   line source
b@1478 1 /*!
b@1478 2 * jQuery JavaScript Library v2.1.4
b@1478 3 * http://jquery.com/
b@1478 4 *
b@1478 5 * Includes Sizzle.js
b@1478 6 * http://sizzlejs.com/
b@1478 7 *
b@1478 8 * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
b@1478 9 * Released under the MIT license
b@1478 10 * http://jquery.org/license
b@1478 11 *
b@1478 12 * Date: 2015-04-28T16:01Z
b@1478 13 */
b@1478 14
b@1478 15 (function( global, factory ) {
b@1478 16
b@1478 17 if ( typeof module === "object" && typeof module.exports === "object" ) {
b@1478 18 // For CommonJS and CommonJS-like environments where a proper `window`
b@1478 19 // is present, execute the factory and get jQuery.
b@1478 20 // For environments that do not have a `window` with a `document`
b@1478 21 // (such as Node.js), expose a factory as module.exports.
b@1478 22 // This accentuates the need for the creation of a real `window`.
b@1478 23 // e.g. var jQuery = require("jquery")(window);
b@1478 24 // See ticket #14549 for more info.
b@1478 25 module.exports = global.document ?
b@1478 26 factory( global, true ) :
b@1478 27 function( w ) {
b@1478 28 if ( !w.document ) {
b@1478 29 throw new Error( "jQuery requires a window with a document" );
b@1478 30 }
b@1478 31 return factory( w );
b@1478 32 };
b@1478 33 } else {
b@1478 34 factory( global );
b@1478 35 }
b@1478 36
b@1478 37 // Pass this if window is not defined yet
b@1478 38 }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
b@1478 39
b@1478 40 // Support: Firefox 18+
b@1478 41 // Can't be in strict mode, several libs including ASP.NET trace
b@1478 42 // the stack via arguments.caller.callee and Firefox dies if
b@1478 43 // you try to trace through "use strict" call chains. (#13335)
b@1478 44 //
b@1478 45
b@1478 46 var arr = [];
b@1478 47
b@1478 48 var slice = arr.slice;
b@1478 49
b@1478 50 var concat = arr.concat;
b@1478 51
b@1478 52 var push = arr.push;
b@1478 53
b@1478 54 var indexOf = arr.indexOf;
b@1478 55
b@1478 56 var class2type = {};
b@1478 57
b@1478 58 var toString = class2type.toString;
b@1478 59
b@1478 60 var hasOwn = class2type.hasOwnProperty;
b@1478 61
b@1478 62 var support = {};
b@1478 63
b@1478 64
b@1478 65
b@1478 66 var
b@1478 67 // Use the correct document accordingly with window argument (sandbox)
b@1478 68 document = window.document,
b@1478 69
b@1478 70 version = "2.1.4",
b@1478 71
b@1478 72 // Define a local copy of jQuery
b@1478 73 jQuery = function( selector, context ) {
b@1478 74 // The jQuery object is actually just the init constructor 'enhanced'
b@1478 75 // Need init if jQuery is called (just allow error to be thrown if not included)
b@1478 76 return new jQuery.fn.init( selector, context );
b@1478 77 },
b@1478 78
b@1478 79 // Support: Android<4.1
b@1478 80 // Make sure we trim BOM and NBSP
b@1478 81 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
b@1478 82
b@1478 83 // Matches dashed string for camelizing
b@1478 84 rmsPrefix = /^-ms-/,
b@1478 85 rdashAlpha = /-([\da-z])/gi,
b@1478 86
b@1478 87 // Used by jQuery.camelCase as callback to replace()
b@1478 88 fcamelCase = function( all, letter ) {
b@1478 89 return letter.toUpperCase();
b@1478 90 };
b@1478 91
b@1478 92 jQuery.fn = jQuery.prototype = {
b@1478 93 // The current version of jQuery being used
b@1478 94 jquery: version,
b@1478 95
b@1478 96 constructor: jQuery,
b@1478 97
b@1478 98 // Start with an empty selector
b@1478 99 selector: "",
b@1478 100
b@1478 101 // The default length of a jQuery object is 0
b@1478 102 length: 0,
b@1478 103
b@1478 104 toArray: function() {
b@1478 105 return slice.call( this );
b@1478 106 },
b@1478 107
b@1478 108 // Get the Nth element in the matched element set OR
b@1478 109 // Get the whole matched element set as a clean array
b@1478 110 get: function( num ) {
b@1478 111 return num != null ?
b@1478 112
b@1478 113 // Return just the one element from the set
b@1478 114 ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
b@1478 115
b@1478 116 // Return all the elements in a clean array
b@1478 117 slice.call( this );
b@1478 118 },
b@1478 119
b@1478 120 // Take an array of elements and push it onto the stack
b@1478 121 // (returning the new matched element set)
b@1478 122 pushStack: function( elems ) {
b@1478 123
b@1478 124 // Build a new jQuery matched element set
b@1478 125 var ret = jQuery.merge( this.constructor(), elems );
b@1478 126
b@1478 127 // Add the old object onto the stack (as a reference)
b@1478 128 ret.prevObject = this;
b@1478 129 ret.context = this.context;
b@1478 130
b@1478 131 // Return the newly-formed element set
b@1478 132 return ret;
b@1478 133 },
b@1478 134
b@1478 135 // Execute a callback for every element in the matched set.
b@1478 136 // (You can seed the arguments with an array of args, but this is
b@1478 137 // only used internally.)
b@1478 138 each: function( callback, args ) {
b@1478 139 return jQuery.each( this, callback, args );
b@1478 140 },
b@1478 141
b@1478 142 map: function( callback ) {
b@1478 143 return this.pushStack( jQuery.map(this, function( elem, i ) {
b@1478 144 return callback.call( elem, i, elem );
b@1478 145 }));
b@1478 146 },
b@1478 147
b@1478 148 slice: function() {
b@1478 149 return this.pushStack( slice.apply( this, arguments ) );
b@1478 150 },
b@1478 151
b@1478 152 first: function() {
b@1478 153 return this.eq( 0 );
b@1478 154 },
b@1478 155
b@1478 156 last: function() {
b@1478 157 return this.eq( -1 );
b@1478 158 },
b@1478 159
b@1478 160 eq: function( i ) {
b@1478 161 var len = this.length,
b@1478 162 j = +i + ( i < 0 ? len : 0 );
b@1478 163 return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
b@1478 164 },
b@1478 165
b@1478 166 end: function() {
b@1478 167 return this.prevObject || this.constructor(null);
b@1478 168 },
b@1478 169
b@1478 170 // For internal use only.
b@1478 171 // Behaves like an Array's method, not like a jQuery method.
b@1478 172 push: push,
b@1478 173 sort: arr.sort,
b@1478 174 splice: arr.splice
b@1478 175 };
b@1478 176
b@1478 177 jQuery.extend = jQuery.fn.extend = function() {
b@1478 178 var options, name, src, copy, copyIsArray, clone,
b@1478 179 target = arguments[0] || {},
b@1478 180 i = 1,
b@1478 181 length = arguments.length,
b@1478 182 deep = false;
b@1478 183
b@1478 184 // Handle a deep copy situation
b@1478 185 if ( typeof target === "boolean" ) {
b@1478 186 deep = target;
b@1478 187
b@1478 188 // Skip the boolean and the target
b@1478 189 target = arguments[ i ] || {};
b@1478 190 i++;
b@1478 191 }
b@1478 192
b@1478 193 // Handle case when target is a string or something (possible in deep copy)
b@1478 194 if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
b@1478 195 target = {};
b@1478 196 }
b@1478 197
b@1478 198 // Extend jQuery itself if only one argument is passed
b@1478 199 if ( i === length ) {
b@1478 200 target = this;
b@1478 201 i--;
b@1478 202 }
b@1478 203
b@1478 204 for ( ; i < length; i++ ) {
b@1478 205 // Only deal with non-null/undefined values
b@1478 206 if ( (options = arguments[ i ]) != null ) {
b@1478 207 // Extend the base object
b@1478 208 for ( name in options ) {
b@1478 209 src = target[ name ];
b@1478 210 copy = options[ name ];
b@1478 211
b@1478 212 // Prevent never-ending loop
b@1478 213 if ( target === copy ) {
b@1478 214 continue;
b@1478 215 }
b@1478 216
b@1478 217 // Recurse if we're merging plain objects or arrays
b@1478 218 if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
b@1478 219 if ( copyIsArray ) {
b@1478 220 copyIsArray = false;
b@1478 221 clone = src && jQuery.isArray(src) ? src : [];
b@1478 222
b@1478 223 } else {
b@1478 224 clone = src && jQuery.isPlainObject(src) ? src : {};
b@1478 225 }
b@1478 226
b@1478 227 // Never move original objects, clone them
b@1478 228 target[ name ] = jQuery.extend( deep, clone, copy );
b@1478 229
b@1478 230 // Don't bring in undefined values
b@1478 231 } else if ( copy !== undefined ) {
b@1478 232 target[ name ] = copy;
b@1478 233 }
b@1478 234 }
b@1478 235 }
b@1478 236 }
b@1478 237
b@1478 238 // Return the modified object
b@1478 239 return target;
b@1478 240 };
b@1478 241
b@1478 242 jQuery.extend({
b@1478 243 // Unique for each copy of jQuery on the page
b@1478 244 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
b@1478 245
b@1478 246 // Assume jQuery is ready without the ready module
b@1478 247 isReady: true,
b@1478 248
b@1478 249 error: function( msg ) {
b@1478 250 throw new Error( msg );
b@1478 251 },
b@1478 252
b@1478 253 noop: function() {},
b@1478 254
b@1478 255 isFunction: function( obj ) {
b@1478 256 return jQuery.type(obj) === "function";
b@1478 257 },
b@1478 258
b@1478 259 isArray: Array.isArray,
b@1478 260
b@1478 261 isWindow: function( obj ) {
b@1478 262 return obj != null && obj === obj.window;
b@1478 263 },
b@1478 264
b@1478 265 isNumeric: function( obj ) {
b@1478 266 // parseFloat NaNs numeric-cast false positives (null|true|false|"")
b@1478 267 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
b@1478 268 // subtraction forces infinities to NaN
b@1478 269 // adding 1 corrects loss of precision from parseFloat (#15100)
b@1478 270 return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0;
b@1478 271 },
b@1478 272
b@1478 273 isPlainObject: function( obj ) {
b@1478 274 // Not plain objects:
b@1478 275 // - Any object or value whose internal [[Class]] property is not "[object Object]"
b@1478 276 // - DOM nodes
b@1478 277 // - window
b@1478 278 if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
b@1478 279 return false;
b@1478 280 }
b@1478 281
b@1478 282 if ( obj.constructor &&
b@1478 283 !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
b@1478 284 return false;
b@1478 285 }
b@1478 286
b@1478 287 // If the function hasn't returned already, we're confident that
b@1478 288 // |obj| is a plain object, created by {} or constructed with new Object
b@1478 289 return true;
b@1478 290 },
b@1478 291
b@1478 292 isEmptyObject: function( obj ) {
b@1478 293 var name;
b@1478 294 for ( name in obj ) {
b@1478 295 return false;
b@1478 296 }
b@1478 297 return true;
b@1478 298 },
b@1478 299
b@1478 300 type: function( obj ) {
b@1478 301 if ( obj == null ) {
b@1478 302 return obj + "";
b@1478 303 }
b@1478 304 // Support: Android<4.0, iOS<6 (functionish RegExp)
b@1478 305 return typeof obj === "object" || typeof obj === "function" ?
b@1478 306 class2type[ toString.call(obj) ] || "object" :
b@1478 307 typeof obj;
b@1478 308 },
b@1478 309
b@1478 310 // Evaluates a script in a global context
b@1478 311 globalEval: function( code ) {
b@1478 312 var script,
b@1478 313 indirect = eval;
b@1478 314
b@1478 315 code = jQuery.trim( code );
b@1478 316
b@1478 317 if ( code ) {
b@1478 318 // If the code includes a valid, prologue position
b@1478 319 // strict mode pragma, execute code by injecting a
b@1478 320 // script tag into the document.
b@1478 321 if ( code.indexOf("use strict") === 1 ) {
b@1478 322 script = document.createElement("script");
b@1478 323 script.text = code;
b@1478 324 document.head.appendChild( script ).parentNode.removeChild( script );
b@1478 325 } else {
b@1478 326 // Otherwise, avoid the DOM node creation, insertion
b@1478 327 // and removal by using an indirect global eval
b@1478 328 indirect( code );
b@1478 329 }
b@1478 330 }
b@1478 331 },
b@1478 332
b@1478 333 // Convert dashed to camelCase; used by the css and data modules
b@1478 334 // Support: IE9-11+
b@1478 335 // Microsoft forgot to hump their vendor prefix (#9572)
b@1478 336 camelCase: function( string ) {
b@1478 337 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
b@1478 338 },
b@1478 339
b@1478 340 nodeName: function( elem, name ) {
b@1478 341 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
b@1478 342 },
b@1478 343
b@1478 344 // args is for internal usage only
b@1478 345 each: function( obj, callback, args ) {
b@1478 346 var value,
b@1478 347 i = 0,
b@1478 348 length = obj.length,
b@1478 349 isArray = isArraylike( obj );
b@1478 350
b@1478 351 if ( args ) {
b@1478 352 if ( isArray ) {
b@1478 353 for ( ; i < length; i++ ) {
b@1478 354 value = callback.apply( obj[ i ], args );
b@1478 355
b@1478 356 if ( value === false ) {
b@1478 357 break;
b@1478 358 }
b@1478 359 }
b@1478 360 } else {
b@1478 361 for ( i in obj ) {
b@1478 362 value = callback.apply( obj[ i ], args );
b@1478 363
b@1478 364 if ( value === false ) {
b@1478 365 break;
b@1478 366 }
b@1478 367 }
b@1478 368 }
b@1478 369
b@1478 370 // A special, fast, case for the most common use of each
b@1478 371 } else {
b@1478 372 if ( isArray ) {
b@1478 373 for ( ; i < length; i++ ) {
b@1478 374 value = callback.call( obj[ i ], i, obj[ i ] );
b@1478 375
b@1478 376 if ( value === false ) {
b@1478 377 break;
b@1478 378 }
b@1478 379 }
b@1478 380 } else {
b@1478 381 for ( i in obj ) {
b@1478 382 value = callback.call( obj[ i ], i, obj[ i ] );
b@1478 383
b@1478 384 if ( value === false ) {
b@1478 385 break;
b@1478 386 }
b@1478 387 }
b@1478 388 }
b@1478 389 }
b@1478 390
b@1478 391 return obj;
b@1478 392 },
b@1478 393
b@1478 394 // Support: Android<4.1
b@1478 395 trim: function( text ) {
b@1478 396 return text == null ?
b@1478 397 "" :
b@1478 398 ( text + "" ).replace( rtrim, "" );
b@1478 399 },
b@1478 400
b@1478 401 // results is for internal usage only
b@1478 402 makeArray: function( arr, results ) {
b@1478 403 var ret = results || [];
b@1478 404
b@1478 405 if ( arr != null ) {
b@1478 406 if ( isArraylike( Object(arr) ) ) {
b@1478 407 jQuery.merge( ret,
b@1478 408 typeof arr === "string" ?
b@1478 409 [ arr ] : arr
b@1478 410 );
b@1478 411 } else {
b@1478 412 push.call( ret, arr );
b@1478 413 }
b@1478 414 }
b@1478 415
b@1478 416 return ret;
b@1478 417 },
b@1478 418
b@1478 419 inArray: function( elem, arr, i ) {
b@1478 420 return arr == null ? -1 : indexOf.call( arr, elem, i );
b@1478 421 },
b@1478 422
b@1478 423 merge: function( first, second ) {
b@1478 424 var len = +second.length,
b@1478 425 j = 0,
b@1478 426 i = first.length;
b@1478 427
b@1478 428 for ( ; j < len; j++ ) {
b@1478 429 first[ i++ ] = second[ j ];
b@1478 430 }
b@1478 431
b@1478 432 first.length = i;
b@1478 433
b@1478 434 return first;
b@1478 435 },
b@1478 436
b@1478 437 grep: function( elems, callback, invert ) {
b@1478 438 var callbackInverse,
b@1478 439 matches = [],
b@1478 440 i = 0,
b@1478 441 length = elems.length,
b@1478 442 callbackExpect = !invert;
b@1478 443
b@1478 444 // Go through the array, only saving the items
b@1478 445 // that pass the validator function
b@1478 446 for ( ; i < length; i++ ) {
b@1478 447 callbackInverse = !callback( elems[ i ], i );
b@1478 448 if ( callbackInverse !== callbackExpect ) {
b@1478 449 matches.push( elems[ i ] );
b@1478 450 }
b@1478 451 }
b@1478 452
b@1478 453 return matches;
b@1478 454 },
b@1478 455
b@1478 456 // arg is for internal usage only
b@1478 457 map: function( elems, callback, arg ) {
b@1478 458 var value,
b@1478 459 i = 0,
b@1478 460 length = elems.length,
b@1478 461 isArray = isArraylike( elems ),
b@1478 462 ret = [];
b@1478 463
b@1478 464 // Go through the array, translating each of the items to their new values
b@1478 465 if ( isArray ) {
b@1478 466 for ( ; i < length; i++ ) {
b@1478 467 value = callback( elems[ i ], i, arg );
b@1478 468
b@1478 469 if ( value != null ) {
b@1478 470 ret.push( value );
b@1478 471 }
b@1478 472 }
b@1478 473
b@1478 474 // Go through every key on the object,
b@1478 475 } else {
b@1478 476 for ( i in elems ) {
b@1478 477 value = callback( elems[ i ], i, arg );
b@1478 478
b@1478 479 if ( value != null ) {
b@1478 480 ret.push( value );
b@1478 481 }
b@1478 482 }
b@1478 483 }
b@1478 484
b@1478 485 // Flatten any nested arrays
b@1478 486 return concat.apply( [], ret );
b@1478 487 },
b@1478 488
b@1478 489 // A global GUID counter for objects
b@1478 490 guid: 1,
b@1478 491
b@1478 492 // Bind a function to a context, optionally partially applying any
b@1478 493 // arguments.
b@1478 494 proxy: function( fn, context ) {
b@1478 495 var tmp, args, proxy;
b@1478 496
b@1478 497 if ( typeof context === "string" ) {
b@1478 498 tmp = fn[ context ];
b@1478 499 context = fn;
b@1478 500 fn = tmp;
b@1478 501 }
b@1478 502
b@1478 503 // Quick check to determine if target is callable, in the spec
b@1478 504 // this throws a TypeError, but we will just return undefined.
b@1478 505 if ( !jQuery.isFunction( fn ) ) {
b@1478 506 return undefined;
b@1478 507 }
b@1478 508
b@1478 509 // Simulated bind
b@1478 510 args = slice.call( arguments, 2 );
b@1478 511 proxy = function() {
b@1478 512 return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
b@1478 513 };
b@1478 514
b@1478 515 // Set the guid of unique handler to the same of original handler, so it can be removed
b@1478 516 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
b@1478 517
b@1478 518 return proxy;
b@1478 519 },
b@1478 520
b@1478 521 now: Date.now,
b@1478 522
b@1478 523 // jQuery.support is not used in Core but other projects attach their
b@1478 524 // properties to it so it needs to exist.
b@1478 525 support: support
b@1478 526 });
b@1478 527
b@1478 528 // Populate the class2type map
b@1478 529 jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
b@1478 530 class2type[ "[object " + name + "]" ] = name.toLowerCase();
b@1478 531 });
b@1478 532
b@1478 533 function isArraylike( obj ) {
b@1478 534
b@1478 535 // Support: iOS 8.2 (not reproducible in simulator)
b@1478 536 // `in` check used to prevent JIT error (gh-2145)
b@1478 537 // hasOwn isn't used here due to false negatives
b@1478 538 // regarding Nodelist length in IE
b@1478 539 var length = "length" in obj && obj.length,
b@1478 540 type = jQuery.type( obj );
b@1478 541
b@1478 542 if ( type === "function" || jQuery.isWindow( obj ) ) {
b@1478 543 return false;
b@1478 544 }
b@1478 545
b@1478 546 if ( obj.nodeType === 1 && length ) {
b@1478 547 return true;
b@1478 548 }
b@1478 549
b@1478 550 return type === "array" || length === 0 ||
b@1478 551 typeof length === "number" && length > 0 && ( length - 1 ) in obj;
b@1478 552 }
b@1478 553 var Sizzle =
b@1478 554 /*!
b@1478 555 * Sizzle CSS Selector Engine v2.2.0-pre
b@1478 556 * http://sizzlejs.com/
b@1478 557 *
b@1478 558 * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors
b@1478 559 * Released under the MIT license
b@1478 560 * http://jquery.org/license
b@1478 561 *
b@1478 562 * Date: 2014-12-16
b@1478 563 */
b@1478 564 (function( window ) {
b@1478 565
b@1478 566 var i,
b@1478 567 support,
b@1478 568 Expr,
b@1478 569 getText,
b@1478 570 isXML,
b@1478 571 tokenize,
b@1478 572 compile,
b@1478 573 select,
b@1478 574 outermostContext,
b@1478 575 sortInput,
b@1478 576 hasDuplicate,
b@1478 577
b@1478 578 // Local document vars
b@1478 579 setDocument,
b@1478 580 document,
b@1478 581 docElem,
b@1478 582 documentIsHTML,
b@1478 583 rbuggyQSA,
b@1478 584 rbuggyMatches,
b@1478 585 matches,
b@1478 586 contains,
b@1478 587
b@1478 588 // Instance-specific data
b@1478 589 expando = "sizzle" + 1 * new Date(),
b@1478 590 preferredDoc = window.document,
b@1478 591 dirruns = 0,
b@1478 592 done = 0,
b@1478 593 classCache = createCache(),
b@1478 594 tokenCache = createCache(),
b@1478 595 compilerCache = createCache(),
b@1478 596 sortOrder = function( a, b ) {
b@1478 597 if ( a === b ) {
b@1478 598 hasDuplicate = true;
b@1478 599 }
b@1478 600 return 0;
b@1478 601 },
b@1478 602
b@1478 603 // General-purpose constants
b@1478 604 MAX_NEGATIVE = 1 << 31,
b@1478 605
b@1478 606 // Instance methods
b@1478 607 hasOwn = ({}).hasOwnProperty,
b@1478 608 arr = [],
b@1478 609 pop = arr.pop,
b@1478 610 push_native = arr.push,
b@1478 611 push = arr.push,
b@1478 612 slice = arr.slice,
b@1478 613 // Use a stripped-down indexOf as it's faster than native
b@1478 614 // http://jsperf.com/thor-indexof-vs-for/5
b@1478 615 indexOf = function( list, elem ) {
b@1478 616 var i = 0,
b@1478 617 len = list.length;
b@1478 618 for ( ; i < len; i++ ) {
b@1478 619 if ( list[i] === elem ) {
b@1478 620 return i;
b@1478 621 }
b@1478 622 }
b@1478 623 return -1;
b@1478 624 },
b@1478 625
b@1478 626 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
b@1478 627
b@1478 628 // Regular expressions
b@1478 629
b@1478 630 // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
b@1478 631 whitespace = "[\\x20\\t\\r\\n\\f]",
b@1478 632 // http://www.w3.org/TR/css3-syntax/#characters
b@1478 633 characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
b@1478 634
b@1478 635 // Loosely modeled on CSS identifier characters
b@1478 636 // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
b@1478 637 // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
b@1478 638 identifier = characterEncoding.replace( "w", "w#" ),
b@1478 639
b@1478 640 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
b@1478 641 attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace +
b@1478 642 // Operator (capture 2)
b@1478 643 "*([*^$|!~]?=)" + whitespace +
b@1478 644 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
b@1478 645 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
b@1478 646 "*\\]",
b@1478 647
b@1478 648 pseudos = ":(" + characterEncoding + ")(?:\\((" +
b@1478 649 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
b@1478 650 // 1. quoted (capture 3; capture 4 or capture 5)
b@1478 651 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
b@1478 652 // 2. simple (capture 6)
b@1478 653 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
b@1478 654 // 3. anything else (capture 2)
b@1478 655 ".*" +
b@1478 656 ")\\)|)",
b@1478 657
b@1478 658 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
b@1478 659 rwhitespace = new RegExp( whitespace + "+", "g" ),
b@1478 660 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
b@1478 661
b@1478 662 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
b@1478 663 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
b@1478 664
b@1478 665 rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
b@1478 666
b@1478 667 rpseudo = new RegExp( pseudos ),
b@1478 668 ridentifier = new RegExp( "^" + identifier + "$" ),
b@1478 669
b@1478 670 matchExpr = {
b@1478 671 "ID": new RegExp( "^#(" + characterEncoding + ")" ),
b@1478 672 "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
b@1478 673 "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
b@1478 674 "ATTR": new RegExp( "^" + attributes ),
b@1478 675 "PSEUDO": new RegExp( "^" + pseudos ),
b@1478 676 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
b@1478 677 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
b@1478 678 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
b@1478 679 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
b@1478 680 // For use in libraries implementing .is()
b@1478 681 // We use this for POS matching in `select`
b@1478 682 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
b@1478 683 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
b@1478 684 },
b@1478 685
b@1478 686 rinputs = /^(?:input|select|textarea|button)$/i,
b@1478 687 rheader = /^h\d$/i,
b@1478 688
b@1478 689 rnative = /^[^{]+\{\s*\[native \w/,
b@1478 690
b@1478 691 // Easily-parseable/retrievable ID or TAG or CLASS selectors
b@1478 692 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
b@1478 693
b@1478 694 rsibling = /[+~]/,
b@1478 695 rescape = /'|\\/g,
b@1478 696
b@1478 697 // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
b@1478 698 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
b@1478 699 funescape = function( _, escaped, escapedWhitespace ) {
b@1478 700 var high = "0x" + escaped - 0x10000;
b@1478 701 // NaN means non-codepoint
b@1478 702 // Support: Firefox<24
b@1478 703 // Workaround erroneous numeric interpretation of +"0x"
b@1478 704 return high !== high || escapedWhitespace ?
b@1478 705 escaped :
b@1478 706 high < 0 ?
b@1478 707 // BMP codepoint
b@1478 708 String.fromCharCode( high + 0x10000 ) :
b@1478 709 // Supplemental Plane codepoint (surrogate pair)
b@1478 710 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
b@1478 711 },
b@1478 712
b@1478 713 // Used for iframes
b@1478 714 // See setDocument()
b@1478 715 // Removing the function wrapper causes a "Permission Denied"
b@1478 716 // error in IE
b@1478 717 unloadHandler = function() {
b@1478 718 setDocument();
b@1478 719 };
b@1478 720
b@1478 721 // Optimize for push.apply( _, NodeList )
b@1478 722 try {
b@1478 723 push.apply(
b@1478 724 (arr = slice.call( preferredDoc.childNodes )),
b@1478 725 preferredDoc.childNodes
b@1478 726 );
b@1478 727 // Support: Android<4.0
b@1478 728 // Detect silently failing push.apply
b@1478 729 arr[ preferredDoc.childNodes.length ].nodeType;
b@1478 730 } catch ( e ) {
b@1478 731 push = { apply: arr.length ?
b@1478 732
b@1478 733 // Leverage slice if possible
b@1478 734 function( target, els ) {
b@1478 735 push_native.apply( target, slice.call(els) );
b@1478 736 } :
b@1478 737
b@1478 738 // Support: IE<9
b@1478 739 // Otherwise append directly
b@1478 740 function( target, els ) {
b@1478 741 var j = target.length,
b@1478 742 i = 0;
b@1478 743 // Can't trust NodeList.length
b@1478 744 while ( (target[j++] = els[i++]) ) {}
b@1478 745 target.length = j - 1;
b@1478 746 }
b@1478 747 };
b@1478 748 }
b@1478 749
b@1478 750 function Sizzle( selector, context, results, seed ) {
b@1478 751 var match, elem, m, nodeType,
b@1478 752 // QSA vars
b@1478 753 i, groups, old, nid, newContext, newSelector;
b@1478 754
b@1478 755 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
b@1478 756 setDocument( context );
b@1478 757 }
b@1478 758
b@1478 759 context = context || document;
b@1478 760 results = results || [];
b@1478 761 nodeType = context.nodeType;
b@1478 762
b@1478 763 if ( typeof selector !== "string" || !selector ||
b@1478 764 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
b@1478 765
b@1478 766 return results;
b@1478 767 }
b@1478 768
b@1478 769 if ( !seed && documentIsHTML ) {
b@1478 770
b@1478 771 // Try to shortcut find operations when possible (e.g., not under DocumentFragment)
b@1478 772 if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
b@1478 773 // Speed-up: Sizzle("#ID")
b@1478 774 if ( (m = match[1]) ) {
b@1478 775 if ( nodeType === 9 ) {
b@1478 776 elem = context.getElementById( m );
b@1478 777 // Check parentNode to catch when Blackberry 4.6 returns
b@1478 778 // nodes that are no longer in the document (jQuery #6963)
b@1478 779 if ( elem && elem.parentNode ) {
b@1478 780 // Handle the case where IE, Opera, and Webkit return items
b@1478 781 // by name instead of ID
b@1478 782 if ( elem.id === m ) {
b@1478 783 results.push( elem );
b@1478 784 return results;
b@1478 785 }
b@1478 786 } else {
b@1478 787 return results;
b@1478 788 }
b@1478 789 } else {
b@1478 790 // Context is not a document
b@1478 791 if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
b@1478 792 contains( context, elem ) && elem.id === m ) {
b@1478 793 results.push( elem );
b@1478 794 return results;
b@1478 795 }
b@1478 796 }
b@1478 797
b@1478 798 // Speed-up: Sizzle("TAG")
b@1478 799 } else if ( match[2] ) {
b@1478 800 push.apply( results, context.getElementsByTagName( selector ) );
b@1478 801 return results;
b@1478 802
b@1478 803 // Speed-up: Sizzle(".CLASS")
b@1478 804 } else if ( (m = match[3]) && support.getElementsByClassName ) {
b@1478 805 push.apply( results, context.getElementsByClassName( m ) );
b@1478 806 return results;
b@1478 807 }
b@1478 808 }
b@1478 809
b@1478 810 // QSA path
b@1478 811 if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
b@1478 812 nid = old = expando;
b@1478 813 newContext = context;
b@1478 814 newSelector = nodeType !== 1 && selector;
b@1478 815
b@1478 816 // qSA works strangely on Element-rooted queries
b@1478 817 // We can work around this by specifying an extra ID on the root
b@1478 818 // and working up from there (Thanks to Andrew Dupont for the technique)
b@1478 819 // IE 8 doesn't work on object elements
b@1478 820 if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
b@1478 821 groups = tokenize( selector );
b@1478 822
b@1478 823 if ( (old = context.getAttribute("id")) ) {
b@1478 824 nid = old.replace( rescape, "\\$&" );
b@1478 825 } else {
b@1478 826 context.setAttribute( "id", nid );
b@1478 827 }
b@1478 828 nid = "[id='" + nid + "'] ";
b@1478 829
b@1478 830 i = groups.length;
b@1478 831 while ( i-- ) {
b@1478 832 groups[i] = nid + toSelector( groups[i] );
b@1478 833 }
b@1478 834 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context;
b@1478 835 newSelector = groups.join(",");
b@1478 836 }
b@1478 837
b@1478 838 if ( newSelector ) {
b@1478 839 try {
b@1478 840 push.apply( results,
b@1478 841 newContext.querySelectorAll( newSelector )
b@1478 842 );
b@1478 843 return results;
b@1478 844 } catch(qsaError) {
b@1478 845 } finally {
b@1478 846 if ( !old ) {
b@1478 847 context.removeAttribute("id");
b@1478 848 }
b@1478 849 }
b@1478 850 }
b@1478 851 }
b@1478 852 }
b@1478 853
b@1478 854 // All others
b@1478 855 return select( selector.replace( rtrim, "$1" ), context, results, seed );
b@1478 856 }
b@1478 857
b@1478 858 /**
b@1478 859 * Create key-value caches of limited size
b@1478 860 * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
b@1478 861 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
b@1478 862 * deleting the oldest entry
b@1478 863 */
b@1478 864 function createCache() {
b@1478 865 var keys = [];
b@1478 866
b@1478 867 function cache( key, value ) {
b@1478 868 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
b@1478 869 if ( keys.push( key + " " ) > Expr.cacheLength ) {
b@1478 870 // Only keep the most recent entries
b@1478 871 delete cache[ keys.shift() ];
b@1478 872 }
b@1478 873 return (cache[ key + " " ] = value);
b@1478 874 }
b@1478 875 return cache;
b@1478 876 }
b@1478 877
b@1478 878 /**
b@1478 879 * Mark a function for special use by Sizzle
b@1478 880 * @param {Function} fn The function to mark
b@1478 881 */
b@1478 882 function markFunction( fn ) {
b@1478 883 fn[ expando ] = true;
b@1478 884 return fn;
b@1478 885 }
b@1478 886
b@1478 887 /**
b@1478 888 * Support testing using an element
b@1478 889 * @param {Function} fn Passed the created div and expects a boolean result
b@1478 890 */
b@1478 891 function assert( fn ) {
b@1478 892 var div = document.createElement("div");
b@1478 893
b@1478 894 try {
b@1478 895 return !!fn( div );
b@1478 896 } catch (e) {
b@1478 897 return false;
b@1478 898 } finally {
b@1478 899 // Remove from its parent by default
b@1478 900 if ( div.parentNode ) {
b@1478 901 div.parentNode.removeChild( div );
b@1478 902 }
b@1478 903 // release memory in IE
b@1478 904 div = null;
b@1478 905 }
b@1478 906 }
b@1478 907
b@1478 908 /**
b@1478 909 * Adds the same handler for all of the specified attrs
b@1478 910 * @param {String} attrs Pipe-separated list of attributes
b@1478 911 * @param {Function} handler The method that will be applied
b@1478 912 */
b@1478 913 function addHandle( attrs, handler ) {
b@1478 914 var arr = attrs.split("|"),
b@1478 915 i = attrs.length;
b@1478 916
b@1478 917 while ( i-- ) {
b@1478 918 Expr.attrHandle[ arr[i] ] = handler;
b@1478 919 }
b@1478 920 }
b@1478 921
b@1478 922 /**
b@1478 923 * Checks document order of two siblings
b@1478 924 * @param {Element} a
b@1478 925 * @param {Element} b
b@1478 926 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
b@1478 927 */
b@1478 928 function siblingCheck( a, b ) {
b@1478 929 var cur = b && a,
b@1478 930 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
b@1478 931 ( ~b.sourceIndex || MAX_NEGATIVE ) -
b@1478 932 ( ~a.sourceIndex || MAX_NEGATIVE );
b@1478 933
b@1478 934 // Use IE sourceIndex if available on both nodes
b@1478 935 if ( diff ) {
b@1478 936 return diff;
b@1478 937 }
b@1478 938
b@1478 939 // Check if b follows a
b@1478 940 if ( cur ) {
b@1478 941 while ( (cur = cur.nextSibling) ) {
b@1478 942 if ( cur === b ) {
b@1478 943 return -1;
b@1478 944 }
b@1478 945 }
b@1478 946 }
b@1478 947
b@1478 948 return a ? 1 : -1;
b@1478 949 }
b@1478 950
b@1478 951 /**
b@1478 952 * Returns a function to use in pseudos for input types
b@1478 953 * @param {String} type
b@1478 954 */
b@1478 955 function createInputPseudo( type ) {
b@1478 956 return function( elem ) {
b@1478 957 var name = elem.nodeName.toLowerCase();
b@1478 958 return name === "input" && elem.type === type;
b@1478 959 };
b@1478 960 }
b@1478 961
b@1478 962 /**
b@1478 963 * Returns a function to use in pseudos for buttons
b@1478 964 * @param {String} type
b@1478 965 */
b@1478 966 function createButtonPseudo( type ) {
b@1478 967 return function( elem ) {
b@1478 968 var name = elem.nodeName.toLowerCase();
b@1478 969 return (name === "input" || name === "button") && elem.type === type;
b@1478 970 };
b@1478 971 }
b@1478 972
b@1478 973 /**
b@1478 974 * Returns a function to use in pseudos for positionals
b@1478 975 * @param {Function} fn
b@1478 976 */
b@1478 977 function createPositionalPseudo( fn ) {
b@1478 978 return markFunction(function( argument ) {
b@1478 979 argument = +argument;
b@1478 980 return markFunction(function( seed, matches ) {
b@1478 981 var j,
b@1478 982 matchIndexes = fn( [], seed.length, argument ),
b@1478 983 i = matchIndexes.length;
b@1478 984
b@1478 985 // Match elements found at the specified indexes
b@1478 986 while ( i-- ) {
b@1478 987 if ( seed[ (j = matchIndexes[i]) ] ) {
b@1478 988 seed[j] = !(matches[j] = seed[j]);
b@1478 989 }
b@1478 990 }
b@1478 991 });
b@1478 992 });
b@1478 993 }
b@1478 994
b@1478 995 /**
b@1478 996 * Checks a node for validity as a Sizzle context
b@1478 997 * @param {Element|Object=} context
b@1478 998 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
b@1478 999 */
b@1478 1000 function testContext( context ) {
b@1478 1001 return context && typeof context.getElementsByTagName !== "undefined" && context;
b@1478 1002 }
b@1478 1003
b@1478 1004 // Expose support vars for convenience
b@1478 1005 support = Sizzle.support = {};
b@1478 1006
b@1478 1007 /**
b@1478 1008 * Detects XML nodes
b@1478 1009 * @param {Element|Object} elem An element or a document
b@1478 1010 * @returns {Boolean} True iff elem is a non-HTML XML node
b@1478 1011 */
b@1478 1012 isXML = Sizzle.isXML = function( elem ) {
b@1478 1013 // documentElement is verified for cases where it doesn't yet exist
b@1478 1014 // (such as loading iframes in IE - #4833)
b@1478 1015 var documentElement = elem && (elem.ownerDocument || elem).documentElement;
b@1478 1016 return documentElement ? documentElement.nodeName !== "HTML" : false;
b@1478 1017 };
b@1478 1018
b@1478 1019 /**
b@1478 1020 * Sets document-related variables once based on the current document
b@1478 1021 * @param {Element|Object} [doc] An element or document object to use to set the document
b@1478 1022 * @returns {Object} Returns the current document
b@1478 1023 */
b@1478 1024 setDocument = Sizzle.setDocument = function( node ) {
b@1478 1025 var hasCompare, parent,
b@1478 1026 doc = node ? node.ownerDocument || node : preferredDoc;
b@1478 1027
b@1478 1028 // If no document and documentElement is available, return
b@1478 1029 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
b@1478 1030 return document;
b@1478 1031 }
b@1478 1032
b@1478 1033 // Set our document
b@1478 1034 document = doc;
b@1478 1035 docElem = doc.documentElement;
b@1478 1036 parent = doc.defaultView;
b@1478 1037
b@1478 1038 // Support: IE>8
b@1478 1039 // If iframe document is assigned to "document" variable and if iframe has been reloaded,
b@1478 1040 // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
b@1478 1041 // IE6-8 do not support the defaultView property so parent will be undefined
b@1478 1042 if ( parent && parent !== parent.top ) {
b@1478 1043 // IE11 does not have attachEvent, so all must suffer
b@1478 1044 if ( parent.addEventListener ) {
b@1478 1045 parent.addEventListener( "unload", unloadHandler, false );
b@1478 1046 } else if ( parent.attachEvent ) {
b@1478 1047 parent.attachEvent( "onunload", unloadHandler );
b@1478 1048 }
b@1478 1049 }
b@1478 1050
b@1478 1051 /* Support tests
b@1478 1052 ---------------------------------------------------------------------- */
b@1478 1053 documentIsHTML = !isXML( doc );
b@1478 1054
b@1478 1055 /* Attributes
b@1478 1056 ---------------------------------------------------------------------- */
b@1478 1057
b@1478 1058 // Support: IE<8
b@1478 1059 // Verify that getAttribute really returns attributes and not properties
b@1478 1060 // (excepting IE8 booleans)
b@1478 1061 support.attributes = assert(function( div ) {
b@1478 1062 div.className = "i";
b@1478 1063 return !div.getAttribute("className");
b@1478 1064 });
b@1478 1065
b@1478 1066 /* getElement(s)By*
b@1478 1067 ---------------------------------------------------------------------- */
b@1478 1068
b@1478 1069 // Check if getElementsByTagName("*") returns only elements
b@1478 1070 support.getElementsByTagName = assert(function( div ) {
b@1478 1071 div.appendChild( doc.createComment("") );
b@1478 1072 return !div.getElementsByTagName("*").length;
b@1478 1073 });
b@1478 1074
b@1478 1075 // Support: IE<9
b@1478 1076 support.getElementsByClassName = rnative.test( doc.getElementsByClassName );
b@1478 1077
b@1478 1078 // Support: IE<10
b@1478 1079 // Check if getElementById returns elements by name
b@1478 1080 // The broken getElementById methods don't pick up programatically-set names,
b@1478 1081 // so use a roundabout getElementsByName test
b@1478 1082 support.getById = assert(function( div ) {
b@1478 1083 docElem.appendChild( div ).id = expando;
b@1478 1084 return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
b@1478 1085 });
b@1478 1086
b@1478 1087 // ID find and filter
b@1478 1088 if ( support.getById ) {
b@1478 1089 Expr.find["ID"] = function( id, context ) {
b@1478 1090 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
b@1478 1091 var m = context.getElementById( id );
b@1478 1092 // Check parentNode to catch when Blackberry 4.6 returns
b@1478 1093 // nodes that are no longer in the document #6963
b@1478 1094 return m && m.parentNode ? [ m ] : [];
b@1478 1095 }
b@1478 1096 };
b@1478 1097 Expr.filter["ID"] = function( id ) {
b@1478 1098 var attrId = id.replace( runescape, funescape );
b@1478 1099 return function( elem ) {
b@1478 1100 return elem.getAttribute("id") === attrId;
b@1478 1101 };
b@1478 1102 };
b@1478 1103 } else {
b@1478 1104 // Support: IE6/7
b@1478 1105 // getElementById is not reliable as a find shortcut
b@1478 1106 delete Expr.find["ID"];
b@1478 1107
b@1478 1108 Expr.filter["ID"] = function( id ) {
b@1478 1109 var attrId = id.replace( runescape, funescape );
b@1478 1110 return function( elem ) {
b@1478 1111 var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
b@1478 1112 return node && node.value === attrId;
b@1478 1113 };
b@1478 1114 };
b@1478 1115 }
b@1478 1116
b@1478 1117 // Tag
b@1478 1118 Expr.find["TAG"] = support.getElementsByTagName ?
b@1478 1119 function( tag, context ) {
b@1478 1120 if ( typeof context.getElementsByTagName !== "undefined" ) {
b@1478 1121 return context.getElementsByTagName( tag );
b@1478 1122
b@1478 1123 // DocumentFragment nodes don't have gEBTN
b@1478 1124 } else if ( support.qsa ) {
b@1478 1125 return context.querySelectorAll( tag );
b@1478 1126 }
b@1478 1127 } :
b@1478 1128
b@1478 1129 function( tag, context ) {
b@1478 1130 var elem,
b@1478 1131 tmp = [],
b@1478 1132 i = 0,
b@1478 1133 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
b@1478 1134 results = context.getElementsByTagName( tag );
b@1478 1135
b@1478 1136 // Filter out possible comments
b@1478 1137 if ( tag === "*" ) {
b@1478 1138 while ( (elem = results[i++]) ) {
b@1478 1139 if ( elem.nodeType === 1 ) {
b@1478 1140 tmp.push( elem );
b@1478 1141 }
b@1478 1142 }
b@1478 1143
b@1478 1144 return tmp;
b@1478 1145 }
b@1478 1146 return results;
b@1478 1147 };
b@1478 1148
b@1478 1149 // Class
b@1478 1150 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
b@1478 1151 if ( documentIsHTML ) {
b@1478 1152 return context.getElementsByClassName( className );
b@1478 1153 }
b@1478 1154 };
b@1478 1155
b@1478 1156 /* QSA/matchesSelector
b@1478 1157 ---------------------------------------------------------------------- */
b@1478 1158
b@1478 1159 // QSA and matchesSelector support
b@1478 1160
b@1478 1161 // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
b@1478 1162 rbuggyMatches = [];
b@1478 1163
b@1478 1164 // qSa(:focus) reports false when true (Chrome 21)
b@1478 1165 // We allow this because of a bug in IE8/9 that throws an error
b@1478 1166 // whenever `document.activeElement` is accessed on an iframe
b@1478 1167 // So, we allow :focus to pass through QSA all the time to avoid the IE error
b@1478 1168 // See http://bugs.jquery.com/ticket/13378
b@1478 1169 rbuggyQSA = [];
b@1478 1170
b@1478 1171 if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
b@1478 1172 // Build QSA regex
b@1478 1173 // Regex strategy adopted from Diego Perini
b@1478 1174 assert(function( div ) {
b@1478 1175 // Select is set to empty string on purpose
b@1478 1176 // This is to test IE's treatment of not explicitly
b@1478 1177 // setting a boolean content attribute,
b@1478 1178 // since its presence should be enough
b@1478 1179 // http://bugs.jquery.com/ticket/12359
b@1478 1180 docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" +
b@1478 1181 "<select id='" + expando + "-\f]' msallowcapture=''>" +
b@1478 1182 "<option selected=''></option></select>";
b@1478 1183
b@1478 1184 // Support: IE8, Opera 11-12.16
b@1478 1185 // Nothing should be selected when empty strings follow ^= or $= or *=
b@1478 1186 // The test attribute must be unknown in Opera but "safe" for WinRT
b@1478 1187 // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
b@1478 1188 if ( div.querySelectorAll("[msallowcapture^='']").length ) {
b@1478 1189 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
b@1478 1190 }
b@1478 1191
b@1478 1192 // Support: IE8
b@1478 1193 // Boolean attributes and "value" are not treated correctly
b@1478 1194 if ( !div.querySelectorAll("[selected]").length ) {
b@1478 1195 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
b@1478 1196 }
b@1478 1197
b@1478 1198 // Support: Chrome<29, Android<4.2+, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.7+
b@1478 1199 if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
b@1478 1200 rbuggyQSA.push("~=");
b@1478 1201 }
b@1478 1202
b@1478 1203 // Webkit/Opera - :checked should return selected option elements
b@1478 1204 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
b@1478 1205 // IE8 throws error here and will not see later tests
b@1478 1206 if ( !div.querySelectorAll(":checked").length ) {
b@1478 1207 rbuggyQSA.push(":checked");
b@1478 1208 }
b@1478 1209
b@1478 1210 // Support: Safari 8+, iOS 8+
b@1478 1211 // https://bugs.webkit.org/show_bug.cgi?id=136851
b@1478 1212 // In-page `selector#id sibing-combinator selector` fails
b@1478 1213 if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) {
b@1478 1214 rbuggyQSA.push(".#.+[+~]");
b@1478 1215 }
b@1478 1216 });
b@1478 1217
b@1478 1218 assert(function( div ) {
b@1478 1219 // Support: Windows 8 Native Apps
b@1478 1220 // The type and name attributes are restricted during .innerHTML assignment
b@1478 1221 var input = doc.createElement("input");
b@1478 1222 input.setAttribute( "type", "hidden" );
b@1478 1223 div.appendChild( input ).setAttribute( "name", "D" );
b@1478 1224
b@1478 1225 // Support: IE8
b@1478 1226 // Enforce case-sensitivity of name attribute
b@1478 1227 if ( div.querySelectorAll("[name=d]").length ) {
b@1478 1228 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
b@1478 1229 }
b@1478 1230
b@1478 1231 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
b@1478 1232 // IE8 throws error here and will not see later tests
b@1478 1233 if ( !div.querySelectorAll(":enabled").length ) {
b@1478 1234 rbuggyQSA.push( ":enabled", ":disabled" );
b@1478 1235 }
b@1478 1236
b@1478 1237 // Opera 10-11 does not throw on post-comma invalid pseudos
b@1478 1238 div.querySelectorAll("*,:x");
b@1478 1239 rbuggyQSA.push(",.*:");
b@1478 1240 });
b@1478 1241 }
b@1478 1242
b@1478 1243 if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
b@1478 1244 docElem.webkitMatchesSelector ||
b@1478 1245 docElem.mozMatchesSelector ||
b@1478 1246 docElem.oMatchesSelector ||
b@1478 1247 docElem.msMatchesSelector) )) ) {
b@1478 1248
b@1478 1249 assert(function( div ) {
b@1478 1250 // Check to see if it's possible to do matchesSelector
b@1478 1251 // on a disconnected node (IE 9)
b@1478 1252 support.disconnectedMatch = matches.call( div, "div" );
b@1478 1253
b@1478 1254 // This should fail with an exception
b@1478 1255 // Gecko does not error, returns false instead
b@1478 1256 matches.call( div, "[s!='']:x" );
b@1478 1257 rbuggyMatches.push( "!=", pseudos );
b@1478 1258 });
b@1478 1259 }
b@1478 1260
b@1478 1261 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
b@1478 1262 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
b@1478 1263
b@1478 1264 /* Contains
b@1478 1265 ---------------------------------------------------------------------- */
b@1478 1266 hasCompare = rnative.test( docElem.compareDocumentPosition );
b@1478 1267
b@1478 1268 // Element contains another
b@1478 1269 // Purposefully does not implement inclusive descendent
b@1478 1270 // As in, an element does not contain itself
b@1478 1271 contains = hasCompare || rnative.test( docElem.contains ) ?
b@1478 1272 function( a, b ) {
b@1478 1273 var adown = a.nodeType === 9 ? a.documentElement : a,
b@1478 1274 bup = b && b.parentNode;
b@1478 1275 return a === bup || !!( bup && bup.nodeType === 1 && (
b@1478 1276 adown.contains ?
b@1478 1277 adown.contains( bup ) :
b@1478 1278 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
b@1478 1279 ));
b@1478 1280 } :
b@1478 1281 function( a, b ) {
b@1478 1282 if ( b ) {
b@1478 1283 while ( (b = b.parentNode) ) {
b@1478 1284 if ( b === a ) {
b@1478 1285 return true;
b@1478 1286 }
b@1478 1287 }
b@1478 1288 }
b@1478 1289 return false;
b@1478 1290 };
b@1478 1291
b@1478 1292 /* Sorting
b@1478 1293 ---------------------------------------------------------------------- */
b@1478 1294
b@1478 1295 // Document order sorting
b@1478 1296 sortOrder = hasCompare ?
b@1478 1297 function( a, b ) {
b@1478 1298
b@1478 1299 // Flag for duplicate removal
b@1478 1300 if ( a === b ) {
b@1478 1301 hasDuplicate = true;
b@1478 1302 return 0;
b@1478 1303 }
b@1478 1304
b@1478 1305 // Sort on method existence if only one input has compareDocumentPosition
b@1478 1306 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
b@1478 1307 if ( compare ) {
b@1478 1308 return compare;
b@1478 1309 }
b@1478 1310
b@1478 1311 // Calculate position if both inputs belong to the same document
b@1478 1312 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
b@1478 1313 a.compareDocumentPosition( b ) :
b@1478 1314
b@1478 1315 // Otherwise we know they are disconnected
b@1478 1316 1;
b@1478 1317
b@1478 1318 // Disconnected nodes
b@1478 1319 if ( compare & 1 ||
b@1478 1320 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
b@1478 1321
b@1478 1322 // Choose the first element that is related to our preferred document
b@1478 1323 if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
b@1478 1324 return -1;
b@1478 1325 }
b@1478 1326 if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
b@1478 1327 return 1;
b@1478 1328 }
b@1478 1329
b@1478 1330 // Maintain original order
b@1478 1331 return sortInput ?
b@1478 1332 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
b@1478 1333 0;
b@1478 1334 }
b@1478 1335
b@1478 1336 return compare & 4 ? -1 : 1;
b@1478 1337 } :
b@1478 1338 function( a, b ) {
b@1478 1339 // Exit early if the nodes are identical
b@1478 1340 if ( a === b ) {
b@1478 1341 hasDuplicate = true;
b@1478 1342 return 0;
b@1478 1343 }
b@1478 1344
b@1478 1345 var cur,
b@1478 1346 i = 0,
b@1478 1347 aup = a.parentNode,
b@1478 1348 bup = b.parentNode,
b@1478 1349 ap = [ a ],
b@1478 1350 bp = [ b ];
b@1478 1351
b@1478 1352 // Parentless nodes are either documents or disconnected
b@1478 1353 if ( !aup || !bup ) {
b@1478 1354 return a === doc ? -1 :
b@1478 1355 b === doc ? 1 :
b@1478 1356 aup ? -1 :
b@1478 1357 bup ? 1 :
b@1478 1358 sortInput ?
b@1478 1359 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
b@1478 1360 0;
b@1478 1361
b@1478 1362 // If the nodes are siblings, we can do a quick check
b@1478 1363 } else if ( aup === bup ) {
b@1478 1364 return siblingCheck( a, b );
b@1478 1365 }
b@1478 1366
b@1478 1367 // Otherwise we need full lists of their ancestors for comparison
b@1478 1368 cur = a;
b@1478 1369 while ( (cur = cur.parentNode) ) {
b@1478 1370 ap.unshift( cur );
b@1478 1371 }
b@1478 1372 cur = b;
b@1478 1373 while ( (cur = cur.parentNode) ) {
b@1478 1374 bp.unshift( cur );
b@1478 1375 }
b@1478 1376
b@1478 1377 // Walk down the tree looking for a discrepancy
b@1478 1378 while ( ap[i] === bp[i] ) {
b@1478 1379 i++;
b@1478 1380 }
b@1478 1381
b@1478 1382 return i ?
b@1478 1383 // Do a sibling check if the nodes have a common ancestor
b@1478 1384 siblingCheck( ap[i], bp[i] ) :
b@1478 1385
b@1478 1386 // Otherwise nodes in our document sort first
b@1478 1387 ap[i] === preferredDoc ? -1 :
b@1478 1388 bp[i] === preferredDoc ? 1 :
b@1478 1389 0;
b@1478 1390 };
b@1478 1391
b@1478 1392 return doc;
b@1478 1393 };
b@1478 1394
b@1478 1395 Sizzle.matches = function( expr, elements ) {
b@1478 1396 return Sizzle( expr, null, null, elements );
b@1478 1397 };
b@1478 1398
b@1478 1399 Sizzle.matchesSelector = function( elem, expr ) {
b@1478 1400 // Set document vars if needed
b@1478 1401 if ( ( elem.ownerDocument || elem ) !== document ) {
b@1478 1402 setDocument( elem );
b@1478 1403 }
b@1478 1404
b@1478 1405 // Make sure that attribute selectors are quoted
b@1478 1406 expr = expr.replace( rattributeQuotes, "='$1']" );
b@1478 1407
b@1478 1408 if ( support.matchesSelector && documentIsHTML &&
b@1478 1409 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
b@1478 1410 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
b@1478 1411
b@1478 1412 try {
b@1478 1413 var ret = matches.call( elem, expr );
b@1478 1414
b@1478 1415 // IE 9's matchesSelector returns false on disconnected nodes
b@1478 1416 if ( ret || support.disconnectedMatch ||
b@1478 1417 // As well, disconnected nodes are said to be in a document
b@1478 1418 // fragment in IE 9
b@1478 1419 elem.document && elem.document.nodeType !== 11 ) {
b@1478 1420 return ret;
b@1478 1421 }
b@1478 1422 } catch (e) {}
b@1478 1423 }
b@1478 1424
b@1478 1425 return Sizzle( expr, document, null, [ elem ] ).length > 0;
b@1478 1426 };
b@1478 1427
b@1478 1428 Sizzle.contains = function( context, elem ) {
b@1478 1429 // Set document vars if needed
b@1478 1430 if ( ( context.ownerDocument || context ) !== document ) {
b@1478 1431 setDocument( context );
b@1478 1432 }
b@1478 1433 return contains( context, elem );
b@1478 1434 };
b@1478 1435
b@1478 1436 Sizzle.attr = function( elem, name ) {
b@1478 1437 // Set document vars if needed
b@1478 1438 if ( ( elem.ownerDocument || elem ) !== document ) {
b@1478 1439 setDocument( elem );
b@1478 1440 }
b@1478 1441
b@1478 1442 var fn = Expr.attrHandle[ name.toLowerCase() ],
b@1478 1443 // Don't get fooled by Object.prototype properties (jQuery #13807)
b@1478 1444 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
b@1478 1445 fn( elem, name, !documentIsHTML ) :
b@1478 1446 undefined;
b@1478 1447
b@1478 1448 return val !== undefined ?
b@1478 1449 val :
b@1478 1450 support.attributes || !documentIsHTML ?
b@1478 1451 elem.getAttribute( name ) :
b@1478 1452 (val = elem.getAttributeNode(name)) && val.specified ?
b@1478 1453 val.value :
b@1478 1454 null;
b@1478 1455 };
b@1478 1456
b@1478 1457 Sizzle.error = function( msg ) {
b@1478 1458 throw new Error( "Syntax error, unrecognized expression: " + msg );
b@1478 1459 };
b@1478 1460
b@1478 1461 /**
b@1478 1462 * Document sorting and removing duplicates
b@1478 1463 * @param {ArrayLike} results
b@1478 1464 */
b@1478 1465 Sizzle.uniqueSort = function( results ) {
b@1478 1466 var elem,
b@1478 1467 duplicates = [],
b@1478 1468 j = 0,
b@1478 1469 i = 0;
b@1478 1470
b@1478 1471 // Unless we *know* we can detect duplicates, assume their presence
b@1478 1472 hasDuplicate = !support.detectDuplicates;
b@1478 1473 sortInput = !support.sortStable && results.slice( 0 );
b@1478 1474 results.sort( sortOrder );
b@1478 1475
b@1478 1476 if ( hasDuplicate ) {
b@1478 1477 while ( (elem = results[i++]) ) {
b@1478 1478 if ( elem === results[ i ] ) {
b@1478 1479 j = duplicates.push( i );
b@1478 1480 }
b@1478 1481 }
b@1478 1482 while ( j-- ) {
b@1478 1483 results.splice( duplicates[ j ], 1 );
b@1478 1484 }
b@1478 1485 }
b@1478 1486
b@1478 1487 // Clear input after sorting to release objects
b@1478 1488 // See https://github.com/jquery/sizzle/pull/225
b@1478 1489 sortInput = null;
b@1478 1490
b@1478 1491 return results;
b@1478 1492 };
b@1478 1493
b@1478 1494 /**
b@1478 1495 * Utility function for retrieving the text value of an array of DOM nodes
b@1478 1496 * @param {Array|Element} elem
b@1478 1497 */
b@1478 1498 getText = Sizzle.getText = function( elem ) {
b@1478 1499 var node,
b@1478 1500 ret = "",
b@1478 1501 i = 0,
b@1478 1502 nodeType = elem.nodeType;
b@1478 1503
b@1478 1504 if ( !nodeType ) {
b@1478 1505 // If no nodeType, this is expected to be an array
b@1478 1506 while ( (node = elem[i++]) ) {
b@1478 1507 // Do not traverse comment nodes
b@1478 1508 ret += getText( node );
b@1478 1509 }
b@1478 1510 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
b@1478 1511 // Use textContent for elements
b@1478 1512 // innerText usage removed for consistency of new lines (jQuery #11153)
b@1478 1513 if ( typeof elem.textContent === "string" ) {
b@1478 1514 return elem.textContent;
b@1478 1515 } else {
b@1478 1516 // Traverse its children
b@1478 1517 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
b@1478 1518 ret += getText( elem );
b@1478 1519 }
b@1478 1520 }
b@1478 1521 } else if ( nodeType === 3 || nodeType === 4 ) {
b@1478 1522 return elem.nodeValue;
b@1478 1523 }
b@1478 1524 // Do not include comment or processing instruction nodes
b@1478 1525
b@1478 1526 return ret;
b@1478 1527 };
b@1478 1528
b@1478 1529 Expr = Sizzle.selectors = {
b@1478 1530
b@1478 1531 // Can be adjusted by the user
b@1478 1532 cacheLength: 50,
b@1478 1533
b@1478 1534 createPseudo: markFunction,
b@1478 1535
b@1478 1536 match: matchExpr,
b@1478 1537
b@1478 1538 attrHandle: {},
b@1478 1539
b@1478 1540 find: {},
b@1478 1541
b@1478 1542 relative: {
b@1478 1543 ">": { dir: "parentNode", first: true },
b@1478 1544 " ": { dir: "parentNode" },
b@1478 1545 "+": { dir: "previousSibling", first: true },
b@1478 1546 "~": { dir: "previousSibling" }
b@1478 1547 },
b@1478 1548
b@1478 1549 preFilter: {
b@1478 1550 "ATTR": function( match ) {
b@1478 1551 match[1] = match[1].replace( runescape, funescape );
b@1478 1552
b@1478 1553 // Move the given value to match[3] whether quoted or unquoted
b@1478 1554 match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
b@1478 1555
b@1478 1556 if ( match[2] === "~=" ) {
b@1478 1557 match[3] = " " + match[3] + " ";
b@1478 1558 }
b@1478 1559
b@1478 1560 return match.slice( 0, 4 );
b@1478 1561 },
b@1478 1562
b@1478 1563 "CHILD": function( match ) {
b@1478 1564 /* matches from matchExpr["CHILD"]
b@1478 1565 1 type (only|nth|...)
b@1478 1566 2 what (child|of-type)
b@1478 1567 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
b@1478 1568 4 xn-component of xn+y argument ([+-]?\d*n|)
b@1478 1569 5 sign of xn-component
b@1478 1570 6 x of xn-component
b@1478 1571 7 sign of y-component
b@1478 1572 8 y of y-component
b@1478 1573 */
b@1478 1574 match[1] = match[1].toLowerCase();
b@1478 1575
b@1478 1576 if ( match[1].slice( 0, 3 ) === "nth" ) {
b@1478 1577 // nth-* requires argument
b@1478 1578 if ( !match[3] ) {
b@1478 1579 Sizzle.error( match[0] );
b@1478 1580 }
b@1478 1581
b@1478 1582 // numeric x and y parameters for Expr.filter.CHILD
b@1478 1583 // remember that false/true cast respectively to 0/1
b@1478 1584 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
b@1478 1585 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
b@1478 1586
b@1478 1587 // other types prohibit arguments
b@1478 1588 } else if ( match[3] ) {
b@1478 1589 Sizzle.error( match[0] );
b@1478 1590 }
b@1478 1591
b@1478 1592 return match;
b@1478 1593 },
b@1478 1594
b@1478 1595 "PSEUDO": function( match ) {
b@1478 1596 var excess,
b@1478 1597 unquoted = !match[6] && match[2];
b@1478 1598
b@1478 1599 if ( matchExpr["CHILD"].test( match[0] ) ) {
b@1478 1600 return null;
b@1478 1601 }
b@1478 1602
b@1478 1603 // Accept quoted arguments as-is
b@1478 1604 if ( match[3] ) {
b@1478 1605 match[2] = match[4] || match[5] || "";
b@1478 1606
b@1478 1607 // Strip excess characters from unquoted arguments
b@1478 1608 } else if ( unquoted && rpseudo.test( unquoted ) &&
b@1478 1609 // Get excess from tokenize (recursively)
b@1478 1610 (excess = tokenize( unquoted, true )) &&
b@1478 1611 // advance to the next closing parenthesis
b@1478 1612 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
b@1478 1613
b@1478 1614 // excess is a negative index
b@1478 1615 match[0] = match[0].slice( 0, excess );
b@1478 1616 match[2] = unquoted.slice( 0, excess );
b@1478 1617 }
b@1478 1618
b@1478 1619 // Return only captures needed by the pseudo filter method (type and argument)
b@1478 1620 return match.slice( 0, 3 );
b@1478 1621 }
b@1478 1622 },
b@1478 1623
b@1478 1624 filter: {
b@1478 1625
b@1478 1626 "TAG": function( nodeNameSelector ) {
b@1478 1627 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
b@1478 1628 return nodeNameSelector === "*" ?
b@1478 1629 function() { return true; } :
b@1478 1630 function( elem ) {
b@1478 1631 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
b@1478 1632 };
b@1478 1633 },
b@1478 1634
b@1478 1635 "CLASS": function( className ) {
b@1478 1636 var pattern = classCache[ className + " " ];
b@1478 1637
b@1478 1638 return pattern ||
b@1478 1639 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
b@1478 1640 classCache( className, function( elem ) {
b@1478 1641 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
b@1478 1642 });
b@1478 1643 },
b@1478 1644
b@1478 1645 "ATTR": function( name, operator, check ) {
b@1478 1646 return function( elem ) {
b@1478 1647 var result = Sizzle.attr( elem, name );
b@1478 1648
b@1478 1649 if ( result == null ) {
b@1478 1650 return operator === "!=";
b@1478 1651 }
b@1478 1652 if ( !operator ) {
b@1478 1653 return true;
b@1478 1654 }
b@1478 1655
b@1478 1656 result += "";
b@1478 1657
b@1478 1658 return operator === "=" ? result === check :
b@1478 1659 operator === "!=" ? result !== check :
b@1478 1660 operator === "^=" ? check && result.indexOf( check ) === 0 :
b@1478 1661 operator === "*=" ? check && result.indexOf( check ) > -1 :
b@1478 1662 operator === "$=" ? check && result.slice( -check.length ) === check :
b@1478 1663 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
b@1478 1664 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
b@1478 1665 false;
b@1478 1666 };
b@1478 1667 },
b@1478 1668
b@1478 1669 "CHILD": function( type, what, argument, first, last ) {
b@1478 1670 var simple = type.slice( 0, 3 ) !== "nth",
b@1478 1671 forward = type.slice( -4 ) !== "last",
b@1478 1672 ofType = what === "of-type";
b@1478 1673
b@1478 1674 return first === 1 && last === 0 ?
b@1478 1675
b@1478 1676 // Shortcut for :nth-*(n)
b@1478 1677 function( elem ) {
b@1478 1678 return !!elem.parentNode;
b@1478 1679 } :
b@1478 1680
b@1478 1681 function( elem, context, xml ) {
b@1478 1682 var cache, outerCache, node, diff, nodeIndex, start,
b@1478 1683 dir = simple !== forward ? "nextSibling" : "previousSibling",
b@1478 1684 parent = elem.parentNode,
b@1478 1685 name = ofType && elem.nodeName.toLowerCase(),
b@1478 1686 useCache = !xml && !ofType;
b@1478 1687
b@1478 1688 if ( parent ) {
b@1478 1689
b@1478 1690 // :(first|last|only)-(child|of-type)
b@1478 1691 if ( simple ) {
b@1478 1692 while ( dir ) {
b@1478 1693 node = elem;
b@1478 1694 while ( (node = node[ dir ]) ) {
b@1478 1695 if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
b@1478 1696 return false;
b@1478 1697 }
b@1478 1698 }
b@1478 1699 // Reverse direction for :only-* (if we haven't yet done so)
b@1478 1700 start = dir = type === "only" && !start && "nextSibling";
b@1478 1701 }
b@1478 1702 return true;
b@1478 1703 }
b@1478 1704
b@1478 1705 start = [ forward ? parent.firstChild : parent.lastChild ];
b@1478 1706
b@1478 1707 // non-xml :nth-child(...) stores cache data on `parent`
b@1478 1708 if ( forward && useCache ) {
b@1478 1709 // Seek `elem` from a previously-cached index
b@1478 1710 outerCache = parent[ expando ] || (parent[ expando ] = {});
b@1478 1711 cache = outerCache[ type ] || [];
b@1478 1712 nodeIndex = cache[0] === dirruns && cache[1];
b@1478 1713 diff = cache[0] === dirruns && cache[2];
b@1478 1714 node = nodeIndex && parent.childNodes[ nodeIndex ];
b@1478 1715
b@1478 1716 while ( (node = ++nodeIndex && node && node[ dir ] ||
b@1478 1717
b@1478 1718 // Fallback to seeking `elem` from the start
b@1478 1719 (diff = nodeIndex = 0) || start.pop()) ) {
b@1478 1720
b@1478 1721 // When found, cache indexes on `parent` and break
b@1478 1722 if ( node.nodeType === 1 && ++diff && node === elem ) {
b@1478 1723 outerCache[ type ] = [ dirruns, nodeIndex, diff ];
b@1478 1724 break;
b@1478 1725 }
b@1478 1726 }
b@1478 1727
b@1478 1728 // Use previously-cached element index if available
b@1478 1729 } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
b@1478 1730 diff = cache[1];
b@1478 1731
b@1478 1732 // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
b@1478 1733 } else {
b@1478 1734 // Use the same loop as above to seek `elem` from the start
b@1478 1735 while ( (node = ++nodeIndex && node && node[ dir ] ||
b@1478 1736 (diff = nodeIndex = 0) || start.pop()) ) {
b@1478 1737
b@1478 1738 if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
b@1478 1739 // Cache the index of each encountered element
b@1478 1740 if ( useCache ) {
b@1478 1741 (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
b@1478 1742 }
b@1478 1743
b@1478 1744 if ( node === elem ) {
b@1478 1745 break;
b@1478 1746 }
b@1478 1747 }
b@1478 1748 }
b@1478 1749 }
b@1478 1750
b@1478 1751 // Incorporate the offset, then check against cycle size
b@1478 1752 diff -= last;
b@1478 1753 return diff === first || ( diff % first === 0 && diff / first >= 0 );
b@1478 1754 }
b@1478 1755 };
b@1478 1756 },
b@1478 1757
b@1478 1758 "PSEUDO": function( pseudo, argument ) {
b@1478 1759 // pseudo-class names are case-insensitive
b@1478 1760 // http://www.w3.org/TR/selectors/#pseudo-classes
b@1478 1761 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
b@1478 1762 // Remember that setFilters inherits from pseudos
b@1478 1763 var args,
b@1478 1764 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
b@1478 1765 Sizzle.error( "unsupported pseudo: " + pseudo );
b@1478 1766
b@1478 1767 // The user may use createPseudo to indicate that
b@1478 1768 // arguments are needed to create the filter function
b@1478 1769 // just as Sizzle does
b@1478 1770 if ( fn[ expando ] ) {
b@1478 1771 return fn( argument );
b@1478 1772 }
b@1478 1773
b@1478 1774 // But maintain support for old signatures
b@1478 1775 if ( fn.length > 1 ) {
b@1478 1776 args = [ pseudo, pseudo, "", argument ];
b@1478 1777 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
b@1478 1778 markFunction(function( seed, matches ) {
b@1478 1779 var idx,
b@1478 1780 matched = fn( seed, argument ),
b@1478 1781 i = matched.length;
b@1478 1782 while ( i-- ) {
b@1478 1783 idx = indexOf( seed, matched[i] );
b@1478 1784 seed[ idx ] = !( matches[ idx ] = matched[i] );
b@1478 1785 }
b@1478 1786 }) :
b@1478 1787 function( elem ) {
b@1478 1788 return fn( elem, 0, args );
b@1478 1789 };
b@1478 1790 }
b@1478 1791
b@1478 1792 return fn;
b@1478 1793 }
b@1478 1794 },
b@1478 1795
b@1478 1796 pseudos: {
b@1478 1797 // Potentially complex pseudos
b@1478 1798 "not": markFunction(function( selector ) {
b@1478 1799 // Trim the selector passed to compile
b@1478 1800 // to avoid treating leading and trailing
b@1478 1801 // spaces as combinators
b@1478 1802 var input = [],
b@1478 1803 results = [],
b@1478 1804 matcher = compile( selector.replace( rtrim, "$1" ) );
b@1478 1805
b@1478 1806 return matcher[ expando ] ?
b@1478 1807 markFunction(function( seed, matches, context, xml ) {
b@1478 1808 var elem,
b@1478 1809 unmatched = matcher( seed, null, xml, [] ),
b@1478 1810 i = seed.length;
b@1478 1811
b@1478 1812 // Match elements unmatched by `matcher`
b@1478 1813 while ( i-- ) {
b@1478 1814 if ( (elem = unmatched[i]) ) {
b@1478 1815 seed[i] = !(matches[i] = elem);
b@1478 1816 }
b@1478 1817 }
b@1478 1818 }) :
b@1478 1819 function( elem, context, xml ) {
b@1478 1820 input[0] = elem;
b@1478 1821 matcher( input, null, xml, results );
b@1478 1822 // Don't keep the element (issue #299)
b@1478 1823 input[0] = null;
b@1478 1824 return !results.pop();
b@1478 1825 };
b@1478 1826 }),
b@1478 1827
b@1478 1828 "has": markFunction(function( selector ) {
b@1478 1829 return function( elem ) {
b@1478 1830 return Sizzle( selector, elem ).length > 0;
b@1478 1831 };
b@1478 1832 }),
b@1478 1833
b@1478 1834 "contains": markFunction(function( text ) {
b@1478 1835 text = text.replace( runescape, funescape );
b@1478 1836 return function( elem ) {
b@1478 1837 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
b@1478 1838 };
b@1478 1839 }),
b@1478 1840
b@1478 1841 // "Whether an element is represented by a :lang() selector
b@1478 1842 // is based solely on the element's language value
b@1478 1843 // being equal to the identifier C,
b@1478 1844 // or beginning with the identifier C immediately followed by "-".
b@1478 1845 // The matching of C against the element's language value is performed case-insensitively.
b@1478 1846 // The identifier C does not have to be a valid language name."
b@1478 1847 // http://www.w3.org/TR/selectors/#lang-pseudo
b@1478 1848 "lang": markFunction( function( lang ) {
b@1478 1849 // lang value must be a valid identifier
b@1478 1850 if ( !ridentifier.test(lang || "") ) {
b@1478 1851 Sizzle.error( "unsupported lang: " + lang );
b@1478 1852 }
b@1478 1853 lang = lang.replace( runescape, funescape ).toLowerCase();
b@1478 1854 return function( elem ) {
b@1478 1855 var elemLang;
b@1478 1856 do {
b@1478 1857 if ( (elemLang = documentIsHTML ?
b@1478 1858 elem.lang :
b@1478 1859 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
b@1478 1860
b@1478 1861 elemLang = elemLang.toLowerCase();
b@1478 1862 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
b@1478 1863 }
b@1478 1864 } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
b@1478 1865 return false;
b@1478 1866 };
b@1478 1867 }),
b@1478 1868
b@1478 1869 // Miscellaneous
b@1478 1870 "target": function( elem ) {
b@1478 1871 var hash = window.location && window.location.hash;
b@1478 1872 return hash && hash.slice( 1 ) === elem.id;
b@1478 1873 },
b@1478 1874
b@1478 1875 "root": function( elem ) {
b@1478 1876 return elem === docElem;
b@1478 1877 },
b@1478 1878
b@1478 1879 "focus": function( elem ) {
b@1478 1880 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
b@1478 1881 },
b@1478 1882
b@1478 1883 // Boolean properties
b@1478 1884 "enabled": function( elem ) {
b@1478 1885 return elem.disabled === false;
b@1478 1886 },
b@1478 1887
b@1478 1888 "disabled": function( elem ) {
b@1478 1889 return elem.disabled === true;
b@1478 1890 },
b@1478 1891
b@1478 1892 "checked": function( elem ) {
b@1478 1893 // In CSS3, :checked should return both checked and selected elements
b@1478 1894 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
b@1478 1895 var nodeName = elem.nodeName.toLowerCase();
b@1478 1896 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
b@1478 1897 },
b@1478 1898
b@1478 1899 "selected": function( elem ) {
b@1478 1900 // Accessing this property makes selected-by-default
b@1478 1901 // options in Safari work properly
b@1478 1902 if ( elem.parentNode ) {
b@1478 1903 elem.parentNode.selectedIndex;
b@1478 1904 }
b@1478 1905
b@1478 1906 return elem.selected === true;
b@1478 1907 },
b@1478 1908
b@1478 1909 // Contents
b@1478 1910 "empty": function( elem ) {
b@1478 1911 // http://www.w3.org/TR/selectors/#empty-pseudo
b@1478 1912 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
b@1478 1913 // but not by others (comment: 8; processing instruction: 7; etc.)
b@1478 1914 // nodeType < 6 works because attributes (2) do not appear as children
b@1478 1915 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
b@1478 1916 if ( elem.nodeType < 6 ) {
b@1478 1917 return false;
b@1478 1918 }
b@1478 1919 }
b@1478 1920 return true;
b@1478 1921 },
b@1478 1922
b@1478 1923 "parent": function( elem ) {
b@1478 1924 return !Expr.pseudos["empty"]( elem );
b@1478 1925 },
b@1478 1926
b@1478 1927 // Element/input types
b@1478 1928 "header": function( elem ) {
b@1478 1929 return rheader.test( elem.nodeName );
b@1478 1930 },
b@1478 1931
b@1478 1932 "input": function( elem ) {
b@1478 1933 return rinputs.test( elem.nodeName );
b@1478 1934 },
b@1478 1935
b@1478 1936 "button": function( elem ) {
b@1478 1937 var name = elem.nodeName.toLowerCase();
b@1478 1938 return name === "input" && elem.type === "button" || name === "button";
b@1478 1939 },
b@1478 1940
b@1478 1941 "text": function( elem ) {
b@1478 1942 var attr;
b@1478 1943 return elem.nodeName.toLowerCase() === "input" &&
b@1478 1944 elem.type === "text" &&
b@1478 1945
b@1478 1946 // Support: IE<8
b@1478 1947 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
b@1478 1948 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
b@1478 1949 },
b@1478 1950
b@1478 1951 // Position-in-collection
b@1478 1952 "first": createPositionalPseudo(function() {
b@1478 1953 return [ 0 ];
b@1478 1954 }),
b@1478 1955
b@1478 1956 "last": createPositionalPseudo(function( matchIndexes, length ) {
b@1478 1957 return [ length - 1 ];
b@1478 1958 }),
b@1478 1959
b@1478 1960 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
b@1478 1961 return [ argument < 0 ? argument + length : argument ];
b@1478 1962 }),
b@1478 1963
b@1478 1964 "even": createPositionalPseudo(function( matchIndexes, length ) {
b@1478 1965 var i = 0;
b@1478 1966 for ( ; i < length; i += 2 ) {
b@1478 1967 matchIndexes.push( i );
b@1478 1968 }
b@1478 1969 return matchIndexes;
b@1478 1970 }),
b@1478 1971
b@1478 1972 "odd": createPositionalPseudo(function( matchIndexes, length ) {
b@1478 1973 var i = 1;
b@1478 1974 for ( ; i < length; i += 2 ) {
b@1478 1975 matchIndexes.push( i );
b@1478 1976 }
b@1478 1977 return matchIndexes;
b@1478 1978 }),
b@1478 1979
b@1478 1980 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
b@1478 1981 var i = argument < 0 ? argument + length : argument;
b@1478 1982 for ( ; --i >= 0; ) {
b@1478 1983 matchIndexes.push( i );
b@1478 1984 }
b@1478 1985 return matchIndexes;
b@1478 1986 }),
b@1478 1987
b@1478 1988 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
b@1478 1989 var i = argument < 0 ? argument + length : argument;
b@1478 1990 for ( ; ++i < length; ) {
b@1478 1991 matchIndexes.push( i );
b@1478 1992 }
b@1478 1993 return matchIndexes;
b@1478 1994 })
b@1478 1995 }
b@1478 1996 };
b@1478 1997
b@1478 1998 Expr.pseudos["nth"] = Expr.pseudos["eq"];
b@1478 1999
b@1478 2000 // Add button/input type pseudos
b@1478 2001 for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
b@1478 2002 Expr.pseudos[ i ] = createInputPseudo( i );
b@1478 2003 }
b@1478 2004 for ( i in { submit: true, reset: true } ) {
b@1478 2005 Expr.pseudos[ i ] = createButtonPseudo( i );
b@1478 2006 }
b@1478 2007
b@1478 2008 // Easy API for creating new setFilters
b@1478 2009 function setFilters() {}
b@1478 2010 setFilters.prototype = Expr.filters = Expr.pseudos;
b@1478 2011 Expr.setFilters = new setFilters();
b@1478 2012
b@1478 2013 tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
b@1478 2014 var matched, match, tokens, type,
b@1478 2015 soFar, groups, preFilters,
b@1478 2016 cached = tokenCache[ selector + " " ];
b@1478 2017
b@1478 2018 if ( cached ) {
b@1478 2019 return parseOnly ? 0 : cached.slice( 0 );
b@1478 2020 }
b@1478 2021
b@1478 2022 soFar = selector;
b@1478 2023 groups = [];
b@1478 2024 preFilters = Expr.preFilter;
b@1478 2025
b@1478 2026 while ( soFar ) {
b@1478 2027
b@1478 2028 // Comma and first run
b@1478 2029 if ( !matched || (match = rcomma.exec( soFar )) ) {
b@1478 2030 if ( match ) {
b@1478 2031 // Don't consume trailing commas as valid
b@1478 2032 soFar = soFar.slice( match[0].length ) || soFar;
b@1478 2033 }
b@1478 2034 groups.push( (tokens = []) );
b@1478 2035 }
b@1478 2036
b@1478 2037 matched = false;
b@1478 2038
b@1478 2039 // Combinators
b@1478 2040 if ( (match = rcombinators.exec( soFar )) ) {
b@1478 2041 matched = match.shift();
b@1478 2042 tokens.push({
b@1478 2043 value: matched,
b@1478 2044 // Cast descendant combinators to space
b@1478 2045 type: match[0].replace( rtrim, " " )
b@1478 2046 });
b@1478 2047 soFar = soFar.slice( matched.length );
b@1478 2048 }
b@1478 2049
b@1478 2050 // Filters
b@1478 2051 for ( type in Expr.filter ) {
b@1478 2052 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
b@1478 2053 (match = preFilters[ type ]( match ))) ) {
b@1478 2054 matched = match.shift();
b@1478 2055 tokens.push({
b@1478 2056 value: matched,
b@1478 2057 type: type,
b@1478 2058 matches: match
b@1478 2059 });
b@1478 2060 soFar = soFar.slice( matched.length );
b@1478 2061 }
b@1478 2062 }
b@1478 2063
b@1478 2064 if ( !matched ) {
b@1478 2065 break;
b@1478 2066 }
b@1478 2067 }
b@1478 2068
b@1478 2069 // Return the length of the invalid excess
b@1478 2070 // if we're just parsing
b@1478 2071 // Otherwise, throw an error or return tokens
b@1478 2072 return parseOnly ?
b@1478 2073 soFar.length :
b@1478 2074 soFar ?
b@1478 2075 Sizzle.error( selector ) :
b@1478 2076 // Cache the tokens
b@1478 2077 tokenCache( selector, groups ).slice( 0 );
b@1478 2078 };
b@1478 2079
b@1478 2080 function toSelector( tokens ) {
b@1478 2081 var i = 0,
b@1478 2082 len = tokens.length,
b@1478 2083 selector = "";
b@1478 2084 for ( ; i < len; i++ ) {
b@1478 2085 selector += tokens[i].value;
b@1478 2086 }
b@1478 2087 return selector;
b@1478 2088 }
b@1478 2089
b@1478 2090 function addCombinator( matcher, combinator, base ) {
b@1478 2091 var dir = combinator.dir,
b@1478 2092 checkNonElements = base && dir === "parentNode",
b@1478 2093 doneName = done++;
b@1478 2094
b@1478 2095 return combinator.first ?
b@1478 2096 // Check against closest ancestor/preceding element
b@1478 2097 function( elem, context, xml ) {
b@1478 2098 while ( (elem = elem[ dir ]) ) {
b@1478 2099 if ( elem.nodeType === 1 || checkNonElements ) {
b@1478 2100 return matcher( elem, context, xml );
b@1478 2101 }
b@1478 2102 }
b@1478 2103 } :
b@1478 2104
b@1478 2105 // Check against all ancestor/preceding elements
b@1478 2106 function( elem, context, xml ) {
b@1478 2107 var oldCache, outerCache,
b@1478 2108 newCache = [ dirruns, doneName ];
b@1478 2109
b@1478 2110 // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
b@1478 2111 if ( xml ) {
b@1478 2112 while ( (elem = elem[ dir ]) ) {
b@1478 2113 if ( elem.nodeType === 1 || checkNonElements ) {
b@1478 2114 if ( matcher( elem, context, xml ) ) {
b@1478 2115 return true;
b@1478 2116 }
b@1478 2117 }
b@1478 2118 }
b@1478 2119 } else {
b@1478 2120 while ( (elem = elem[ dir ]) ) {
b@1478 2121 if ( elem.nodeType === 1 || checkNonElements ) {
b@1478 2122 outerCache = elem[ expando ] || (elem[ expando ] = {});
b@1478 2123 if ( (oldCache = outerCache[ dir ]) &&
b@1478 2124 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
b@1478 2125
b@1478 2126 // Assign to newCache so results back-propagate to previous elements
b@1478 2127 return (newCache[ 2 ] = oldCache[ 2 ]);
b@1478 2128 } else {
b@1478 2129 // Reuse newcache so results back-propagate to previous elements
b@1478 2130 outerCache[ dir ] = newCache;
b@1478 2131
b@1478 2132 // A match means we're done; a fail means we have to keep checking
b@1478 2133 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
b@1478 2134 return true;
b@1478 2135 }
b@1478 2136 }
b@1478 2137 }
b@1478 2138 }
b@1478 2139 }
b@1478 2140 };
b@1478 2141 }
b@1478 2142
b@1478 2143 function elementMatcher( matchers ) {
b@1478 2144 return matchers.length > 1 ?
b@1478 2145 function( elem, context, xml ) {
b@1478 2146 var i = matchers.length;
b@1478 2147 while ( i-- ) {
b@1478 2148 if ( !matchers[i]( elem, context, xml ) ) {
b@1478 2149 return false;
b@1478 2150 }
b@1478 2151 }
b@1478 2152 return true;
b@1478 2153 } :
b@1478 2154 matchers[0];
b@1478 2155 }
b@1478 2156
b@1478 2157 function multipleContexts( selector, contexts, results ) {
b@1478 2158 var i = 0,
b@1478 2159 len = contexts.length;
b@1478 2160 for ( ; i < len; i++ ) {
b@1478 2161 Sizzle( selector, contexts[i], results );
b@1478 2162 }
b@1478 2163 return results;
b@1478 2164 }
b@1478 2165
b@1478 2166 function condense( unmatched, map, filter, context, xml ) {
b@1478 2167 var elem,
b@1478 2168 newUnmatched = [],
b@1478 2169 i = 0,
b@1478 2170 len = unmatched.length,
b@1478 2171 mapped = map != null;
b@1478 2172
b@1478 2173 for ( ; i < len; i++ ) {
b@1478 2174 if ( (elem = unmatched[i]) ) {
b@1478 2175 if ( !filter || filter( elem, context, xml ) ) {
b@1478 2176 newUnmatched.push( elem );
b@1478 2177 if ( mapped ) {
b@1478 2178 map.push( i );
b@1478 2179 }
b@1478 2180 }
b@1478 2181 }
b@1478 2182 }
b@1478 2183
b@1478 2184 return newUnmatched;
b@1478 2185 }
b@1478 2186
b@1478 2187 function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
b@1478 2188 if ( postFilter && !postFilter[ expando ] ) {
b@1478 2189 postFilter = setMatcher( postFilter );
b@1478 2190 }
b@1478 2191 if ( postFinder && !postFinder[ expando ] ) {
b@1478 2192 postFinder = setMatcher( postFinder, postSelector );
b@1478 2193 }
b@1478 2194 return markFunction(function( seed, results, context, xml ) {
b@1478 2195 var temp, i, elem,
b@1478 2196 preMap = [],
b@1478 2197 postMap = [],
b@1478 2198 preexisting = results.length,
b@1478 2199
b@1478 2200 // Get initial elements from seed or context
b@1478 2201 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
b@1478 2202
b@1478 2203 // Prefilter to get matcher input, preserving a map for seed-results synchronization
b@1478 2204 matcherIn = preFilter && ( seed || !selector ) ?
b@1478 2205 condense( elems, preMap, preFilter, context, xml ) :
b@1478 2206 elems,
b@1478 2207
b@1478 2208 matcherOut = matcher ?
b@1478 2209 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
b@1478 2210 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
b@1478 2211
b@1478 2212 // ...intermediate processing is necessary
b@1478 2213 [] :
b@1478 2214
b@1478 2215 // ...otherwise use results directly
b@1478 2216 results :
b@1478 2217 matcherIn;
b@1478 2218
b@1478 2219 // Find primary matches
b@1478 2220 if ( matcher ) {
b@1478 2221 matcher( matcherIn, matcherOut, context, xml );
b@1478 2222 }
b@1478 2223
b@1478 2224 // Apply postFilter
b@1478 2225 if ( postFilter ) {
b@1478 2226 temp = condense( matcherOut, postMap );
b@1478 2227 postFilter( temp, [], context, xml );
b@1478 2228
b@1478 2229 // Un-match failing elements by moving them back to matcherIn
b@1478 2230 i = temp.length;
b@1478 2231 while ( i-- ) {
b@1478 2232 if ( (elem = temp[i]) ) {
b@1478 2233 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
b@1478 2234 }
b@1478 2235 }
b@1478 2236 }
b@1478 2237
b@1478 2238 if ( seed ) {
b@1478 2239 if ( postFinder || preFilter ) {
b@1478 2240 if ( postFinder ) {
b@1478 2241 // Get the final matcherOut by condensing this intermediate into postFinder contexts
b@1478 2242 temp = [];
b@1478 2243 i = matcherOut.length;
b@1478 2244 while ( i-- ) {
b@1478 2245 if ( (elem = matcherOut[i]) ) {
b@1478 2246 // Restore matcherIn since elem is not yet a final match
b@1478 2247 temp.push( (matcherIn[i] = elem) );
b@1478 2248 }
b@1478 2249 }
b@1478 2250 postFinder( null, (matcherOut = []), temp, xml );
b@1478 2251 }
b@1478 2252
b@1478 2253 // Move matched elements from seed to results to keep them synchronized
b@1478 2254 i = matcherOut.length;
b@1478 2255 while ( i-- ) {
b@1478 2256 if ( (elem = matcherOut[i]) &&
b@1478 2257 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
b@1478 2258
b@1478 2259 seed[temp] = !(results[temp] = elem);
b@1478 2260 }
b@1478 2261 }
b@1478 2262 }
b@1478 2263
b@1478 2264 // Add elements to results, through postFinder if defined
b@1478 2265 } else {
b@1478 2266 matcherOut = condense(
b@1478 2267 matcherOut === results ?
b@1478 2268 matcherOut.splice( preexisting, matcherOut.length ) :
b@1478 2269 matcherOut
b@1478 2270 );
b@1478 2271 if ( postFinder ) {
b@1478 2272 postFinder( null, results, matcherOut, xml );
b@1478 2273 } else {
b@1478 2274 push.apply( results, matcherOut );
b@1478 2275 }
b@1478 2276 }
b@1478 2277 });
b@1478 2278 }
b@1478 2279
b@1478 2280 function matcherFromTokens( tokens ) {
b@1478 2281 var checkContext, matcher, j,
b@1478 2282 len = tokens.length,
b@1478 2283 leadingRelative = Expr.relative[ tokens[0].type ],
b@1478 2284 implicitRelative = leadingRelative || Expr.relative[" "],
b@1478 2285 i = leadingRelative ? 1 : 0,
b@1478 2286
b@1478 2287 // The foundational matcher ensures that elements are reachable from top-level context(s)
b@1478 2288 matchContext = addCombinator( function( elem ) {
b@1478 2289 return elem === checkContext;
b@1478 2290 }, implicitRelative, true ),
b@1478 2291 matchAnyContext = addCombinator( function( elem ) {
b@1478 2292 return indexOf( checkContext, elem ) > -1;
b@1478 2293 }, implicitRelative, true ),
b@1478 2294 matchers = [ function( elem, context, xml ) {
b@1478 2295 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
b@1478 2296 (checkContext = context).nodeType ?
b@1478 2297 matchContext( elem, context, xml ) :
b@1478 2298 matchAnyContext( elem, context, xml ) );
b@1478 2299 // Avoid hanging onto element (issue #299)
b@1478 2300 checkContext = null;
b@1478 2301 return ret;
b@1478 2302 } ];
b@1478 2303
b@1478 2304 for ( ; i < len; i++ ) {
b@1478 2305 if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
b@1478 2306 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
b@1478 2307 } else {
b@1478 2308 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
b@1478 2309
b@1478 2310 // Return special upon seeing a positional matcher
b@1478 2311 if ( matcher[ expando ] ) {
b@1478 2312 // Find the next relative operator (if any) for proper handling
b@1478 2313 j = ++i;
b@1478 2314 for ( ; j < len; j++ ) {
b@1478 2315 if ( Expr.relative[ tokens[j].type ] ) {
b@1478 2316 break;
b@1478 2317 }
b@1478 2318 }
b@1478 2319 return setMatcher(
b@1478 2320 i > 1 && elementMatcher( matchers ),
b@1478 2321 i > 1 && toSelector(
b@1478 2322 // If the preceding token was a descendant combinator, insert an implicit any-element `*`
b@1478 2323 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
b@1478 2324 ).replace( rtrim, "$1" ),
b@1478 2325 matcher,
b@1478 2326 i < j && matcherFromTokens( tokens.slice( i, j ) ),
b@1478 2327 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
b@1478 2328 j < len && toSelector( tokens )
b@1478 2329 );
b@1478 2330 }
b@1478 2331 matchers.push( matcher );
b@1478 2332 }
b@1478 2333 }
b@1478 2334
b@1478 2335 return elementMatcher( matchers );
b@1478 2336 }
b@1478 2337
b@1478 2338 function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
b@1478 2339 var bySet = setMatchers.length > 0,
b@1478 2340 byElement = elementMatchers.length > 0,
b@1478 2341 superMatcher = function( seed, context, xml, results, outermost ) {
b@1478 2342 var elem, j, matcher,
b@1478 2343 matchedCount = 0,
b@1478 2344 i = "0",
b@1478 2345 unmatched = seed && [],
b@1478 2346 setMatched = [],
b@1478 2347 contextBackup = outermostContext,
b@1478 2348 // We must always have either seed elements or outermost context
b@1478 2349 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
b@1478 2350 // Use integer dirruns iff this is the outermost matcher
b@1478 2351 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
b@1478 2352 len = elems.length;
b@1478 2353
b@1478 2354 if ( outermost ) {
b@1478 2355 outermostContext = context !== document && context;
b@1478 2356 }
b@1478 2357
b@1478 2358 // Add elements passing elementMatchers directly to results
b@1478 2359 // Keep `i` a string if there are no elements so `matchedCount` will be "00" below
b@1478 2360 // Support: IE<9, Safari
b@1478 2361 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
b@1478 2362 for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
b@1478 2363 if ( byElement && elem ) {
b@1478 2364 j = 0;
b@1478 2365 while ( (matcher = elementMatchers[j++]) ) {
b@1478 2366 if ( matcher( elem, context, xml ) ) {
b@1478 2367 results.push( elem );
b@1478 2368 break;
b@1478 2369 }
b@1478 2370 }
b@1478 2371 if ( outermost ) {
b@1478 2372 dirruns = dirrunsUnique;
b@1478 2373 }
b@1478 2374 }
b@1478 2375
b@1478 2376 // Track unmatched elements for set filters
b@1478 2377 if ( bySet ) {
b@1478 2378 // They will have gone through all possible matchers
b@1478 2379 if ( (elem = !matcher && elem) ) {
b@1478 2380 matchedCount--;
b@1478 2381 }
b@1478 2382
b@1478 2383 // Lengthen the array for every element, matched or not
b@1478 2384 if ( seed ) {
b@1478 2385 unmatched.push( elem );
b@1478 2386 }
b@1478 2387 }
b@1478 2388 }
b@1478 2389
b@1478 2390 // Apply set filters to unmatched elements
b@1478 2391 matchedCount += i;
b@1478 2392 if ( bySet && i !== matchedCount ) {
b@1478 2393 j = 0;
b@1478 2394 while ( (matcher = setMatchers[j++]) ) {
b@1478 2395 matcher( unmatched, setMatched, context, xml );
b@1478 2396 }
b@1478 2397
b@1478 2398 if ( seed ) {
b@1478 2399 // Reintegrate element matches to eliminate the need for sorting
b@1478 2400 if ( matchedCount > 0 ) {
b@1478 2401 while ( i-- ) {
b@1478 2402 if ( !(unmatched[i] || setMatched[i]) ) {
b@1478 2403 setMatched[i] = pop.call( results );
b@1478 2404 }
b@1478 2405 }
b@1478 2406 }
b@1478 2407
b@1478 2408 // Discard index placeholder values to get only actual matches
b@1478 2409 setMatched = condense( setMatched );
b@1478 2410 }
b@1478 2411
b@1478 2412 // Add matches to results
b@1478 2413 push.apply( results, setMatched );
b@1478 2414
b@1478 2415 // Seedless set matches succeeding multiple successful matchers stipulate sorting
b@1478 2416 if ( outermost && !seed && setMatched.length > 0 &&
b@1478 2417 ( matchedCount + setMatchers.length ) > 1 ) {
b@1478 2418
b@1478 2419 Sizzle.uniqueSort( results );
b@1478 2420 }
b@1478 2421 }
b@1478 2422
b@1478 2423 // Override manipulation of globals by nested matchers
b@1478 2424 if ( outermost ) {
b@1478 2425 dirruns = dirrunsUnique;
b@1478 2426 outermostContext = contextBackup;
b@1478 2427 }
b@1478 2428
b@1478 2429 return unmatched;
b@1478 2430 };
b@1478 2431
b@1478 2432 return bySet ?
b@1478 2433 markFunction( superMatcher ) :
b@1478 2434 superMatcher;
b@1478 2435 }
b@1478 2436
b@1478 2437 compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
b@1478 2438 var i,
b@1478 2439 setMatchers = [],
b@1478 2440 elementMatchers = [],
b@1478 2441 cached = compilerCache[ selector + " " ];
b@1478 2442
b@1478 2443 if ( !cached ) {
b@1478 2444 // Generate a function of recursive functions that can be used to check each element
b@1478 2445 if ( !match ) {
b@1478 2446 match = tokenize( selector );
b@1478 2447 }
b@1478 2448 i = match.length;
b@1478 2449 while ( i-- ) {
b@1478 2450 cached = matcherFromTokens( match[i] );
b@1478 2451 if ( cached[ expando ] ) {
b@1478 2452 setMatchers.push( cached );
b@1478 2453 } else {
b@1478 2454 elementMatchers.push( cached );
b@1478 2455 }
b@1478 2456 }
b@1478 2457
b@1478 2458 // Cache the compiled function
b@1478 2459 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
b@1478 2460
b@1478 2461 // Save selector and tokenization
b@1478 2462 cached.selector = selector;
b@1478 2463 }
b@1478 2464 return cached;
b@1478 2465 };
b@1478 2466
b@1478 2467 /**
b@1478 2468 * A low-level selection function that works with Sizzle's compiled
b@1478 2469 * selector functions
b@1478 2470 * @param {String|Function} selector A selector or a pre-compiled
b@1478 2471 * selector function built with Sizzle.compile
b@1478 2472 * @param {Element} context
b@1478 2473 * @param {Array} [results]
b@1478 2474 * @param {Array} [seed] A set of elements to match against
b@1478 2475 */
b@1478 2476 select = Sizzle.select = function( selector, context, results, seed ) {
b@1478 2477 var i, tokens, token, type, find,
b@1478 2478 compiled = typeof selector === "function" && selector,
b@1478 2479 match = !seed && tokenize( (selector = compiled.selector || selector) );
b@1478 2480
b@1478 2481 results = results || [];
b@1478 2482
b@1478 2483 // Try to minimize operations if there is no seed and only one group
b@1478 2484 if ( match.length === 1 ) {
b@1478 2485
b@1478 2486 // Take a shortcut and set the context if the root selector is an ID
b@1478 2487 tokens = match[0] = match[0].slice( 0 );
b@1478 2488 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
b@1478 2489 support.getById && context.nodeType === 9 && documentIsHTML &&
b@1478 2490 Expr.relative[ tokens[1].type ] ) {
b@1478 2491
b@1478 2492 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
b@1478 2493 if ( !context ) {
b@1478 2494 return results;
b@1478 2495
b@1478 2496 // Precompiled matchers will still verify ancestry, so step up a level
b@1478 2497 } else if ( compiled ) {
b@1478 2498 context = context.parentNode;
b@1478 2499 }
b@1478 2500
b@1478 2501 selector = selector.slice( tokens.shift().value.length );
b@1478 2502 }
b@1478 2503
b@1478 2504 // Fetch a seed set for right-to-left matching
b@1478 2505 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
b@1478 2506 while ( i-- ) {
b@1478 2507 token = tokens[i];
b@1478 2508
b@1478 2509 // Abort if we hit a combinator
b@1478 2510 if ( Expr.relative[ (type = token.type) ] ) {
b@1478 2511 break;
b@1478 2512 }
b@1478 2513 if ( (find = Expr.find[ type ]) ) {
b@1478 2514 // Search, expanding context for leading sibling combinators
b@1478 2515 if ( (seed = find(
b@1478 2516 token.matches[0].replace( runescape, funescape ),
b@1478 2517 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
b@1478 2518 )) ) {
b@1478 2519
b@1478 2520 // If seed is empty or no tokens remain, we can return early
b@1478 2521 tokens.splice( i, 1 );
b@1478 2522 selector = seed.length && toSelector( tokens );
b@1478 2523 if ( !selector ) {
b@1478 2524 push.apply( results, seed );
b@1478 2525 return results;
b@1478 2526 }
b@1478 2527
b@1478 2528 break;
b@1478 2529 }
b@1478 2530 }
b@1478 2531 }
b@1478 2532 }
b@1478 2533
b@1478 2534 // Compile and execute a filtering function if one is not provided
b@1478 2535 // Provide `match` to avoid retokenization if we modified the selector above
b@1478 2536 ( compiled || compile( selector, match ) )(
b@1478 2537 seed,
b@1478 2538 context,
b@1478 2539 !documentIsHTML,
b@1478 2540 results,
b@1478 2541 rsibling.test( selector ) && testContext( context.parentNode ) || context
b@1478 2542 );
b@1478 2543 return results;
b@1478 2544 };
b@1478 2545
b@1478 2546 // One-time assignments
b@1478 2547
b@1478 2548 // Sort stability
b@1478 2549 support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
b@1478 2550
b@1478 2551 // Support: Chrome 14-35+
b@1478 2552 // Always assume duplicates if they aren't passed to the comparison function
b@1478 2553 support.detectDuplicates = !!hasDuplicate;
b@1478 2554
b@1478 2555 // Initialize against the default document
b@1478 2556 setDocument();
b@1478 2557
b@1478 2558 // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
b@1478 2559 // Detached nodes confoundingly follow *each other*
b@1478 2560 support.sortDetached = assert(function( div1 ) {
b@1478 2561 // Should return 1, but returns 4 (following)
b@1478 2562 return div1.compareDocumentPosition( document.createElement("div") ) & 1;
b@1478 2563 });
b@1478 2564
b@1478 2565 // Support: IE<8
b@1478 2566 // Prevent attribute/property "interpolation"
b@1478 2567 // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
b@1478 2568 if ( !assert(function( div ) {
b@1478 2569 div.innerHTML = "<a href='#'></a>";
b@1478 2570 return div.firstChild.getAttribute("href") === "#" ;
b@1478 2571 }) ) {
b@1478 2572 addHandle( "type|href|height|width", function( elem, name, isXML ) {
b@1478 2573 if ( !isXML ) {
b@1478 2574 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
b@1478 2575 }
b@1478 2576 });
b@1478 2577 }
b@1478 2578
b@1478 2579 // Support: IE<9
b@1478 2580 // Use defaultValue in place of getAttribute("value")
b@1478 2581 if ( !support.attributes || !assert(function( div ) {
b@1478 2582 div.innerHTML = "<input/>";
b@1478 2583 div.firstChild.setAttribute( "value", "" );
b@1478 2584 return div.firstChild.getAttribute( "value" ) === "";
b@1478 2585 }) ) {
b@1478 2586 addHandle( "value", function( elem, name, isXML ) {
b@1478 2587 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
b@1478 2588 return elem.defaultValue;
b@1478 2589 }
b@1478 2590 });
b@1478 2591 }
b@1478 2592
b@1478 2593 // Support: IE<9
b@1478 2594 // Use getAttributeNode to fetch booleans when getAttribute lies
b@1478 2595 if ( !assert(function( div ) {
b@1478 2596 return div.getAttribute("disabled") == null;
b@1478 2597 }) ) {
b@1478 2598 addHandle( booleans, function( elem, name, isXML ) {
b@1478 2599 var val;
b@1478 2600 if ( !isXML ) {
b@1478 2601 return elem[ name ] === true ? name.toLowerCase() :
b@1478 2602 (val = elem.getAttributeNode( name )) && val.specified ?
b@1478 2603 val.value :
b@1478 2604 null;
b@1478 2605 }
b@1478 2606 });
b@1478 2607 }
b@1478 2608
b@1478 2609 return Sizzle;
b@1478 2610
b@1478 2611 })( window );
b@1478 2612
b@1478 2613
b@1478 2614
b@1478 2615 jQuery.find = Sizzle;
b@1478 2616 jQuery.expr = Sizzle.selectors;
b@1478 2617 jQuery.expr[":"] = jQuery.expr.pseudos;
b@1478 2618 jQuery.unique = Sizzle.uniqueSort;
b@1478 2619 jQuery.text = Sizzle.getText;
b@1478 2620 jQuery.isXMLDoc = Sizzle.isXML;
b@1478 2621 jQuery.contains = Sizzle.contains;
b@1478 2622
b@1478 2623
b@1478 2624
b@1478 2625 var rneedsContext = jQuery.expr.match.needsContext;
b@1478 2626
b@1478 2627 var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
b@1478 2628
b@1478 2629
b@1478 2630
b@1478 2631 var risSimple = /^.[^:#\[\.,]*$/;
b@1478 2632
b@1478 2633 // Implement the identical functionality for filter and not
b@1478 2634 function winnow( elements, qualifier, not ) {
b@1478 2635 if ( jQuery.isFunction( qualifier ) ) {
b@1478 2636 return jQuery.grep( elements, function( elem, i ) {
b@1478 2637 /* jshint -W018 */
b@1478 2638 return !!qualifier.call( elem, i, elem ) !== not;
b@1478 2639 });
b@1478 2640
b@1478 2641 }
b@1478 2642
b@1478 2643 if ( qualifier.nodeType ) {
b@1478 2644 return jQuery.grep( elements, function( elem ) {
b@1478 2645 return ( elem === qualifier ) !== not;
b@1478 2646 });
b@1478 2647
b@1478 2648 }
b@1478 2649
b@1478 2650 if ( typeof qualifier === "string" ) {
b@1478 2651 if ( risSimple.test( qualifier ) ) {
b@1478 2652 return jQuery.filter( qualifier, elements, not );
b@1478 2653 }
b@1478 2654
b@1478 2655 qualifier = jQuery.filter( qualifier, elements );
b@1478 2656 }
b@1478 2657
b@1478 2658 return jQuery.grep( elements, function( elem ) {
b@1478 2659 return ( indexOf.call( qualifier, elem ) >= 0 ) !== not;
b@1478 2660 });
b@1478 2661 }
b@1478 2662
b@1478 2663 jQuery.filter = function( expr, elems, not ) {
b@1478 2664 var elem = elems[ 0 ];
b@1478 2665
b@1478 2666 if ( not ) {
b@1478 2667 expr = ":not(" + expr + ")";
b@1478 2668 }
b@1478 2669
b@1478 2670 return elems.length === 1 && elem.nodeType === 1 ?
b@1478 2671 jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
b@1478 2672 jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
b@1478 2673 return elem.nodeType === 1;
b@1478 2674 }));
b@1478 2675 };
b@1478 2676
b@1478 2677 jQuery.fn.extend({
b@1478 2678 find: function( selector ) {
b@1478 2679 var i,
b@1478 2680 len = this.length,
b@1478 2681 ret = [],
b@1478 2682 self = this;
b@1478 2683
b@1478 2684 if ( typeof selector !== "string" ) {
b@1478 2685 return this.pushStack( jQuery( selector ).filter(function() {
b@1478 2686 for ( i = 0; i < len; i++ ) {
b@1478 2687 if ( jQuery.contains( self[ i ], this ) ) {
b@1478 2688 return true;
b@1478 2689 }
b@1478 2690 }
b@1478 2691 }) );
b@1478 2692 }
b@1478 2693
b@1478 2694 for ( i = 0; i < len; i++ ) {
b@1478 2695 jQuery.find( selector, self[ i ], ret );
b@1478 2696 }
b@1478 2697
b@1478 2698 // Needed because $( selector, context ) becomes $( context ).find( selector )
b@1478 2699 ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
b@1478 2700 ret.selector = this.selector ? this.selector + " " + selector : selector;
b@1478 2701 return ret;
b@1478 2702 },
b@1478 2703 filter: function( selector ) {
b@1478 2704 return this.pushStack( winnow(this, selector || [], false) );
b@1478 2705 },
b@1478 2706 not: function( selector ) {
b@1478 2707 return this.pushStack( winnow(this, selector || [], true) );
b@1478 2708 },
b@1478 2709 is: function( selector ) {
b@1478 2710 return !!winnow(
b@1478 2711 this,
b@1478 2712
b@1478 2713 // If this is a positional/relative selector, check membership in the returned set
b@1478 2714 // so $("p:first").is("p:last") won't return true for a doc with two "p".
b@1478 2715 typeof selector === "string" && rneedsContext.test( selector ) ?
b@1478 2716 jQuery( selector ) :
b@1478 2717 selector || [],
b@1478 2718 false
b@1478 2719 ).length;
b@1478 2720 }
b@1478 2721 });
b@1478 2722
b@1478 2723
b@1478 2724 // Initialize a jQuery object
b@1478 2725
b@1478 2726
b@1478 2727 // A central reference to the root jQuery(document)
b@1478 2728 var rootjQuery,
b@1478 2729
b@1478 2730 // A simple way to check for HTML strings
b@1478 2731 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
b@1478 2732 // Strict HTML recognition (#11290: must start with <)
b@1478 2733 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
b@1478 2734
b@1478 2735 init = jQuery.fn.init = function( selector, context ) {
b@1478 2736 var match, elem;
b@1478 2737
b@1478 2738 // HANDLE: $(""), $(null), $(undefined), $(false)
b@1478 2739 if ( !selector ) {
b@1478 2740 return this;
b@1478 2741 }
b@1478 2742
b@1478 2743 // Handle HTML strings
b@1478 2744 if ( typeof selector === "string" ) {
b@1478 2745 if ( selector[0] === "<" && selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) {
b@1478 2746 // Assume that strings that start and end with <> are HTML and skip the regex check
b@1478 2747 match = [ null, selector, null ];
b@1478 2748
b@1478 2749 } else {
b@1478 2750 match = rquickExpr.exec( selector );
b@1478 2751 }
b@1478 2752
b@1478 2753 // Match html or make sure no context is specified for #id
b@1478 2754 if ( match && (match[1] || !context) ) {
b@1478 2755
b@1478 2756 // HANDLE: $(html) -> $(array)
b@1478 2757 if ( match[1] ) {
b@1478 2758 context = context instanceof jQuery ? context[0] : context;
b@1478 2759
b@1478 2760 // Option to run scripts is true for back-compat
b@1478 2761 // Intentionally let the error be thrown if parseHTML is not present
b@1478 2762 jQuery.merge( this, jQuery.parseHTML(
b@1478 2763 match[1],
b@1478 2764 context && context.nodeType ? context.ownerDocument || context : document,
b@1478 2765 true
b@1478 2766 ) );
b@1478 2767
b@1478 2768 // HANDLE: $(html, props)
b@1478 2769 if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
b@1478 2770 for ( match in context ) {
b@1478 2771 // Properties of context are called as methods if possible
b@1478 2772 if ( jQuery.isFunction( this[ match ] ) ) {
b@1478 2773 this[ match ]( context[ match ] );
b@1478 2774
b@1478 2775 // ...and otherwise set as attributes
b@1478 2776 } else {
b@1478 2777 this.attr( match, context[ match ] );
b@1478 2778 }
b@1478 2779 }
b@1478 2780 }
b@1478 2781
b@1478 2782 return this;
b@1478 2783
b@1478 2784 // HANDLE: $(#id)
b@1478 2785 } else {
b@1478 2786 elem = document.getElementById( match[2] );
b@1478 2787
b@1478 2788 // Support: Blackberry 4.6
b@1478 2789 // gEBID returns nodes no longer in the document (#6963)
b@1478 2790 if ( elem && elem.parentNode ) {
b@1478 2791 // Inject the element directly into the jQuery object
b@1478 2792 this.length = 1;
b@1478 2793 this[0] = elem;
b@1478 2794 }
b@1478 2795
b@1478 2796 this.context = document;
b@1478 2797 this.selector = selector;
b@1478 2798 return this;
b@1478 2799 }
b@1478 2800
b@1478 2801 // HANDLE: $(expr, $(...))
b@1478 2802 } else if ( !context || context.jquery ) {
b@1478 2803 return ( context || rootjQuery ).find( selector );
b@1478 2804
b@1478 2805 // HANDLE: $(expr, context)
b@1478 2806 // (which is just equivalent to: $(context).find(expr)
b@1478 2807 } else {
b@1478 2808 return this.constructor( context ).find( selector );
b@1478 2809 }
b@1478 2810
b@1478 2811 // HANDLE: $(DOMElement)
b@1478 2812 } else if ( selector.nodeType ) {
b@1478 2813 this.context = this[0] = selector;
b@1478 2814 this.length = 1;
b@1478 2815 return this;
b@1478 2816
b@1478 2817 // HANDLE: $(function)
b@1478 2818 // Shortcut for document ready
b@1478 2819 } else if ( jQuery.isFunction( selector ) ) {
b@1478 2820 return typeof rootjQuery.ready !== "undefined" ?
b@1478 2821 rootjQuery.ready( selector ) :
b@1478 2822 // Execute immediately if ready is not present
b@1478 2823 selector( jQuery );
b@1478 2824 }
b@1478 2825
b@1478 2826 if ( selector.selector !== undefined ) {
b@1478 2827 this.selector = selector.selector;
b@1478 2828 this.context = selector.context;
b@1478 2829 }
b@1478 2830
b@1478 2831 return jQuery.makeArray( selector, this );
b@1478 2832 };
b@1478 2833
b@1478 2834 // Give the init function the jQuery prototype for later instantiation
b@1478 2835 init.prototype = jQuery.fn;
b@1478 2836
b@1478 2837 // Initialize central reference
b@1478 2838 rootjQuery = jQuery( document );
b@1478 2839
b@1478 2840
b@1478 2841 var rparentsprev = /^(?:parents|prev(?:Until|All))/,
b@1478 2842 // Methods guaranteed to produce a unique set when starting from a unique set
b@1478 2843 guaranteedUnique = {
b@1478 2844 children: true,
b@1478 2845 contents: true,
b@1478 2846 next: true,
b@1478 2847 prev: true
b@1478 2848 };
b@1478 2849
b@1478 2850 jQuery.extend({
b@1478 2851 dir: function( elem, dir, until ) {
b@1478 2852 var matched = [],
b@1478 2853 truncate = until !== undefined;
b@1478 2854
b@1478 2855 while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) {
b@1478 2856 if ( elem.nodeType === 1 ) {
b@1478 2857 if ( truncate && jQuery( elem ).is( until ) ) {
b@1478 2858 break;
b@1478 2859 }
b@1478 2860 matched.push( elem );
b@1478 2861 }
b@1478 2862 }
b@1478 2863 return matched;
b@1478 2864 },
b@1478 2865
b@1478 2866 sibling: function( n, elem ) {
b@1478 2867 var matched = [];
b@1478 2868
b@1478 2869 for ( ; n; n = n.nextSibling ) {
b@1478 2870 if ( n.nodeType === 1 && n !== elem ) {
b@1478 2871 matched.push( n );
b@1478 2872 }
b@1478 2873 }
b@1478 2874
b@1478 2875 return matched;
b@1478 2876 }
b@1478 2877 });
b@1478 2878
b@1478 2879 jQuery.fn.extend({
b@1478 2880 has: function( target ) {
b@1478 2881 var targets = jQuery( target, this ),
b@1478 2882 l = targets.length;
b@1478 2883
b@1478 2884 return this.filter(function() {
b@1478 2885 var i = 0;
b@1478 2886 for ( ; i < l; i++ ) {
b@1478 2887 if ( jQuery.contains( this, targets[i] ) ) {
b@1478 2888 return true;
b@1478 2889 }
b@1478 2890 }
b@1478 2891 });
b@1478 2892 },
b@1478 2893
b@1478 2894 closest: function( selectors, context ) {
b@1478 2895 var cur,
b@1478 2896 i = 0,
b@1478 2897 l = this.length,
b@1478 2898 matched = [],
b@1478 2899 pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
b@1478 2900 jQuery( selectors, context || this.context ) :
b@1478 2901 0;
b@1478 2902
b@1478 2903 for ( ; i < l; i++ ) {
b@1478 2904 for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
b@1478 2905 // Always skip document fragments
b@1478 2906 if ( cur.nodeType < 11 && (pos ?
b@1478 2907 pos.index(cur) > -1 :
b@1478 2908
b@1478 2909 // Don't pass non-elements to Sizzle
b@1478 2910 cur.nodeType === 1 &&
b@1478 2911 jQuery.find.matchesSelector(cur, selectors)) ) {
b@1478 2912
b@1478 2913 matched.push( cur );
b@1478 2914 break;
b@1478 2915 }
b@1478 2916 }
b@1478 2917 }
b@1478 2918
b@1478 2919 return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched );
b@1478 2920 },
b@1478 2921
b@1478 2922 // Determine the position of an element within the set
b@1478 2923 index: function( elem ) {
b@1478 2924
b@1478 2925 // No argument, return index in parent
b@1478 2926 if ( !elem ) {
b@1478 2927 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
b@1478 2928 }
b@1478 2929
b@1478 2930 // Index in selector
b@1478 2931 if ( typeof elem === "string" ) {
b@1478 2932 return indexOf.call( jQuery( elem ), this[ 0 ] );
b@1478 2933 }
b@1478 2934
b@1478 2935 // Locate the position of the desired element
b@1478 2936 return indexOf.call( this,
b@1478 2937
b@1478 2938 // If it receives a jQuery object, the first element is used
b@1478 2939 elem.jquery ? elem[ 0 ] : elem
b@1478 2940 );
b@1478 2941 },
b@1478 2942
b@1478 2943 add: function( selector, context ) {
b@1478 2944 return this.pushStack(
b@1478 2945 jQuery.unique(
b@1478 2946 jQuery.merge( this.get(), jQuery( selector, context ) )
b@1478 2947 )
b@1478 2948 );
b@1478 2949 },
b@1478 2950
b@1478 2951 addBack: function( selector ) {
b@1478 2952 return this.add( selector == null ?
b@1478 2953 this.prevObject : this.prevObject.filter(selector)
b@1478 2954 );
b@1478 2955 }
b@1478 2956 });
b@1478 2957
b@1478 2958 function sibling( cur, dir ) {
b@1478 2959 while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {}
b@1478 2960 return cur;
b@1478 2961 }
b@1478 2962
b@1478 2963 jQuery.each({
b@1478 2964 parent: function( elem ) {
b@1478 2965 var parent = elem.parentNode;
b@1478 2966 return parent && parent.nodeType !== 11 ? parent : null;
b@1478 2967 },
b@1478 2968 parents: function( elem ) {
b@1478 2969 return jQuery.dir( elem, "parentNode" );
b@1478 2970 },
b@1478 2971 parentsUntil: function( elem, i, until ) {
b@1478 2972 return jQuery.dir( elem, "parentNode", until );
b@1478 2973 },
b@1478 2974 next: function( elem ) {
b@1478 2975 return sibling( elem, "nextSibling" );
b@1478 2976 },
b@1478 2977 prev: function( elem ) {
b@1478 2978 return sibling( elem, "previousSibling" );
b@1478 2979 },
b@1478 2980 nextAll: function( elem ) {
b@1478 2981 return jQuery.dir( elem, "nextSibling" );
b@1478 2982 },
b@1478 2983 prevAll: function( elem ) {
b@1478 2984 return jQuery.dir( elem, "previousSibling" );
b@1478 2985 },
b@1478 2986 nextUntil: function( elem, i, until ) {
b@1478 2987 return jQuery.dir( elem, "nextSibling", until );
b@1478 2988 },
b@1478 2989 prevUntil: function( elem, i, until ) {
b@1478 2990 return jQuery.dir( elem, "previousSibling", until );
b@1478 2991 },
b@1478 2992 siblings: function( elem ) {
b@1478 2993 return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
b@1478 2994 },
b@1478 2995 children: function( elem ) {
b@1478 2996 return jQuery.sibling( elem.firstChild );
b@1478 2997 },
b@1478 2998 contents: function( elem ) {
b@1478 2999 return elem.contentDocument || jQuery.merge( [], elem.childNodes );
b@1478 3000 }
b@1478 3001 }, function( name, fn ) {
b@1478 3002 jQuery.fn[ name ] = function( until, selector ) {
b@1478 3003 var matched = jQuery.map( this, fn, until );
b@1478 3004
b@1478 3005 if ( name.slice( -5 ) !== "Until" ) {
b@1478 3006 selector = until;
b@1478 3007 }
b@1478 3008
b@1478 3009 if ( selector && typeof selector === "string" ) {
b@1478 3010 matched = jQuery.filter( selector, matched );
b@1478 3011 }
b@1478 3012
b@1478 3013 if ( this.length > 1 ) {
b@1478 3014 // Remove duplicates
b@1478 3015 if ( !guaranteedUnique[ name ] ) {
b@1478 3016 jQuery.unique( matched );
b@1478 3017 }
b@1478 3018
b@1478 3019 // Reverse order for parents* and prev-derivatives
b@1478 3020 if ( rparentsprev.test( name ) ) {
b@1478 3021 matched.reverse();
b@1478 3022 }
b@1478 3023 }
b@1478 3024
b@1478 3025 return this.pushStack( matched );
b@1478 3026 };
b@1478 3027 });
b@1478 3028 var rnotwhite = (/\S+/g);
b@1478 3029
b@1478 3030
b@1478 3031
b@1478 3032 // String to Object options format cache
b@1478 3033 var optionsCache = {};
b@1478 3034
b@1478 3035 // Convert String-formatted options into Object-formatted ones and store in cache
b@1478 3036 function createOptions( options ) {
b@1478 3037 var object = optionsCache[ options ] = {};
b@1478 3038 jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
b@1478 3039 object[ flag ] = true;
b@1478 3040 });
b@1478 3041 return object;
b@1478 3042 }
b@1478 3043
b@1478 3044 /*
b@1478 3045 * Create a callback list using the following parameters:
b@1478 3046 *
b@1478 3047 * options: an optional list of space-separated options that will change how
b@1478 3048 * the callback list behaves or a more traditional option object
b@1478 3049 *
b@1478 3050 * By default a callback list will act like an event callback list and can be
b@1478 3051 * "fired" multiple times.
b@1478 3052 *
b@1478 3053 * Possible options:
b@1478 3054 *
b@1478 3055 * once: will ensure the callback list can only be fired once (like a Deferred)
b@1478 3056 *
b@1478 3057 * memory: will keep track of previous values and will call any callback added
b@1478 3058 * after the list has been fired right away with the latest "memorized"
b@1478 3059 * values (like a Deferred)
b@1478 3060 *
b@1478 3061 * unique: will ensure a callback can only be added once (no duplicate in the list)
b@1478 3062 *
b@1478 3063 * stopOnFalse: interrupt callings when a callback returns false
b@1478 3064 *
b@1478 3065 */
b@1478 3066 jQuery.Callbacks = function( options ) {
b@1478 3067
b@1478 3068 // Convert options from String-formatted to Object-formatted if needed
b@1478 3069 // (we check in cache first)
b@1478 3070 options = typeof options === "string" ?
b@1478 3071 ( optionsCache[ options ] || createOptions( options ) ) :
b@1478 3072 jQuery.extend( {}, options );
b@1478 3073
b@1478 3074 var // Last fire value (for non-forgettable lists)
b@1478 3075 memory,
b@1478 3076 // Flag to know if list was already fired
b@1478 3077 fired,
b@1478 3078 // Flag to know if list is currently firing
b@1478 3079 firing,
b@1478 3080 // First callback to fire (used internally by add and fireWith)
b@1478 3081 firingStart,
b@1478 3082 // End of the loop when firing
b@1478 3083 firingLength,
b@1478 3084 // Index of currently firing callback (modified by remove if needed)
b@1478 3085 firingIndex,
b@1478 3086 // Actual callback list
b@1478 3087 list = [],
b@1478 3088 // Stack of fire calls for repeatable lists
b@1478 3089 stack = !options.once && [],
b@1478 3090 // Fire callbacks
b@1478 3091 fire = function( data ) {
b@1478 3092 memory = options.memory && data;
b@1478 3093 fired = true;
b@1478 3094 firingIndex = firingStart || 0;
b@1478 3095 firingStart = 0;
b@1478 3096 firingLength = list.length;
b@1478 3097 firing = true;
b@1478 3098 for ( ; list && firingIndex < firingLength; firingIndex++ ) {
b@1478 3099 if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
b@1478 3100 memory = false; // To prevent further calls using add
b@1478 3101 break;
b@1478 3102 }
b@1478 3103 }
b@1478 3104 firing = false;
b@1478 3105 if ( list ) {
b@1478 3106 if ( stack ) {
b@1478 3107 if ( stack.length ) {
b@1478 3108 fire( stack.shift() );
b@1478 3109 }
b@1478 3110 } else if ( memory ) {
b@1478 3111 list = [];
b@1478 3112 } else {
b@1478 3113 self.disable();
b@1478 3114 }
b@1478 3115 }
b@1478 3116 },
b@1478 3117 // Actual Callbacks object
b@1478 3118 self = {
b@1478 3119 // Add a callback or a collection of callbacks to the list
b@1478 3120 add: function() {
b@1478 3121 if ( list ) {
b@1478 3122 // First, we save the current length
b@1478 3123 var start = list.length;
b@1478 3124 (function add( args ) {
b@1478 3125 jQuery.each( args, function( _, arg ) {
b@1478 3126 var type = jQuery.type( arg );
b@1478 3127 if ( type === "function" ) {
b@1478 3128 if ( !options.unique || !self.has( arg ) ) {
b@1478 3129 list.push( arg );
b@1478 3130 }
b@1478 3131 } else if ( arg && arg.length && type !== "string" ) {
b@1478 3132 // Inspect recursively
b@1478 3133 add( arg );
b@1478 3134 }
b@1478 3135 });
b@1478 3136 })( arguments );
b@1478 3137 // Do we need to add the callbacks to the
b@1478 3138 // current firing batch?
b@1478 3139 if ( firing ) {
b@1478 3140 firingLength = list.length;
b@1478 3141 // With memory, if we're not firing then
b@1478 3142 // we should call right away
b@1478 3143 } else if ( memory ) {
b@1478 3144 firingStart = start;
b@1478 3145 fire( memory );
b@1478 3146 }
b@1478 3147 }
b@1478 3148 return this;
b@1478 3149 },
b@1478 3150 // Remove a callback from the list
b@1478 3151 remove: function() {
b@1478 3152 if ( list ) {
b@1478 3153 jQuery.each( arguments, function( _, arg ) {
b@1478 3154 var index;
b@1478 3155 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
b@1478 3156 list.splice( index, 1 );
b@1478 3157 // Handle firing indexes
b@1478 3158 if ( firing ) {
b@1478 3159 if ( index <= firingLength ) {
b@1478 3160 firingLength--;
b@1478 3161 }
b@1478 3162 if ( index <= firingIndex ) {
b@1478 3163 firingIndex--;
b@1478 3164 }
b@1478 3165 }
b@1478 3166 }
b@1478 3167 });
b@1478 3168 }
b@1478 3169 return this;
b@1478 3170 },
b@1478 3171 // Check if a given callback is in the list.
b@1478 3172 // If no argument is given, return whether or not list has callbacks attached.
b@1478 3173 has: function( fn ) {
b@1478 3174 return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
b@1478 3175 },
b@1478 3176 // Remove all callbacks from the list
b@1478 3177 empty: function() {
b@1478 3178 list = [];
b@1478 3179 firingLength = 0;
b@1478 3180 return this;
b@1478 3181 },
b@1478 3182 // Have the list do nothing anymore
b@1478 3183 disable: function() {
b@1478 3184 list = stack = memory = undefined;
b@1478 3185 return this;
b@1478 3186 },
b@1478 3187 // Is it disabled?
b@1478 3188 disabled: function() {
b@1478 3189 return !list;
b@1478 3190 },
b@1478 3191 // Lock the list in its current state
b@1478 3192 lock: function() {
b@1478 3193 stack = undefined;
b@1478 3194 if ( !memory ) {
b@1478 3195 self.disable();
b@1478 3196 }
b@1478 3197 return this;
b@1478 3198 },
b@1478 3199 // Is it locked?
b@1478 3200 locked: function() {
b@1478 3201 return !stack;
b@1478 3202 },
b@1478 3203 // Call all callbacks with the given context and arguments
b@1478 3204 fireWith: function( context, args ) {
b@1478 3205 if ( list && ( !fired || stack ) ) {
b@1478 3206 args = args || [];
b@1478 3207 args = [ context, args.slice ? args.slice() : args ];
b@1478 3208 if ( firing ) {
b@1478 3209 stack.push( args );
b@1478 3210 } else {
b@1478 3211 fire( args );
b@1478 3212 }
b@1478 3213 }
b@1478 3214 return this;
b@1478 3215 },
b@1478 3216 // Call all the callbacks with the given arguments
b@1478 3217 fire: function() {
b@1478 3218 self.fireWith( this, arguments );
b@1478 3219 return this;
b@1478 3220 },
b@1478 3221 // To know if the callbacks have already been called at least once
b@1478 3222 fired: function() {
b@1478 3223 return !!fired;
b@1478 3224 }
b@1478 3225 };
b@1478 3226
b@1478 3227 return self;
b@1478 3228 };
b@1478 3229
b@1478 3230
b@1478 3231 jQuery.extend({
b@1478 3232
b@1478 3233 Deferred: function( func ) {
b@1478 3234 var tuples = [
b@1478 3235 // action, add listener, listener list, final state
b@1478 3236 [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
b@1478 3237 [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
b@1478 3238 [ "notify", "progress", jQuery.Callbacks("memory") ]
b@1478 3239 ],
b@1478 3240 state = "pending",
b@1478 3241 promise = {
b@1478 3242 state: function() {
b@1478 3243 return state;
b@1478 3244 },
b@1478 3245 always: function() {
b@1478 3246 deferred.done( arguments ).fail( arguments );
b@1478 3247 return this;
b@1478 3248 },
b@1478 3249 then: function( /* fnDone, fnFail, fnProgress */ ) {
b@1478 3250 var fns = arguments;
b@1478 3251 return jQuery.Deferred(function( newDefer ) {
b@1478 3252 jQuery.each( tuples, function( i, tuple ) {
b@1478 3253 var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
b@1478 3254 // deferred[ done | fail | progress ] for forwarding actions to newDefer
b@1478 3255 deferred[ tuple[1] ](function() {
b@1478 3256 var returned = fn && fn.apply( this, arguments );
b@1478 3257 if ( returned && jQuery.isFunction( returned.promise ) ) {
b@1478 3258 returned.promise()
b@1478 3259 .done( newDefer.resolve )
b@1478 3260 .fail( newDefer.reject )
b@1478 3261 .progress( newDefer.notify );
b@1478 3262 } else {
b@1478 3263 newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
b@1478 3264 }
b@1478 3265 });
b@1478 3266 });
b@1478 3267 fns = null;
b@1478 3268 }).promise();
b@1478 3269 },
b@1478 3270 // Get a promise for this deferred
b@1478 3271 // If obj is provided, the promise aspect is added to the object
b@1478 3272 promise: function( obj ) {
b@1478 3273 return obj != null ? jQuery.extend( obj, promise ) : promise;
b@1478 3274 }
b@1478 3275 },
b@1478 3276 deferred = {};
b@1478 3277
b@1478 3278 // Keep pipe for back-compat
b@1478 3279 promise.pipe = promise.then;
b@1478 3280
b@1478 3281 // Add list-specific methods
b@1478 3282 jQuery.each( tuples, function( i, tuple ) {
b@1478 3283 var list = tuple[ 2 ],
b@1478 3284 stateString = tuple[ 3 ];
b@1478 3285
b@1478 3286 // promise[ done | fail | progress ] = list.add
b@1478 3287 promise[ tuple[1] ] = list.add;
b@1478 3288
b@1478 3289 // Handle state
b@1478 3290 if ( stateString ) {
b@1478 3291 list.add(function() {
b@1478 3292 // state = [ resolved | rejected ]
b@1478 3293 state = stateString;
b@1478 3294
b@1478 3295 // [ reject_list | resolve_list ].disable; progress_list.lock
b@1478 3296 }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
b@1478 3297 }
b@1478 3298
b@1478 3299 // deferred[ resolve | reject | notify ]
b@1478 3300 deferred[ tuple[0] ] = function() {
b@1478 3301 deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
b@1478 3302 return this;
b@1478 3303 };
b@1478 3304 deferred[ tuple[0] + "With" ] = list.fireWith;
b@1478 3305 });
b@1478 3306
b@1478 3307 // Make the deferred a promise
b@1478 3308 promise.promise( deferred );
b@1478 3309
b@1478 3310 // Call given func if any
b@1478 3311 if ( func ) {
b@1478 3312 func.call( deferred, deferred );
b@1478 3313 }
b@1478 3314
b@1478 3315 // All done!
b@1478 3316 return deferred;
b@1478 3317 },
b@1478 3318
b@1478 3319 // Deferred helper
b@1478 3320 when: function( subordinate /* , ..., subordinateN */ ) {
b@1478 3321 var i = 0,
b@1478 3322 resolveValues = slice.call( arguments ),
b@1478 3323 length = resolveValues.length,
b@1478 3324
b@1478 3325 // the count of uncompleted subordinates
b@1478 3326 remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
b@1478 3327
b@1478 3328 // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
b@1478 3329 deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
b@1478 3330
b@1478 3331 // Update function for both resolve and progress values
b@1478 3332 updateFunc = function( i, contexts, values ) {
b@1478 3333 return function( value ) {
b@1478 3334 contexts[ i ] = this;
b@1478 3335 values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
b@1478 3336 if ( values === progressValues ) {
b@1478 3337 deferred.notifyWith( contexts, values );
b@1478 3338 } else if ( !( --remaining ) ) {
b@1478 3339 deferred.resolveWith( contexts, values );
b@1478 3340 }
b@1478 3341 };
b@1478 3342 },
b@1478 3343
b@1478 3344 progressValues, progressContexts, resolveContexts;
b@1478 3345
b@1478 3346 // Add listeners to Deferred subordinates; treat others as resolved
b@1478 3347 if ( length > 1 ) {
b@1478 3348 progressValues = new Array( length );
b@1478 3349 progressContexts = new Array( length );
b@1478 3350 resolveContexts = new Array( length );
b@1478 3351 for ( ; i < length; i++ ) {
b@1478 3352 if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
b@1478 3353 resolveValues[ i ].promise()
b@1478 3354 .done( updateFunc( i, resolveContexts, resolveValues ) )
b@1478 3355 .fail( deferred.reject )
b@1478 3356 .progress( updateFunc( i, progressContexts, progressValues ) );
b@1478 3357 } else {
b@1478 3358 --remaining;
b@1478 3359 }
b@1478 3360 }
b@1478 3361 }
b@1478 3362
b@1478 3363 // If we're not waiting on anything, resolve the master
b@1478 3364 if ( !remaining ) {
b@1478 3365 deferred.resolveWith( resolveContexts, resolveValues );
b@1478 3366 }
b@1478 3367
b@1478 3368 return deferred.promise();
b@1478 3369 }
b@1478 3370 });
b@1478 3371
b@1478 3372
b@1478 3373 // The deferred used on DOM ready
b@1478 3374 var readyList;
b@1478 3375
b@1478 3376 jQuery.fn.ready = function( fn ) {
b@1478 3377 // Add the callback
b@1478 3378 jQuery.ready.promise().done( fn );
b@1478 3379
b@1478 3380 return this;
b@1478 3381 };
b@1478 3382
b@1478 3383 jQuery.extend({
b@1478 3384 // Is the DOM ready to be used? Set to true once it occurs.
b@1478 3385 isReady: false,
b@1478 3386
b@1478 3387 // A counter to track how many items to wait for before
b@1478 3388 // the ready event fires. See #6781
b@1478 3389 readyWait: 1,
b@1478 3390
b@1478 3391 // Hold (or release) the ready event
b@1478 3392 holdReady: function( hold ) {
b@1478 3393 if ( hold ) {
b@1478 3394 jQuery.readyWait++;
b@1478 3395 } else {
b@1478 3396 jQuery.ready( true );
b@1478 3397 }
b@1478 3398 },
b@1478 3399
b@1478 3400 // Handle when the DOM is ready
b@1478 3401 ready: function( wait ) {
b@1478 3402
b@1478 3403 // Abort if there are pending holds or we're already ready
b@1478 3404 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
b@1478 3405 return;
b@1478 3406 }
b@1478 3407
b@1478 3408 // Remember that the DOM is ready
b@1478 3409 jQuery.isReady = true;
b@1478 3410
b@1478 3411 // If a normal DOM Ready event fired, decrement, and wait if need be
b@1478 3412 if ( wait !== true && --jQuery.readyWait > 0 ) {
b@1478 3413 return;
b@1478 3414 }
b@1478 3415
b@1478 3416 // If there are functions bound, to execute
b@1478 3417 readyList.resolveWith( document, [ jQuery ] );
b@1478 3418
b@1478 3419 // Trigger any bound ready events
b@1478 3420 if ( jQuery.fn.triggerHandler ) {
b@1478 3421 jQuery( document ).triggerHandler( "ready" );
b@1478 3422 jQuery( document ).off( "ready" );
b@1478 3423 }
b@1478 3424 }
b@1478 3425 });
b@1478 3426
b@1478 3427 /**
b@1478 3428 * The ready event handler and self cleanup method
b@1478 3429 */
b@1478 3430 function completed() {
b@1478 3431 document.removeEventListener( "DOMContentLoaded", completed, false );
b@1478 3432 window.removeEventListener( "load", completed, false );
b@1478 3433 jQuery.ready();
b@1478 3434 }
b@1478 3435
b@1478 3436 jQuery.ready.promise = function( obj ) {
b@1478 3437 if ( !readyList ) {
b@1478 3438
b@1478 3439 readyList = jQuery.Deferred();
b@1478 3440
b@1478 3441 // Catch cases where $(document).ready() is called after the browser event has already occurred.
b@1478 3442 // We once tried to use readyState "interactive" here, but it caused issues like the one
b@1478 3443 // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
b@1478 3444 if ( document.readyState === "complete" ) {
b@1478 3445 // Handle it asynchronously to allow scripts the opportunity to delay ready
b@1478 3446 setTimeout( jQuery.ready );
b@1478 3447
b@1478 3448 } else {
b@1478 3449
b@1478 3450 // Use the handy event callback
b@1478 3451 document.addEventListener( "DOMContentLoaded", completed, false );
b@1478 3452
b@1478 3453 // A fallback to window.onload, that will always work
b@1478 3454 window.addEventListener( "load", completed, false );
b@1478 3455 }
b@1478 3456 }
b@1478 3457 return readyList.promise( obj );
b@1478 3458 };
b@1478 3459
b@1478 3460 // Kick off the DOM ready check even if the user does not
b@1478 3461 jQuery.ready.promise();
b@1478 3462
b@1478 3463
b@1478 3464
b@1478 3465
b@1478 3466 // Multifunctional method to get and set values of a collection
b@1478 3467 // The value/s can optionally be executed if it's a function
b@1478 3468 var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
b@1478 3469 var i = 0,
b@1478 3470 len = elems.length,
b@1478 3471 bulk = key == null;
b@1478 3472
b@1478 3473 // Sets many values
b@1478 3474 if ( jQuery.type( key ) === "object" ) {
b@1478 3475 chainable = true;
b@1478 3476 for ( i in key ) {
b@1478 3477 jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
b@1478 3478 }
b@1478 3479
b@1478 3480 // Sets one value
b@1478 3481 } else if ( value !== undefined ) {
b@1478 3482 chainable = true;
b@1478 3483
b@1478 3484 if ( !jQuery.isFunction( value ) ) {
b@1478 3485 raw = true;
b@1478 3486 }
b@1478 3487
b@1478 3488 if ( bulk ) {
b@1478 3489 // Bulk operations run against the entire set
b@1478 3490 if ( raw ) {
b@1478 3491 fn.call( elems, value );
b@1478 3492 fn = null;
b@1478 3493
b@1478 3494 // ...except when executing function values
b@1478 3495 } else {
b@1478 3496 bulk = fn;
b@1478 3497 fn = function( elem, key, value ) {
b@1478 3498 return bulk.call( jQuery( elem ), value );
b@1478 3499 };
b@1478 3500 }
b@1478 3501 }
b@1478 3502
b@1478 3503 if ( fn ) {
b@1478 3504 for ( ; i < len; i++ ) {
b@1478 3505 fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
b@1478 3506 }
b@1478 3507 }
b@1478 3508 }
b@1478 3509
b@1478 3510 return chainable ?
b@1478 3511 elems :
b@1478 3512
b@1478 3513 // Gets
b@1478 3514 bulk ?
b@1478 3515 fn.call( elems ) :
b@1478 3516 len ? fn( elems[0], key ) : emptyGet;
b@1478 3517 };
b@1478 3518
b@1478 3519
b@1478 3520 /**
b@1478 3521 * Determines whether an object can have data
b@1478 3522 */
b@1478 3523 jQuery.acceptData = function( owner ) {
b@1478 3524 // Accepts only:
b@1478 3525 // - Node
b@1478 3526 // - Node.ELEMENT_NODE
b@1478 3527 // - Node.DOCUMENT_NODE
b@1478 3528 // - Object
b@1478 3529 // - Any
b@1478 3530 /* jshint -W018 */
b@1478 3531 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
b@1478 3532 };
b@1478 3533
b@1478 3534
b@1478 3535 function Data() {
b@1478 3536 // Support: Android<4,
b@1478 3537 // Old WebKit does not have Object.preventExtensions/freeze method,
b@1478 3538 // return new empty object instead with no [[set]] accessor
b@1478 3539 Object.defineProperty( this.cache = {}, 0, {
b@1478 3540 get: function() {
b@1478 3541 return {};
b@1478 3542 }
b@1478 3543 });
b@1478 3544
b@1478 3545 this.expando = jQuery.expando + Data.uid++;
b@1478 3546 }
b@1478 3547
b@1478 3548 Data.uid = 1;
b@1478 3549 Data.accepts = jQuery.acceptData;
b@1478 3550
b@1478 3551 Data.prototype = {
b@1478 3552 key: function( owner ) {
b@1478 3553 // We can accept data for non-element nodes in modern browsers,
b@1478 3554 // but we should not, see #8335.
b@1478 3555 // Always return the key for a frozen object.
b@1478 3556 if ( !Data.accepts( owner ) ) {
b@1478 3557 return 0;
b@1478 3558 }
b@1478 3559
b@1478 3560 var descriptor = {},
b@1478 3561 // Check if the owner object already has a cache key
b@1478 3562 unlock = owner[ this.expando ];
b@1478 3563
b@1478 3564 // If not, create one
b@1478 3565 if ( !unlock ) {
b@1478 3566 unlock = Data.uid++;
b@1478 3567
b@1478 3568 // Secure it in a non-enumerable, non-writable property
b@1478 3569 try {
b@1478 3570 descriptor[ this.expando ] = { value: unlock };
b@1478 3571 Object.defineProperties( owner, descriptor );
b@1478 3572
b@1478 3573 // Support: Android<4
b@1478 3574 // Fallback to a less secure definition
b@1478 3575 } catch ( e ) {
b@1478 3576 descriptor[ this.expando ] = unlock;
b@1478 3577 jQuery.extend( owner, descriptor );
b@1478 3578 }
b@1478 3579 }
b@1478 3580
b@1478 3581 // Ensure the cache object
b@1478 3582 if ( !this.cache[ unlock ] ) {
b@1478 3583 this.cache[ unlock ] = {};
b@1478 3584 }
b@1478 3585
b@1478 3586 return unlock;
b@1478 3587 },
b@1478 3588 set: function( owner, data, value ) {
b@1478 3589 var prop,
b@1478 3590 // There may be an unlock assigned to this node,
b@1478 3591 // if there is no entry for this "owner", create one inline
b@1478 3592 // and set the unlock as though an owner entry had always existed
b@1478 3593 unlock = this.key( owner ),
b@1478 3594 cache = this.cache[ unlock ];
b@1478 3595
b@1478 3596 // Handle: [ owner, key, value ] args
b@1478 3597 if ( typeof data === "string" ) {
b@1478 3598 cache[ data ] = value;
b@1478 3599
b@1478 3600 // Handle: [ owner, { properties } ] args
b@1478 3601 } else {
b@1478 3602 // Fresh assignments by object are shallow copied
b@1478 3603 if ( jQuery.isEmptyObject( cache ) ) {
b@1478 3604 jQuery.extend( this.cache[ unlock ], data );
b@1478 3605 // Otherwise, copy the properties one-by-one to the cache object
b@1478 3606 } else {
b@1478 3607 for ( prop in data ) {
b@1478 3608 cache[ prop ] = data[ prop ];
b@1478 3609 }
b@1478 3610 }
b@1478 3611 }
b@1478 3612 return cache;
b@1478 3613 },
b@1478 3614 get: function( owner, key ) {
b@1478 3615 // Either a valid cache is found, or will be created.
b@1478 3616 // New caches will be created and the unlock returned,
b@1478 3617 // allowing direct access to the newly created
b@1478 3618 // empty data object. A valid owner object must be provided.
b@1478 3619 var cache = this.cache[ this.key( owner ) ];
b@1478 3620
b@1478 3621 return key === undefined ?
b@1478 3622 cache : cache[ key ];
b@1478 3623 },
b@1478 3624 access: function( owner, key, value ) {
b@1478 3625 var stored;
b@1478 3626 // In cases where either:
b@1478 3627 //
b@1478 3628 // 1. No key was specified
b@1478 3629 // 2. A string key was specified, but no value provided
b@1478 3630 //
b@1478 3631 // Take the "read" path and allow the get method to determine
b@1478 3632 // which value to return, respectively either:
b@1478 3633 //
b@1478 3634 // 1. The entire cache object
b@1478 3635 // 2. The data stored at the key
b@1478 3636 //
b@1478 3637 if ( key === undefined ||
b@1478 3638 ((key && typeof key === "string") && value === undefined) ) {
b@1478 3639
b@1478 3640 stored = this.get( owner, key );
b@1478 3641
b@1478 3642 return stored !== undefined ?
b@1478 3643 stored : this.get( owner, jQuery.camelCase(key) );
b@1478 3644 }
b@1478 3645
b@1478 3646 // [*]When the key is not a string, or both a key and value
b@1478 3647 // are specified, set or extend (existing objects) with either:
b@1478 3648 //
b@1478 3649 // 1. An object of properties
b@1478 3650 // 2. A key and value
b@1478 3651 //
b@1478 3652 this.set( owner, key, value );
b@1478 3653
b@1478 3654 // Since the "set" path can have two possible entry points
b@1478 3655 // return the expected data based on which path was taken[*]
b@1478 3656 return value !== undefined ? value : key;
b@1478 3657 },
b@1478 3658 remove: function( owner, key ) {
b@1478 3659 var i, name, camel,
b@1478 3660 unlock = this.key( owner ),
b@1478 3661 cache = this.cache[ unlock ];
b@1478 3662
b@1478 3663 if ( key === undefined ) {
b@1478 3664 this.cache[ unlock ] = {};
b@1478 3665
b@1478 3666 } else {
b@1478 3667 // Support array or space separated string of keys
b@1478 3668 if ( jQuery.isArray( key ) ) {
b@1478 3669 // If "name" is an array of keys...
b@1478 3670 // When data is initially created, via ("key", "val") signature,
b@1478 3671 // keys will be converted to camelCase.
b@1478 3672 // Since there is no way to tell _how_ a key was added, remove
b@1478 3673 // both plain key and camelCase key. #12786
b@1478 3674 // This will only penalize the array argument path.
b@1478 3675 name = key.concat( key.map( jQuery.camelCase ) );
b@1478 3676 } else {
b@1478 3677 camel = jQuery.camelCase( key );
b@1478 3678 // Try the string as a key before any manipulation
b@1478 3679 if ( key in cache ) {
b@1478 3680 name = [ key, camel ];
b@1478 3681 } else {
b@1478 3682 // If a key with the spaces exists, use it.
b@1478 3683 // Otherwise, create an array by matching non-whitespace
b@1478 3684 name = camel;
b@1478 3685 name = name in cache ?
b@1478 3686 [ name ] : ( name.match( rnotwhite ) || [] );
b@1478 3687 }
b@1478 3688 }
b@1478 3689
b@1478 3690 i = name.length;
b@1478 3691 while ( i-- ) {
b@1478 3692 delete cache[ name[ i ] ];
b@1478 3693 }
b@1478 3694 }
b@1478 3695 },
b@1478 3696 hasData: function( owner ) {
b@1478 3697 return !jQuery.isEmptyObject(
b@1478 3698 this.cache[ owner[ this.expando ] ] || {}
b@1478 3699 );
b@1478 3700 },
b@1478 3701 discard: function( owner ) {
b@1478 3702 if ( owner[ this.expando ] ) {
b@1478 3703 delete this.cache[ owner[ this.expando ] ];
b@1478 3704 }
b@1478 3705 }
b@1478 3706 };
b@1478 3707 var data_priv = new Data();
b@1478 3708
b@1478 3709 var data_user = new Data();
b@1478 3710
b@1478 3711
b@1478 3712
b@1478 3713 // Implementation Summary
b@1478 3714 //
b@1478 3715 // 1. Enforce API surface and semantic compatibility with 1.9.x branch
b@1478 3716 // 2. Improve the module's maintainability by reducing the storage
b@1478 3717 // paths to a single mechanism.
b@1478 3718 // 3. Use the same single mechanism to support "private" and "user" data.
b@1478 3719 // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
b@1478 3720 // 5. Avoid exposing implementation details on user objects (eg. expando properties)
b@1478 3721 // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
b@1478 3722
b@1478 3723 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
b@1478 3724 rmultiDash = /([A-Z])/g;
b@1478 3725
b@1478 3726 function dataAttr( elem, key, data ) {
b@1478 3727 var name;
b@1478 3728
b@1478 3729 // If nothing was found internally, try to fetch any
b@1478 3730 // data from the HTML5 data-* attribute
b@1478 3731 if ( data === undefined && elem.nodeType === 1 ) {
b@1478 3732 name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
b@1478 3733 data = elem.getAttribute( name );
b@1478 3734
b@1478 3735 if ( typeof data === "string" ) {
b@1478 3736 try {
b@1478 3737 data = data === "true" ? true :
b@1478 3738 data === "false" ? false :
b@1478 3739 data === "null" ? null :
b@1478 3740 // Only convert to a number if it doesn't change the string
b@1478 3741 +data + "" === data ? +data :
b@1478 3742 rbrace.test( data ) ? jQuery.parseJSON( data ) :
b@1478 3743 data;
b@1478 3744 } catch( e ) {}
b@1478 3745
b@1478 3746 // Make sure we set the data so it isn't changed later
b@1478 3747 data_user.set( elem, key, data );
b@1478 3748 } else {
b@1478 3749 data = undefined;
b@1478 3750 }
b@1478 3751 }
b@1478 3752 return data;
b@1478 3753 }
b@1478 3754
b@1478 3755 jQuery.extend({
b@1478 3756 hasData: function( elem ) {
b@1478 3757 return data_user.hasData( elem ) || data_priv.hasData( elem );
b@1478 3758 },
b@1478 3759
b@1478 3760 data: function( elem, name, data ) {
b@1478 3761 return data_user.access( elem, name, data );
b@1478 3762 },
b@1478 3763
b@1478 3764 removeData: function( elem, name ) {
b@1478 3765 data_user.remove( elem, name );
b@1478 3766 },
b@1478 3767
b@1478 3768 // TODO: Now that all calls to _data and _removeData have been replaced
b@1478 3769 // with direct calls to data_priv methods, these can be deprecated.
b@1478 3770 _data: function( elem, name, data ) {
b@1478 3771 return data_priv.access( elem, name, data );
b@1478 3772 },
b@1478 3773
b@1478 3774 _removeData: function( elem, name ) {
b@1478 3775 data_priv.remove( elem, name );
b@1478 3776 }
b@1478 3777 });
b@1478 3778
b@1478 3779 jQuery.fn.extend({
b@1478 3780 data: function( key, value ) {
b@1478 3781 var i, name, data,
b@1478 3782 elem = this[ 0 ],
b@1478 3783 attrs = elem && elem.attributes;
b@1478 3784
b@1478 3785 // Gets all values
b@1478 3786 if ( key === undefined ) {
b@1478 3787 if ( this.length ) {
b@1478 3788 data = data_user.get( elem );
b@1478 3789
b@1478 3790 if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) {
b@1478 3791 i = attrs.length;
b@1478 3792 while ( i-- ) {
b@1478 3793
b@1478 3794 // Support: IE11+
b@1478 3795 // The attrs elements can be null (#14894)
b@1478 3796 if ( attrs[ i ] ) {
b@1478 3797 name = attrs[ i ].name;
b@1478 3798 if ( name.indexOf( "data-" ) === 0 ) {
b@1478 3799 name = jQuery.camelCase( name.slice(5) );
b@1478 3800 dataAttr( elem, name, data[ name ] );
b@1478 3801 }
b@1478 3802 }
b@1478 3803 }
b@1478 3804 data_priv.set( elem, "hasDataAttrs", true );
b@1478 3805 }
b@1478 3806 }
b@1478 3807
b@1478 3808 return data;
b@1478 3809 }
b@1478 3810
b@1478 3811 // Sets multiple values
b@1478 3812 if ( typeof key === "object" ) {
b@1478 3813 return this.each(function() {
b@1478 3814 data_user.set( this, key );
b@1478 3815 });
b@1478 3816 }
b@1478 3817
b@1478 3818 return access( this, function( value ) {
b@1478 3819 var data,
b@1478 3820 camelKey = jQuery.camelCase( key );
b@1478 3821
b@1478 3822 // The calling jQuery object (element matches) is not empty
b@1478 3823 // (and therefore has an element appears at this[ 0 ]) and the
b@1478 3824 // `value` parameter was not undefined. An empty jQuery object
b@1478 3825 // will result in `undefined` for elem = this[ 0 ] which will
b@1478 3826 // throw an exception if an attempt to read a data cache is made.
b@1478 3827 if ( elem && value === undefined ) {
b@1478 3828 // Attempt to get data from the cache
b@1478 3829 // with the key as-is
b@1478 3830 data = data_user.get( elem, key );
b@1478 3831 if ( data !== undefined ) {
b@1478 3832 return data;
b@1478 3833 }
b@1478 3834
b@1478 3835 // Attempt to get data from the cache
b@1478 3836 // with the key camelized
b@1478 3837 data = data_user.get( elem, camelKey );
b@1478 3838 if ( data !== undefined ) {
b@1478 3839 return data;
b@1478 3840 }
b@1478 3841
b@1478 3842 // Attempt to "discover" the data in
b@1478 3843 // HTML5 custom data-* attrs
b@1478 3844 data = dataAttr( elem, camelKey, undefined );
b@1478 3845 if ( data !== undefined ) {
b@1478 3846 return data;
b@1478 3847 }
b@1478 3848
b@1478 3849 // We tried really hard, but the data doesn't exist.
b@1478 3850 return;
b@1478 3851 }
b@1478 3852
b@1478 3853 // Set the data...
b@1478 3854 this.each(function() {
b@1478 3855 // First, attempt to store a copy or reference of any
b@1478 3856 // data that might've been store with a camelCased key.
b@1478 3857 var data = data_user.get( this, camelKey );
b@1478 3858
b@1478 3859 // For HTML5 data-* attribute interop, we have to
b@1478 3860 // store property names with dashes in a camelCase form.
b@1478 3861 // This might not apply to all properties...*
b@1478 3862 data_user.set( this, camelKey, value );
b@1478 3863
b@1478 3864 // *... In the case of properties that might _actually_
b@1478 3865 // have dashes, we need to also store a copy of that
b@1478 3866 // unchanged property.
b@1478 3867 if ( key.indexOf("-") !== -1 && data !== undefined ) {
b@1478 3868 data_user.set( this, key, value );
b@1478 3869 }
b@1478 3870 });
b@1478 3871 }, null, value, arguments.length > 1, null, true );
b@1478 3872 },
b@1478 3873
b@1478 3874 removeData: function( key ) {
b@1478 3875 return this.each(function() {
b@1478 3876 data_user.remove( this, key );
b@1478 3877 });
b@1478 3878 }
b@1478 3879 });
b@1478 3880
b@1478 3881
b@1478 3882 jQuery.extend({
b@1478 3883 queue: function( elem, type, data ) {
b@1478 3884 var queue;
b@1478 3885
b@1478 3886 if ( elem ) {
b@1478 3887 type = ( type || "fx" ) + "queue";
b@1478 3888 queue = data_priv.get( elem, type );
b@1478 3889
b@1478 3890 // Speed up dequeue by getting out quickly if this is just a lookup
b@1478 3891 if ( data ) {
b@1478 3892 if ( !queue || jQuery.isArray( data ) ) {
b@1478 3893 queue = data_priv.access( elem, type, jQuery.makeArray(data) );
b@1478 3894 } else {
b@1478 3895 queue.push( data );
b@1478 3896 }
b@1478 3897 }
b@1478 3898 return queue || [];
b@1478 3899 }
b@1478 3900 },
b@1478 3901
b@1478 3902 dequeue: function( elem, type ) {
b@1478 3903 type = type || "fx";
b@1478 3904
b@1478 3905 var queue = jQuery.queue( elem, type ),
b@1478 3906 startLength = queue.length,
b@1478 3907 fn = queue.shift(),
b@1478 3908 hooks = jQuery._queueHooks( elem, type ),
b@1478 3909 next = function() {
b@1478 3910 jQuery.dequeue( elem, type );
b@1478 3911 };
b@1478 3912
b@1478 3913 // If the fx queue is dequeued, always remove the progress sentinel
b@1478 3914 if ( fn === "inprogress" ) {
b@1478 3915 fn = queue.shift();
b@1478 3916 startLength--;
b@1478 3917 }
b@1478 3918
b@1478 3919 if ( fn ) {
b@1478 3920
b@1478 3921 // Add a progress sentinel to prevent the fx queue from being
b@1478 3922 // automatically dequeued
b@1478 3923 if ( type === "fx" ) {
b@1478 3924 queue.unshift( "inprogress" );
b@1478 3925 }
b@1478 3926
b@1478 3927 // Clear up the last queue stop function
b@1478 3928 delete hooks.stop;
b@1478 3929 fn.call( elem, next, hooks );
b@1478 3930 }
b@1478 3931
b@1478 3932 if ( !startLength && hooks ) {
b@1478 3933 hooks.empty.fire();
b@1478 3934 }
b@1478 3935 },
b@1478 3936
b@1478 3937 // Not public - generate a queueHooks object, or return the current one
b@1478 3938 _queueHooks: function( elem, type ) {
b@1478 3939 var key = type + "queueHooks";
b@1478 3940 return data_priv.get( elem, key ) || data_priv.access( elem, key, {
b@1478 3941 empty: jQuery.Callbacks("once memory").add(function() {
b@1478 3942 data_priv.remove( elem, [ type + "queue", key ] );
b@1478 3943 })
b@1478 3944 });
b@1478 3945 }
b@1478 3946 });
b@1478 3947
b@1478 3948 jQuery.fn.extend({
b@1478 3949 queue: function( type, data ) {
b@1478 3950 var setter = 2;
b@1478 3951
b@1478 3952 if ( typeof type !== "string" ) {
b@1478 3953 data = type;
b@1478 3954 type = "fx";
b@1478 3955 setter--;
b@1478 3956 }
b@1478 3957
b@1478 3958 if ( arguments.length < setter ) {
b@1478 3959 return jQuery.queue( this[0], type );
b@1478 3960 }
b@1478 3961
b@1478 3962 return data === undefined ?
b@1478 3963 this :
b@1478 3964 this.each(function() {
b@1478 3965 var queue = jQuery.queue( this, type, data );
b@1478 3966
b@1478 3967 // Ensure a hooks for this queue
b@1478 3968 jQuery._queueHooks( this, type );
b@1478 3969
b@1478 3970 if ( type === "fx" && queue[0] !== "inprogress" ) {
b@1478 3971 jQuery.dequeue( this, type );
b@1478 3972 }
b@1478 3973 });
b@1478 3974 },
b@1478 3975 dequeue: function( type ) {
b@1478 3976 return this.each(function() {
b@1478 3977 jQuery.dequeue( this, type );
b@1478 3978 });
b@1478 3979 },
b@1478 3980 clearQueue: function( type ) {
b@1478 3981 return this.queue( type || "fx", [] );
b@1478 3982 },
b@1478 3983 // Get a promise resolved when queues of a certain type
b@1478 3984 // are emptied (fx is the type by default)
b@1478 3985 promise: function( type, obj ) {
b@1478 3986 var tmp,
b@1478 3987 count = 1,
b@1478 3988 defer = jQuery.Deferred(),
b@1478 3989 elements = this,
b@1478 3990 i = this.length,
b@1478 3991 resolve = function() {
b@1478 3992 if ( !( --count ) ) {
b@1478 3993 defer.resolveWith( elements, [ elements ] );
b@1478 3994 }
b@1478 3995 };
b@1478 3996
b@1478 3997 if ( typeof type !== "string" ) {
b@1478 3998 obj = type;
b@1478 3999 type = undefined;
b@1478 4000 }
b@1478 4001 type = type || "fx";
b@1478 4002
b@1478 4003 while ( i-- ) {
b@1478 4004 tmp = data_priv.get( elements[ i ], type + "queueHooks" );
b@1478 4005 if ( tmp && tmp.empty ) {
b@1478 4006 count++;
b@1478 4007 tmp.empty.add( resolve );
b@1478 4008 }
b@1478 4009 }
b@1478 4010 resolve();
b@1478 4011 return defer.promise( obj );
b@1478 4012 }
b@1478 4013 });
b@1478 4014 var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;
b@1478 4015
b@1478 4016 var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
b@1478 4017
b@1478 4018 var isHidden = function( elem, el ) {
b@1478 4019 // isHidden might be called from jQuery#filter function;
b@1478 4020 // in that case, element will be second argument
b@1478 4021 elem = el || elem;
b@1478 4022 return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
b@1478 4023 };
b@1478 4024
b@1478 4025 var rcheckableType = (/^(?:checkbox|radio)$/i);
b@1478 4026
b@1478 4027
b@1478 4028
b@1478 4029 (function() {
b@1478 4030 var fragment = document.createDocumentFragment(),
b@1478 4031 div = fragment.appendChild( document.createElement( "div" ) ),
b@1478 4032 input = document.createElement( "input" );
b@1478 4033
b@1478 4034 // Support: Safari<=5.1
b@1478 4035 // Check state lost if the name is set (#11217)
b@1478 4036 // Support: Windows Web Apps (WWA)
b@1478 4037 // `name` and `type` must use .setAttribute for WWA (#14901)
b@1478 4038 input.setAttribute( "type", "radio" );
b@1478 4039 input.setAttribute( "checked", "checked" );
b@1478 4040 input.setAttribute( "name", "t" );
b@1478 4041
b@1478 4042 div.appendChild( input );
b@1478 4043
b@1478 4044 // Support: Safari<=5.1, Android<4.2
b@1478 4045 // Older WebKit doesn't clone checked state correctly in fragments
b@1478 4046 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
b@1478 4047
b@1478 4048 // Support: IE<=11+
b@1478 4049 // Make sure textarea (and checkbox) defaultValue is properly cloned
b@1478 4050 div.innerHTML = "<textarea>x</textarea>";
b@1478 4051 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
b@1478 4052 })();
b@1478 4053 var strundefined = typeof undefined;
b@1478 4054
b@1478 4055
b@1478 4056
b@1478 4057 support.focusinBubbles = "onfocusin" in window;
b@1478 4058
b@1478 4059
b@1478 4060 var
b@1478 4061 rkeyEvent = /^key/,
b@1478 4062 rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/,
b@1478 4063 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
b@1478 4064 rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
b@1478 4065
b@1478 4066 function returnTrue() {
b@1478 4067 return true;
b@1478 4068 }
b@1478 4069
b@1478 4070 function returnFalse() {
b@1478 4071 return false;
b@1478 4072 }
b@1478 4073
b@1478 4074 function safeActiveElement() {
b@1478 4075 try {
b@1478 4076 return document.activeElement;
b@1478 4077 } catch ( err ) { }
b@1478 4078 }
b@1478 4079
b@1478 4080 /*
b@1478 4081 * Helper functions for managing events -- not part of the public interface.
b@1478 4082 * Props to Dean Edwards' addEvent library for many of the ideas.
b@1478 4083 */
b@1478 4084 jQuery.event = {
b@1478 4085
b@1478 4086 global: {},
b@1478 4087
b@1478 4088 add: function( elem, types, handler, data, selector ) {
b@1478 4089
b@1478 4090 var handleObjIn, eventHandle, tmp,
b@1478 4091 events, t, handleObj,
b@1478 4092 special, handlers, type, namespaces, origType,
b@1478 4093 elemData = data_priv.get( elem );
b@1478 4094
b@1478 4095 // Don't attach events to noData or text/comment nodes (but allow plain objects)
b@1478 4096 if ( !elemData ) {
b@1478 4097 return;
b@1478 4098 }
b@1478 4099
b@1478 4100 // Caller can pass in an object of custom data in lieu of the handler
b@1478 4101 if ( handler.handler ) {
b@1478 4102 handleObjIn = handler;
b@1478 4103 handler = handleObjIn.handler;
b@1478 4104 selector = handleObjIn.selector;
b@1478 4105 }
b@1478 4106
b@1478 4107 // Make sure that the handler has a unique ID, used to find/remove it later
b@1478 4108 if ( !handler.guid ) {
b@1478 4109 handler.guid = jQuery.guid++;
b@1478 4110 }
b@1478 4111
b@1478 4112 // Init the element's event structure and main handler, if this is the first
b@1478 4113 if ( !(events = elemData.events) ) {
b@1478 4114 events = elemData.events = {};
b@1478 4115 }
b@1478 4116 if ( !(eventHandle = elemData.handle) ) {
b@1478 4117 eventHandle = elemData.handle = function( e ) {
b@1478 4118 // Discard the second event of a jQuery.event.trigger() and
b@1478 4119 // when an event is called after a page has unloaded
b@1478 4120 return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ?
b@1478 4121 jQuery.event.dispatch.apply( elem, arguments ) : undefined;
b@1478 4122 };
b@1478 4123 }
b@1478 4124
b@1478 4125 // Handle multiple events separated by a space
b@1478 4126 types = ( types || "" ).match( rnotwhite ) || [ "" ];
b@1478 4127 t = types.length;
b@1478 4128 while ( t-- ) {
b@1478 4129 tmp = rtypenamespace.exec( types[t] ) || [];
b@1478 4130 type = origType = tmp[1];
b@1478 4131 namespaces = ( tmp[2] || "" ).split( "." ).sort();
b@1478 4132
b@1478 4133 // There *must* be a type, no attaching namespace-only handlers
b@1478 4134 if ( !type ) {
b@1478 4135 continue;
b@1478 4136 }
b@1478 4137
b@1478 4138 // If event changes its type, use the special event handlers for the changed type
b@1478 4139 special = jQuery.event.special[ type ] || {};
b@1478 4140
b@1478 4141 // If selector defined, determine special event api type, otherwise given type
b@1478 4142 type = ( selector ? special.delegateType : special.bindType ) || type;
b@1478 4143
b@1478 4144 // Update special based on newly reset type
b@1478 4145 special = jQuery.event.special[ type ] || {};
b@1478 4146
b@1478 4147 // handleObj is passed to all event handlers
b@1478 4148 handleObj = jQuery.extend({
b@1478 4149 type: type,
b@1478 4150 origType: origType,
b@1478 4151 data: data,
b@1478 4152 handler: handler,
b@1478 4153 guid: handler.guid,
b@1478 4154 selector: selector,
b@1478 4155 needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
b@1478 4156 namespace: namespaces.join(".")
b@1478 4157 }, handleObjIn );
b@1478 4158
b@1478 4159 // Init the event handler queue if we're the first
b@1478 4160 if ( !(handlers = events[ type ]) ) {
b@1478 4161 handlers = events[ type ] = [];
b@1478 4162 handlers.delegateCount = 0;
b@1478 4163
b@1478 4164 // Only use addEventListener if the special events handler returns false
b@1478 4165 if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
b@1478 4166 if ( elem.addEventListener ) {
b@1478 4167 elem.addEventListener( type, eventHandle, false );
b@1478 4168 }
b@1478 4169 }
b@1478 4170 }
b@1478 4171
b@1478 4172 if ( special.add ) {
b@1478 4173 special.add.call( elem, handleObj );
b@1478 4174
b@1478 4175 if ( !handleObj.handler.guid ) {
b@1478 4176 handleObj.handler.guid = handler.guid;
b@1478 4177 }
b@1478 4178 }
b@1478 4179
b@1478 4180 // Add to the element's handler list, delegates in front
b@1478 4181 if ( selector ) {
b@1478 4182 handlers.splice( handlers.delegateCount++, 0, handleObj );
b@1478 4183 } else {
b@1478 4184 handlers.push( handleObj );
b@1478 4185 }
b@1478 4186
b@1478 4187 // Keep track of which events have ever been used, for event optimization
b@1478 4188 jQuery.event.global[ type ] = true;
b@1478 4189 }
b@1478 4190
b@1478 4191 },
b@1478 4192
b@1478 4193 // Detach an event or set of events from an element
b@1478 4194 remove: function( elem, types, handler, selector, mappedTypes ) {
b@1478 4195
b@1478 4196 var j, origCount, tmp,
b@1478 4197 events, t, handleObj,
b@1478 4198 special, handlers, type, namespaces, origType,
b@1478 4199 elemData = data_priv.hasData( elem ) && data_priv.get( elem );
b@1478 4200
b@1478 4201 if ( !elemData || !(events = elemData.events) ) {
b@1478 4202 return;
b@1478 4203 }
b@1478 4204
b@1478 4205 // Once for each type.namespace in types; type may be omitted
b@1478 4206 types = ( types || "" ).match( rnotwhite ) || [ "" ];
b@1478 4207 t = types.length;
b@1478 4208 while ( t-- ) {
b@1478 4209 tmp = rtypenamespace.exec( types[t] ) || [];
b@1478 4210 type = origType = tmp[1];
b@1478 4211 namespaces = ( tmp[2] || "" ).split( "." ).sort();
b@1478 4212
b@1478 4213 // Unbind all events (on this namespace, if provided) for the element
b@1478 4214 if ( !type ) {
b@1478 4215 for ( type in events ) {
b@1478 4216 jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
b@1478 4217 }
b@1478 4218 continue;
b@1478 4219 }
b@1478 4220
b@1478 4221 special = jQuery.event.special[ type ] || {};
b@1478 4222 type = ( selector ? special.delegateType : special.bindType ) || type;
b@1478 4223 handlers = events[ type ] || [];
b@1478 4224 tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
b@1478 4225
b@1478 4226 // Remove matching events
b@1478 4227 origCount = j = handlers.length;
b@1478 4228 while ( j-- ) {
b@1478 4229 handleObj = handlers[ j ];
b@1478 4230
b@1478 4231 if ( ( mappedTypes || origType === handleObj.origType ) &&
b@1478 4232 ( !handler || handler.guid === handleObj.guid ) &&
b@1478 4233 ( !tmp || tmp.test( handleObj.namespace ) ) &&
b@1478 4234 ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
b@1478 4235 handlers.splice( j, 1 );
b@1478 4236
b@1478 4237 if ( handleObj.selector ) {
b@1478 4238 handlers.delegateCount--;
b@1478 4239 }
b@1478 4240 if ( special.remove ) {
b@1478 4241 special.remove.call( elem, handleObj );
b@1478 4242 }
b@1478 4243 }
b@1478 4244 }
b@1478 4245
b@1478 4246 // Remove generic event handler if we removed something and no more handlers exist
b@1478 4247 // (avoids potential for endless recursion during removal of special event handlers)
b@1478 4248 if ( origCount && !handlers.length ) {
b@1478 4249 if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
b@1478 4250 jQuery.removeEvent( elem, type, elemData.handle );
b@1478 4251 }
b@1478 4252
b@1478 4253 delete events[ type ];
b@1478 4254 }
b@1478 4255 }
b@1478 4256
b@1478 4257 // Remove the expando if it's no longer used
b@1478 4258 if ( jQuery.isEmptyObject( events ) ) {
b@1478 4259 delete elemData.handle;
b@1478 4260 data_priv.remove( elem, "events" );
b@1478 4261 }
b@1478 4262 },
b@1478 4263
b@1478 4264 trigger: function( event, data, elem, onlyHandlers ) {
b@1478 4265
b@1478 4266 var i, cur, tmp, bubbleType, ontype, handle, special,
b@1478 4267 eventPath = [ elem || document ],
b@1478 4268 type = hasOwn.call( event, "type" ) ? event.type : event,
b@1478 4269 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
b@1478 4270
b@1478 4271 cur = tmp = elem = elem || document;
b@1478 4272
b@1478 4273 // Don't do events on text and comment nodes
b@1478 4274 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
b@1478 4275 return;
b@1478 4276 }
b@1478 4277
b@1478 4278 // focus/blur morphs to focusin/out; ensure we're not firing them right now
b@1478 4279 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
b@1478 4280 return;
b@1478 4281 }
b@1478 4282
b@1478 4283 if ( type.indexOf(".") >= 0 ) {
b@1478 4284 // Namespaced trigger; create a regexp to match event type in handle()
b@1478 4285 namespaces = type.split(".");
b@1478 4286 type = namespaces.shift();
b@1478 4287 namespaces.sort();
b@1478 4288 }
b@1478 4289 ontype = type.indexOf(":") < 0 && "on" + type;
b@1478 4290
b@1478 4291 // Caller can pass in a jQuery.Event object, Object, or just an event type string
b@1478 4292 event = event[ jQuery.expando ] ?
b@1478 4293 event :
b@1478 4294 new jQuery.Event( type, typeof event === "object" && event );
b@1478 4295
b@1478 4296 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
b@1478 4297 event.isTrigger = onlyHandlers ? 2 : 3;
b@1478 4298 event.namespace = namespaces.join(".");
b@1478 4299 event.namespace_re = event.namespace ?
b@1478 4300 new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
b@1478 4301 null;
b@1478 4302
b@1478 4303 // Clean up the event in case it is being reused
b@1478 4304 event.result = undefined;
b@1478 4305 if ( !event.target ) {
b@1478 4306 event.target = elem;
b@1478 4307 }
b@1478 4308
b@1478 4309 // Clone any incoming data and prepend the event, creating the handler arg list
b@1478 4310 data = data == null ?
b@1478 4311 [ event ] :
b@1478 4312 jQuery.makeArray( data, [ event ] );
b@1478 4313
b@1478 4314 // Allow special events to draw outside the lines
b@1478 4315 special = jQuery.event.special[ type ] || {};
b@1478 4316 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
b@1478 4317 return;
b@1478 4318 }
b@1478 4319
b@1478 4320 // Determine event propagation path in advance, per W3C events spec (#9951)
b@1478 4321 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
b@1478 4322 if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
b@1478 4323
b@1478 4324 bubbleType = special.delegateType || type;
b@1478 4325 if ( !rfocusMorph.test( bubbleType + type ) ) {
b@1478 4326 cur = cur.parentNode;
b@1478 4327 }
b@1478 4328 for ( ; cur; cur = cur.parentNode ) {
b@1478 4329 eventPath.push( cur );
b@1478 4330 tmp = cur;
b@1478 4331 }
b@1478 4332
b@1478 4333 // Only add window if we got to document (e.g., not plain obj or detached DOM)
b@1478 4334 if ( tmp === (elem.ownerDocument || document) ) {
b@1478 4335 eventPath.push( tmp.defaultView || tmp.parentWindow || window );
b@1478 4336 }
b@1478 4337 }
b@1478 4338
b@1478 4339 // Fire handlers on the event path
b@1478 4340 i = 0;
b@1478 4341 while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
b@1478 4342
b@1478 4343 event.type = i > 1 ?
b@1478 4344 bubbleType :
b@1478 4345 special.bindType || type;
b@1478 4346
b@1478 4347 // jQuery handler
b@1478 4348 handle = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( cur, "handle" );
b@1478 4349 if ( handle ) {
b@1478 4350 handle.apply( cur, data );
b@1478 4351 }
b@1478 4352
b@1478 4353 // Native handler
b@1478 4354 handle = ontype && cur[ ontype ];
b@1478 4355 if ( handle && handle.apply && jQuery.acceptData( cur ) ) {
b@1478 4356 event.result = handle.apply( cur, data );
b@1478 4357 if ( event.result === false ) {
b@1478 4358 event.preventDefault();
b@1478 4359 }
b@1478 4360 }
b@1478 4361 }
b@1478 4362 event.type = type;
b@1478 4363
b@1478 4364 // If nobody prevented the default action, do it now
b@1478 4365 if ( !onlyHandlers && !event.isDefaultPrevented() ) {
b@1478 4366
b@1478 4367 if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&
b@1478 4368 jQuery.acceptData( elem ) ) {
b@1478 4369
b@1478 4370 // Call a native DOM method on the target with the same name name as the event.
b@1478 4371 // Don't do default actions on window, that's where global variables be (#6170)
b@1478 4372 if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
b@1478 4373
b@1478 4374 // Don't re-trigger an onFOO event when we call its FOO() method
b@1478 4375 tmp = elem[ ontype ];
b@1478 4376
b@1478 4377 if ( tmp ) {
b@1478 4378 elem[ ontype ] = null;
b@1478 4379 }
b@1478 4380
b@1478 4381 // Prevent re-triggering of the same event, since we already bubbled it above
b@1478 4382 jQuery.event.triggered = type;
b@1478 4383 elem[ type ]();
b@1478 4384 jQuery.event.triggered = undefined;
b@1478 4385
b@1478 4386 if ( tmp ) {
b@1478 4387 elem[ ontype ] = tmp;
b@1478 4388 }
b@1478 4389 }
b@1478 4390 }
b@1478 4391 }
b@1478 4392
b@1478 4393 return event.result;
b@1478 4394 },
b@1478 4395
b@1478 4396 dispatch: function( event ) {
b@1478 4397
b@1478 4398 // Make a writable jQuery.Event from the native event object
b@1478 4399 event = jQuery.event.fix( event );
b@1478 4400
b@1478 4401 var i, j, ret, matched, handleObj,
b@1478 4402 handlerQueue = [],
b@1478 4403 args = slice.call( arguments ),
b@1478 4404 handlers = ( data_priv.get( this, "events" ) || {} )[ event.type ] || [],
b@1478 4405 special = jQuery.event.special[ event.type ] || {};
b@1478 4406
b@1478 4407 // Use the fix-ed jQuery.Event rather than the (read-only) native event
b@1478 4408 args[0] = event;
b@1478 4409 event.delegateTarget = this;
b@1478 4410
b@1478 4411 // Call the preDispatch hook for the mapped type, and let it bail if desired
b@1478 4412 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
b@1478 4413 return;
b@1478 4414 }
b@1478 4415
b@1478 4416 // Determine handlers
b@1478 4417 handlerQueue = jQuery.event.handlers.call( this, event, handlers );
b@1478 4418
b@1478 4419 // Run delegates first; they may want to stop propagation beneath us
b@1478 4420 i = 0;
b@1478 4421 while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
b@1478 4422 event.currentTarget = matched.elem;
b@1478 4423
b@1478 4424 j = 0;
b@1478 4425 while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
b@1478 4426
b@1478 4427 // Triggered event must either 1) have no namespace, or 2) have namespace(s)
b@1478 4428 // a subset or equal to those in the bound event (both can have no namespace).
b@1478 4429 if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
b@1478 4430
b@1478 4431 event.handleObj = handleObj;
b@1478 4432 event.data = handleObj.data;
b@1478 4433
b@1478 4434 ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
b@1478 4435 .apply( matched.elem, args );
b@1478 4436
b@1478 4437 if ( ret !== undefined ) {
b@1478 4438 if ( (event.result = ret) === false ) {
b@1478 4439 event.preventDefault();
b@1478 4440 event.stopPropagation();
b@1478 4441 }
b@1478 4442 }
b@1478 4443 }
b@1478 4444 }
b@1478 4445 }
b@1478 4446
b@1478 4447 // Call the postDispatch hook for the mapped type
b@1478 4448 if ( special.postDispatch ) {
b@1478 4449 special.postDispatch.call( this, event );
b@1478 4450 }
b@1478 4451
b@1478 4452 return event.result;
b@1478 4453 },
b@1478 4454
b@1478 4455 handlers: function( event, handlers ) {
b@1478 4456 var i, matches, sel, handleObj,
b@1478 4457 handlerQueue = [],
b@1478 4458 delegateCount = handlers.delegateCount,
b@1478 4459 cur = event.target;
b@1478 4460
b@1478 4461 // Find delegate handlers
b@1478 4462 // Black-hole SVG <use> instance trees (#13180)
b@1478 4463 // Avoid non-left-click bubbling in Firefox (#3861)
b@1478 4464 if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
b@1478 4465
b@1478 4466 for ( ; cur !== this; cur = cur.parentNode || this ) {
b@1478 4467
b@1478 4468 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
b@1478 4469 if ( cur.disabled !== true || event.type !== "click" ) {
b@1478 4470 matches = [];
b@1478 4471 for ( i = 0; i < delegateCount; i++ ) {
b@1478 4472 handleObj = handlers[ i ];
b@1478 4473
b@1478 4474 // Don't conflict with Object.prototype properties (#13203)
b@1478 4475 sel = handleObj.selector + " ";
b@1478 4476
b@1478 4477 if ( matches[ sel ] === undefined ) {
b@1478 4478 matches[ sel ] = handleObj.needsContext ?
b@1478 4479 jQuery( sel, this ).index( cur ) >= 0 :
b@1478 4480 jQuery.find( sel, this, null, [ cur ] ).length;
b@1478 4481 }
b@1478 4482 if ( matches[ sel ] ) {
b@1478 4483 matches.push( handleObj );
b@1478 4484 }
b@1478 4485 }
b@1478 4486 if ( matches.length ) {
b@1478 4487 handlerQueue.push({ elem: cur, handlers: matches });
b@1478 4488 }
b@1478 4489 }
b@1478 4490 }
b@1478 4491 }
b@1478 4492
b@1478 4493 // Add the remaining (directly-bound) handlers
b@1478 4494 if ( delegateCount < handlers.length ) {
b@1478 4495 handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
b@1478 4496 }
b@1478 4497
b@1478 4498 return handlerQueue;
b@1478 4499 },
b@1478 4500
b@1478 4501 // Includes some event props shared by KeyEvent and MouseEvent
b@1478 4502 props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
b@1478 4503
b@1478 4504 fixHooks: {},
b@1478 4505
b@1478 4506 keyHooks: {
b@1478 4507 props: "char charCode key keyCode".split(" "),
b@1478 4508 filter: function( event, original ) {
b@1478 4509
b@1478 4510 // Add which for key events
b@1478 4511 if ( event.which == null ) {
b@1478 4512 event.which = original.charCode != null ? original.charCode : original.keyCode;
b@1478 4513 }
b@1478 4514
b@1478 4515 return event;
b@1478 4516 }
b@1478 4517 },
b@1478 4518
b@1478 4519 mouseHooks: {
b@1478 4520 props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
b@1478 4521 filter: function( event, original ) {
b@1478 4522 var eventDoc, doc, body,
b@1478 4523 button = original.button;
b@1478 4524
b@1478 4525 // Calculate pageX/Y if missing and clientX/Y available
b@1478 4526 if ( event.pageX == null && original.clientX != null ) {
b@1478 4527 eventDoc = event.target.ownerDocument || document;
b@1478 4528 doc = eventDoc.documentElement;
b@1478 4529 body = eventDoc.body;
b@1478 4530
b@1478 4531 event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
b@1478 4532 event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
b@1478 4533 }
b@1478 4534
b@1478 4535 // Add which for click: 1 === left; 2 === middle; 3 === right
b@1478 4536 // Note: button is not normalized, so don't use it
b@1478 4537 if ( !event.which && button !== undefined ) {
b@1478 4538 event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
b@1478 4539 }
b@1478 4540
b@1478 4541 return event;
b@1478 4542 }
b@1478 4543 },
b@1478 4544
b@1478 4545 fix: function( event ) {
b@1478 4546 if ( event[ jQuery.expando ] ) {
b@1478 4547 return event;
b@1478 4548 }
b@1478 4549
b@1478 4550 // Create a writable copy of the event object and normalize some properties
b@1478 4551 var i, prop, copy,
b@1478 4552 type = event.type,
b@1478 4553 originalEvent = event,
b@1478 4554 fixHook = this.fixHooks[ type ];
b@1478 4555
b@1478 4556 if ( !fixHook ) {
b@1478 4557 this.fixHooks[ type ] = fixHook =
b@1478 4558 rmouseEvent.test( type ) ? this.mouseHooks :
b@1478 4559 rkeyEvent.test( type ) ? this.keyHooks :
b@1478 4560 {};
b@1478 4561 }
b@1478 4562 copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
b@1478 4563
b@1478 4564 event = new jQuery.Event( originalEvent );
b@1478 4565
b@1478 4566 i = copy.length;
b@1478 4567 while ( i-- ) {
b@1478 4568 prop = copy[ i ];
b@1478 4569 event[ prop ] = originalEvent[ prop ];
b@1478 4570 }
b@1478 4571
b@1478 4572 // Support: Cordova 2.5 (WebKit) (#13255)
b@1478 4573 // All events should have a target; Cordova deviceready doesn't
b@1478 4574 if ( !event.target ) {
b@1478 4575 event.target = document;
b@1478 4576 }
b@1478 4577
b@1478 4578 // Support: Safari 6.0+, Chrome<28
b@1478 4579 // Target should not be a text node (#504, #13143)
b@1478 4580 if ( event.target.nodeType === 3 ) {
b@1478 4581 event.target = event.target.parentNode;
b@1478 4582 }
b@1478 4583
b@1478 4584 return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
b@1478 4585 },
b@1478 4586
b@1478 4587 special: {
b@1478 4588 load: {
b@1478 4589 // Prevent triggered image.load events from bubbling to window.load
b@1478 4590 noBubble: true
b@1478 4591 },
b@1478 4592 focus: {
b@1478 4593 // Fire native event if possible so blur/focus sequence is correct
b@1478 4594 trigger: function() {
b@1478 4595 if ( this !== safeActiveElement() && this.focus ) {
b@1478 4596 this.focus();
b@1478 4597 return false;
b@1478 4598 }
b@1478 4599 },
b@1478 4600 delegateType: "focusin"
b@1478 4601 },
b@1478 4602 blur: {
b@1478 4603 trigger: function() {
b@1478 4604 if ( this === safeActiveElement() && this.blur ) {
b@1478 4605 this.blur();
b@1478 4606 return false;
b@1478 4607 }
b@1478 4608 },
b@1478 4609 delegateType: "focusout"
b@1478 4610 },
b@1478 4611 click: {
b@1478 4612 // For checkbox, fire native event so checked state will be right
b@1478 4613 trigger: function() {
b@1478 4614 if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
b@1478 4615 this.click();
b@1478 4616 return false;
b@1478 4617 }
b@1478 4618 },
b@1478 4619
b@1478 4620 // For cross-browser consistency, don't fire native .click() on links
b@1478 4621 _default: function( event ) {
b@1478 4622 return jQuery.nodeName( event.target, "a" );
b@1478 4623 }
b@1478 4624 },
b@1478 4625
b@1478 4626 beforeunload: {
b@1478 4627 postDispatch: function( event ) {
b@1478 4628
b@1478 4629 // Support: Firefox 20+
b@1478 4630 // Firefox doesn't alert if the returnValue field is not set.
b@1478 4631 if ( event.result !== undefined && event.originalEvent ) {
b@1478 4632 event.originalEvent.returnValue = event.result;
b@1478 4633 }
b@1478 4634 }
b@1478 4635 }
b@1478 4636 },
b@1478 4637
b@1478 4638 simulate: function( type, elem, event, bubble ) {
b@1478 4639 // Piggyback on a donor event to simulate a different one.
b@1478 4640 // Fake originalEvent to avoid donor's stopPropagation, but if the
b@1478 4641 // simulated event prevents default then we do the same on the donor.
b@1478 4642 var e = jQuery.extend(
b@1478 4643 new jQuery.Event(),
b@1478 4644 event,
b@1478 4645 {
b@1478 4646 type: type,
b@1478 4647 isSimulated: true,
b@1478 4648 originalEvent: {}
b@1478 4649 }
b@1478 4650 );
b@1478 4651 if ( bubble ) {
b@1478 4652 jQuery.event.trigger( e, null, elem );
b@1478 4653 } else {
b@1478 4654 jQuery.event.dispatch.call( elem, e );
b@1478 4655 }
b@1478 4656 if ( e.isDefaultPrevented() ) {
b@1478 4657 event.preventDefault();
b@1478 4658 }
b@1478 4659 }
b@1478 4660 };
b@1478 4661
b@1478 4662 jQuery.removeEvent = function( elem, type, handle ) {
b@1478 4663 if ( elem.removeEventListener ) {
b@1478 4664 elem.removeEventListener( type, handle, false );
b@1478 4665 }
b@1478 4666 };
b@1478 4667
b@1478 4668 jQuery.Event = function( src, props ) {
b@1478 4669 // Allow instantiation without the 'new' keyword
b@1478 4670 if ( !(this instanceof jQuery.Event) ) {
b@1478 4671 return new jQuery.Event( src, props );
b@1478 4672 }
b@1478 4673
b@1478 4674 // Event object
b@1478 4675 if ( src && src.type ) {
b@1478 4676 this.originalEvent = src;
b@1478 4677 this.type = src.type;
b@1478 4678
b@1478 4679 // Events bubbling up the document may have been marked as prevented
b@1478 4680 // by a handler lower down the tree; reflect the correct value.
b@1478 4681 this.isDefaultPrevented = src.defaultPrevented ||
b@1478 4682 src.defaultPrevented === undefined &&
b@1478 4683 // Support: Android<4.0
b@1478 4684 src.returnValue === false ?
b@1478 4685 returnTrue :
b@1478 4686 returnFalse;
b@1478 4687
b@1478 4688 // Event type
b@1478 4689 } else {
b@1478 4690 this.type = src;
b@1478 4691 }
b@1478 4692
b@1478 4693 // Put explicitly provided properties onto the event object
b@1478 4694 if ( props ) {
b@1478 4695 jQuery.extend( this, props );
b@1478 4696 }
b@1478 4697
b@1478 4698 // Create a timestamp if incoming event doesn't have one
b@1478 4699 this.timeStamp = src && src.timeStamp || jQuery.now();
b@1478 4700
b@1478 4701 // Mark it as fixed
b@1478 4702 this[ jQuery.expando ] = true;
b@1478 4703 };
b@1478 4704
b@1478 4705 // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
b@1478 4706 // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
b@1478 4707 jQuery.Event.prototype = {
b@1478 4708 isDefaultPrevented: returnFalse,
b@1478 4709 isPropagationStopped: returnFalse,
b@1478 4710 isImmediatePropagationStopped: returnFalse,
b@1478 4711
b@1478 4712 preventDefault: function() {
b@1478 4713 var e = this.originalEvent;
b@1478 4714
b@1478 4715 this.isDefaultPrevented = returnTrue;
b@1478 4716
b@1478 4717 if ( e && e.preventDefault ) {
b@1478 4718 e.preventDefault();
b@1478 4719 }
b@1478 4720 },
b@1478 4721 stopPropagation: function() {
b@1478 4722 var e = this.originalEvent;
b@1478 4723
b@1478 4724 this.isPropagationStopped = returnTrue;
b@1478 4725
b@1478 4726 if ( e && e.stopPropagation ) {
b@1478 4727 e.stopPropagation();
b@1478 4728 }
b@1478 4729 },
b@1478 4730 stopImmediatePropagation: function() {
b@1478 4731 var e = this.originalEvent;
b@1478 4732
b@1478 4733 this.isImmediatePropagationStopped = returnTrue;
b@1478 4734
b@1478 4735 if ( e && e.stopImmediatePropagation ) {
b@1478 4736 e.stopImmediatePropagation();
b@1478 4737 }
b@1478 4738
b@1478 4739 this.stopPropagation();
b@1478 4740 }
b@1478 4741 };
b@1478 4742
b@1478 4743 // Create mouseenter/leave events using mouseover/out and event-time checks
b@1478 4744 // Support: Chrome 15+
b@1478 4745 jQuery.each({
b@1478 4746 mouseenter: "mouseover",
b@1478 4747 mouseleave: "mouseout",
b@1478 4748 pointerenter: "pointerover",
b@1478 4749 pointerleave: "pointerout"
b@1478 4750 }, function( orig, fix ) {
b@1478 4751 jQuery.event.special[ orig ] = {
b@1478 4752 delegateType: fix,
b@1478 4753 bindType: fix,
b@1478 4754
b@1478 4755 handle: function( event ) {
b@1478 4756 var ret,
b@1478 4757 target = this,
b@1478 4758 related = event.relatedTarget,
b@1478 4759 handleObj = event.handleObj;
b@1478 4760
b@1478 4761 // For mousenter/leave call the handler if related is outside the target.
b@1478 4762 // NB: No relatedTarget if the mouse left/entered the browser window
b@1478 4763 if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
b@1478 4764 event.type = handleObj.origType;
b@1478 4765 ret = handleObj.handler.apply( this, arguments );
b@1478 4766 event.type = fix;
b@1478 4767 }
b@1478 4768 return ret;
b@1478 4769 }
b@1478 4770 };
b@1478 4771 });
b@1478 4772
b@1478 4773 // Support: Firefox, Chrome, Safari
b@1478 4774 // Create "bubbling" focus and blur events
b@1478 4775 if ( !support.focusinBubbles ) {
b@1478 4776 jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
b@1478 4777
b@1478 4778 // Attach a single capturing handler on the document while someone wants focusin/focusout
b@1478 4779 var handler = function( event ) {
b@1478 4780 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
b@1478 4781 };
b@1478 4782
b@1478 4783 jQuery.event.special[ fix ] = {
b@1478 4784 setup: function() {
b@1478 4785 var doc = this.ownerDocument || this,
b@1478 4786 attaches = data_priv.access( doc, fix );
b@1478 4787
b@1478 4788 if ( !attaches ) {
b@1478 4789 doc.addEventListener( orig, handler, true );
b@1478 4790 }
b@1478 4791 data_priv.access( doc, fix, ( attaches || 0 ) + 1 );
b@1478 4792 },
b@1478 4793 teardown: function() {
b@1478 4794 var doc = this.ownerDocument || this,
b@1478 4795 attaches = data_priv.access( doc, fix ) - 1;
b@1478 4796
b@1478 4797 if ( !attaches ) {
b@1478 4798 doc.removeEventListener( orig, handler, true );
b@1478 4799 data_priv.remove( doc, fix );
b@1478 4800
b@1478 4801 } else {
b@1478 4802 data_priv.access( doc, fix, attaches );
b@1478 4803 }
b@1478 4804 }
b@1478 4805 };
b@1478 4806 });
b@1478 4807 }
b@1478 4808
b@1478 4809 jQuery.fn.extend({
b@1478 4810
b@1478 4811 on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
b@1478 4812 var origFn, type;
b@1478 4813
b@1478 4814 // Types can be a map of types/handlers
b@1478 4815 if ( typeof types === "object" ) {
b@1478 4816 // ( types-Object, selector, data )
b@1478 4817 if ( typeof selector !== "string" ) {
b@1478 4818 // ( types-Object, data )
b@1478 4819 data = data || selector;
b@1478 4820 selector = undefined;
b@1478 4821 }
b@1478 4822 for ( type in types ) {
b@1478 4823 this.on( type, selector, data, types[ type ], one );
b@1478 4824 }
b@1478 4825 return this;
b@1478 4826 }
b@1478 4827
b@1478 4828 if ( data == null && fn == null ) {
b@1478 4829 // ( types, fn )
b@1478 4830 fn = selector;
b@1478 4831 data = selector = undefined;
b@1478 4832 } else if ( fn == null ) {
b@1478 4833 if ( typeof selector === "string" ) {
b@1478 4834 // ( types, selector, fn )
b@1478 4835 fn = data;
b@1478 4836 data = undefined;
b@1478 4837 } else {
b@1478 4838 // ( types, data, fn )
b@1478 4839 fn = data;
b@1478 4840 data = selector;
b@1478 4841 selector = undefined;
b@1478 4842 }
b@1478 4843 }
b@1478 4844 if ( fn === false ) {
b@1478 4845 fn = returnFalse;
b@1478 4846 } else if ( !fn ) {
b@1478 4847 return this;
b@1478 4848 }
b@1478 4849
b@1478 4850 if ( one === 1 ) {
b@1478 4851 origFn = fn;
b@1478 4852 fn = function( event ) {
b@1478 4853 // Can use an empty set, since event contains the info
b@1478 4854 jQuery().off( event );
b@1478 4855 return origFn.apply( this, arguments );
b@1478 4856 };
b@1478 4857 // Use same guid so caller can remove using origFn
b@1478 4858 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
b@1478 4859 }
b@1478 4860 return this.each( function() {
b@1478 4861 jQuery.event.add( this, types, fn, data, selector );
b@1478 4862 });
b@1478 4863 },
b@1478 4864 one: function( types, selector, data, fn ) {
b@1478 4865 return this.on( types, selector, data, fn, 1 );
b@1478 4866 },
b@1478 4867 off: function( types, selector, fn ) {
b@1478 4868 var handleObj, type;
b@1478 4869 if ( types && types.preventDefault && types.handleObj ) {
b@1478 4870 // ( event ) dispatched jQuery.Event
b@1478 4871 handleObj = types.handleObj;
b@1478 4872 jQuery( types.delegateTarget ).off(
b@1478 4873 handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
b@1478 4874 handleObj.selector,
b@1478 4875 handleObj.handler
b@1478 4876 );
b@1478 4877 return this;
b@1478 4878 }
b@1478 4879 if ( typeof types === "object" ) {
b@1478 4880 // ( types-object [, selector] )
b@1478 4881 for ( type in types ) {
b@1478 4882 this.off( type, selector, types[ type ] );
b@1478 4883 }
b@1478 4884 return this;
b@1478 4885 }
b@1478 4886 if ( selector === false || typeof selector === "function" ) {
b@1478 4887 // ( types [, fn] )
b@1478 4888 fn = selector;
b@1478 4889 selector = undefined;
b@1478 4890 }
b@1478 4891 if ( fn === false ) {
b@1478 4892 fn = returnFalse;
b@1478 4893 }
b@1478 4894 return this.each(function() {
b@1478 4895 jQuery.event.remove( this, types, fn, selector );
b@1478 4896 });
b@1478 4897 },
b@1478 4898
b@1478 4899 trigger: function( type, data ) {
b@1478 4900 return this.each(function() {
b@1478 4901 jQuery.event.trigger( type, data, this );
b@1478 4902 });
b@1478 4903 },
b@1478 4904 triggerHandler: function( type, data ) {
b@1478 4905 var elem = this[0];
b@1478 4906 if ( elem ) {
b@1478 4907 return jQuery.event.trigger( type, data, elem, true );
b@1478 4908 }
b@1478 4909 }
b@1478 4910 });
b@1478 4911
b@1478 4912
b@1478 4913 var
b@1478 4914 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
b@1478 4915 rtagName = /<([\w:]+)/,
b@1478 4916 rhtml = /<|&#?\w+;/,
b@1478 4917 rnoInnerhtml = /<(?:script|style|link)/i,
b@1478 4918 // checked="checked" or checked
b@1478 4919 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
b@1478 4920 rscriptType = /^$|\/(?:java|ecma)script/i,
b@1478 4921 rscriptTypeMasked = /^true\/(.*)/,
b@1478 4922 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
b@1478 4923
b@1478 4924 // We have to close these tags to support XHTML (#13200)
b@1478 4925 wrapMap = {
b@1478 4926
b@1478 4927 // Support: IE9
b@1478 4928 option: [ 1, "<select multiple='multiple'>", "</select>" ],
b@1478 4929
b@1478 4930 thead: [ 1, "<table>", "</table>" ],
b@1478 4931 col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
b@1478 4932 tr: [ 2, "<table><tbody>", "</tbody></table>" ],
b@1478 4933 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
b@1478 4934
b@1478 4935 _default: [ 0, "", "" ]
b@1478 4936 };
b@1478 4937
b@1478 4938 // Support: IE9
b@1478 4939 wrapMap.optgroup = wrapMap.option;
b@1478 4940
b@1478 4941 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
b@1478 4942 wrapMap.th = wrapMap.td;
b@1478 4943
b@1478 4944 // Support: 1.x compatibility
b@1478 4945 // Manipulating tables requires a tbody
b@1478 4946 function manipulationTarget( elem, content ) {
b@1478 4947 return jQuery.nodeName( elem, "table" ) &&
b@1478 4948 jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
b@1478 4949
b@1478 4950 elem.getElementsByTagName("tbody")[0] ||
b@1478 4951 elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
b@1478 4952 elem;
b@1478 4953 }
b@1478 4954
b@1478 4955 // Replace/restore the type attribute of script elements for safe DOM manipulation
b@1478 4956 function disableScript( elem ) {
b@1478 4957 elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
b@1478 4958 return elem;
b@1478 4959 }
b@1478 4960 function restoreScript( elem ) {
b@1478 4961 var match = rscriptTypeMasked.exec( elem.type );
b@1478 4962
b@1478 4963 if ( match ) {
b@1478 4964 elem.type = match[ 1 ];
b@1478 4965 } else {
b@1478 4966 elem.removeAttribute("type");
b@1478 4967 }
b@1478 4968
b@1478 4969 return elem;
b@1478 4970 }
b@1478 4971
b@1478 4972 // Mark scripts as having already been evaluated
b@1478 4973 function setGlobalEval( elems, refElements ) {
b@1478 4974 var i = 0,
b@1478 4975 l = elems.length;
b@1478 4976
b@1478 4977 for ( ; i < l; i++ ) {
b@1478 4978 data_priv.set(
b@1478 4979 elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" )
b@1478 4980 );
b@1478 4981 }
b@1478 4982 }
b@1478 4983
b@1478 4984 function cloneCopyEvent( src, dest ) {
b@1478 4985 var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
b@1478 4986
b@1478 4987 if ( dest.nodeType !== 1 ) {
b@1478 4988 return;
b@1478 4989 }
b@1478 4990
b@1478 4991 // 1. Copy private data: events, handlers, etc.
b@1478 4992 if ( data_priv.hasData( src ) ) {
b@1478 4993 pdataOld = data_priv.access( src );
b@1478 4994 pdataCur = data_priv.set( dest, pdataOld );
b@1478 4995 events = pdataOld.events;
b@1478 4996
b@1478 4997 if ( events ) {
b@1478 4998 delete pdataCur.handle;
b@1478 4999 pdataCur.events = {};
b@1478 5000
b@1478 5001 for ( type in events ) {
b@1478 5002 for ( i = 0, l = events[ type ].length; i < l; i++ ) {
b@1478 5003 jQuery.event.add( dest, type, events[ type ][ i ] );
b@1478 5004 }
b@1478 5005 }
b@1478 5006 }
b@1478 5007 }
b@1478 5008
b@1478 5009 // 2. Copy user data
b@1478 5010 if ( data_user.hasData( src ) ) {
b@1478 5011 udataOld = data_user.access( src );
b@1478 5012 udataCur = jQuery.extend( {}, udataOld );
b@1478 5013
b@1478 5014 data_user.set( dest, udataCur );
b@1478 5015 }
b@1478 5016 }
b@1478 5017
b@1478 5018 function getAll( context, tag ) {
b@1478 5019 var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) :
b@1478 5020 context.querySelectorAll ? context.querySelectorAll( tag || "*" ) :
b@1478 5021 [];
b@1478 5022
b@1478 5023 return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
b@1478 5024 jQuery.merge( [ context ], ret ) :
b@1478 5025 ret;
b@1478 5026 }
b@1478 5027
b@1478 5028 // Fix IE bugs, see support tests
b@1478 5029 function fixInput( src, dest ) {
b@1478 5030 var nodeName = dest.nodeName.toLowerCase();
b@1478 5031
b@1478 5032 // Fails to persist the checked state of a cloned checkbox or radio button.
b@1478 5033 if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
b@1478 5034 dest.checked = src.checked;
b@1478 5035
b@1478 5036 // Fails to return the selected option to the default selected state when cloning options
b@1478 5037 } else if ( nodeName === "input" || nodeName === "textarea" ) {
b@1478 5038 dest.defaultValue = src.defaultValue;
b@1478 5039 }
b@1478 5040 }
b@1478 5041
b@1478 5042 jQuery.extend({
b@1478 5043 clone: function( elem, dataAndEvents, deepDataAndEvents ) {
b@1478 5044 var i, l, srcElements, destElements,
b@1478 5045 clone = elem.cloneNode( true ),
b@1478 5046 inPage = jQuery.contains( elem.ownerDocument, elem );
b@1478 5047
b@1478 5048 // Fix IE cloning issues
b@1478 5049 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
b@1478 5050 !jQuery.isXMLDoc( elem ) ) {
b@1478 5051
b@1478 5052 // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
b@1478 5053 destElements = getAll( clone );
b@1478 5054 srcElements = getAll( elem );
b@1478 5055
b@1478 5056 for ( i = 0, l = srcElements.length; i < l; i++ ) {
b@1478 5057 fixInput( srcElements[ i ], destElements[ i ] );
b@1478 5058 }
b@1478 5059 }
b@1478 5060
b@1478 5061 // Copy the events from the original to the clone
b@1478 5062 if ( dataAndEvents ) {
b@1478 5063 if ( deepDataAndEvents ) {
b@1478 5064 srcElements = srcElements || getAll( elem );
b@1478 5065 destElements = destElements || getAll( clone );
b@1478 5066
b@1478 5067 for ( i = 0, l = srcElements.length; i < l; i++ ) {
b@1478 5068 cloneCopyEvent( srcElements[ i ], destElements[ i ] );
b@1478 5069 }
b@1478 5070 } else {
b@1478 5071 cloneCopyEvent( elem, clone );
b@1478 5072 }
b@1478 5073 }
b@1478 5074
b@1478 5075 // Preserve script evaluation history
b@1478 5076 destElements = getAll( clone, "script" );
b@1478 5077 if ( destElements.length > 0 ) {
b@1478 5078 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
b@1478 5079 }
b@1478 5080
b@1478 5081 // Return the cloned set
b@1478 5082 return clone;
b@1478 5083 },
b@1478 5084
b@1478 5085 buildFragment: function( elems, context, scripts, selection ) {
b@1478 5086 var elem, tmp, tag, wrap, contains, j,
b@1478 5087 fragment = context.createDocumentFragment(),
b@1478 5088 nodes = [],
b@1478 5089 i = 0,
b@1478 5090 l = elems.length;
b@1478 5091
b@1478 5092 for ( ; i < l; i++ ) {
b@1478 5093 elem = elems[ i ];
b@1478 5094
b@1478 5095 if ( elem || elem === 0 ) {
b@1478 5096
b@1478 5097 // Add nodes directly
b@1478 5098 if ( jQuery.type( elem ) === "object" ) {
b@1478 5099 // Support: QtWebKit, PhantomJS
b@1478 5100 // push.apply(_, arraylike) throws on ancient WebKit
b@1478 5101 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
b@1478 5102
b@1478 5103 // Convert non-html into a text node
b@1478 5104 } else if ( !rhtml.test( elem ) ) {
b@1478 5105 nodes.push( context.createTextNode( elem ) );
b@1478 5106
b@1478 5107 // Convert html into DOM nodes
b@1478 5108 } else {
b@1478 5109 tmp = tmp || fragment.appendChild( context.createElement("div") );
b@1478 5110
b@1478 5111 // Deserialize a standard representation
b@1478 5112 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
b@1478 5113 wrap = wrapMap[ tag ] || wrapMap._default;
b@1478 5114 tmp.innerHTML = wrap[ 1 ] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[ 2 ];
b@1478 5115
b@1478 5116 // Descend through wrappers to the right content
b@1478 5117 j = wrap[ 0 ];
b@1478 5118 while ( j-- ) {
b@1478 5119 tmp = tmp.lastChild;
b@1478 5120 }
b@1478 5121
b@1478 5122 // Support: QtWebKit, PhantomJS
b@1478 5123 // push.apply(_, arraylike) throws on ancient WebKit
b@1478 5124 jQuery.merge( nodes, tmp.childNodes );
b@1478 5125
b@1478 5126 // Remember the top-level container
b@1478 5127 tmp = fragment.firstChild;
b@1478 5128
b@1478 5129 // Ensure the created nodes are orphaned (#12392)
b@1478 5130 tmp.textContent = "";
b@1478 5131 }
b@1478 5132 }
b@1478 5133 }
b@1478 5134
b@1478 5135 // Remove wrapper from fragment
b@1478 5136 fragment.textContent = "";
b@1478 5137
b@1478 5138 i = 0;
b@1478 5139 while ( (elem = nodes[ i++ ]) ) {
b@1478 5140
b@1478 5141 // #4087 - If origin and destination elements are the same, and this is
b@1478 5142 // that element, do not do anything
b@1478 5143 if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
b@1478 5144 continue;
b@1478 5145 }
b@1478 5146
b@1478 5147 contains = jQuery.contains( elem.ownerDocument, elem );
b@1478 5148
b@1478 5149 // Append to fragment
b@1478 5150 tmp = getAll( fragment.appendChild( elem ), "script" );
b@1478 5151
b@1478 5152 // Preserve script evaluation history
b@1478 5153 if ( contains ) {
b@1478 5154 setGlobalEval( tmp );
b@1478 5155 }
b@1478 5156
b@1478 5157 // Capture executables
b@1478 5158 if ( scripts ) {
b@1478 5159 j = 0;
b@1478 5160 while ( (elem = tmp[ j++ ]) ) {
b@1478 5161 if ( rscriptType.test( elem.type || "" ) ) {
b@1478 5162 scripts.push( elem );
b@1478 5163 }
b@1478 5164 }
b@1478 5165 }
b@1478 5166 }
b@1478 5167
b@1478 5168 return fragment;
b@1478 5169 },
b@1478 5170
b@1478 5171 cleanData: function( elems ) {
b@1478 5172 var data, elem, type, key,
b@1478 5173 special = jQuery.event.special,
b@1478 5174 i = 0;
b@1478 5175
b@1478 5176 for ( ; (elem = elems[ i ]) !== undefined; i++ ) {
b@1478 5177 if ( jQuery.acceptData( elem ) ) {
b@1478 5178 key = elem[ data_priv.expando ];
b@1478 5179
b@1478 5180 if ( key && (data = data_priv.cache[ key ]) ) {
b@1478 5181 if ( data.events ) {
b@1478 5182 for ( type in data.events ) {
b@1478 5183 if ( special[ type ] ) {
b@1478 5184 jQuery.event.remove( elem, type );
b@1478 5185
b@1478 5186 // This is a shortcut to avoid jQuery.event.remove's overhead
b@1478 5187 } else {
b@1478 5188 jQuery.removeEvent( elem, type, data.handle );
b@1478 5189 }
b@1478 5190 }
b@1478 5191 }
b@1478 5192 if ( data_priv.cache[ key ] ) {
b@1478 5193 // Discard any remaining `private` data
b@1478 5194 delete data_priv.cache[ key ];
b@1478 5195 }
b@1478 5196 }
b@1478 5197 }
b@1478 5198 // Discard any remaining `user` data
b@1478 5199 delete data_user.cache[ elem[ data_user.expando ] ];
b@1478 5200 }
b@1478 5201 }
b@1478 5202 });
b@1478 5203
b@1478 5204 jQuery.fn.extend({
b@1478 5205 text: function( value ) {
b@1478 5206 return access( this, function( value ) {
b@1478 5207 return value === undefined ?
b@1478 5208 jQuery.text( this ) :
b@1478 5209 this.empty().each(function() {
b@1478 5210 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
b@1478 5211 this.textContent = value;
b@1478 5212 }
b@1478 5213 });
b@1478 5214 }, null, value, arguments.length );
b@1478 5215 },
b@1478 5216
b@1478 5217 append: function() {
b@1478 5218 return this.domManip( arguments, function( elem ) {
b@1478 5219 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
b@1478 5220 var target = manipulationTarget( this, elem );
b@1478 5221 target.appendChild( elem );
b@1478 5222 }
b@1478 5223 });
b@1478 5224 },
b@1478 5225
b@1478 5226 prepend: function() {
b@1478 5227 return this.domManip( arguments, function( elem ) {
b@1478 5228 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
b@1478 5229 var target = manipulationTarget( this, elem );
b@1478 5230 target.insertBefore( elem, target.firstChild );
b@1478 5231 }
b@1478 5232 });
b@1478 5233 },
b@1478 5234
b@1478 5235 before: function() {
b@1478 5236 return this.domManip( arguments, function( elem ) {
b@1478 5237 if ( this.parentNode ) {
b@1478 5238 this.parentNode.insertBefore( elem, this );
b@1478 5239 }
b@1478 5240 });
b@1478 5241 },
b@1478 5242
b@1478 5243 after: function() {
b@1478 5244 return this.domManip( arguments, function( elem ) {
b@1478 5245 if ( this.parentNode ) {
b@1478 5246 this.parentNode.insertBefore( elem, this.nextSibling );
b@1478 5247 }
b@1478 5248 });
b@1478 5249 },
b@1478 5250
b@1478 5251 remove: function( selector, keepData /* Internal Use Only */ ) {
b@1478 5252 var elem,
b@1478 5253 elems = selector ? jQuery.filter( selector, this ) : this,
b@1478 5254 i = 0;
b@1478 5255
b@1478 5256 for ( ; (elem = elems[i]) != null; i++ ) {
b@1478 5257 if ( !keepData && elem.nodeType === 1 ) {
b@1478 5258 jQuery.cleanData( getAll( elem ) );
b@1478 5259 }
b@1478 5260
b@1478 5261 if ( elem.parentNode ) {
b@1478 5262 if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
b@1478 5263 setGlobalEval( getAll( elem, "script" ) );
b@1478 5264 }
b@1478 5265 elem.parentNode.removeChild( elem );
b@1478 5266 }
b@1478 5267 }
b@1478 5268
b@1478 5269 return this;
b@1478 5270 },
b@1478 5271
b@1478 5272 empty: function() {
b@1478 5273 var elem,
b@1478 5274 i = 0;
b@1478 5275
b@1478 5276 for ( ; (elem = this[i]) != null; i++ ) {
b@1478 5277 if ( elem.nodeType === 1 ) {
b@1478 5278
b@1478 5279 // Prevent memory leaks
b@1478 5280 jQuery.cleanData( getAll( elem, false ) );
b@1478 5281
b@1478 5282 // Remove any remaining nodes
b@1478 5283 elem.textContent = "";
b@1478 5284 }
b@1478 5285 }
b@1478 5286
b@1478 5287 return this;
b@1478 5288 },
b@1478 5289
b@1478 5290 clone: function( dataAndEvents, deepDataAndEvents ) {
b@1478 5291 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
b@1478 5292 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
b@1478 5293
b@1478 5294 return this.map(function() {
b@1478 5295 return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
b@1478 5296 });
b@1478 5297 },
b@1478 5298
b@1478 5299 html: function( value ) {
b@1478 5300 return access( this, function( value ) {
b@1478 5301 var elem = this[ 0 ] || {},
b@1478 5302 i = 0,
b@1478 5303 l = this.length;
b@1478 5304
b@1478 5305 if ( value === undefined && elem.nodeType === 1 ) {
b@1478 5306 return elem.innerHTML;
b@1478 5307 }
b@1478 5308
b@1478 5309 // See if we can take a shortcut and just use innerHTML
b@1478 5310 if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
b@1478 5311 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
b@1478 5312
b@1478 5313 value = value.replace( rxhtmlTag, "<$1></$2>" );
b@1478 5314
b@1478 5315 try {
b@1478 5316 for ( ; i < l; i++ ) {
b@1478 5317 elem = this[ i ] || {};
b@1478 5318
b@1478 5319 // Remove element nodes and prevent memory leaks
b@1478 5320 if ( elem.nodeType === 1 ) {
b@1478 5321 jQuery.cleanData( getAll( elem, false ) );
b@1478 5322 elem.innerHTML = value;
b@1478 5323 }
b@1478 5324 }
b@1478 5325
b@1478 5326 elem = 0;
b@1478 5327
b@1478 5328 // If using innerHTML throws an exception, use the fallback method
b@1478 5329 } catch( e ) {}
b@1478 5330 }
b@1478 5331
b@1478 5332 if ( elem ) {
b@1478 5333 this.empty().append( value );
b@1478 5334 }
b@1478 5335 }, null, value, arguments.length );
b@1478 5336 },
b@1478 5337
b@1478 5338 replaceWith: function() {
b@1478 5339 var arg = arguments[ 0 ];
b@1478 5340
b@1478 5341 // Make the changes, replacing each context element with the new content
b@1478 5342 this.domManip( arguments, function( elem ) {
b@1478 5343 arg = this.parentNode;
b@1478 5344
b@1478 5345 jQuery.cleanData( getAll( this ) );
b@1478 5346
b@1478 5347 if ( arg ) {
b@1478 5348 arg.replaceChild( elem, this );
b@1478 5349 }
b@1478 5350 });
b@1478 5351
b@1478 5352 // Force removal if there was no new content (e.g., from empty arguments)
b@1478 5353 return arg && (arg.length || arg.nodeType) ? this : this.remove();
b@1478 5354 },
b@1478 5355
b@1478 5356 detach: function( selector ) {
b@1478 5357 return this.remove( selector, true );
b@1478 5358 },
b@1478 5359
b@1478 5360 domManip: function( args, callback ) {
b@1478 5361
b@1478 5362 // Flatten any nested arrays
b@1478 5363 args = concat.apply( [], args );
b@1478 5364
b@1478 5365 var fragment, first, scripts, hasScripts, node, doc,
b@1478 5366 i = 0,
b@1478 5367 l = this.length,
b@1478 5368 set = this,
b@1478 5369 iNoClone = l - 1,
b@1478 5370 value = args[ 0 ],
b@1478 5371 isFunction = jQuery.isFunction( value );
b@1478 5372
b@1478 5373 // We can't cloneNode fragments that contain checked, in WebKit
b@1478 5374 if ( isFunction ||
b@1478 5375 ( l > 1 && typeof value === "string" &&
b@1478 5376 !support.checkClone && rchecked.test( value ) ) ) {
b@1478 5377 return this.each(function( index ) {
b@1478 5378 var self = set.eq( index );
b@1478 5379 if ( isFunction ) {
b@1478 5380 args[ 0 ] = value.call( this, index, self.html() );
b@1478 5381 }
b@1478 5382 self.domManip( args, callback );
b@1478 5383 });
b@1478 5384 }
b@1478 5385
b@1478 5386 if ( l ) {
b@1478 5387 fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
b@1478 5388 first = fragment.firstChild;
b@1478 5389
b@1478 5390 if ( fragment.childNodes.length === 1 ) {
b@1478 5391 fragment = first;
b@1478 5392 }
b@1478 5393
b@1478 5394 if ( first ) {
b@1478 5395 scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
b@1478 5396 hasScripts = scripts.length;
b@1478 5397
b@1478 5398 // Use the original fragment for the last item instead of the first because it can end up
b@1478 5399 // being emptied incorrectly in certain situations (#8070).
b@1478 5400 for ( ; i < l; i++ ) {
b@1478 5401 node = fragment;
b@1478 5402
b@1478 5403 if ( i !== iNoClone ) {
b@1478 5404 node = jQuery.clone( node, true, true );
b@1478 5405
b@1478 5406 // Keep references to cloned scripts for later restoration
b@1478 5407 if ( hasScripts ) {
b@1478 5408 // Support: QtWebKit
b@1478 5409 // jQuery.merge because push.apply(_, arraylike) throws
b@1478 5410 jQuery.merge( scripts, getAll( node, "script" ) );
b@1478 5411 }
b@1478 5412 }
b@1478 5413
b@1478 5414 callback.call( this[ i ], node, i );
b@1478 5415 }
b@1478 5416
b@1478 5417 if ( hasScripts ) {
b@1478 5418 doc = scripts[ scripts.length - 1 ].ownerDocument;
b@1478 5419
b@1478 5420 // Reenable scripts
b@1478 5421 jQuery.map( scripts, restoreScript );
b@1478 5422
b@1478 5423 // Evaluate executable scripts on first document insertion
b@1478 5424 for ( i = 0; i < hasScripts; i++ ) {
b@1478 5425 node = scripts[ i ];
b@1478 5426 if ( rscriptType.test( node.type || "" ) &&
b@1478 5427 !data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
b@1478 5428
b@1478 5429 if ( node.src ) {
b@1478 5430 // Optional AJAX dependency, but won't run scripts if not present
b@1478 5431 if ( jQuery._evalUrl ) {
b@1478 5432 jQuery._evalUrl( node.src );
b@1478 5433 }
b@1478 5434 } else {
b@1478 5435 jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) );
b@1478 5436 }
b@1478 5437 }
b@1478 5438 }
b@1478 5439 }
b@1478 5440 }
b@1478 5441 }
b@1478 5442
b@1478 5443 return this;
b@1478 5444 }
b@1478 5445 });
b@1478 5446
b@1478 5447 jQuery.each({
b@1478 5448 appendTo: "append",
b@1478 5449 prependTo: "prepend",
b@1478 5450 insertBefore: "before",
b@1478 5451 insertAfter: "after",
b@1478 5452 replaceAll: "replaceWith"
b@1478 5453 }, function( name, original ) {
b@1478 5454 jQuery.fn[ name ] = function( selector ) {
b@1478 5455 var elems,
b@1478 5456 ret = [],
b@1478 5457 insert = jQuery( selector ),
b@1478 5458 last = insert.length - 1,
b@1478 5459 i = 0;
b@1478 5460
b@1478 5461 for ( ; i <= last; i++ ) {
b@1478 5462 elems = i === last ? this : this.clone( true );
b@1478 5463 jQuery( insert[ i ] )[ original ]( elems );
b@1478 5464
b@1478 5465 // Support: QtWebKit
b@1478 5466 // .get() because push.apply(_, arraylike) throws
b@1478 5467 push.apply( ret, elems.get() );
b@1478 5468 }
b@1478 5469
b@1478 5470 return this.pushStack( ret );
b@1478 5471 };
b@1478 5472 });
b@1478 5473
b@1478 5474
b@1478 5475 var iframe,
b@1478 5476 elemdisplay = {};
b@1478 5477
b@1478 5478 /**
b@1478 5479 * Retrieve the actual display of a element
b@1478 5480 * @param {String} name nodeName of the element
b@1478 5481 * @param {Object} doc Document object
b@1478 5482 */
b@1478 5483 // Called only from within defaultDisplay
b@1478 5484 function actualDisplay( name, doc ) {
b@1478 5485 var style,
b@1478 5486 elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
b@1478 5487
b@1478 5488 // getDefaultComputedStyle might be reliably used only on attached element
b@1478 5489 display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ?
b@1478 5490
b@1478 5491 // Use of this method is a temporary fix (more like optimization) until something better comes along,
b@1478 5492 // since it was removed from specification and supported only in FF
b@1478 5493 style.display : jQuery.css( elem[ 0 ], "display" );
b@1478 5494
b@1478 5495 // We don't have any data stored on the element,
b@1478 5496 // so use "detach" method as fast way to get rid of the element
b@1478 5497 elem.detach();
b@1478 5498
b@1478 5499 return display;
b@1478 5500 }
b@1478 5501
b@1478 5502 /**
b@1478 5503 * Try to determine the default display value of an element
b@1478 5504 * @param {String} nodeName
b@1478 5505 */
b@1478 5506 function defaultDisplay( nodeName ) {
b@1478 5507 var doc = document,
b@1478 5508 display = elemdisplay[ nodeName ];
b@1478 5509
b@1478 5510 if ( !display ) {
b@1478 5511 display = actualDisplay( nodeName, doc );
b@1478 5512
b@1478 5513 // If the simple way fails, read from inside an iframe
b@1478 5514 if ( display === "none" || !display ) {
b@1478 5515
b@1478 5516 // Use the already-created iframe if possible
b@1478 5517 iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement );
b@1478 5518
b@1478 5519 // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
b@1478 5520 doc = iframe[ 0 ].contentDocument;
b@1478 5521
b@1478 5522 // Support: IE
b@1478 5523 doc.write();
b@1478 5524 doc.close();
b@1478 5525
b@1478 5526 display = actualDisplay( nodeName, doc );
b@1478 5527 iframe.detach();
b@1478 5528 }
b@1478 5529
b@1478 5530 // Store the correct default display
b@1478 5531 elemdisplay[ nodeName ] = display;
b@1478 5532 }
b@1478 5533
b@1478 5534 return display;
b@1478 5535 }
b@1478 5536 var rmargin = (/^margin/);
b@1478 5537
b@1478 5538 var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
b@1478 5539
b@1478 5540 var getStyles = function( elem ) {
b@1478 5541 // Support: IE<=11+, Firefox<=30+ (#15098, #14150)
b@1478 5542 // IE throws on elements created in popups
b@1478 5543 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
b@1478 5544 if ( elem.ownerDocument.defaultView.opener ) {
b@1478 5545 return elem.ownerDocument.defaultView.getComputedStyle( elem, null );
b@1478 5546 }
b@1478 5547
b@1478 5548 return window.getComputedStyle( elem, null );
b@1478 5549 };
b@1478 5550
b@1478 5551
b@1478 5552
b@1478 5553 function curCSS( elem, name, computed ) {
b@1478 5554 var width, minWidth, maxWidth, ret,
b@1478 5555 style = elem.style;
b@1478 5556
b@1478 5557 computed = computed || getStyles( elem );
b@1478 5558
b@1478 5559 // Support: IE9
b@1478 5560 // getPropertyValue is only needed for .css('filter') (#12537)
b@1478 5561 if ( computed ) {
b@1478 5562 ret = computed.getPropertyValue( name ) || computed[ name ];
b@1478 5563 }
b@1478 5564
b@1478 5565 if ( computed ) {
b@1478 5566
b@1478 5567 if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
b@1478 5568 ret = jQuery.style( elem, name );
b@1478 5569 }
b@1478 5570
b@1478 5571 // Support: iOS < 6
b@1478 5572 // A tribute to the "awesome hack by Dean Edwards"
b@1478 5573 // iOS < 6 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
b@1478 5574 // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
b@1478 5575 if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
b@1478 5576
b@1478 5577 // Remember the original values
b@1478 5578 width = style.width;
b@1478 5579 minWidth = style.minWidth;
b@1478 5580 maxWidth = style.maxWidth;
b@1478 5581
b@1478 5582 // Put in the new values to get a computed value out
b@1478 5583 style.minWidth = style.maxWidth = style.width = ret;
b@1478 5584 ret = computed.width;
b@1478 5585
b@1478 5586 // Revert the changed values
b@1478 5587 style.width = width;
b@1478 5588 style.minWidth = minWidth;
b@1478 5589 style.maxWidth = maxWidth;
b@1478 5590 }
b@1478 5591 }
b@1478 5592
b@1478 5593 return ret !== undefined ?
b@1478 5594 // Support: IE
b@1478 5595 // IE returns zIndex value as an integer.
b@1478 5596 ret + "" :
b@1478 5597 ret;
b@1478 5598 }
b@1478 5599
b@1478 5600
b@1478 5601 function addGetHookIf( conditionFn, hookFn ) {
b@1478 5602 // Define the hook, we'll check on the first run if it's really needed.
b@1478 5603 return {
b@1478 5604 get: function() {
b@1478 5605 if ( conditionFn() ) {
b@1478 5606 // Hook not needed (or it's not possible to use it due
b@1478 5607 // to missing dependency), remove it.
b@1478 5608 delete this.get;
b@1478 5609 return;
b@1478 5610 }
b@1478 5611
b@1478 5612 // Hook needed; redefine it so that the support test is not executed again.
b@1478 5613 return (this.get = hookFn).apply( this, arguments );
b@1478 5614 }
b@1478 5615 };
b@1478 5616 }
b@1478 5617
b@1478 5618
b@1478 5619 (function() {
b@1478 5620 var pixelPositionVal, boxSizingReliableVal,
b@1478 5621 docElem = document.documentElement,
b@1478 5622 container = document.createElement( "div" ),
b@1478 5623 div = document.createElement( "div" );
b@1478 5624
b@1478 5625 if ( !div.style ) {
b@1478 5626 return;
b@1478 5627 }
b@1478 5628
b@1478 5629 // Support: IE9-11+
b@1478 5630 // Style of cloned element affects source element cloned (#8908)
b@1478 5631 div.style.backgroundClip = "content-box";
b@1478 5632 div.cloneNode( true ).style.backgroundClip = "";
b@1478 5633 support.clearCloneStyle = div.style.backgroundClip === "content-box";
b@1478 5634
b@1478 5635 container.style.cssText = "border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;" +
b@1478 5636 "position:absolute";
b@1478 5637 container.appendChild( div );
b@1478 5638
b@1478 5639 // Executing both pixelPosition & boxSizingReliable tests require only one layout
b@1478 5640 // so they're executed at the same time to save the second computation.
b@1478 5641 function computePixelPositionAndBoxSizingReliable() {
b@1478 5642 div.style.cssText =
b@1478 5643 // Support: Firefox<29, Android 2.3
b@1478 5644 // Vendor-prefix box-sizing
b@1478 5645 "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
b@1478 5646 "box-sizing:border-box;display:block;margin-top:1%;top:1%;" +
b@1478 5647 "border:1px;padding:1px;width:4px;position:absolute";
b@1478 5648 div.innerHTML = "";
b@1478 5649 docElem.appendChild( container );
b@1478 5650
b@1478 5651 var divStyle = window.getComputedStyle( div, null );
b@1478 5652 pixelPositionVal = divStyle.top !== "1%";
b@1478 5653 boxSizingReliableVal = divStyle.width === "4px";
b@1478 5654
b@1478 5655 docElem.removeChild( container );
b@1478 5656 }
b@1478 5657
b@1478 5658 // Support: node.js jsdom
b@1478 5659 // Don't assume that getComputedStyle is a property of the global object
b@1478 5660 if ( window.getComputedStyle ) {
b@1478 5661 jQuery.extend( support, {
b@1478 5662 pixelPosition: function() {
b@1478 5663
b@1478 5664 // This test is executed only once but we still do memoizing
b@1478 5665 // since we can use the boxSizingReliable pre-computing.
b@1478 5666 // No need to check if the test was already performed, though.
b@1478 5667 computePixelPositionAndBoxSizingReliable();
b@1478 5668 return pixelPositionVal;
b@1478 5669 },
b@1478 5670 boxSizingReliable: function() {
b@1478 5671 if ( boxSizingReliableVal == null ) {
b@1478 5672 computePixelPositionAndBoxSizingReliable();
b@1478 5673 }
b@1478 5674 return boxSizingReliableVal;
b@1478 5675 },
b@1478 5676 reliableMarginRight: function() {
b@1478 5677
b@1478 5678 // Support: Android 2.3
b@1478 5679 // Check if div with explicit width and no margin-right incorrectly
b@1478 5680 // gets computed margin-right based on width of container. (#3333)
b@1478 5681 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
b@1478 5682 // This support function is only executed once so no memoizing is needed.
b@1478 5683 var ret,
b@1478 5684 marginDiv = div.appendChild( document.createElement( "div" ) );
b@1478 5685
b@1478 5686 // Reset CSS: box-sizing; display; margin; border; padding
b@1478 5687 marginDiv.style.cssText = div.style.cssText =
b@1478 5688 // Support: Firefox<29, Android 2.3
b@1478 5689 // Vendor-prefix box-sizing
b@1478 5690 "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
b@1478 5691 "box-sizing:content-box;display:block;margin:0;border:0;padding:0";
b@1478 5692 marginDiv.style.marginRight = marginDiv.style.width = "0";
b@1478 5693 div.style.width = "1px";
b@1478 5694 docElem.appendChild( container );
b@1478 5695
b@1478 5696 ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight );
b@1478 5697
b@1478 5698 docElem.removeChild( container );
b@1478 5699 div.removeChild( marginDiv );
b@1478 5700
b@1478 5701 return ret;
b@1478 5702 }
b@1478 5703 });
b@1478 5704 }
b@1478 5705 })();
b@1478 5706
b@1478 5707
b@1478 5708 // A method for quickly swapping in/out CSS properties to get correct calculations.
b@1478 5709 jQuery.swap = function( elem, options, callback, args ) {
b@1478 5710 var ret, name,
b@1478 5711 old = {};
b@1478 5712
b@1478 5713 // Remember the old values, and insert the new ones
b@1478 5714 for ( name in options ) {
b@1478 5715 old[ name ] = elem.style[ name ];
b@1478 5716 elem.style[ name ] = options[ name ];
b@1478 5717 }
b@1478 5718
b@1478 5719 ret = callback.apply( elem, args || [] );
b@1478 5720
b@1478 5721 // Revert the old values
b@1478 5722 for ( name in options ) {
b@1478 5723 elem.style[ name ] = old[ name ];
b@1478 5724 }
b@1478 5725
b@1478 5726 return ret;
b@1478 5727 };
b@1478 5728
b@1478 5729
b@1478 5730 var
b@1478 5731 // Swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
b@1478 5732 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
b@1478 5733 rdisplayswap = /^(none|table(?!-c[ea]).+)/,
b@1478 5734 rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),
b@1478 5735 rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ),
b@1478 5736
b@1478 5737 cssShow = { position: "absolute", visibility: "hidden", display: "block" },
b@1478 5738 cssNormalTransform = {
b@1478 5739 letterSpacing: "0",
b@1478 5740 fontWeight: "400"
b@1478 5741 },
b@1478 5742
b@1478 5743 cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
b@1478 5744
b@1478 5745 // Return a css property mapped to a potentially vendor prefixed property
b@1478 5746 function vendorPropName( style, name ) {
b@1478 5747
b@1478 5748 // Shortcut for names that are not vendor prefixed
b@1478 5749 if ( name in style ) {
b@1478 5750 return name;
b@1478 5751 }
b@1478 5752
b@1478 5753 // Check for vendor prefixed names
b@1478 5754 var capName = name[0].toUpperCase() + name.slice(1),
b@1478 5755 origName = name,
b@1478 5756 i = cssPrefixes.length;
b@1478 5757
b@1478 5758 while ( i-- ) {
b@1478 5759 name = cssPrefixes[ i ] + capName;
b@1478 5760 if ( name in style ) {
b@1478 5761 return name;
b@1478 5762 }
b@1478 5763 }
b@1478 5764
b@1478 5765 return origName;
b@1478 5766 }
b@1478 5767
b@1478 5768 function setPositiveNumber( elem, value, subtract ) {
b@1478 5769 var matches = rnumsplit.exec( value );
b@1478 5770 return matches ?
b@1478 5771 // Guard against undefined "subtract", e.g., when used as in cssHooks
b@1478 5772 Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
b@1478 5773 value;
b@1478 5774 }
b@1478 5775
b@1478 5776 function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
b@1478 5777 var i = extra === ( isBorderBox ? "border" : "content" ) ?
b@1478 5778 // If we already have the right measurement, avoid augmentation
b@1478 5779 4 :
b@1478 5780 // Otherwise initialize for horizontal or vertical properties
b@1478 5781 name === "width" ? 1 : 0,
b@1478 5782
b@1478 5783 val = 0;
b@1478 5784
b@1478 5785 for ( ; i < 4; i += 2 ) {
b@1478 5786 // Both box models exclude margin, so add it if we want it
b@1478 5787 if ( extra === "margin" ) {
b@1478 5788 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
b@1478 5789 }
b@1478 5790
b@1478 5791 if ( isBorderBox ) {
b@1478 5792 // border-box includes padding, so remove it if we want content
b@1478 5793 if ( extra === "content" ) {
b@1478 5794 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
b@1478 5795 }
b@1478 5796
b@1478 5797 // At this point, extra isn't border nor margin, so remove border
b@1478 5798 if ( extra !== "margin" ) {
b@1478 5799 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
b@1478 5800 }
b@1478 5801 } else {
b@1478 5802 // At this point, extra isn't content, so add padding
b@1478 5803 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
b@1478 5804
b@1478 5805 // At this point, extra isn't content nor padding, so add border
b@1478 5806 if ( extra !== "padding" ) {
b@1478 5807 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
b@1478 5808 }
b@1478 5809 }
b@1478 5810 }
b@1478 5811
b@1478 5812 return val;
b@1478 5813 }
b@1478 5814
b@1478 5815 function getWidthOrHeight( elem, name, extra ) {
b@1478 5816
b@1478 5817 // Start with offset property, which is equivalent to the border-box value
b@1478 5818 var valueIsBorderBox = true,
b@1478 5819 val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
b@1478 5820 styles = getStyles( elem ),
b@1478 5821 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
b@1478 5822
b@1478 5823 // Some non-html elements return undefined for offsetWidth, so check for null/undefined
b@1478 5824 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
b@1478 5825 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
b@1478 5826 if ( val <= 0 || val == null ) {
b@1478 5827 // Fall back to computed then uncomputed css if necessary
b@1478 5828 val = curCSS( elem, name, styles );
b@1478 5829 if ( val < 0 || val == null ) {
b@1478 5830 val = elem.style[ name ];
b@1478 5831 }
b@1478 5832
b@1478 5833 // Computed unit is not pixels. Stop here and return.
b@1478 5834 if ( rnumnonpx.test(val) ) {
b@1478 5835 return val;
b@1478 5836 }
b@1478 5837
b@1478 5838 // Check for style in case a browser which returns unreliable values
b@1478 5839 // for getComputedStyle silently falls back to the reliable elem.style
b@1478 5840 valueIsBorderBox = isBorderBox &&
b@1478 5841 ( support.boxSizingReliable() || val === elem.style[ name ] );
b@1478 5842
b@1478 5843 // Normalize "", auto, and prepare for extra
b@1478 5844 val = parseFloat( val ) || 0;
b@1478 5845 }
b@1478 5846
b@1478 5847 // Use the active box-sizing model to add/subtract irrelevant styles
b@1478 5848 return ( val +
b@1478 5849 augmentWidthOrHeight(
b@1478 5850 elem,
b@1478 5851 name,
b@1478 5852 extra || ( isBorderBox ? "border" : "content" ),
b@1478 5853 valueIsBorderBox,
b@1478 5854 styles
b@1478 5855 )
b@1478 5856 ) + "px";
b@1478 5857 }
b@1478 5858
b@1478 5859 function showHide( elements, show ) {
b@1478 5860 var display, elem, hidden,
b@1478 5861 values = [],
b@1478 5862 index = 0,
b@1478 5863 length = elements.length;
b@1478 5864
b@1478 5865 for ( ; index < length; index++ ) {
b@1478 5866 elem = elements[ index ];
b@1478 5867 if ( !elem.style ) {
b@1478 5868 continue;
b@1478 5869 }
b@1478 5870
b@1478 5871 values[ index ] = data_priv.get( elem, "olddisplay" );
b@1478 5872 display = elem.style.display;
b@1478 5873 if ( show ) {
b@1478 5874 // Reset the inline display of this element to learn if it is
b@1478 5875 // being hidden by cascaded rules or not
b@1478 5876 if ( !values[ index ] && display === "none" ) {
b@1478 5877 elem.style.display = "";
b@1478 5878 }
b@1478 5879
b@1478 5880 // Set elements which have been overridden with display: none
b@1478 5881 // in a stylesheet to whatever the default browser style is
b@1478 5882 // for such an element
b@1478 5883 if ( elem.style.display === "" && isHidden( elem ) ) {
b@1478 5884 values[ index ] = data_priv.access( elem, "olddisplay", defaultDisplay(elem.nodeName) );
b@1478 5885 }
b@1478 5886 } else {
b@1478 5887 hidden = isHidden( elem );
b@1478 5888
b@1478 5889 if ( display !== "none" || !hidden ) {
b@1478 5890 data_priv.set( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
b@1478 5891 }
b@1478 5892 }
b@1478 5893 }
b@1478 5894
b@1478 5895 // Set the display of most of the elements in a second loop
b@1478 5896 // to avoid the constant reflow
b@1478 5897 for ( index = 0; index < length; index++ ) {
b@1478 5898 elem = elements[ index ];
b@1478 5899 if ( !elem.style ) {
b@1478 5900 continue;
b@1478 5901 }
b@1478 5902 if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
b@1478 5903 elem.style.display = show ? values[ index ] || "" : "none";
b@1478 5904 }
b@1478 5905 }
b@1478 5906
b@1478 5907 return elements;
b@1478 5908 }
b@1478 5909
b@1478 5910 jQuery.extend({
b@1478 5911
b@1478 5912 // Add in style property hooks for overriding the default
b@1478 5913 // behavior of getting and setting a style property
b@1478 5914 cssHooks: {
b@1478 5915 opacity: {
b@1478 5916 get: function( elem, computed ) {
b@1478 5917 if ( computed ) {
b@1478 5918
b@1478 5919 // We should always get a number back from opacity
b@1478 5920 var ret = curCSS( elem, "opacity" );
b@1478 5921 return ret === "" ? "1" : ret;
b@1478 5922 }
b@1478 5923 }
b@1478 5924 }
b@1478 5925 },
b@1478 5926
b@1478 5927 // Don't automatically add "px" to these possibly-unitless properties
b@1478 5928 cssNumber: {
b@1478 5929 "columnCount": true,
b@1478 5930 "fillOpacity": true,
b@1478 5931 "flexGrow": true,
b@1478 5932 "flexShrink": true,
b@1478 5933 "fontWeight": true,
b@1478 5934 "lineHeight": true,
b@1478 5935 "opacity": true,
b@1478 5936 "order": true,
b@1478 5937 "orphans": true,
b@1478 5938 "widows": true,
b@1478 5939 "zIndex": true,
b@1478 5940 "zoom": true
b@1478 5941 },
b@1478 5942
b@1478 5943 // Add in properties whose names you wish to fix before
b@1478 5944 // setting or getting the value
b@1478 5945 cssProps: {
b@1478 5946 "float": "cssFloat"
b@1478 5947 },
b@1478 5948
b@1478 5949 // Get and set the style property on a DOM Node
b@1478 5950 style: function( elem, name, value, extra ) {
b@1478 5951
b@1478 5952 // Don't set styles on text and comment nodes
b@1478 5953 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
b@1478 5954 return;
b@1478 5955 }
b@1478 5956
b@1478 5957 // Make sure that we're working with the right name
b@1478 5958 var ret, type, hooks,
b@1478 5959 origName = jQuery.camelCase( name ),
b@1478 5960 style = elem.style;
b@1478 5961
b@1478 5962 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
b@1478 5963
b@1478 5964 // Gets hook for the prefixed version, then unprefixed version
b@1478 5965 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
b@1478 5966
b@1478 5967 // Check if we're setting a value
b@1478 5968 if ( value !== undefined ) {
b@1478 5969 type = typeof value;
b@1478 5970
b@1478 5971 // Convert "+=" or "-=" to relative numbers (#7345)
b@1478 5972 if ( type === "string" && (ret = rrelNum.exec( value )) ) {
b@1478 5973 value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
b@1478 5974 // Fixes bug #9237
b@1478 5975 type = "number";
b@1478 5976 }
b@1478 5977
b@1478 5978 // Make sure that null and NaN values aren't set (#7116)
b@1478 5979 if ( value == null || value !== value ) {
b@1478 5980 return;
b@1478 5981 }
b@1478 5982
b@1478 5983 // If a number, add 'px' to the (except for certain CSS properties)
b@1478 5984 if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
b@1478 5985 value += "px";
b@1478 5986 }
b@1478 5987
b@1478 5988 // Support: IE9-11+
b@1478 5989 // background-* props affect original clone's values
b@1478 5990 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
b@1478 5991 style[ name ] = "inherit";
b@1478 5992 }
b@1478 5993
b@1478 5994 // If a hook was provided, use that value, otherwise just set the specified value
b@1478 5995 if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
b@1478 5996 style[ name ] = value;
b@1478 5997 }
b@1478 5998
b@1478 5999 } else {
b@1478 6000 // If a hook was provided get the non-computed value from there
b@1478 6001 if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
b@1478 6002 return ret;
b@1478 6003 }
b@1478 6004
b@1478 6005 // Otherwise just get the value from the style object
b@1478 6006 return style[ name ];
b@1478 6007 }
b@1478 6008 },
b@1478 6009
b@1478 6010 css: function( elem, name, extra, styles ) {
b@1478 6011 var val, num, hooks,
b@1478 6012 origName = jQuery.camelCase( name );
b@1478 6013
b@1478 6014 // Make sure that we're working with the right name
b@1478 6015 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
b@1478 6016
b@1478 6017 // Try prefixed name followed by the unprefixed name
b@1478 6018 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
b@1478 6019
b@1478 6020 // If a hook was provided get the computed value from there
b@1478 6021 if ( hooks && "get" in hooks ) {
b@1478 6022 val = hooks.get( elem, true, extra );
b@1478 6023 }
b@1478 6024
b@1478 6025 // Otherwise, if a way to get the computed value exists, use that
b@1478 6026 if ( val === undefined ) {
b@1478 6027 val = curCSS( elem, name, styles );
b@1478 6028 }
b@1478 6029
b@1478 6030 // Convert "normal" to computed value
b@1478 6031 if ( val === "normal" && name in cssNormalTransform ) {
b@1478 6032 val = cssNormalTransform[ name ];
b@1478 6033 }
b@1478 6034
b@1478 6035 // Make numeric if forced or a qualifier was provided and val looks numeric
b@1478 6036 if ( extra === "" || extra ) {
b@1478 6037 num = parseFloat( val );
b@1478 6038 return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
b@1478 6039 }
b@1478 6040 return val;
b@1478 6041 }
b@1478 6042 });
b@1478 6043
b@1478 6044 jQuery.each([ "height", "width" ], function( i, name ) {
b@1478 6045 jQuery.cssHooks[ name ] = {
b@1478 6046 get: function( elem, computed, extra ) {
b@1478 6047 if ( computed ) {
b@1478 6048
b@1478 6049 // Certain elements can have dimension info if we invisibly show them
b@1478 6050 // but it must have a current display style that would benefit
b@1478 6051 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ?
b@1478 6052 jQuery.swap( elem, cssShow, function() {
b@1478 6053 return getWidthOrHeight( elem, name, extra );
b@1478 6054 }) :
b@1478 6055 getWidthOrHeight( elem, name, extra );
b@1478 6056 }
b@1478 6057 },
b@1478 6058
b@1478 6059 set: function( elem, value, extra ) {
b@1478 6060 var styles = extra && getStyles( elem );
b@1478 6061 return setPositiveNumber( elem, value, extra ?
b@1478 6062 augmentWidthOrHeight(
b@1478 6063 elem,
b@1478 6064 name,
b@1478 6065 extra,
b@1478 6066 jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
b@1478 6067 styles
b@1478 6068 ) : 0
b@1478 6069 );
b@1478 6070 }
b@1478 6071 };
b@1478 6072 });
b@1478 6073
b@1478 6074 // Support: Android 2.3
b@1478 6075 jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
b@1478 6076 function( elem, computed ) {
b@1478 6077 if ( computed ) {
b@1478 6078 return jQuery.swap( elem, { "display": "inline-block" },
b@1478 6079 curCSS, [ elem, "marginRight" ] );
b@1478 6080 }
b@1478 6081 }
b@1478 6082 );
b@1478 6083
b@1478 6084 // These hooks are used by animate to expand properties
b@1478 6085 jQuery.each({
b@1478 6086 margin: "",
b@1478 6087 padding: "",
b@1478 6088 border: "Width"
b@1478 6089 }, function( prefix, suffix ) {
b@1478 6090 jQuery.cssHooks[ prefix + suffix ] = {
b@1478 6091 expand: function( value ) {
b@1478 6092 var i = 0,
b@1478 6093 expanded = {},
b@1478 6094
b@1478 6095 // Assumes a single number if not a string
b@1478 6096 parts = typeof value === "string" ? value.split(" ") : [ value ];
b@1478 6097
b@1478 6098 for ( ; i < 4; i++ ) {
b@1478 6099 expanded[ prefix + cssExpand[ i ] + suffix ] =
b@1478 6100 parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
b@1478 6101 }
b@1478 6102
b@1478 6103 return expanded;
b@1478 6104 }
b@1478 6105 };
b@1478 6106
b@1478 6107 if ( !rmargin.test( prefix ) ) {
b@1478 6108 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
b@1478 6109 }
b@1478 6110 });
b@1478 6111
b@1478 6112 jQuery.fn.extend({
b@1478 6113 css: function( name, value ) {
b@1478 6114 return access( this, function( elem, name, value ) {
b@1478 6115 var styles, len,
b@1478 6116 map = {},
b@1478 6117 i = 0;
b@1478 6118
b@1478 6119 if ( jQuery.isArray( name ) ) {
b@1478 6120 styles = getStyles( elem );
b@1478 6121 len = name.length;
b@1478 6122
b@1478 6123 for ( ; i < len; i++ ) {
b@1478 6124 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
b@1478 6125 }
b@1478 6126
b@1478 6127 return map;
b@1478 6128 }
b@1478 6129
b@1478 6130 return value !== undefined ?
b@1478 6131 jQuery.style( elem, name, value ) :
b@1478 6132 jQuery.css( elem, name );
b@1478 6133 }, name, value, arguments.length > 1 );
b@1478 6134 },
b@1478 6135 show: function() {
b@1478 6136 return showHide( this, true );
b@1478 6137 },
b@1478 6138 hide: function() {
b@1478 6139 return showHide( this );
b@1478 6140 },
b@1478 6141 toggle: function( state ) {
b@1478 6142 if ( typeof state === "boolean" ) {
b@1478 6143 return state ? this.show() : this.hide();
b@1478 6144 }
b@1478 6145
b@1478 6146 return this.each(function() {
b@1478 6147 if ( isHidden( this ) ) {
b@1478 6148 jQuery( this ).show();
b@1478 6149 } else {
b@1478 6150 jQuery( this ).hide();
b@1478 6151 }
b@1478 6152 });
b@1478 6153 }
b@1478 6154 });
b@1478 6155
b@1478 6156
b@1478 6157 function Tween( elem, options, prop, end, easing ) {
b@1478 6158 return new Tween.prototype.init( elem, options, prop, end, easing );
b@1478 6159 }
b@1478 6160 jQuery.Tween = Tween;
b@1478 6161
b@1478 6162 Tween.prototype = {
b@1478 6163 constructor: Tween,
b@1478 6164 init: function( elem, options, prop, end, easing, unit ) {
b@1478 6165 this.elem = elem;
b@1478 6166 this.prop = prop;
b@1478 6167 this.easing = easing || "swing";
b@1478 6168 this.options = options;
b@1478 6169 this.start = this.now = this.cur();
b@1478 6170 this.end = end;
b@1478 6171 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
b@1478 6172 },
b@1478 6173 cur: function() {
b@1478 6174 var hooks = Tween.propHooks[ this.prop ];
b@1478 6175
b@1478 6176 return hooks && hooks.get ?
b@1478 6177 hooks.get( this ) :
b@1478 6178 Tween.propHooks._default.get( this );
b@1478 6179 },
b@1478 6180 run: function( percent ) {
b@1478 6181 var eased,
b@1478 6182 hooks = Tween.propHooks[ this.prop ];
b@1478 6183
b@1478 6184 if ( this.options.duration ) {
b@1478 6185 this.pos = eased = jQuery.easing[ this.easing ](
b@1478 6186 percent, this.options.duration * percent, 0, 1, this.options.duration
b@1478 6187 );
b@1478 6188 } else {
b@1478 6189 this.pos = eased = percent;
b@1478 6190 }
b@1478 6191 this.now = ( this.end - this.start ) * eased + this.start;
b@1478 6192
b@1478 6193 if ( this.options.step ) {
b@1478 6194 this.options.step.call( this.elem, this.now, this );
b@1478 6195 }
b@1478 6196
b@1478 6197 if ( hooks && hooks.set ) {
b@1478 6198 hooks.set( this );
b@1478 6199 } else {
b@1478 6200 Tween.propHooks._default.set( this );
b@1478 6201 }
b@1478 6202 return this;
b@1478 6203 }
b@1478 6204 };
b@1478 6205
b@1478 6206 Tween.prototype.init.prototype = Tween.prototype;
b@1478 6207
b@1478 6208 Tween.propHooks = {
b@1478 6209 _default: {
b@1478 6210 get: function( tween ) {
b@1478 6211 var result;
b@1478 6212
b@1478 6213 if ( tween.elem[ tween.prop ] != null &&
b@1478 6214 (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
b@1478 6215 return tween.elem[ tween.prop ];
b@1478 6216 }
b@1478 6217
b@1478 6218 // Passing an empty string as a 3rd parameter to .css will automatically
b@1478 6219 // attempt a parseFloat and fallback to a string if the parse fails.
b@1478 6220 // Simple values such as "10px" are parsed to Float;
b@1478 6221 // complex values such as "rotate(1rad)" are returned as-is.
b@1478 6222 result = jQuery.css( tween.elem, tween.prop, "" );
b@1478 6223 // Empty strings, null, undefined and "auto" are converted to 0.
b@1478 6224 return !result || result === "auto" ? 0 : result;
b@1478 6225 },
b@1478 6226 set: function( tween ) {
b@1478 6227 // Use step hook for back compat.
b@1478 6228 // Use cssHook if its there.
b@1478 6229 // Use .style if available and use plain properties where available.
b@1478 6230 if ( jQuery.fx.step[ tween.prop ] ) {
b@1478 6231 jQuery.fx.step[ tween.prop ]( tween );
b@1478 6232 } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
b@1478 6233 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
b@1478 6234 } else {
b@1478 6235 tween.elem[ tween.prop ] = tween.now;
b@1478 6236 }
b@1478 6237 }
b@1478 6238 }
b@1478 6239 };
b@1478 6240
b@1478 6241 // Support: IE9
b@1478 6242 // Panic based approach to setting things on disconnected nodes
b@1478 6243 Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
b@1478 6244 set: function( tween ) {
b@1478 6245 if ( tween.elem.nodeType && tween.elem.parentNode ) {
b@1478 6246 tween.elem[ tween.prop ] = tween.now;
b@1478 6247 }
b@1478 6248 }
b@1478 6249 };
b@1478 6250
b@1478 6251 jQuery.easing = {
b@1478 6252 linear: function( p ) {
b@1478 6253 return p;
b@1478 6254 },
b@1478 6255 swing: function( p ) {
b@1478 6256 return 0.5 - Math.cos( p * Math.PI ) / 2;
b@1478 6257 }
b@1478 6258 };
b@1478 6259
b@1478 6260 jQuery.fx = Tween.prototype.init;
b@1478 6261
b@1478 6262 // Back Compat <1.8 extension point
b@1478 6263 jQuery.fx.step = {};
b@1478 6264
b@1478 6265
b@1478 6266
b@1478 6267
b@1478 6268 var
b@1478 6269 fxNow, timerId,
b@1478 6270 rfxtypes = /^(?:toggle|show|hide)$/,
b@1478 6271 rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ),
b@1478 6272 rrun = /queueHooks$/,
b@1478 6273 animationPrefilters = [ defaultPrefilter ],
b@1478 6274 tweeners = {
b@1478 6275 "*": [ function( prop, value ) {
b@1478 6276 var tween = this.createTween( prop, value ),
b@1478 6277 target = tween.cur(),
b@1478 6278 parts = rfxnum.exec( value ),
b@1478 6279 unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
b@1478 6280
b@1478 6281 // Starting value computation is required for potential unit mismatches
b@1478 6282 start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) &&
b@1478 6283 rfxnum.exec( jQuery.css( tween.elem, prop ) ),
b@1478 6284 scale = 1,
b@1478 6285 maxIterations = 20;
b@1478 6286
b@1478 6287 if ( start && start[ 3 ] !== unit ) {
b@1478 6288 // Trust units reported by jQuery.css
b@1478 6289 unit = unit || start[ 3 ];
b@1478 6290
b@1478 6291 // Make sure we update the tween properties later on
b@1478 6292 parts = parts || [];
b@1478 6293
b@1478 6294 // Iteratively approximate from a nonzero starting point
b@1478 6295 start = +target || 1;
b@1478 6296
b@1478 6297 do {
b@1478 6298 // If previous iteration zeroed out, double until we get *something*.
b@1478 6299 // Use string for doubling so we don't accidentally see scale as unchanged below
b@1478 6300 scale = scale || ".5";
b@1478 6301
b@1478 6302 // Adjust and apply
b@1478 6303 start = start / scale;
b@1478 6304 jQuery.style( tween.elem, prop, start + unit );
b@1478 6305
b@1478 6306 // Update scale, tolerating zero or NaN from tween.cur(),
b@1478 6307 // break the loop if scale is unchanged or perfect, or if we've just had enough
b@1478 6308 } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
b@1478 6309 }
b@1478 6310
b@1478 6311 // Update tween properties
b@1478 6312 if ( parts ) {
b@1478 6313 start = tween.start = +start || +target || 0;
b@1478 6314 tween.unit = unit;
b@1478 6315 // If a +=/-= token was provided, we're doing a relative animation
b@1478 6316 tween.end = parts[ 1 ] ?
b@1478 6317 start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :
b@1478 6318 +parts[ 2 ];
b@1478 6319 }
b@1478 6320
b@1478 6321 return tween;
b@1478 6322 } ]
b@1478 6323 };
b@1478 6324
b@1478 6325 // Animations created synchronously will run synchronously
b@1478 6326 function createFxNow() {
b@1478 6327 setTimeout(function() {
b@1478 6328 fxNow = undefined;
b@1478 6329 });
b@1478 6330 return ( fxNow = jQuery.now() );
b@1478 6331 }
b@1478 6332
b@1478 6333 // Generate parameters to create a standard animation
b@1478 6334 function genFx( type, includeWidth ) {
b@1478 6335 var which,
b@1478 6336 i = 0,
b@1478 6337 attrs = { height: type };
b@1478 6338
b@1478 6339 // If we include width, step value is 1 to do all cssExpand values,
b@1478 6340 // otherwise step value is 2 to skip over Left and Right
b@1478 6341 includeWidth = includeWidth ? 1 : 0;
b@1478 6342 for ( ; i < 4 ; i += 2 - includeWidth ) {
b@1478 6343 which = cssExpand[ i ];
b@1478 6344 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
b@1478 6345 }
b@1478 6346
b@1478 6347 if ( includeWidth ) {
b@1478 6348 attrs.opacity = attrs.width = type;
b@1478 6349 }
b@1478 6350
b@1478 6351 return attrs;
b@1478 6352 }
b@1478 6353
b@1478 6354 function createTween( value, prop, animation ) {
b@1478 6355 var tween,
b@1478 6356 collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
b@1478 6357 index = 0,
b@1478 6358 length = collection.length;
b@1478 6359 for ( ; index < length; index++ ) {
b@1478 6360 if ( (tween = collection[ index ].call( animation, prop, value )) ) {
b@1478 6361
b@1478 6362 // We're done with this property
b@1478 6363 return tween;
b@1478 6364 }
b@1478 6365 }
b@1478 6366 }
b@1478 6367
b@1478 6368 function defaultPrefilter( elem, props, opts ) {
b@1478 6369 /* jshint validthis: true */
b@1478 6370 var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
b@1478 6371 anim = this,
b@1478 6372 orig = {},
b@1478 6373 style = elem.style,
b@1478 6374 hidden = elem.nodeType && isHidden( elem ),
b@1478 6375 dataShow = data_priv.get( elem, "fxshow" );
b@1478 6376
b@1478 6377 // Handle queue: false promises
b@1478 6378 if ( !opts.queue ) {
b@1478 6379 hooks = jQuery._queueHooks( elem, "fx" );
b@1478 6380 if ( hooks.unqueued == null ) {
b@1478 6381 hooks.unqueued = 0;
b@1478 6382 oldfire = hooks.empty.fire;
b@1478 6383 hooks.empty.fire = function() {
b@1478 6384 if ( !hooks.unqueued ) {
b@1478 6385 oldfire();
b@1478 6386 }
b@1478 6387 };
b@1478 6388 }
b@1478 6389 hooks.unqueued++;
b@1478 6390
b@1478 6391 anim.always(function() {
b@1478 6392 // Ensure the complete handler is called before this completes
b@1478 6393 anim.always(function() {
b@1478 6394 hooks.unqueued--;
b@1478 6395 if ( !jQuery.queue( elem, "fx" ).length ) {
b@1478 6396 hooks.empty.fire();
b@1478 6397 }
b@1478 6398 });
b@1478 6399 });
b@1478 6400 }
b@1478 6401
b@1478 6402 // Height/width overflow pass
b@1478 6403 if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
b@1478 6404 // Make sure that nothing sneaks out
b@1478 6405 // Record all 3 overflow attributes because IE9-10 do not
b@1478 6406 // change the overflow attribute when overflowX and
b@1478 6407 // overflowY are set to the same value
b@1478 6408 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
b@1478 6409
b@1478 6410 // Set display property to inline-block for height/width
b@1478 6411 // animations on inline elements that are having width/height animated
b@1478 6412 display = jQuery.css( elem, "display" );
b@1478 6413
b@1478 6414 // Test default display if display is currently "none"
b@1478 6415 checkDisplay = display === "none" ?
b@1478 6416 data_priv.get( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
b@1478 6417
b@1478 6418 if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
b@1478 6419 style.display = "inline-block";
b@1478 6420 }
b@1478 6421 }
b@1478 6422
b@1478 6423 if ( opts.overflow ) {
b@1478 6424 style.overflow = "hidden";
b@1478 6425 anim.always(function() {
b@1478 6426 style.overflow = opts.overflow[ 0 ];
b@1478 6427 style.overflowX = opts.overflow[ 1 ];
b@1478 6428 style.overflowY = opts.overflow[ 2 ];
b@1478 6429 });
b@1478 6430 }
b@1478 6431
b@1478 6432 // show/hide pass
b@1478 6433 for ( prop in props ) {
b@1478 6434 value = props[ prop ];
b@1478 6435 if ( rfxtypes.exec( value ) ) {
b@1478 6436 delete props[ prop ];
b@1478 6437 toggle = toggle || value === "toggle";
b@1478 6438 if ( value === ( hidden ? "hide" : "show" ) ) {
b@1478 6439
b@1478 6440 // If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden
b@1478 6441 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
b@1478 6442 hidden = true;
b@1478 6443 } else {
b@1478 6444 continue;
b@1478 6445 }
b@1478 6446 }
b@1478 6447 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
b@1478 6448
b@1478 6449 // Any non-fx value stops us from restoring the original display value
b@1478 6450 } else {
b@1478 6451 display = undefined;
b@1478 6452 }
b@1478 6453 }
b@1478 6454
b@1478 6455 if ( !jQuery.isEmptyObject( orig ) ) {
b@1478 6456 if ( dataShow ) {
b@1478 6457 if ( "hidden" in dataShow ) {
b@1478 6458 hidden = dataShow.hidden;
b@1478 6459 }
b@1478 6460 } else {
b@1478 6461 dataShow = data_priv.access( elem, "fxshow", {} );
b@1478 6462 }
b@1478 6463
b@1478 6464 // Store state if its toggle - enables .stop().toggle() to "reverse"
b@1478 6465 if ( toggle ) {
b@1478 6466 dataShow.hidden = !hidden;
b@1478 6467 }
b@1478 6468 if ( hidden ) {
b@1478 6469 jQuery( elem ).show();
b@1478 6470 } else {
b@1478 6471 anim.done(function() {
b@1478 6472 jQuery( elem ).hide();
b@1478 6473 });
b@1478 6474 }
b@1478 6475 anim.done(function() {
b@1478 6476 var prop;
b@1478 6477
b@1478 6478 data_priv.remove( elem, "fxshow" );
b@1478 6479 for ( prop in orig ) {
b@1478 6480 jQuery.style( elem, prop, orig[ prop ] );
b@1478 6481 }
b@1478 6482 });
b@1478 6483 for ( prop in orig ) {
b@1478 6484 tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
b@1478 6485
b@1478 6486 if ( !( prop in dataShow ) ) {
b@1478 6487 dataShow[ prop ] = tween.start;
b@1478 6488 if ( hidden ) {
b@1478 6489 tween.end = tween.start;
b@1478 6490 tween.start = prop === "width" || prop === "height" ? 1 : 0;
b@1478 6491 }
b@1478 6492 }
b@1478 6493 }
b@1478 6494
b@1478 6495 // If this is a noop like .hide().hide(), restore an overwritten display value
b@1478 6496 } else if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" ) {
b@1478 6497 style.display = display;
b@1478 6498 }
b@1478 6499 }
b@1478 6500
b@1478 6501 function propFilter( props, specialEasing ) {
b@1478 6502 var index, name, easing, value, hooks;
b@1478 6503
b@1478 6504 // camelCase, specialEasing and expand cssHook pass
b@1478 6505 for ( index in props ) {
b@1478 6506 name = jQuery.camelCase( index );
b@1478 6507 easing = specialEasing[ name ];
b@1478 6508 value = props[ index ];
b@1478 6509 if ( jQuery.isArray( value ) ) {
b@1478 6510 easing = value[ 1 ];
b@1478 6511 value = props[ index ] = value[ 0 ];
b@1478 6512 }
b@1478 6513
b@1478 6514 if ( index !== name ) {
b@1478 6515 props[ name ] = value;
b@1478 6516 delete props[ index ];
b@1478 6517 }
b@1478 6518
b@1478 6519 hooks = jQuery.cssHooks[ name ];
b@1478 6520 if ( hooks && "expand" in hooks ) {
b@1478 6521 value = hooks.expand( value );
b@1478 6522 delete props[ name ];
b@1478 6523
b@1478 6524 // Not quite $.extend, this won't overwrite existing keys.
b@1478 6525 // Reusing 'index' because we have the correct "name"
b@1478 6526 for ( index in value ) {
b@1478 6527 if ( !( index in props ) ) {
b@1478 6528 props[ index ] = value[ index ];
b@1478 6529 specialEasing[ index ] = easing;
b@1478 6530 }
b@1478 6531 }
b@1478 6532 } else {
b@1478 6533 specialEasing[ name ] = easing;
b@1478 6534 }
b@1478 6535 }
b@1478 6536 }
b@1478 6537
b@1478 6538 function Animation( elem, properties, options ) {
b@1478 6539 var result,
b@1478 6540 stopped,
b@1478 6541 index = 0,
b@1478 6542 length = animationPrefilters.length,
b@1478 6543 deferred = jQuery.Deferred().always( function() {
b@1478 6544 // Don't match elem in the :animated selector
b@1478 6545 delete tick.elem;
b@1478 6546 }),
b@1478 6547 tick = function() {
b@1478 6548 if ( stopped ) {
b@1478 6549 return false;
b@1478 6550 }
b@1478 6551 var currentTime = fxNow || createFxNow(),
b@1478 6552 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
b@1478 6553 // Support: Android 2.3
b@1478 6554 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
b@1478 6555 temp = remaining / animation.duration || 0,
b@1478 6556 percent = 1 - temp,
b@1478 6557 index = 0,
b@1478 6558 length = animation.tweens.length;
b@1478 6559
b@1478 6560 for ( ; index < length ; index++ ) {
b@1478 6561 animation.tweens[ index ].run( percent );
b@1478 6562 }
b@1478 6563
b@1478 6564 deferred.notifyWith( elem, [ animation, percent, remaining ]);
b@1478 6565
b@1478 6566 if ( percent < 1 && length ) {
b@1478 6567 return remaining;
b@1478 6568 } else {
b@1478 6569 deferred.resolveWith( elem, [ animation ] );
b@1478 6570 return false;
b@1478 6571 }
b@1478 6572 },
b@1478 6573 animation = deferred.promise({
b@1478 6574 elem: elem,
b@1478 6575 props: jQuery.extend( {}, properties ),
b@1478 6576 opts: jQuery.extend( true, { specialEasing: {} }, options ),
b@1478 6577 originalProperties: properties,
b@1478 6578 originalOptions: options,
b@1478 6579 startTime: fxNow || createFxNow(),
b@1478 6580 duration: options.duration,
b@1478 6581 tweens: [],
b@1478 6582 createTween: function( prop, end ) {
b@1478 6583 var tween = jQuery.Tween( elem, animation.opts, prop, end,
b@1478 6584 animation.opts.specialEasing[ prop ] || animation.opts.easing );
b@1478 6585 animation.tweens.push( tween );
b@1478 6586 return tween;
b@1478 6587 },
b@1478 6588 stop: function( gotoEnd ) {
b@1478 6589 var index = 0,
b@1478 6590 // If we are going to the end, we want to run all the tweens
b@1478 6591 // otherwise we skip this part
b@1478 6592 length = gotoEnd ? animation.tweens.length : 0;
b@1478 6593 if ( stopped ) {
b@1478 6594 return this;
b@1478 6595 }
b@1478 6596 stopped = true;
b@1478 6597 for ( ; index < length ; index++ ) {
b@1478 6598 animation.tweens[ index ].run( 1 );
b@1478 6599 }
b@1478 6600
b@1478 6601 // Resolve when we played the last frame; otherwise, reject
b@1478 6602 if ( gotoEnd ) {
b@1478 6603 deferred.resolveWith( elem, [ animation, gotoEnd ] );
b@1478 6604 } else {
b@1478 6605 deferred.rejectWith( elem, [ animation, gotoEnd ] );
b@1478 6606 }
b@1478 6607 return this;
b@1478 6608 }
b@1478 6609 }),
b@1478 6610 props = animation.props;
b@1478 6611
b@1478 6612 propFilter( props, animation.opts.specialEasing );
b@1478 6613
b@1478 6614 for ( ; index < length ; index++ ) {
b@1478 6615 result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
b@1478 6616 if ( result ) {
b@1478 6617 return result;
b@1478 6618 }
b@1478 6619 }
b@1478 6620
b@1478 6621 jQuery.map( props, createTween, animation );
b@1478 6622
b@1478 6623 if ( jQuery.isFunction( animation.opts.start ) ) {
b@1478 6624 animation.opts.start.call( elem, animation );
b@1478 6625 }
b@1478 6626
b@1478 6627 jQuery.fx.timer(
b@1478 6628 jQuery.extend( tick, {
b@1478 6629 elem: elem,
b@1478 6630 anim: animation,
b@1478 6631 queue: animation.opts.queue
b@1478 6632 })
b@1478 6633 );
b@1478 6634
b@1478 6635 // attach callbacks from options
b@1478 6636 return animation.progress( animation.opts.progress )
b@1478 6637 .done( animation.opts.done, animation.opts.complete )
b@1478 6638 .fail( animation.opts.fail )
b@1478 6639 .always( animation.opts.always );
b@1478 6640 }
b@1478 6641
b@1478 6642 jQuery.Animation = jQuery.extend( Animation, {
b@1478 6643
b@1478 6644 tweener: function( props, callback ) {
b@1478 6645 if ( jQuery.isFunction( props ) ) {
b@1478 6646 callback = props;
b@1478 6647 props = [ "*" ];
b@1478 6648 } else {
b@1478 6649 props = props.split(" ");
b@1478 6650 }
b@1478 6651
b@1478 6652 var prop,
b@1478 6653 index = 0,
b@1478 6654 length = props.length;
b@1478 6655
b@1478 6656 for ( ; index < length ; index++ ) {
b@1478 6657 prop = props[ index ];
b@1478 6658 tweeners[ prop ] = tweeners[ prop ] || [];
b@1478 6659 tweeners[ prop ].unshift( callback );
b@1478 6660 }
b@1478 6661 },
b@1478 6662
b@1478 6663 prefilter: function( callback, prepend ) {
b@1478 6664 if ( prepend ) {
b@1478 6665 animationPrefilters.unshift( callback );
b@1478 6666 } else {
b@1478 6667 animationPrefilters.push( callback );
b@1478 6668 }
b@1478 6669 }
b@1478 6670 });
b@1478 6671
b@1478 6672 jQuery.speed = function( speed, easing, fn ) {
b@1478 6673 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
b@1478 6674 complete: fn || !fn && easing ||
b@1478 6675 jQuery.isFunction( speed ) && speed,
b@1478 6676 duration: speed,
b@1478 6677 easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
b@1478 6678 };
b@1478 6679
b@1478 6680 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
b@1478 6681 opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
b@1478 6682
b@1478 6683 // Normalize opt.queue - true/undefined/null -> "fx"
b@1478 6684 if ( opt.queue == null || opt.queue === true ) {
b@1478 6685 opt.queue = "fx";
b@1478 6686 }
b@1478 6687
b@1478 6688 // Queueing
b@1478 6689 opt.old = opt.complete;
b@1478 6690
b@1478 6691 opt.complete = function() {
b@1478 6692 if ( jQuery.isFunction( opt.old ) ) {
b@1478 6693 opt.old.call( this );
b@1478 6694 }
b@1478 6695
b@1478 6696 if ( opt.queue ) {
b@1478 6697 jQuery.dequeue( this, opt.queue );
b@1478 6698 }
b@1478 6699 };
b@1478 6700
b@1478 6701 return opt;
b@1478 6702 };
b@1478 6703
b@1478 6704 jQuery.fn.extend({
b@1478 6705 fadeTo: function( speed, to, easing, callback ) {
b@1478 6706
b@1478 6707 // Show any hidden elements after setting opacity to 0
b@1478 6708 return this.filter( isHidden ).css( "opacity", 0 ).show()
b@1478 6709
b@1478 6710 // Animate to the value specified
b@1478 6711 .end().animate({ opacity: to }, speed, easing, callback );
b@1478 6712 },
b@1478 6713 animate: function( prop, speed, easing, callback ) {
b@1478 6714 var empty = jQuery.isEmptyObject( prop ),
b@1478 6715 optall = jQuery.speed( speed, easing, callback ),
b@1478 6716 doAnimation = function() {
b@1478 6717 // Operate on a copy of prop so per-property easing won't be lost
b@1478 6718 var anim = Animation( this, jQuery.extend( {}, prop ), optall );
b@1478 6719
b@1478 6720 // Empty animations, or finishing resolves immediately
b@1478 6721 if ( empty || data_priv.get( this, "finish" ) ) {
b@1478 6722 anim.stop( true );
b@1478 6723 }
b@1478 6724 };
b@1478 6725 doAnimation.finish = doAnimation;
b@1478 6726
b@1478 6727 return empty || optall.queue === false ?
b@1478 6728 this.each( doAnimation ) :
b@1478 6729 this.queue( optall.queue, doAnimation );
b@1478 6730 },
b@1478 6731 stop: function( type, clearQueue, gotoEnd ) {
b@1478 6732 var stopQueue = function( hooks ) {
b@1478 6733 var stop = hooks.stop;
b@1478 6734 delete hooks.stop;
b@1478 6735 stop( gotoEnd );
b@1478 6736 };
b@1478 6737
b@1478 6738 if ( typeof type !== "string" ) {
b@1478 6739 gotoEnd = clearQueue;
b@1478 6740 clearQueue = type;
b@1478 6741 type = undefined;
b@1478 6742 }
b@1478 6743 if ( clearQueue && type !== false ) {
b@1478 6744 this.queue( type || "fx", [] );
b@1478 6745 }
b@1478 6746
b@1478 6747 return this.each(function() {
b@1478 6748 var dequeue = true,
b@1478 6749 index = type != null && type + "queueHooks",
b@1478 6750 timers = jQuery.timers,
b@1478 6751 data = data_priv.get( this );
b@1478 6752
b@1478 6753 if ( index ) {
b@1478 6754 if ( data[ index ] && data[ index ].stop ) {
b@1478 6755 stopQueue( data[ index ] );
b@1478 6756 }
b@1478 6757 } else {
b@1478 6758 for ( index in data ) {
b@1478 6759 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
b@1478 6760 stopQueue( data[ index ] );
b@1478 6761 }
b@1478 6762 }
b@1478 6763 }
b@1478 6764
b@1478 6765 for ( index = timers.length; index--; ) {
b@1478 6766 if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
b@1478 6767 timers[ index ].anim.stop( gotoEnd );
b@1478 6768 dequeue = false;
b@1478 6769 timers.splice( index, 1 );
b@1478 6770 }
b@1478 6771 }
b@1478 6772
b@1478 6773 // Start the next in the queue if the last step wasn't forced.
b@1478 6774 // Timers currently will call their complete callbacks, which
b@1478 6775 // will dequeue but only if they were gotoEnd.
b@1478 6776 if ( dequeue || !gotoEnd ) {
b@1478 6777 jQuery.dequeue( this, type );
b@1478 6778 }
b@1478 6779 });
b@1478 6780 },
b@1478 6781 finish: function( type ) {
b@1478 6782 if ( type !== false ) {
b@1478 6783 type = type || "fx";
b@1478 6784 }
b@1478 6785 return this.each(function() {
b@1478 6786 var index,
b@1478 6787 data = data_priv.get( this ),
b@1478 6788 queue = data[ type + "queue" ],
b@1478 6789 hooks = data[ type + "queueHooks" ],
b@1478 6790 timers = jQuery.timers,
b@1478 6791 length = queue ? queue.length : 0;
b@1478 6792
b@1478 6793 // Enable finishing flag on private data
b@1478 6794 data.finish = true;
b@1478 6795
b@1478 6796 // Empty the queue first
b@1478 6797 jQuery.queue( this, type, [] );
b@1478 6798
b@1478 6799 if ( hooks && hooks.stop ) {
b@1478 6800 hooks.stop.call( this, true );
b@1478 6801 }
b@1478 6802
b@1478 6803 // Look for any active animations, and finish them
b@1478 6804 for ( index = timers.length; index--; ) {
b@1478 6805 if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
b@1478 6806 timers[ index ].anim.stop( true );
b@1478 6807 timers.splice( index, 1 );
b@1478 6808 }
b@1478 6809 }
b@1478 6810
b@1478 6811 // Look for any animations in the old queue and finish them
b@1478 6812 for ( index = 0; index < length; index++ ) {
b@1478 6813 if ( queue[ index ] && queue[ index ].finish ) {
b@1478 6814 queue[ index ].finish.call( this );
b@1478 6815 }
b@1478 6816 }
b@1478 6817
b@1478 6818 // Turn off finishing flag
b@1478 6819 delete data.finish;
b@1478 6820 });
b@1478 6821 }
b@1478 6822 });
b@1478 6823
b@1478 6824 jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
b@1478 6825 var cssFn = jQuery.fn[ name ];
b@1478 6826 jQuery.fn[ name ] = function( speed, easing, callback ) {
b@1478 6827 return speed == null || typeof speed === "boolean" ?
b@1478 6828 cssFn.apply( this, arguments ) :
b@1478 6829 this.animate( genFx( name, true ), speed, easing, callback );
b@1478 6830 };
b@1478 6831 });
b@1478 6832
b@1478 6833 // Generate shortcuts for custom animations
b@1478 6834 jQuery.each({
b@1478 6835 slideDown: genFx("show"),
b@1478 6836 slideUp: genFx("hide"),
b@1478 6837 slideToggle: genFx("toggle"),
b@1478 6838 fadeIn: { opacity: "show" },
b@1478 6839 fadeOut: { opacity: "hide" },
b@1478 6840 fadeToggle: { opacity: "toggle" }
b@1478 6841 }, function( name, props ) {
b@1478 6842 jQuery.fn[ name ] = function( speed, easing, callback ) {
b@1478 6843 return this.animate( props, speed, easing, callback );
b@1478 6844 };
b@1478 6845 });
b@1478 6846
b@1478 6847 jQuery.timers = [];
b@1478 6848 jQuery.fx.tick = function() {
b@1478 6849 var timer,
b@1478 6850 i = 0,
b@1478 6851 timers = jQuery.timers;
b@1478 6852
b@1478 6853 fxNow = jQuery.now();
b@1478 6854
b@1478 6855 for ( ; i < timers.length; i++ ) {
b@1478 6856 timer = timers[ i ];
b@1478 6857 // Checks the timer has not already been removed
b@1478 6858 if ( !timer() && timers[ i ] === timer ) {
b@1478 6859 timers.splice( i--, 1 );
b@1478 6860 }
b@1478 6861 }
b@1478 6862
b@1478 6863 if ( !timers.length ) {
b@1478 6864 jQuery.fx.stop();
b@1478 6865 }
b@1478 6866 fxNow = undefined;
b@1478 6867 };
b@1478 6868
b@1478 6869 jQuery.fx.timer = function( timer ) {
b@1478 6870 jQuery.timers.push( timer );
b@1478 6871 if ( timer() ) {
b@1478 6872 jQuery.fx.start();
b@1478 6873 } else {
b@1478 6874 jQuery.timers.pop();
b@1478 6875 }
b@1478 6876 };
b@1478 6877
b@1478 6878 jQuery.fx.interval = 13;
b@1478 6879
b@1478 6880 jQuery.fx.start = function() {
b@1478 6881 if ( !timerId ) {
b@1478 6882 timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
b@1478 6883 }
b@1478 6884 };
b@1478 6885
b@1478 6886 jQuery.fx.stop = function() {
b@1478 6887 clearInterval( timerId );
b@1478 6888 timerId = null;
b@1478 6889 };
b@1478 6890
b@1478 6891 jQuery.fx.speeds = {
b@1478 6892 slow: 600,
b@1478 6893 fast: 200,
b@1478 6894 // Default speed
b@1478 6895 _default: 400
b@1478 6896 };
b@1478 6897
b@1478 6898
b@1478 6899 // Based off of the plugin by Clint Helfers, with permission.
b@1478 6900 // http://blindsignals.com/index.php/2009/07/jquery-delay/
b@1478 6901 jQuery.fn.delay = function( time, type ) {
b@1478 6902 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
b@1478 6903 type = type || "fx";
b@1478 6904
b@1478 6905 return this.queue( type, function( next, hooks ) {
b@1478 6906 var timeout = setTimeout( next, time );
b@1478 6907 hooks.stop = function() {
b@1478 6908 clearTimeout( timeout );
b@1478 6909 };
b@1478 6910 });
b@1478 6911 };
b@1478 6912
b@1478 6913
b@1478 6914 (function() {
b@1478 6915 var input = document.createElement( "input" ),
b@1478 6916 select = document.createElement( "select" ),
b@1478 6917 opt = select.appendChild( document.createElement( "option" ) );
b@1478 6918
b@1478 6919 input.type = "checkbox";
b@1478 6920
b@1478 6921 // Support: iOS<=5.1, Android<=4.2+
b@1478 6922 // Default value for a checkbox should be "on"
b@1478 6923 support.checkOn = input.value !== "";
b@1478 6924
b@1478 6925 // Support: IE<=11+
b@1478 6926 // Must access selectedIndex to make default options select
b@1478 6927 support.optSelected = opt.selected;
b@1478 6928
b@1478 6929 // Support: Android<=2.3
b@1478 6930 // Options inside disabled selects are incorrectly marked as disabled
b@1478 6931 select.disabled = true;
b@1478 6932 support.optDisabled = !opt.disabled;
b@1478 6933
b@1478 6934 // Support: IE<=11+
b@1478 6935 // An input loses its value after becoming a radio
b@1478 6936 input = document.createElement( "input" );
b@1478 6937 input.value = "t";
b@1478 6938 input.type = "radio";
b@1478 6939 support.radioValue = input.value === "t";
b@1478 6940 })();
b@1478 6941
b@1478 6942
b@1478 6943 var nodeHook, boolHook,
b@1478 6944 attrHandle = jQuery.expr.attrHandle;
b@1478 6945
b@1478 6946 jQuery.fn.extend({
b@1478 6947 attr: function( name, value ) {
b@1478 6948 return access( this, jQuery.attr, name, value, arguments.length > 1 );
b@1478 6949 },
b@1478 6950
b@1478 6951 removeAttr: function( name ) {
b@1478 6952 return this.each(function() {
b@1478 6953 jQuery.removeAttr( this, name );
b@1478 6954 });
b@1478 6955 }
b@1478 6956 });
b@1478 6957
b@1478 6958 jQuery.extend({
b@1478 6959 attr: function( elem, name, value ) {
b@1478 6960 var hooks, ret,
b@1478 6961 nType = elem.nodeType;
b@1478 6962
b@1478 6963 // don't get/set attributes on text, comment and attribute nodes
b@1478 6964 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
b@1478 6965 return;
b@1478 6966 }
b@1478 6967
b@1478 6968 // Fallback to prop when attributes are not supported
b@1478 6969 if ( typeof elem.getAttribute === strundefined ) {
b@1478 6970 return jQuery.prop( elem, name, value );
b@1478 6971 }
b@1478 6972
b@1478 6973 // All attributes are lowercase
b@1478 6974 // Grab necessary hook if one is defined
b@1478 6975 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
b@1478 6976 name = name.toLowerCase();
b@1478 6977 hooks = jQuery.attrHooks[ name ] ||
b@1478 6978 ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
b@1478 6979 }
b@1478 6980
b@1478 6981 if ( value !== undefined ) {
b@1478 6982
b@1478 6983 if ( value === null ) {
b@1478 6984 jQuery.removeAttr( elem, name );
b@1478 6985
b@1478 6986 } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
b@1478 6987 return ret;
b@1478 6988
b@1478 6989 } else {
b@1478 6990 elem.setAttribute( name, value + "" );
b@1478 6991 return value;
b@1478 6992 }
b@1478 6993
b@1478 6994 } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
b@1478 6995 return ret;
b@1478 6996
b@1478 6997 } else {
b@1478 6998 ret = jQuery.find.attr( elem, name );
b@1478 6999
b@1478 7000 // Non-existent attributes return null, we normalize to undefined
b@1478 7001 return ret == null ?
b@1478 7002 undefined :
b@1478 7003 ret;
b@1478 7004 }
b@1478 7005 },
b@1478 7006
b@1478 7007 removeAttr: function( elem, value ) {
b@1478 7008 var name, propName,
b@1478 7009 i = 0,
b@1478 7010 attrNames = value && value.match( rnotwhite );
b@1478 7011
b@1478 7012 if ( attrNames && elem.nodeType === 1 ) {
b@1478 7013 while ( (name = attrNames[i++]) ) {
b@1478 7014 propName = jQuery.propFix[ name ] || name;
b@1478 7015
b@1478 7016 // Boolean attributes get special treatment (#10870)
b@1478 7017 if ( jQuery.expr.match.bool.test( name ) ) {
b@1478 7018 // Set corresponding property to false
b@1478 7019 elem[ propName ] = false;
b@1478 7020 }
b@1478 7021
b@1478 7022 elem.removeAttribute( name );
b@1478 7023 }
b@1478 7024 }
b@1478 7025 },
b@1478 7026
b@1478 7027 attrHooks: {
b@1478 7028 type: {
b@1478 7029 set: function( elem, value ) {
b@1478 7030 if ( !support.radioValue && value === "radio" &&
b@1478 7031 jQuery.nodeName( elem, "input" ) ) {
b@1478 7032 var val = elem.value;
b@1478 7033 elem.setAttribute( "type", value );
b@1478 7034 if ( val ) {
b@1478 7035 elem.value = val;
b@1478 7036 }
b@1478 7037 return value;
b@1478 7038 }
b@1478 7039 }
b@1478 7040 }
b@1478 7041 }
b@1478 7042 });
b@1478 7043
b@1478 7044 // Hooks for boolean attributes
b@1478 7045 boolHook = {
b@1478 7046 set: function( elem, value, name ) {
b@1478 7047 if ( value === false ) {
b@1478 7048 // Remove boolean attributes when set to false
b@1478 7049 jQuery.removeAttr( elem, name );
b@1478 7050 } else {
b@1478 7051 elem.setAttribute( name, name );
b@1478 7052 }
b@1478 7053 return name;
b@1478 7054 }
b@1478 7055 };
b@1478 7056 jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
b@1478 7057 var getter = attrHandle[ name ] || jQuery.find.attr;
b@1478 7058
b@1478 7059 attrHandle[ name ] = function( elem, name, isXML ) {
b@1478 7060 var ret, handle;
b@1478 7061 if ( !isXML ) {
b@1478 7062 // Avoid an infinite loop by temporarily removing this function from the getter
b@1478 7063 handle = attrHandle[ name ];
b@1478 7064 attrHandle[ name ] = ret;
b@1478 7065 ret = getter( elem, name, isXML ) != null ?
b@1478 7066 name.toLowerCase() :
b@1478 7067 null;
b@1478 7068 attrHandle[ name ] = handle;
b@1478 7069 }
b@1478 7070 return ret;
b@1478 7071 };
b@1478 7072 });
b@1478 7073
b@1478 7074
b@1478 7075
b@1478 7076
b@1478 7077 var rfocusable = /^(?:input|select|textarea|button)$/i;
b@1478 7078
b@1478 7079 jQuery.fn.extend({
b@1478 7080 prop: function( name, value ) {
b@1478 7081 return access( this, jQuery.prop, name, value, arguments.length > 1 );
b@1478 7082 },
b@1478 7083
b@1478 7084 removeProp: function( name ) {
b@1478 7085 return this.each(function() {
b@1478 7086 delete this[ jQuery.propFix[ name ] || name ];
b@1478 7087 });
b@1478 7088 }
b@1478 7089 });
b@1478 7090
b@1478 7091 jQuery.extend({
b@1478 7092 propFix: {
b@1478 7093 "for": "htmlFor",
b@1478 7094 "class": "className"
b@1478 7095 },
b@1478 7096
b@1478 7097 prop: function( elem, name, value ) {
b@1478 7098 var ret, hooks, notxml,
b@1478 7099 nType = elem.nodeType;
b@1478 7100
b@1478 7101 // Don't get/set properties on text, comment and attribute nodes
b@1478 7102 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
b@1478 7103 return;
b@1478 7104 }
b@1478 7105
b@1478 7106 notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
b@1478 7107
b@1478 7108 if ( notxml ) {
b@1478 7109 // Fix name and attach hooks
b@1478 7110 name = jQuery.propFix[ name ] || name;
b@1478 7111 hooks = jQuery.propHooks[ name ];
b@1478 7112 }
b@1478 7113
b@1478 7114 if ( value !== undefined ) {
b@1478 7115 return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
b@1478 7116 ret :
b@1478 7117 ( elem[ name ] = value );
b@1478 7118
b@1478 7119 } else {
b@1478 7120 return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
b@1478 7121 ret :
b@1478 7122 elem[ name ];
b@1478 7123 }
b@1478 7124 },
b@1478 7125
b@1478 7126 propHooks: {
b@1478 7127 tabIndex: {
b@1478 7128 get: function( elem ) {
b@1478 7129 return elem.hasAttribute( "tabindex" ) || rfocusable.test( elem.nodeName ) || elem.href ?
b@1478 7130 elem.tabIndex :
b@1478 7131 -1;
b@1478 7132 }
b@1478 7133 }
b@1478 7134 }
b@1478 7135 });
b@1478 7136
b@1478 7137 if ( !support.optSelected ) {
b@1478 7138 jQuery.propHooks.selected = {
b@1478 7139 get: function( elem ) {
b@1478 7140 var parent = elem.parentNode;
b@1478 7141 if ( parent && parent.parentNode ) {
b@1478 7142 parent.parentNode.selectedIndex;
b@1478 7143 }
b@1478 7144 return null;
b@1478 7145 }
b@1478 7146 };
b@1478 7147 }
b@1478 7148
b@1478 7149 jQuery.each([
b@1478 7150 "tabIndex",
b@1478 7151 "readOnly",
b@1478 7152 "maxLength",
b@1478 7153 "cellSpacing",
b@1478 7154 "cellPadding",
b@1478 7155 "rowSpan",
b@1478 7156 "colSpan",
b@1478 7157 "useMap",
b@1478 7158 "frameBorder",
b@1478 7159 "contentEditable"
b@1478 7160 ], function() {
b@1478 7161 jQuery.propFix[ this.toLowerCase() ] = this;
b@1478 7162 });
b@1478 7163
b@1478 7164
b@1478 7165
b@1478 7166
b@1478 7167 var rclass = /[\t\r\n\f]/g;
b@1478 7168
b@1478 7169 jQuery.fn.extend({
b@1478 7170 addClass: function( value ) {
b@1478 7171 var classes, elem, cur, clazz, j, finalValue,
b@1478 7172 proceed = typeof value === "string" && value,
b@1478 7173 i = 0,
b@1478 7174 len = this.length;
b@1478 7175
b@1478 7176 if ( jQuery.isFunction( value ) ) {
b@1478 7177 return this.each(function( j ) {
b@1478 7178 jQuery( this ).addClass( value.call( this, j, this.className ) );
b@1478 7179 });
b@1478 7180 }
b@1478 7181
b@1478 7182 if ( proceed ) {
b@1478 7183 // The disjunction here is for better compressibility (see removeClass)
b@1478 7184 classes = ( value || "" ).match( rnotwhite ) || [];
b@1478 7185
b@1478 7186 for ( ; i < len; i++ ) {
b@1478 7187 elem = this[ i ];
b@1478 7188 cur = elem.nodeType === 1 && ( elem.className ?
b@1478 7189 ( " " + elem.className + " " ).replace( rclass, " " ) :
b@1478 7190 " "
b@1478 7191 );
b@1478 7192
b@1478 7193 if ( cur ) {
b@1478 7194 j = 0;
b@1478 7195 while ( (clazz = classes[j++]) ) {
b@1478 7196 if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
b@1478 7197 cur += clazz + " ";
b@1478 7198 }
b@1478 7199 }
b@1478 7200
b@1478 7201 // only assign if different to avoid unneeded rendering.
b@1478 7202 finalValue = jQuery.trim( cur );
b@1478 7203 if ( elem.className !== finalValue ) {
b@1478 7204 elem.className = finalValue;
b@1478 7205 }
b@1478 7206 }
b@1478 7207 }
b@1478 7208 }
b@1478 7209
b@1478 7210 return this;
b@1478 7211 },
b@1478 7212
b@1478 7213 removeClass: function( value ) {
b@1478 7214 var classes, elem, cur, clazz, j, finalValue,
b@1478 7215 proceed = arguments.length === 0 || typeof value === "string" && value,
b@1478 7216 i = 0,
b@1478 7217 len = this.length;
b@1478 7218
b@1478 7219 if ( jQuery.isFunction( value ) ) {
b@1478 7220 return this.each(function( j ) {
b@1478 7221 jQuery( this ).removeClass( value.call( this, j, this.className ) );
b@1478 7222 });
b@1478 7223 }
b@1478 7224 if ( proceed ) {
b@1478 7225 classes = ( value || "" ).match( rnotwhite ) || [];
b@1478 7226
b@1478 7227 for ( ; i < len; i++ ) {
b@1478 7228 elem = this[ i ];
b@1478 7229 // This expression is here for better compressibility (see addClass)
b@1478 7230 cur = elem.nodeType === 1 && ( elem.className ?
b@1478 7231 ( " " + elem.className + " " ).replace( rclass, " " ) :
b@1478 7232 ""
b@1478 7233 );
b@1478 7234
b@1478 7235 if ( cur ) {
b@1478 7236 j = 0;
b@1478 7237 while ( (clazz = classes[j++]) ) {
b@1478 7238 // Remove *all* instances
b@1478 7239 while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
b@1478 7240 cur = cur.replace( " " + clazz + " ", " " );
b@1478 7241 }
b@1478 7242 }
b@1478 7243
b@1478 7244 // Only assign if different to avoid unneeded rendering.
b@1478 7245 finalValue = value ? jQuery.trim( cur ) : "";
b@1478 7246 if ( elem.className !== finalValue ) {
b@1478 7247 elem.className = finalValue;
b@1478 7248 }
b@1478 7249 }
b@1478 7250 }
b@1478 7251 }
b@1478 7252
b@1478 7253 return this;
b@1478 7254 },
b@1478 7255
b@1478 7256 toggleClass: function( value, stateVal ) {
b@1478 7257 var type = typeof value;
b@1478 7258
b@1478 7259 if ( typeof stateVal === "boolean" && type === "string" ) {
b@1478 7260 return stateVal ? this.addClass( value ) : this.removeClass( value );
b@1478 7261 }
b@1478 7262
b@1478 7263 if ( jQuery.isFunction( value ) ) {
b@1478 7264 return this.each(function( i ) {
b@1478 7265 jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
b@1478 7266 });
b@1478 7267 }
b@1478 7268
b@1478 7269 return this.each(function() {
b@1478 7270 if ( type === "string" ) {
b@1478 7271 // Toggle individual class names
b@1478 7272 var className,
b@1478 7273 i = 0,
b@1478 7274 self = jQuery( this ),
b@1478 7275 classNames = value.match( rnotwhite ) || [];
b@1478 7276
b@1478 7277 while ( (className = classNames[ i++ ]) ) {
b@1478 7278 // Check each className given, space separated list
b@1478 7279 if ( self.hasClass( className ) ) {
b@1478 7280 self.removeClass( className );
b@1478 7281 } else {
b@1478 7282 self.addClass( className );
b@1478 7283 }
b@1478 7284 }
b@1478 7285
b@1478 7286 // Toggle whole class name
b@1478 7287 } else if ( type === strundefined || type === "boolean" ) {
b@1478 7288 if ( this.className ) {
b@1478 7289 // store className if set
b@1478 7290 data_priv.set( this, "__className__", this.className );
b@1478 7291 }
b@1478 7292
b@1478 7293 // If the element has a class name or if we're passed `false`,
b@1478 7294 // then remove the whole classname (if there was one, the above saved it).
b@1478 7295 // Otherwise bring back whatever was previously saved (if anything),
b@1478 7296 // falling back to the empty string if nothing was stored.
b@1478 7297 this.className = this.className || value === false ? "" : data_priv.get( this, "__className__" ) || "";
b@1478 7298 }
b@1478 7299 });
b@1478 7300 },
b@1478 7301
b@1478 7302 hasClass: function( selector ) {
b@1478 7303 var className = " " + selector + " ",
b@1478 7304 i = 0,
b@1478 7305 l = this.length;
b@1478 7306 for ( ; i < l; i++ ) {
b@1478 7307 if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
b@1478 7308 return true;
b@1478 7309 }
b@1478 7310 }
b@1478 7311
b@1478 7312 return false;
b@1478 7313 }
b@1478 7314 });
b@1478 7315
b@1478 7316
b@1478 7317
b@1478 7318
b@1478 7319 var rreturn = /\r/g;
b@1478 7320
b@1478 7321 jQuery.fn.extend({
b@1478 7322 val: function( value ) {
b@1478 7323 var hooks, ret, isFunction,
b@1478 7324 elem = this[0];
b@1478 7325
b@1478 7326 if ( !arguments.length ) {
b@1478 7327 if ( elem ) {
b@1478 7328 hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
b@1478 7329
b@1478 7330 if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
b@1478 7331 return ret;
b@1478 7332 }
b@1478 7333
b@1478 7334 ret = elem.value;
b@1478 7335
b@1478 7336 return typeof ret === "string" ?
b@1478 7337 // Handle most common string cases
b@1478 7338 ret.replace(rreturn, "") :
b@1478 7339 // Handle cases where value is null/undef or number
b@1478 7340 ret == null ? "" : ret;
b@1478 7341 }
b@1478 7342
b@1478 7343 return;
b@1478 7344 }
b@1478 7345
b@1478 7346 isFunction = jQuery.isFunction( value );
b@1478 7347
b@1478 7348 return this.each(function( i ) {
b@1478 7349 var val;
b@1478 7350
b@1478 7351 if ( this.nodeType !== 1 ) {
b@1478 7352 return;
b@1478 7353 }
b@1478 7354
b@1478 7355 if ( isFunction ) {
b@1478 7356 val = value.call( this, i, jQuery( this ).val() );
b@1478 7357 } else {
b@1478 7358 val = value;
b@1478 7359 }
b@1478 7360
b@1478 7361 // Treat null/undefined as ""; convert numbers to string
b@1478 7362 if ( val == null ) {
b@1478 7363 val = "";
b@1478 7364
b@1478 7365 } else if ( typeof val === "number" ) {
b@1478 7366 val += "";
b@1478 7367
b@1478 7368 } else if ( jQuery.isArray( val ) ) {
b@1478 7369 val = jQuery.map( val, function( value ) {
b@1478 7370 return value == null ? "" : value + "";
b@1478 7371 });
b@1478 7372 }
b@1478 7373
b@1478 7374 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
b@1478 7375
b@1478 7376 // If set returns undefined, fall back to normal setting
b@1478 7377 if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
b@1478 7378 this.value = val;
b@1478 7379 }
b@1478 7380 });
b@1478 7381 }
b@1478 7382 });
b@1478 7383
b@1478 7384 jQuery.extend({
b@1478 7385 valHooks: {
b@1478 7386 option: {
b@1478 7387 get: function( elem ) {
b@1478 7388 var val = jQuery.find.attr( elem, "value" );
b@1478 7389 return val != null ?
b@1478 7390 val :
b@1478 7391 // Support: IE10-11+
b@1478 7392 // option.text throws exceptions (#14686, #14858)
b@1478 7393 jQuery.trim( jQuery.text( elem ) );
b@1478 7394 }
b@1478 7395 },
b@1478 7396 select: {
b@1478 7397 get: function( elem ) {
b@1478 7398 var value, option,
b@1478 7399 options = elem.options,
b@1478 7400 index = elem.selectedIndex,
b@1478 7401 one = elem.type === "select-one" || index < 0,
b@1478 7402 values = one ? null : [],
b@1478 7403 max = one ? index + 1 : options.length,
b@1478 7404 i = index < 0 ?
b@1478 7405 max :
b@1478 7406 one ? index : 0;
b@1478 7407
b@1478 7408 // Loop through all the selected options
b@1478 7409 for ( ; i < max; i++ ) {
b@1478 7410 option = options[ i ];
b@1478 7411
b@1478 7412 // IE6-9 doesn't update selected after form reset (#2551)
b@1478 7413 if ( ( option.selected || i === index ) &&
b@1478 7414 // Don't return options that are disabled or in a disabled optgroup
b@1478 7415 ( support.optDisabled ? !option.disabled : option.getAttribute( "disabled" ) === null ) &&
b@1478 7416 ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
b@1478 7417
b@1478 7418 // Get the specific value for the option
b@1478 7419 value = jQuery( option ).val();
b@1478 7420
b@1478 7421 // We don't need an array for one selects
b@1478 7422 if ( one ) {
b@1478 7423 return value;
b@1478 7424 }
b@1478 7425
b@1478 7426 // Multi-Selects return an array
b@1478 7427 values.push( value );
b@1478 7428 }
b@1478 7429 }
b@1478 7430
b@1478 7431 return values;
b@1478 7432 },
b@1478 7433
b@1478 7434 set: function( elem, value ) {
b@1478 7435 var optionSet, option,
b@1478 7436 options = elem.options,
b@1478 7437 values = jQuery.makeArray( value ),
b@1478 7438 i = options.length;
b@1478 7439
b@1478 7440 while ( i-- ) {
b@1478 7441 option = options[ i ];
b@1478 7442 if ( (option.selected = jQuery.inArray( option.value, values ) >= 0) ) {
b@1478 7443 optionSet = true;
b@1478 7444 }
b@1478 7445 }
b@1478 7446
b@1478 7447 // Force browsers to behave consistently when non-matching value is set
b@1478 7448 if ( !optionSet ) {
b@1478 7449 elem.selectedIndex = -1;
b@1478 7450 }
b@1478 7451 return values;
b@1478 7452 }
b@1478 7453 }
b@1478 7454 }
b@1478 7455 });
b@1478 7456
b@1478 7457 // Radios and checkboxes getter/setter
b@1478 7458 jQuery.each([ "radio", "checkbox" ], function() {
b@1478 7459 jQuery.valHooks[ this ] = {
b@1478 7460 set: function( elem, value ) {
b@1478 7461 if ( jQuery.isArray( value ) ) {
b@1478 7462 return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
b@1478 7463 }
b@1478 7464 }
b@1478 7465 };
b@1478 7466 if ( !support.checkOn ) {
b@1478 7467 jQuery.valHooks[ this ].get = function( elem ) {
b@1478 7468 return elem.getAttribute("value") === null ? "on" : elem.value;
b@1478 7469 };
b@1478 7470 }
b@1478 7471 });
b@1478 7472
b@1478 7473
b@1478 7474
b@1478 7475
b@1478 7476 // Return jQuery for attributes-only inclusion
b@1478 7477
b@1478 7478
b@1478 7479 jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
b@1478 7480 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
b@1478 7481 "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
b@1478 7482
b@1478 7483 // Handle event binding
b@1478 7484 jQuery.fn[ name ] = function( data, fn ) {
b@1478 7485 return arguments.length > 0 ?
b@1478 7486 this.on( name, null, data, fn ) :
b@1478 7487 this.trigger( name );
b@1478 7488 };
b@1478 7489 });
b@1478 7490
b@1478 7491 jQuery.fn.extend({
b@1478 7492 hover: function( fnOver, fnOut ) {
b@1478 7493 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
b@1478 7494 },
b@1478 7495
b@1478 7496 bind: function( types, data, fn ) {
b@1478 7497 return this.on( types, null, data, fn );
b@1478 7498 },
b@1478 7499 unbind: function( types, fn ) {
b@1478 7500 return this.off( types, null, fn );
b@1478 7501 },
b@1478 7502
b@1478 7503 delegate: function( selector, types, data, fn ) {
b@1478 7504 return this.on( types, selector, data, fn );
b@1478 7505 },
b@1478 7506 undelegate: function( selector, types, fn ) {
b@1478 7507 // ( namespace ) or ( selector, types [, fn] )
b@1478 7508 return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
b@1478 7509 }
b@1478 7510 });
b@1478 7511
b@1478 7512
b@1478 7513 var nonce = jQuery.now();
b@1478 7514
b@1478 7515 var rquery = (/\?/);
b@1478 7516
b@1478 7517
b@1478 7518
b@1478 7519 // Support: Android 2.3
b@1478 7520 // Workaround failure to string-cast null input
b@1478 7521 jQuery.parseJSON = function( data ) {
b@1478 7522 return JSON.parse( data + "" );
b@1478 7523 };
b@1478 7524
b@1478 7525
b@1478 7526 // Cross-browser xml parsing
b@1478 7527 jQuery.parseXML = function( data ) {
b@1478 7528 var xml, tmp;
b@1478 7529 if ( !data || typeof data !== "string" ) {
b@1478 7530 return null;
b@1478 7531 }
b@1478 7532
b@1478 7533 // Support: IE9
b@1478 7534 try {
b@1478 7535 tmp = new DOMParser();
b@1478 7536 xml = tmp.parseFromString( data, "text/xml" );
b@1478 7537 } catch ( e ) {
b@1478 7538 xml = undefined;
b@1478 7539 }
b@1478 7540
b@1478 7541 if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
b@1478 7542 jQuery.error( "Invalid XML: " + data );
b@1478 7543 }
b@1478 7544 return xml;
b@1478 7545 };
b@1478 7546
b@1478 7547
b@1478 7548 var
b@1478 7549 rhash = /#.*$/,
b@1478 7550 rts = /([?&])_=[^&]*/,
b@1478 7551 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
b@1478 7552 // #7653, #8125, #8152: local protocol detection
b@1478 7553 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
b@1478 7554 rnoContent = /^(?:GET|HEAD)$/,
b@1478 7555 rprotocol = /^\/\//,
b@1478 7556 rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
b@1478 7557
b@1478 7558 /* Prefilters
b@1478 7559 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
b@1478 7560 * 2) These are called:
b@1478 7561 * - BEFORE asking for a transport
b@1478 7562 * - AFTER param serialization (s.data is a string if s.processData is true)
b@1478 7563 * 3) key is the dataType
b@1478 7564 * 4) the catchall symbol "*" can be used
b@1478 7565 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
b@1478 7566 */
b@1478 7567 prefilters = {},
b@1478 7568
b@1478 7569 /* Transports bindings
b@1478 7570 * 1) key is the dataType
b@1478 7571 * 2) the catchall symbol "*" can be used
b@1478 7572 * 3) selection will start with transport dataType and THEN go to "*" if needed
b@1478 7573 */
b@1478 7574 transports = {},
b@1478 7575
b@1478 7576 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
b@1478 7577 allTypes = "*/".concat( "*" ),
b@1478 7578
b@1478 7579 // Document location
b@1478 7580 ajaxLocation = window.location.href,
b@1478 7581
b@1478 7582 // Segment location into parts
b@1478 7583 ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
b@1478 7584
b@1478 7585 // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
b@1478 7586 function addToPrefiltersOrTransports( structure ) {
b@1478 7587
b@1478 7588 // dataTypeExpression is optional and defaults to "*"
b@1478 7589 return function( dataTypeExpression, func ) {
b@1478 7590
b@1478 7591 if ( typeof dataTypeExpression !== "string" ) {
b@1478 7592 func = dataTypeExpression;
b@1478 7593 dataTypeExpression = "*";
b@1478 7594 }
b@1478 7595
b@1478 7596 var dataType,
b@1478 7597 i = 0,
b@1478 7598 dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
b@1478 7599
b@1478 7600 if ( jQuery.isFunction( func ) ) {
b@1478 7601 // For each dataType in the dataTypeExpression
b@1478 7602 while ( (dataType = dataTypes[i++]) ) {
b@1478 7603 // Prepend if requested
b@1478 7604 if ( dataType[0] === "+" ) {
b@1478 7605 dataType = dataType.slice( 1 ) || "*";
b@1478 7606 (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
b@1478 7607
b@1478 7608 // Otherwise append
b@1478 7609 } else {
b@1478 7610 (structure[ dataType ] = structure[ dataType ] || []).push( func );
b@1478 7611 }
b@1478 7612 }
b@1478 7613 }
b@1478 7614 };
b@1478 7615 }
b@1478 7616
b@1478 7617 // Base inspection function for prefilters and transports
b@1478 7618 function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
b@1478 7619
b@1478 7620 var inspected = {},
b@1478 7621 seekingTransport = ( structure === transports );
b@1478 7622
b@1478 7623 function inspect( dataType ) {
b@1478 7624 var selected;
b@1478 7625 inspected[ dataType ] = true;
b@1478 7626 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
b@1478 7627 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
b@1478 7628 if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
b@1478 7629 options.dataTypes.unshift( dataTypeOrTransport );
b@1478 7630 inspect( dataTypeOrTransport );
b@1478 7631 return false;
b@1478 7632 } else if ( seekingTransport ) {
b@1478 7633 return !( selected = dataTypeOrTransport );
b@1478 7634 }
b@1478 7635 });
b@1478 7636 return selected;
b@1478 7637 }
b@1478 7638
b@1478 7639 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
b@1478 7640 }
b@1478 7641
b@1478 7642 // A special extend for ajax options
b@1478 7643 // that takes "flat" options (not to be deep extended)
b@1478 7644 // Fixes #9887
b@1478 7645 function ajaxExtend( target, src ) {
b@1478 7646 var key, deep,
b@1478 7647 flatOptions = jQuery.ajaxSettings.flatOptions || {};
b@1478 7648
b@1478 7649 for ( key in src ) {
b@1478 7650 if ( src[ key ] !== undefined ) {
b@1478 7651 ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
b@1478 7652 }
b@1478 7653 }
b@1478 7654 if ( deep ) {
b@1478 7655 jQuery.extend( true, target, deep );
b@1478 7656 }
b@1478 7657
b@1478 7658 return target;
b@1478 7659 }
b@1478 7660
b@1478 7661 /* Handles responses to an ajax request:
b@1478 7662 * - finds the right dataType (mediates between content-type and expected dataType)
b@1478 7663 * - returns the corresponding response
b@1478 7664 */
b@1478 7665 function ajaxHandleResponses( s, jqXHR, responses ) {
b@1478 7666
b@1478 7667 var ct, type, finalDataType, firstDataType,
b@1478 7668 contents = s.contents,
b@1478 7669 dataTypes = s.dataTypes;
b@1478 7670
b@1478 7671 // Remove auto dataType and get content-type in the process
b@1478 7672 while ( dataTypes[ 0 ] === "*" ) {
b@1478 7673 dataTypes.shift();
b@1478 7674 if ( ct === undefined ) {
b@1478 7675 ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
b@1478 7676 }
b@1478 7677 }
b@1478 7678
b@1478 7679 // Check if we're dealing with a known content-type
b@1478 7680 if ( ct ) {
b@1478 7681 for ( type in contents ) {
b@1478 7682 if ( contents[ type ] && contents[ type ].test( ct ) ) {
b@1478 7683 dataTypes.unshift( type );
b@1478 7684 break;
b@1478 7685 }
b@1478 7686 }
b@1478 7687 }
b@1478 7688
b@1478 7689 // Check to see if we have a response for the expected dataType
b@1478 7690 if ( dataTypes[ 0 ] in responses ) {
b@1478 7691 finalDataType = dataTypes[ 0 ];
b@1478 7692 } else {
b@1478 7693 // Try convertible dataTypes
b@1478 7694 for ( type in responses ) {
b@1478 7695 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
b@1478 7696 finalDataType = type;
b@1478 7697 break;
b@1478 7698 }
b@1478 7699 if ( !firstDataType ) {
b@1478 7700 firstDataType = type;
b@1478 7701 }
b@1478 7702 }
b@1478 7703 // Or just use first one
b@1478 7704 finalDataType = finalDataType || firstDataType;
b@1478 7705 }
b@1478 7706
b@1478 7707 // If we found a dataType
b@1478 7708 // We add the dataType to the list if needed
b@1478 7709 // and return the corresponding response
b@1478 7710 if ( finalDataType ) {
b@1478 7711 if ( finalDataType !== dataTypes[ 0 ] ) {
b@1478 7712 dataTypes.unshift( finalDataType );
b@1478 7713 }
b@1478 7714 return responses[ finalDataType ];
b@1478 7715 }
b@1478 7716 }
b@1478 7717
b@1478 7718 /* Chain conversions given the request and the original response
b@1478 7719 * Also sets the responseXXX fields on the jqXHR instance
b@1478 7720 */
b@1478 7721 function ajaxConvert( s, response, jqXHR, isSuccess ) {
b@1478 7722 var conv2, current, conv, tmp, prev,
b@1478 7723 converters = {},
b@1478 7724 // Work with a copy of dataTypes in case we need to modify it for conversion
b@1478 7725 dataTypes = s.dataTypes.slice();
b@1478 7726
b@1478 7727 // Create converters map with lowercased keys
b@1478 7728 if ( dataTypes[ 1 ] ) {
b@1478 7729 for ( conv in s.converters ) {
b@1478 7730 converters[ conv.toLowerCase() ] = s.converters[ conv ];
b@1478 7731 }
b@1478 7732 }
b@1478 7733
b@1478 7734 current = dataTypes.shift();
b@1478 7735
b@1478 7736 // Convert to each sequential dataType
b@1478 7737 while ( current ) {
b@1478 7738
b@1478 7739 if ( s.responseFields[ current ] ) {
b@1478 7740 jqXHR[ s.responseFields[ current ] ] = response;
b@1478 7741 }
b@1478 7742
b@1478 7743 // Apply the dataFilter if provided
b@1478 7744 if ( !prev && isSuccess && s.dataFilter ) {
b@1478 7745 response = s.dataFilter( response, s.dataType );
b@1478 7746 }
b@1478 7747
b@1478 7748 prev = current;
b@1478 7749 current = dataTypes.shift();
b@1478 7750
b@1478 7751 if ( current ) {
b@1478 7752
b@1478 7753 // There's only work to do if current dataType is non-auto
b@1478 7754 if ( current === "*" ) {
b@1478 7755
b@1478 7756 current = prev;
b@1478 7757
b@1478 7758 // Convert response if prev dataType is non-auto and differs from current
b@1478 7759 } else if ( prev !== "*" && prev !== current ) {
b@1478 7760
b@1478 7761 // Seek a direct converter
b@1478 7762 conv = converters[ prev + " " + current ] || converters[ "* " + current ];
b@1478 7763
b@1478 7764 // If none found, seek a pair
b@1478 7765 if ( !conv ) {
b@1478 7766 for ( conv2 in converters ) {
b@1478 7767
b@1478 7768 // If conv2 outputs current
b@1478 7769 tmp = conv2.split( " " );
b@1478 7770 if ( tmp[ 1 ] === current ) {
b@1478 7771
b@1478 7772 // If prev can be converted to accepted input
b@1478 7773 conv = converters[ prev + " " + tmp[ 0 ] ] ||
b@1478 7774 converters[ "* " + tmp[ 0 ] ];
b@1478 7775 if ( conv ) {
b@1478 7776 // Condense equivalence converters
b@1478 7777 if ( conv === true ) {
b@1478 7778 conv = converters[ conv2 ];
b@1478 7779
b@1478 7780 // Otherwise, insert the intermediate dataType
b@1478 7781 } else if ( converters[ conv2 ] !== true ) {
b@1478 7782 current = tmp[ 0 ];
b@1478 7783 dataTypes.unshift( tmp[ 1 ] );
b@1478 7784 }
b@1478 7785 break;
b@1478 7786 }
b@1478 7787 }
b@1478 7788 }
b@1478 7789 }
b@1478 7790
b@1478 7791 // Apply converter (if not an equivalence)
b@1478 7792 if ( conv !== true ) {
b@1478 7793
b@1478 7794 // Unless errors are allowed to bubble, catch and return them
b@1478 7795 if ( conv && s[ "throws" ] ) {
b@1478 7796 response = conv( response );
b@1478 7797 } else {
b@1478 7798 try {
b@1478 7799 response = conv( response );
b@1478 7800 } catch ( e ) {
b@1478 7801 return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
b@1478 7802 }
b@1478 7803 }
b@1478 7804 }
b@1478 7805 }
b@1478 7806 }
b@1478 7807 }
b@1478 7808
b@1478 7809 return { state: "success", data: response };
b@1478 7810 }
b@1478 7811
b@1478 7812 jQuery.extend({
b@1478 7813
b@1478 7814 // Counter for holding the number of active queries
b@1478 7815 active: 0,
b@1478 7816
b@1478 7817 // Last-Modified header cache for next request
b@1478 7818 lastModified: {},
b@1478 7819 etag: {},
b@1478 7820
b@1478 7821 ajaxSettings: {
b@1478 7822 url: ajaxLocation,
b@1478 7823 type: "GET",
b@1478 7824 isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
b@1478 7825 global: true,
b@1478 7826 processData: true,
b@1478 7827 async: true,
b@1478 7828 contentType: "application/x-www-form-urlencoded; charset=UTF-8",
b@1478 7829 /*
b@1478 7830 timeout: 0,
b@1478 7831 data: null,
b@1478 7832 dataType: null,
b@1478 7833 username: null,
b@1478 7834 password: null,
b@1478 7835 cache: null,
b@1478 7836 throws: false,
b@1478 7837 traditional: false,
b@1478 7838 headers: {},
b@1478 7839 */
b@1478 7840
b@1478 7841 accepts: {
b@1478 7842 "*": allTypes,
b@1478 7843 text: "text/plain",
b@1478 7844 html: "text/html",
b@1478 7845 xml: "application/xml, text/xml",
b@1478 7846 json: "application/json, text/javascript"
b@1478 7847 },
b@1478 7848
b@1478 7849 contents: {
b@1478 7850 xml: /xml/,
b@1478 7851 html: /html/,
b@1478 7852 json: /json/
b@1478 7853 },
b@1478 7854
b@1478 7855 responseFields: {
b@1478 7856 xml: "responseXML",
b@1478 7857 text: "responseText",
b@1478 7858 json: "responseJSON"
b@1478 7859 },
b@1478 7860
b@1478 7861 // Data converters
b@1478 7862 // Keys separate source (or catchall "*") and destination types with a single space
b@1478 7863 converters: {
b@1478 7864
b@1478 7865 // Convert anything to text
b@1478 7866 "* text": String,
b@1478 7867
b@1478 7868 // Text to html (true = no transformation)
b@1478 7869 "text html": true,
b@1478 7870
b@1478 7871 // Evaluate text as a json expression
b@1478 7872 "text json": jQuery.parseJSON,
b@1478 7873
b@1478 7874 // Parse text as xml
b@1478 7875 "text xml": jQuery.parseXML
b@1478 7876 },
b@1478 7877
b@1478 7878 // For options that shouldn't be deep extended:
b@1478 7879 // you can add your own custom options here if
b@1478 7880 // and when you create one that shouldn't be
b@1478 7881 // deep extended (see ajaxExtend)
b@1478 7882 flatOptions: {
b@1478 7883 url: true,
b@1478 7884 context: true
b@1478 7885 }
b@1478 7886 },
b@1478 7887
b@1478 7888 // Creates a full fledged settings object into target
b@1478 7889 // with both ajaxSettings and settings fields.
b@1478 7890 // If target is omitted, writes into ajaxSettings.
b@1478 7891 ajaxSetup: function( target, settings ) {
b@1478 7892 return settings ?
b@1478 7893
b@1478 7894 // Building a settings object
b@1478 7895 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
b@1478 7896
b@1478 7897 // Extending ajaxSettings
b@1478 7898 ajaxExtend( jQuery.ajaxSettings, target );
b@1478 7899 },
b@1478 7900
b@1478 7901 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
b@1478 7902 ajaxTransport: addToPrefiltersOrTransports( transports ),
b@1478 7903
b@1478 7904 // Main method
b@1478 7905 ajax: function( url, options ) {
b@1478 7906
b@1478 7907 // If url is an object, simulate pre-1.5 signature
b@1478 7908 if ( typeof url === "object" ) {
b@1478 7909 options = url;
b@1478 7910 url = undefined;
b@1478 7911 }
b@1478 7912
b@1478 7913 // Force options to be an object
b@1478 7914 options = options || {};
b@1478 7915
b@1478 7916 var transport,
b@1478 7917 // URL without anti-cache param
b@1478 7918 cacheURL,
b@1478 7919 // Response headers
b@1478 7920 responseHeadersString,
b@1478 7921 responseHeaders,
b@1478 7922 // timeout handle
b@1478 7923 timeoutTimer,
b@1478 7924 // Cross-domain detection vars
b@1478 7925 parts,
b@1478 7926 // To know if global events are to be dispatched
b@1478 7927 fireGlobals,
b@1478 7928 // Loop variable
b@1478 7929 i,
b@1478 7930 // Create the final options object
b@1478 7931 s = jQuery.ajaxSetup( {}, options ),
b@1478 7932 // Callbacks context
b@1478 7933 callbackContext = s.context || s,
b@1478 7934 // Context for global events is callbackContext if it is a DOM node or jQuery collection
b@1478 7935 globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
b@1478 7936 jQuery( callbackContext ) :
b@1478 7937 jQuery.event,
b@1478 7938 // Deferreds
b@1478 7939 deferred = jQuery.Deferred(),
b@1478 7940 completeDeferred = jQuery.Callbacks("once memory"),
b@1478 7941 // Status-dependent callbacks
b@1478 7942 statusCode = s.statusCode || {},
b@1478 7943 // Headers (they are sent all at once)
b@1478 7944 requestHeaders = {},
b@1478 7945 requestHeadersNames = {},
b@1478 7946 // The jqXHR state
b@1478 7947 state = 0,
b@1478 7948 // Default abort message
b@1478 7949 strAbort = "canceled",
b@1478 7950 // Fake xhr
b@1478 7951 jqXHR = {
b@1478 7952 readyState: 0,
b@1478 7953
b@1478 7954 // Builds headers hashtable if needed
b@1478 7955 getResponseHeader: function( key ) {
b@1478 7956 var match;
b@1478 7957 if ( state === 2 ) {
b@1478 7958 if ( !responseHeaders ) {
b@1478 7959 responseHeaders = {};
b@1478 7960 while ( (match = rheaders.exec( responseHeadersString )) ) {
b@1478 7961 responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
b@1478 7962 }
b@1478 7963 }
b@1478 7964 match = responseHeaders[ key.toLowerCase() ];
b@1478 7965 }
b@1478 7966 return match == null ? null : match;
b@1478 7967 },
b@1478 7968
b@1478 7969 // Raw string
b@1478 7970 getAllResponseHeaders: function() {
b@1478 7971 return state === 2 ? responseHeadersString : null;
b@1478 7972 },
b@1478 7973
b@1478 7974 // Caches the header
b@1478 7975 setRequestHeader: function( name, value ) {
b@1478 7976 var lname = name.toLowerCase();
b@1478 7977 if ( !state ) {
b@1478 7978 name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
b@1478 7979 requestHeaders[ name ] = value;
b@1478 7980 }
b@1478 7981 return this;
b@1478 7982 },
b@1478 7983
b@1478 7984 // Overrides response content-type header
b@1478 7985 overrideMimeType: function( type ) {
b@1478 7986 if ( !state ) {
b@1478 7987 s.mimeType = type;
b@1478 7988 }
b@1478 7989 return this;
b@1478 7990 },
b@1478 7991
b@1478 7992 // Status-dependent callbacks
b@1478 7993 statusCode: function( map ) {
b@1478 7994 var code;
b@1478 7995 if ( map ) {
b@1478 7996 if ( state < 2 ) {
b@1478 7997 for ( code in map ) {
b@1478 7998 // Lazy-add the new callback in a way that preserves old ones
b@1478 7999 statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
b@1478 8000 }
b@1478 8001 } else {
b@1478 8002 // Execute the appropriate callbacks
b@1478 8003 jqXHR.always( map[ jqXHR.status ] );
b@1478 8004 }
b@1478 8005 }
b@1478 8006 return this;
b@1478 8007 },
b@1478 8008
b@1478 8009 // Cancel the request
b@1478 8010 abort: function( statusText ) {
b@1478 8011 var finalText = statusText || strAbort;
b@1478 8012 if ( transport ) {
b@1478 8013 transport.abort( finalText );
b@1478 8014 }
b@1478 8015 done( 0, finalText );
b@1478 8016 return this;
b@1478 8017 }
b@1478 8018 };
b@1478 8019
b@1478 8020 // Attach deferreds
b@1478 8021 deferred.promise( jqXHR ).complete = completeDeferred.add;
b@1478 8022 jqXHR.success = jqXHR.done;
b@1478 8023 jqXHR.error = jqXHR.fail;
b@1478 8024
b@1478 8025 // Remove hash character (#7531: and string promotion)
b@1478 8026 // Add protocol if not provided (prefilters might expect it)
b@1478 8027 // Handle falsy url in the settings object (#10093: consistency with old signature)
b@1478 8028 // We also use the url parameter if available
b@1478 8029 s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" )
b@1478 8030 .replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
b@1478 8031
b@1478 8032 // Alias method option to type as per ticket #12004
b@1478 8033 s.type = options.method || options.type || s.method || s.type;
b@1478 8034
b@1478 8035 // Extract dataTypes list
b@1478 8036 s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
b@1478 8037
b@1478 8038 // A cross-domain request is in order when we have a protocol:host:port mismatch
b@1478 8039 if ( s.crossDomain == null ) {
b@1478 8040 parts = rurl.exec( s.url.toLowerCase() );
b@1478 8041 s.crossDomain = !!( parts &&
b@1478 8042 ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
b@1478 8043 ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
b@1478 8044 ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
b@1478 8045 );
b@1478 8046 }
b@1478 8047
b@1478 8048 // Convert data if not already a string
b@1478 8049 if ( s.data && s.processData && typeof s.data !== "string" ) {
b@1478 8050 s.data = jQuery.param( s.data, s.traditional );
b@1478 8051 }
b@1478 8052
b@1478 8053 // Apply prefilters
b@1478 8054 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
b@1478 8055
b@1478 8056 // If request was aborted inside a prefilter, stop there
b@1478 8057 if ( state === 2 ) {
b@1478 8058 return jqXHR;
b@1478 8059 }
b@1478 8060
b@1478 8061 // We can fire global events as of now if asked to
b@1478 8062 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
b@1478 8063 fireGlobals = jQuery.event && s.global;
b@1478 8064
b@1478 8065 // Watch for a new set of requests
b@1478 8066 if ( fireGlobals && jQuery.active++ === 0 ) {
b@1478 8067 jQuery.event.trigger("ajaxStart");
b@1478 8068 }
b@1478 8069
b@1478 8070 // Uppercase the type
b@1478 8071 s.type = s.type.toUpperCase();
b@1478 8072
b@1478 8073 // Determine if request has content
b@1478 8074 s.hasContent = !rnoContent.test( s.type );
b@1478 8075
b@1478 8076 // Save the URL in case we're toying with the If-Modified-Since
b@1478 8077 // and/or If-None-Match header later on
b@1478 8078 cacheURL = s.url;
b@1478 8079
b@1478 8080 // More options handling for requests with no content
b@1478 8081 if ( !s.hasContent ) {
b@1478 8082
b@1478 8083 // If data is available, append data to url
b@1478 8084 if ( s.data ) {
b@1478 8085 cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
b@1478 8086 // #9682: remove data so that it's not used in an eventual retry
b@1478 8087 delete s.data;
b@1478 8088 }
b@1478 8089
b@1478 8090 // Add anti-cache in url if needed
b@1478 8091 if ( s.cache === false ) {
b@1478 8092 s.url = rts.test( cacheURL ) ?
b@1478 8093
b@1478 8094 // If there is already a '_' parameter, set its value
b@1478 8095 cacheURL.replace( rts, "$1_=" + nonce++ ) :
b@1478 8096
b@1478 8097 // Otherwise add one to the end
b@1478 8098 cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
b@1478 8099 }
b@1478 8100 }
b@1478 8101
b@1478 8102 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
b@1478 8103 if ( s.ifModified ) {
b@1478 8104 if ( jQuery.lastModified[ cacheURL ] ) {
b@1478 8105 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
b@1478 8106 }
b@1478 8107 if ( jQuery.etag[ cacheURL ] ) {
b@1478 8108 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
b@1478 8109 }
b@1478 8110 }
b@1478 8111
b@1478 8112 // Set the correct header, if data is being sent
b@1478 8113 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
b@1478 8114 jqXHR.setRequestHeader( "Content-Type", s.contentType );
b@1478 8115 }
b@1478 8116
b@1478 8117 // Set the Accepts header for the server, depending on the dataType
b@1478 8118 jqXHR.setRequestHeader(
b@1478 8119 "Accept",
b@1478 8120 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
b@1478 8121 s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
b@1478 8122 s.accepts[ "*" ]
b@1478 8123 );
b@1478 8124
b@1478 8125 // Check for headers option
b@1478 8126 for ( i in s.headers ) {
b@1478 8127 jqXHR.setRequestHeader( i, s.headers[ i ] );
b@1478 8128 }
b@1478 8129
b@1478 8130 // Allow custom headers/mimetypes and early abort
b@1478 8131 if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
b@1478 8132 // Abort if not done already and return
b@1478 8133 return jqXHR.abort();
b@1478 8134 }
b@1478 8135
b@1478 8136 // Aborting is no longer a cancellation
b@1478 8137 strAbort = "abort";
b@1478 8138
b@1478 8139 // Install callbacks on deferreds
b@1478 8140 for ( i in { success: 1, error: 1, complete: 1 } ) {
b@1478 8141 jqXHR[ i ]( s[ i ] );
b@1478 8142 }
b@1478 8143
b@1478 8144 // Get transport
b@1478 8145 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
b@1478 8146
b@1478 8147 // If no transport, we auto-abort
b@1478 8148 if ( !transport ) {
b@1478 8149 done( -1, "No Transport" );
b@1478 8150 } else {
b@1478 8151 jqXHR.readyState = 1;
b@1478 8152
b@1478 8153 // Send global event
b@1478 8154 if ( fireGlobals ) {
b@1478 8155 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
b@1478 8156 }
b@1478 8157 // Timeout
b@1478 8158 if ( s.async && s.timeout > 0 ) {
b@1478 8159 timeoutTimer = setTimeout(function() {
b@1478 8160 jqXHR.abort("timeout");
b@1478 8161 }, s.timeout );
b@1478 8162 }
b@1478 8163
b@1478 8164 try {
b@1478 8165 state = 1;
b@1478 8166 transport.send( requestHeaders, done );
b@1478 8167 } catch ( e ) {
b@1478 8168 // Propagate exception as error if not done
b@1478 8169 if ( state < 2 ) {
b@1478 8170 done( -1, e );
b@1478 8171 // Simply rethrow otherwise
b@1478 8172 } else {
b@1478 8173 throw e;
b@1478 8174 }
b@1478 8175 }
b@1478 8176 }
b@1478 8177
b@1478 8178 // Callback for when everything is done
b@1478 8179 function done( status, nativeStatusText, responses, headers ) {
b@1478 8180 var isSuccess, success, error, response, modified,
b@1478 8181 statusText = nativeStatusText;
b@1478 8182
b@1478 8183 // Called once
b@1478 8184 if ( state === 2 ) {
b@1478 8185 return;
b@1478 8186 }
b@1478 8187
b@1478 8188 // State is "done" now
b@1478 8189 state = 2;
b@1478 8190
b@1478 8191 // Clear timeout if it exists
b@1478 8192 if ( timeoutTimer ) {
b@1478 8193 clearTimeout( timeoutTimer );
b@1478 8194 }
b@1478 8195
b@1478 8196 // Dereference transport for early garbage collection
b@1478 8197 // (no matter how long the jqXHR object will be used)
b@1478 8198 transport = undefined;
b@1478 8199
b@1478 8200 // Cache response headers
b@1478 8201 responseHeadersString = headers || "";
b@1478 8202
b@1478 8203 // Set readyState
b@1478 8204 jqXHR.readyState = status > 0 ? 4 : 0;
b@1478 8205
b@1478 8206 // Determine if successful
b@1478 8207 isSuccess = status >= 200 && status < 300 || status === 304;
b@1478 8208
b@1478 8209 // Get response data
b@1478 8210 if ( responses ) {
b@1478 8211 response = ajaxHandleResponses( s, jqXHR, responses );
b@1478 8212 }
b@1478 8213
b@1478 8214 // Convert no matter what (that way responseXXX fields are always set)
b@1478 8215 response = ajaxConvert( s, response, jqXHR, isSuccess );
b@1478 8216
b@1478 8217 // If successful, handle type chaining
b@1478 8218 if ( isSuccess ) {
b@1478 8219
b@1478 8220 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
b@1478 8221 if ( s.ifModified ) {
b@1478 8222 modified = jqXHR.getResponseHeader("Last-Modified");
b@1478 8223 if ( modified ) {
b@1478 8224 jQuery.lastModified[ cacheURL ] = modified;
b@1478 8225 }
b@1478 8226 modified = jqXHR.getResponseHeader("etag");
b@1478 8227 if ( modified ) {
b@1478 8228 jQuery.etag[ cacheURL ] = modified;
b@1478 8229 }
b@1478 8230 }
b@1478 8231
b@1478 8232 // if no content
b@1478 8233 if ( status === 204 || s.type === "HEAD" ) {
b@1478 8234 statusText = "nocontent";
b@1478 8235
b@1478 8236 // if not modified
b@1478 8237 } else if ( status === 304 ) {
b@1478 8238 statusText = "notmodified";
b@1478 8239
b@1478 8240 // If we have data, let's convert it
b@1478 8241 } else {
b@1478 8242 statusText = response.state;
b@1478 8243 success = response.data;
b@1478 8244 error = response.error;
b@1478 8245 isSuccess = !error;
b@1478 8246 }
b@1478 8247 } else {
b@1478 8248 // Extract error from statusText and normalize for non-aborts
b@1478 8249 error = statusText;
b@1478 8250 if ( status || !statusText ) {
b@1478 8251 statusText = "error";
b@1478 8252 if ( status < 0 ) {
b@1478 8253 status = 0;
b@1478 8254 }
b@1478 8255 }
b@1478 8256 }
b@1478 8257
b@1478 8258 // Set data for the fake xhr object
b@1478 8259 jqXHR.status = status;
b@1478 8260 jqXHR.statusText = ( nativeStatusText || statusText ) + "";
b@1478 8261
b@1478 8262 // Success/Error
b@1478 8263 if ( isSuccess ) {
b@1478 8264 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
b@1478 8265 } else {
b@1478 8266 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
b@1478 8267 }
b@1478 8268
b@1478 8269 // Status-dependent callbacks
b@1478 8270 jqXHR.statusCode( statusCode );
b@1478 8271 statusCode = undefined;
b@1478 8272
b@1478 8273 if ( fireGlobals ) {
b@1478 8274 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
b@1478 8275 [ jqXHR, s, isSuccess ? success : error ] );
b@1478 8276 }
b@1478 8277
b@1478 8278 // Complete
b@1478 8279 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
b@1478 8280
b@1478 8281 if ( fireGlobals ) {
b@1478 8282 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
b@1478 8283 // Handle the global AJAX counter
b@1478 8284 if ( !( --jQuery.active ) ) {
b@1478 8285 jQuery.event.trigger("ajaxStop");
b@1478 8286 }
b@1478 8287 }
b@1478 8288 }
b@1478 8289
b@1478 8290 return jqXHR;
b@1478 8291 },
b@1478 8292
b@1478 8293 getJSON: function( url, data, callback ) {
b@1478 8294 return jQuery.get( url, data, callback, "json" );
b@1478 8295 },
b@1478 8296
b@1478 8297 getScript: function( url, callback ) {
b@1478 8298 return jQuery.get( url, undefined, callback, "script" );
b@1478 8299 }
b@1478 8300 });
b@1478 8301
b@1478 8302 jQuery.each( [ "get", "post" ], function( i, method ) {
b@1478 8303 jQuery[ method ] = function( url, data, callback, type ) {
b@1478 8304 // Shift arguments if data argument was omitted
b@1478 8305 if ( jQuery.isFunction( data ) ) {
b@1478 8306 type = type || callback;
b@1478 8307 callback = data;
b@1478 8308 data = undefined;
b@1478 8309 }
b@1478 8310
b@1478 8311 return jQuery.ajax({
b@1478 8312 url: url,
b@1478 8313 type: method,
b@1478 8314 dataType: type,
b@1478 8315 data: data,
b@1478 8316 success: callback
b@1478 8317 });
b@1478 8318 };
b@1478 8319 });
b@1478 8320
b@1478 8321
b@1478 8322 jQuery._evalUrl = function( url ) {
b@1478 8323 return jQuery.ajax({
b@1478 8324 url: url,
b@1478 8325 type: "GET",
b@1478 8326 dataType: "script",
b@1478 8327 async: false,
b@1478 8328 global: false,
b@1478 8329 "throws": true
b@1478 8330 });
b@1478 8331 };
b@1478 8332
b@1478 8333
b@1478 8334 jQuery.fn.extend({
b@1478 8335 wrapAll: function( html ) {
b@1478 8336 var wrap;
b@1478 8337
b@1478 8338 if ( jQuery.isFunction( html ) ) {
b@1478 8339 return this.each(function( i ) {
b@1478 8340 jQuery( this ).wrapAll( html.call(this, i) );
b@1478 8341 });
b@1478 8342 }
b@1478 8343
b@1478 8344 if ( this[ 0 ] ) {
b@1478 8345
b@1478 8346 // The elements to wrap the target around
b@1478 8347 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
b@1478 8348
b@1478 8349 if ( this[ 0 ].parentNode ) {
b@1478 8350 wrap.insertBefore( this[ 0 ] );
b@1478 8351 }
b@1478 8352
b@1478 8353 wrap.map(function() {
b@1478 8354 var elem = this;
b@1478 8355
b@1478 8356 while ( elem.firstElementChild ) {
b@1478 8357 elem = elem.firstElementChild;
b@1478 8358 }
b@1478 8359
b@1478 8360 return elem;
b@1478 8361 }).append( this );
b@1478 8362 }
b@1478 8363
b@1478 8364 return this;
b@1478 8365 },
b@1478 8366
b@1478 8367 wrapInner: function( html ) {
b@1478 8368 if ( jQuery.isFunction( html ) ) {
b@1478 8369 return this.each(function( i ) {
b@1478 8370 jQuery( this ).wrapInner( html.call(this, i) );
b@1478 8371 });
b@1478 8372 }
b@1478 8373
b@1478 8374 return this.each(function() {
b@1478 8375 var self = jQuery( this ),
b@1478 8376 contents = self.contents();
b@1478 8377
b@1478 8378 if ( contents.length ) {
b@1478 8379 contents.wrapAll( html );
b@1478 8380
b@1478 8381 } else {
b@1478 8382 self.append( html );
b@1478 8383 }
b@1478 8384 });
b@1478 8385 },
b@1478 8386
b@1478 8387 wrap: function( html ) {
b@1478 8388 var isFunction = jQuery.isFunction( html );
b@1478 8389
b@1478 8390 return this.each(function( i ) {
b@1478 8391 jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
b@1478 8392 });
b@1478 8393 },
b@1478 8394
b@1478 8395 unwrap: function() {
b@1478 8396 return this.parent().each(function() {
b@1478 8397 if ( !jQuery.nodeName( this, "body" ) ) {
b@1478 8398 jQuery( this ).replaceWith( this.childNodes );
b@1478 8399 }
b@1478 8400 }).end();
b@1478 8401 }
b@1478 8402 });
b@1478 8403
b@1478 8404
b@1478 8405 jQuery.expr.filters.hidden = function( elem ) {
b@1478 8406 // Support: Opera <= 12.12
b@1478 8407 // Opera reports offsetWidths and offsetHeights less than zero on some elements
b@1478 8408 return elem.offsetWidth <= 0 && elem.offsetHeight <= 0;
b@1478 8409 };
b@1478 8410 jQuery.expr.filters.visible = function( elem ) {
b@1478 8411 return !jQuery.expr.filters.hidden( elem );
b@1478 8412 };
b@1478 8413
b@1478 8414
b@1478 8415
b@1478 8416
b@1478 8417 var r20 = /%20/g,
b@1478 8418 rbracket = /\[\]$/,
b@1478 8419 rCRLF = /\r?\n/g,
b@1478 8420 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
b@1478 8421 rsubmittable = /^(?:input|select|textarea|keygen)/i;
b@1478 8422
b@1478 8423 function buildParams( prefix, obj, traditional, add ) {
b@1478 8424 var name;
b@1478 8425
b@1478 8426 if ( jQuery.isArray( obj ) ) {
b@1478 8427 // Serialize array item.
b@1478 8428 jQuery.each( obj, function( i, v ) {
b@1478 8429 if ( traditional || rbracket.test( prefix ) ) {
b@1478 8430 // Treat each array item as a scalar.
b@1478 8431 add( prefix, v );
b@1478 8432
b@1478 8433 } else {
b@1478 8434 // Item is non-scalar (array or object), encode its numeric index.
b@1478 8435 buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
b@1478 8436 }
b@1478 8437 });
b@1478 8438
b@1478 8439 } else if ( !traditional && jQuery.type( obj ) === "object" ) {
b@1478 8440 // Serialize object item.
b@1478 8441 for ( name in obj ) {
b@1478 8442 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
b@1478 8443 }
b@1478 8444
b@1478 8445 } else {
b@1478 8446 // Serialize scalar item.
b@1478 8447 add( prefix, obj );
b@1478 8448 }
b@1478 8449 }
b@1478 8450
b@1478 8451 // Serialize an array of form elements or a set of
b@1478 8452 // key/values into a query string
b@1478 8453 jQuery.param = function( a, traditional ) {
b@1478 8454 var prefix,
b@1478 8455 s = [],
b@1478 8456 add = function( key, value ) {
b@1478 8457 // If value is a function, invoke it and return its value
b@1478 8458 value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
b@1478 8459 s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
b@1478 8460 };
b@1478 8461
b@1478 8462 // Set traditional to true for jQuery <= 1.3.2 behavior.
b@1478 8463 if ( traditional === undefined ) {
b@1478 8464 traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
b@1478 8465 }
b@1478 8466
b@1478 8467 // If an array was passed in, assume that it is an array of form elements.
b@1478 8468 if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
b@1478 8469 // Serialize the form elements
b@1478 8470 jQuery.each( a, function() {
b@1478 8471 add( this.name, this.value );
b@1478 8472 });
b@1478 8473
b@1478 8474 } else {
b@1478 8475 // If traditional, encode the "old" way (the way 1.3.2 or older
b@1478 8476 // did it), otherwise encode params recursively.
b@1478 8477 for ( prefix in a ) {
b@1478 8478 buildParams( prefix, a[ prefix ], traditional, add );
b@1478 8479 }
b@1478 8480 }
b@1478 8481
b@1478 8482 // Return the resulting serialization
b@1478 8483 return s.join( "&" ).replace( r20, "+" );
b@1478 8484 };
b@1478 8485
b@1478 8486 jQuery.fn.extend({
b@1478 8487 serialize: function() {
b@1478 8488 return jQuery.param( this.serializeArray() );
b@1478 8489 },
b@1478 8490 serializeArray: function() {
b@1478 8491 return this.map(function() {
b@1478 8492 // Can add propHook for "elements" to filter or add form elements
b@1478 8493 var elements = jQuery.prop( this, "elements" );
b@1478 8494 return elements ? jQuery.makeArray( elements ) : this;
b@1478 8495 })
b@1478 8496 .filter(function() {
b@1478 8497 var type = this.type;
b@1478 8498
b@1478 8499 // Use .is( ":disabled" ) so that fieldset[disabled] works
b@1478 8500 return this.name && !jQuery( this ).is( ":disabled" ) &&
b@1478 8501 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
b@1478 8502 ( this.checked || !rcheckableType.test( type ) );
b@1478 8503 })
b@1478 8504 .map(function( i, elem ) {
b@1478 8505 var val = jQuery( this ).val();
b@1478 8506
b@1478 8507 return val == null ?
b@1478 8508 null :
b@1478 8509 jQuery.isArray( val ) ?
b@1478 8510 jQuery.map( val, function( val ) {
b@1478 8511 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
b@1478 8512 }) :
b@1478 8513 { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
b@1478 8514 }).get();
b@1478 8515 }
b@1478 8516 });
b@1478 8517
b@1478 8518
b@1478 8519 jQuery.ajaxSettings.xhr = function() {
b@1478 8520 try {
b@1478 8521 return new XMLHttpRequest();
b@1478 8522 } catch( e ) {}
b@1478 8523 };
b@1478 8524
b@1478 8525 var xhrId = 0,
b@1478 8526 xhrCallbacks = {},
b@1478 8527 xhrSuccessStatus = {
b@1478 8528 // file protocol always yields status code 0, assume 200
b@1478 8529 0: 200,
b@1478 8530 // Support: IE9
b@1478 8531 // #1450: sometimes IE returns 1223 when it should be 204
b@1478 8532 1223: 204
b@1478 8533 },
b@1478 8534 xhrSupported = jQuery.ajaxSettings.xhr();
b@1478 8535
b@1478 8536 // Support: IE9
b@1478 8537 // Open requests must be manually aborted on unload (#5280)
b@1478 8538 // See https://support.microsoft.com/kb/2856746 for more info
b@1478 8539 if ( window.attachEvent ) {
b@1478 8540 window.attachEvent( "onunload", function() {
b@1478 8541 for ( var key in xhrCallbacks ) {
b@1478 8542 xhrCallbacks[ key ]();
b@1478 8543 }
b@1478 8544 });
b@1478 8545 }
b@1478 8546
b@1478 8547 support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
b@1478 8548 support.ajax = xhrSupported = !!xhrSupported;
b@1478 8549
b@1478 8550 jQuery.ajaxTransport(function( options ) {
b@1478 8551 var callback;
b@1478 8552
b@1478 8553 // Cross domain only allowed if supported through XMLHttpRequest
b@1478 8554 if ( support.cors || xhrSupported && !options.crossDomain ) {
b@1478 8555 return {
b@1478 8556 send: function( headers, complete ) {
b@1478 8557 var i,
b@1478 8558 xhr = options.xhr(),
b@1478 8559 id = ++xhrId;
b@1478 8560
b@1478 8561 xhr.open( options.type, options.url, options.async, options.username, options.password );
b@1478 8562
b@1478 8563 // Apply custom fields if provided
b@1478 8564 if ( options.xhrFields ) {
b@1478 8565 for ( i in options.xhrFields ) {
b@1478 8566 xhr[ i ] = options.xhrFields[ i ];
b@1478 8567 }
b@1478 8568 }
b@1478 8569
b@1478 8570 // Override mime type if needed
b@1478 8571 if ( options.mimeType && xhr.overrideMimeType ) {
b@1478 8572 xhr.overrideMimeType( options.mimeType );
b@1478 8573 }
b@1478 8574
b@1478 8575 // X-Requested-With header
b@1478 8576 // For cross-domain requests, seeing as conditions for a preflight are
b@1478 8577 // akin to a jigsaw puzzle, we simply never set it to be sure.
b@1478 8578 // (it can always be set on a per-request basis or even using ajaxSetup)
b@1478 8579 // For same-domain requests, won't change header if already provided.
b@1478 8580 if ( !options.crossDomain && !headers["X-Requested-With"] ) {
b@1478 8581 headers["X-Requested-With"] = "XMLHttpRequest";
b@1478 8582 }
b@1478 8583
b@1478 8584 // Set headers
b@1478 8585 for ( i in headers ) {
b@1478 8586 xhr.setRequestHeader( i, headers[ i ] );
b@1478 8587 }
b@1478 8588
b@1478 8589 // Callback
b@1478 8590 callback = function( type ) {
b@1478 8591 return function() {
b@1478 8592 if ( callback ) {
b@1478 8593 delete xhrCallbacks[ id ];
b@1478 8594 callback = xhr.onload = xhr.onerror = null;
b@1478 8595
b@1478 8596 if ( type === "abort" ) {
b@1478 8597 xhr.abort();
b@1478 8598 } else if ( type === "error" ) {
b@1478 8599 complete(
b@1478 8600 // file: protocol always yields status 0; see #8605, #14207
b@1478 8601 xhr.status,
b@1478 8602 xhr.statusText
b@1478 8603 );
b@1478 8604 } else {
b@1478 8605 complete(
b@1478 8606 xhrSuccessStatus[ xhr.status ] || xhr.status,
b@1478 8607 xhr.statusText,
b@1478 8608 // Support: IE9
b@1478 8609 // Accessing binary-data responseText throws an exception
b@1478 8610 // (#11426)
b@1478 8611 typeof xhr.responseText === "string" ? {
b@1478 8612 text: xhr.responseText
b@1478 8613 } : undefined,
b@1478 8614 xhr.getAllResponseHeaders()
b@1478 8615 );
b@1478 8616 }
b@1478 8617 }
b@1478 8618 };
b@1478 8619 };
b@1478 8620
b@1478 8621 // Listen to events
b@1478 8622 xhr.onload = callback();
b@1478 8623 xhr.onerror = callback("error");
b@1478 8624
b@1478 8625 // Create the abort callback
b@1478 8626 callback = xhrCallbacks[ id ] = callback("abort");
b@1478 8627
b@1478 8628 try {
b@1478 8629 // Do send the request (this may raise an exception)
b@1478 8630 xhr.send( options.hasContent && options.data || null );
b@1478 8631 } catch ( e ) {
b@1478 8632 // #14683: Only rethrow if this hasn't been notified as an error yet
b@1478 8633 if ( callback ) {
b@1478 8634 throw e;
b@1478 8635 }
b@1478 8636 }
b@1478 8637 },
b@1478 8638
b@1478 8639 abort: function() {
b@1478 8640 if ( callback ) {
b@1478 8641 callback();
b@1478 8642 }
b@1478 8643 }
b@1478 8644 };
b@1478 8645 }
b@1478 8646 });
b@1478 8647
b@1478 8648
b@1478 8649
b@1478 8650
b@1478 8651 // Install script dataType
b@1478 8652 jQuery.ajaxSetup({
b@1478 8653 accepts: {
b@1478 8654 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
b@1478 8655 },
b@1478 8656 contents: {
b@1478 8657 script: /(?:java|ecma)script/
b@1478 8658 },
b@1478 8659 converters: {
b@1478 8660 "text script": function( text ) {
b@1478 8661 jQuery.globalEval( text );
b@1478 8662 return text;
b@1478 8663 }
b@1478 8664 }
b@1478 8665 });
b@1478 8666
b@1478 8667 // Handle cache's special case and crossDomain
b@1478 8668 jQuery.ajaxPrefilter( "script", function( s ) {
b@1478 8669 if ( s.cache === undefined ) {
b@1478 8670 s.cache = false;
b@1478 8671 }
b@1478 8672 if ( s.crossDomain ) {
b@1478 8673 s.type = "GET";
b@1478 8674 }
b@1478 8675 });
b@1478 8676
b@1478 8677 // Bind script tag hack transport
b@1478 8678 jQuery.ajaxTransport( "script", function( s ) {
b@1478 8679 // This transport only deals with cross domain requests
b@1478 8680 if ( s.crossDomain ) {
b@1478 8681 var script, callback;
b@1478 8682 return {
b@1478 8683 send: function( _, complete ) {
b@1478 8684 script = jQuery("<script>").prop({
b@1478 8685 async: true,
b@1478 8686 charset: s.scriptCharset,
b@1478 8687 src: s.url
b@1478 8688 }).on(
b@1478 8689 "load error",
b@1478 8690 callback = function( evt ) {
b@1478 8691 script.remove();
b@1478 8692 callback = null;
b@1478 8693 if ( evt ) {
b@1478 8694 complete( evt.type === "error" ? 404 : 200, evt.type );
b@1478 8695 }
b@1478 8696 }
b@1478 8697 );
b@1478 8698 document.head.appendChild( script[ 0 ] );
b@1478 8699 },
b@1478 8700 abort: function() {
b@1478 8701 if ( callback ) {
b@1478 8702 callback();
b@1478 8703 }
b@1478 8704 }
b@1478 8705 };
b@1478 8706 }
b@1478 8707 });
b@1478 8708
b@1478 8709
b@1478 8710
b@1478 8711
b@1478 8712 var oldCallbacks = [],
b@1478 8713 rjsonp = /(=)\?(?=&|$)|\?\?/;
b@1478 8714
b@1478 8715 // Default jsonp settings
b@1478 8716 jQuery.ajaxSetup({
b@1478 8717 jsonp: "callback",
b@1478 8718 jsonpCallback: function() {
b@1478 8719 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
b@1478 8720 this[ callback ] = true;
b@1478 8721 return callback;
b@1478 8722 }
b@1478 8723 });
b@1478 8724
b@1478 8725 // Detect, normalize options and install callbacks for jsonp requests
b@1478 8726 jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
b@1478 8727
b@1478 8728 var callbackName, overwritten, responseContainer,
b@1478 8729 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
b@1478 8730 "url" :
b@1478 8731 typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
b@1478 8732 );
b@1478 8733
b@1478 8734 // Handle iff the expected data type is "jsonp" or we have a parameter to set
b@1478 8735 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
b@1478 8736
b@1478 8737 // Get callback name, remembering preexisting value associated with it
b@1478 8738 callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
b@1478 8739 s.jsonpCallback() :
b@1478 8740 s.jsonpCallback;
b@1478 8741
b@1478 8742 // Insert callback into url or form data
b@1478 8743 if ( jsonProp ) {
b@1478 8744 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
b@1478 8745 } else if ( s.jsonp !== false ) {
b@1478 8746 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
b@1478 8747 }
b@1478 8748
b@1478 8749 // Use data converter to retrieve json after script execution
b@1478 8750 s.converters["script json"] = function() {
b@1478 8751 if ( !responseContainer ) {
b@1478 8752 jQuery.error( callbackName + " was not called" );
b@1478 8753 }
b@1478 8754 return responseContainer[ 0 ];
b@1478 8755 };
b@1478 8756
b@1478 8757 // force json dataType
b@1478 8758 s.dataTypes[ 0 ] = "json";
b@1478 8759
b@1478 8760 // Install callback
b@1478 8761 overwritten = window[ callbackName ];
b@1478 8762 window[ callbackName ] = function() {
b@1478 8763 responseContainer = arguments;
b@1478 8764 };
b@1478 8765
b@1478 8766 // Clean-up function (fires after converters)
b@1478 8767 jqXHR.always(function() {
b@1478 8768 // Restore preexisting value
b@1478 8769 window[ callbackName ] = overwritten;
b@1478 8770
b@1478 8771 // Save back as free
b@1478 8772 if ( s[ callbackName ] ) {
b@1478 8773 // make sure that re-using the options doesn't screw things around
b@1478 8774 s.jsonpCallback = originalSettings.jsonpCallback;
b@1478 8775
b@1478 8776 // save the callback name for future use
b@1478 8777 oldCallbacks.push( callbackName );
b@1478 8778 }
b@1478 8779
b@1478 8780 // Call if it was a function and we have a response
b@1478 8781 if ( responseContainer && jQuery.isFunction( overwritten ) ) {
b@1478 8782 overwritten( responseContainer[ 0 ] );
b@1478 8783 }
b@1478 8784
b@1478 8785 responseContainer = overwritten = undefined;
b@1478 8786 });
b@1478 8787
b@1478 8788 // Delegate to script
b@1478 8789 return "script";
b@1478 8790 }
b@1478 8791 });
b@1478 8792
b@1478 8793
b@1478 8794
b@1478 8795
b@1478 8796 // data: string of html
b@1478 8797 // context (optional): If specified, the fragment will be created in this context, defaults to document
b@1478 8798 // keepScripts (optional): If true, will include scripts passed in the html string
b@1478 8799 jQuery.parseHTML = function( data, context, keepScripts ) {
b@1478 8800 if ( !data || typeof data !== "string" ) {
b@1478 8801 return null;
b@1478 8802 }
b@1478 8803 if ( typeof context === "boolean" ) {
b@1478 8804 keepScripts = context;
b@1478 8805 context = false;
b@1478 8806 }
b@1478 8807 context = context || document;
b@1478 8808
b@1478 8809 var parsed = rsingleTag.exec( data ),
b@1478 8810 scripts = !keepScripts && [];
b@1478 8811
b@1478 8812 // Single tag
b@1478 8813 if ( parsed ) {
b@1478 8814 return [ context.createElement( parsed[1] ) ];
b@1478 8815 }
b@1478 8816
b@1478 8817 parsed = jQuery.buildFragment( [ data ], context, scripts );
b@1478 8818
b@1478 8819 if ( scripts && scripts.length ) {
b@1478 8820 jQuery( scripts ).remove();
b@1478 8821 }
b@1478 8822
b@1478 8823 return jQuery.merge( [], parsed.childNodes );
b@1478 8824 };
b@1478 8825
b@1478 8826
b@1478 8827 // Keep a copy of the old load method
b@1478 8828 var _load = jQuery.fn.load;
b@1478 8829
b@1478 8830 /**
b@1478 8831 * Load a url into a page
b@1478 8832 */
b@1478 8833 jQuery.fn.load = function( url, params, callback ) {
b@1478 8834 if ( typeof url !== "string" && _load ) {
b@1478 8835 return _load.apply( this, arguments );
b@1478 8836 }
b@1478 8837
b@1478 8838 var selector, type, response,
b@1478 8839 self = this,
b@1478 8840 off = url.indexOf(" ");
b@1478 8841
b@1478 8842 if ( off >= 0 ) {
b@1478 8843 selector = jQuery.trim( url.slice( off ) );
b@1478 8844 url = url.slice( 0, off );
b@1478 8845 }
b@1478 8846
b@1478 8847 // If it's a function
b@1478 8848 if ( jQuery.isFunction( params ) ) {
b@1478 8849
b@1478 8850 // We assume that it's the callback
b@1478 8851 callback = params;
b@1478 8852 params = undefined;
b@1478 8853
b@1478 8854 // Otherwise, build a param string
b@1478 8855 } else if ( params && typeof params === "object" ) {
b@1478 8856 type = "POST";
b@1478 8857 }
b@1478 8858
b@1478 8859 // If we have elements to modify, make the request
b@1478 8860 if ( self.length > 0 ) {
b@1478 8861 jQuery.ajax({
b@1478 8862 url: url,
b@1478 8863
b@1478 8864 // if "type" variable is undefined, then "GET" method will be used
b@1478 8865 type: type,
b@1478 8866 dataType: "html",
b@1478 8867 data: params
b@1478 8868 }).done(function( responseText ) {
b@1478 8869
b@1478 8870 // Save response for use in complete callback
b@1478 8871 response = arguments;
b@1478 8872
b@1478 8873 self.html( selector ?
b@1478 8874
b@1478 8875 // If a selector was specified, locate the right elements in a dummy div
b@1478 8876 // Exclude scripts to avoid IE 'Permission Denied' errors
b@1478 8877 jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
b@1478 8878
b@1478 8879 // Otherwise use the full result
b@1478 8880 responseText );
b@1478 8881
b@1478 8882 }).complete( callback && function( jqXHR, status ) {
b@1478 8883 self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
b@1478 8884 });
b@1478 8885 }
b@1478 8886
b@1478 8887 return this;
b@1478 8888 };
b@1478 8889
b@1478 8890
b@1478 8891
b@1478 8892
b@1478 8893 // Attach a bunch of functions for handling common AJAX events
b@1478 8894 jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) {
b@1478 8895 jQuery.fn[ type ] = function( fn ) {
b@1478 8896 return this.on( type, fn );
b@1478 8897 };
b@1478 8898 });
b@1478 8899
b@1478 8900
b@1478 8901
b@1478 8902
b@1478 8903 jQuery.expr.filters.animated = function( elem ) {
b@1478 8904 return jQuery.grep(jQuery.timers, function( fn ) {
b@1478 8905 return elem === fn.elem;
b@1478 8906 }).length;
b@1478 8907 };
b@1478 8908
b@1478 8909
b@1478 8910
b@1478 8911
b@1478 8912 var docElem = window.document.documentElement;
b@1478 8913
b@1478 8914 /**
b@1478 8915 * Gets a window from an element
b@1478 8916 */
b@1478 8917 function getWindow( elem ) {
b@1478 8918 return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
b@1478 8919 }
b@1478 8920
b@1478 8921 jQuery.offset = {
b@1478 8922 setOffset: function( elem, options, i ) {
b@1478 8923 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
b@1478 8924 position = jQuery.css( elem, "position" ),
b@1478 8925 curElem = jQuery( elem ),
b@1478 8926 props = {};
b@1478 8927
b@1478 8928 // Set position first, in-case top/left are set even on static elem
b@1478 8929 if ( position === "static" ) {
b@1478 8930 elem.style.position = "relative";
b@1478 8931 }
b@1478 8932
b@1478 8933 curOffset = curElem.offset();
b@1478 8934 curCSSTop = jQuery.css( elem, "top" );
b@1478 8935 curCSSLeft = jQuery.css( elem, "left" );
b@1478 8936 calculatePosition = ( position === "absolute" || position === "fixed" ) &&
b@1478 8937 ( curCSSTop + curCSSLeft ).indexOf("auto") > -1;
b@1478 8938
b@1478 8939 // Need to be able to calculate position if either
b@1478 8940 // top or left is auto and position is either absolute or fixed
b@1478 8941 if ( calculatePosition ) {
b@1478 8942 curPosition = curElem.position();
b@1478 8943 curTop = curPosition.top;
b@1478 8944 curLeft = curPosition.left;
b@1478 8945
b@1478 8946 } else {
b@1478 8947 curTop = parseFloat( curCSSTop ) || 0;
b@1478 8948 curLeft = parseFloat( curCSSLeft ) || 0;
b@1478 8949 }
b@1478 8950
b@1478 8951 if ( jQuery.isFunction( options ) ) {
b@1478 8952 options = options.call( elem, i, curOffset );
b@1478 8953 }
b@1478 8954
b@1478 8955 if ( options.top != null ) {
b@1478 8956 props.top = ( options.top - curOffset.top ) + curTop;
b@1478 8957 }
b@1478 8958 if ( options.left != null ) {
b@1478 8959 props.left = ( options.left - curOffset.left ) + curLeft;
b@1478 8960 }
b@1478 8961
b@1478 8962 if ( "using" in options ) {
b@1478 8963 options.using.call( elem, props );
b@1478 8964
b@1478 8965 } else {
b@1478 8966 curElem.css( props );
b@1478 8967 }
b@1478 8968 }
b@1478 8969 };
b@1478 8970
b@1478 8971 jQuery.fn.extend({
b@1478 8972 offset: function( options ) {
b@1478 8973 if ( arguments.length ) {
b@1478 8974 return options === undefined ?
b@1478 8975 this :
b@1478 8976 this.each(function( i ) {
b@1478 8977 jQuery.offset.setOffset( this, options, i );
b@1478 8978 });
b@1478 8979 }
b@1478 8980
b@1478 8981 var docElem, win,
b@1478 8982 elem = this[ 0 ],
b@1478 8983 box = { top: 0, left: 0 },
b@1478 8984 doc = elem && elem.ownerDocument;
b@1478 8985
b@1478 8986 if ( !doc ) {
b@1478 8987 return;
b@1478 8988 }
b@1478 8989
b@1478 8990 docElem = doc.documentElement;
b@1478 8991
b@1478 8992 // Make sure it's not a disconnected DOM node
b@1478 8993 if ( !jQuery.contains( docElem, elem ) ) {
b@1478 8994 return box;
b@1478 8995 }
b@1478 8996
b@1478 8997 // Support: BlackBerry 5, iOS 3 (original iPhone)
b@1478 8998 // If we don't have gBCR, just use 0,0 rather than error
b@1478 8999 if ( typeof elem.getBoundingClientRect !== strundefined ) {
b@1478 9000 box = elem.getBoundingClientRect();
b@1478 9001 }
b@1478 9002 win = getWindow( doc );
b@1478 9003 return {
b@1478 9004 top: box.top + win.pageYOffset - docElem.clientTop,
b@1478 9005 left: box.left + win.pageXOffset - docElem.clientLeft
b@1478 9006 };
b@1478 9007 },
b@1478 9008
b@1478 9009 position: function() {
b@1478 9010 if ( !this[ 0 ] ) {
b@1478 9011 return;
b@1478 9012 }
b@1478 9013
b@1478 9014 var offsetParent, offset,
b@1478 9015 elem = this[ 0 ],
b@1478 9016 parentOffset = { top: 0, left: 0 };
b@1478 9017
b@1478 9018 // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent
b@1478 9019 if ( jQuery.css( elem, "position" ) === "fixed" ) {
b@1478 9020 // Assume getBoundingClientRect is there when computed position is fixed
b@1478 9021 offset = elem.getBoundingClientRect();
b@1478 9022
b@1478 9023 } else {
b@1478 9024 // Get *real* offsetParent
b@1478 9025 offsetParent = this.offsetParent();
b@1478 9026
b@1478 9027 // Get correct offsets
b@1478 9028 offset = this.offset();
b@1478 9029 if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
b@1478 9030 parentOffset = offsetParent.offset();
b@1478 9031 }
b@1478 9032
b@1478 9033 // Add offsetParent borders
b@1478 9034 parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
b@1478 9035 parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
b@1478 9036 }
b@1478 9037
b@1478 9038 // Subtract parent offsets and element margins
b@1478 9039 return {
b@1478 9040 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
b@1478 9041 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
b@1478 9042 };
b@1478 9043 },
b@1478 9044
b@1478 9045 offsetParent: function() {
b@1478 9046 return this.map(function() {
b@1478 9047 var offsetParent = this.offsetParent || docElem;
b@1478 9048
b@1478 9049 while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) {
b@1478 9050 offsetParent = offsetParent.offsetParent;
b@1478 9051 }
b@1478 9052
b@1478 9053 return offsetParent || docElem;
b@1478 9054 });
b@1478 9055 }
b@1478 9056 });
b@1478 9057
b@1478 9058 // Create scrollLeft and scrollTop methods
b@1478 9059 jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
b@1478 9060 var top = "pageYOffset" === prop;
b@1478 9061
b@1478 9062 jQuery.fn[ method ] = function( val ) {
b@1478 9063 return access( this, function( elem, method, val ) {
b@1478 9064 var win = getWindow( elem );
b@1478 9065
b@1478 9066 if ( val === undefined ) {
b@1478 9067 return win ? win[ prop ] : elem[ method ];
b@1478 9068 }
b@1478 9069
b@1478 9070 if ( win ) {
b@1478 9071 win.scrollTo(
b@1478 9072 !top ? val : window.pageXOffset,
b@1478 9073 top ? val : window.pageYOffset
b@1478 9074 );
b@1478 9075
b@1478 9076 } else {
b@1478 9077 elem[ method ] = val;
b@1478 9078 }
b@1478 9079 }, method, val, arguments.length, null );
b@1478 9080 };
b@1478 9081 });
b@1478 9082
b@1478 9083 // Support: Safari<7+, Chrome<37+
b@1478 9084 // Add the top/left cssHooks using jQuery.fn.position
b@1478 9085 // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
b@1478 9086 // Blink bug: https://code.google.com/p/chromium/issues/detail?id=229280
b@1478 9087 // getComputedStyle returns percent when specified for top/left/bottom/right;
b@1478 9088 // rather than make the css module depend on the offset module, just check for it here
b@1478 9089 jQuery.each( [ "top", "left" ], function( i, prop ) {
b@1478 9090 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
b@1478 9091 function( elem, computed ) {
b@1478 9092 if ( computed ) {
b@1478 9093 computed = curCSS( elem, prop );
b@1478 9094 // If curCSS returns percentage, fallback to offset
b@1478 9095 return rnumnonpx.test( computed ) ?
b@1478 9096 jQuery( elem ).position()[ prop ] + "px" :
b@1478 9097 computed;
b@1478 9098 }
b@1478 9099 }
b@1478 9100 );
b@1478 9101 });
b@1478 9102
b@1478 9103
b@1478 9104 // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
b@1478 9105 jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
b@1478 9106 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
b@1478 9107 // Margin is only for outerHeight, outerWidth
b@1478 9108 jQuery.fn[ funcName ] = function( margin, value ) {
b@1478 9109 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
b@1478 9110 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
b@1478 9111
b@1478 9112 return access( this, function( elem, type, value ) {
b@1478 9113 var doc;
b@1478 9114
b@1478 9115 if ( jQuery.isWindow( elem ) ) {
b@1478 9116 // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
b@1478 9117 // isn't a whole lot we can do. See pull request at this URL for discussion:
b@1478 9118 // https://github.com/jquery/jquery/pull/764
b@1478 9119 return elem.document.documentElement[ "client" + name ];
b@1478 9120 }
b@1478 9121
b@1478 9122 // Get document width or height
b@1478 9123 if ( elem.nodeType === 9 ) {
b@1478 9124 doc = elem.documentElement;
b@1478 9125
b@1478 9126 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
b@1478 9127 // whichever is greatest
b@1478 9128 return Math.max(
b@1478 9129 elem.body[ "scroll" + name ], doc[ "scroll" + name ],
b@1478 9130 elem.body[ "offset" + name ], doc[ "offset" + name ],
b@1478 9131 doc[ "client" + name ]
b@1478 9132 );
b@1478 9133 }
b@1478 9134
b@1478 9135 return value === undefined ?
b@1478 9136 // Get width or height on the element, requesting but not forcing parseFloat
b@1478 9137 jQuery.css( elem, type, extra ) :
b@1478 9138
b@1478 9139 // Set width or height on the element
b@1478 9140 jQuery.style( elem, type, value, extra );
b@1478 9141 }, type, chainable ? margin : undefined, chainable, null );
b@1478 9142 };
b@1478 9143 });
b@1478 9144 });
b@1478 9145
b@1478 9146
b@1478 9147 // The number of elements contained in the matched element set
b@1478 9148 jQuery.fn.size = function() {
b@1478 9149 return this.length;
b@1478 9150 };
b@1478 9151
b@1478 9152 jQuery.fn.andSelf = jQuery.fn.addBack;
b@1478 9153
b@1478 9154
b@1478 9155
b@1478 9156
b@1478 9157 // Register as a named AMD module, since jQuery can be concatenated with other
b@1478 9158 // files that may use define, but not via a proper concatenation script that
b@1478 9159 // understands anonymous AMD modules. A named AMD is safest and most robust
b@1478 9160 // way to register. Lowercase jquery is used because AMD module names are
b@1478 9161 // derived from file names, and jQuery is normally delivered in a lowercase
b@1478 9162 // file name. Do this after creating the global so that if an AMD module wants
b@1478 9163 // to call noConflict to hide this version of jQuery, it will work.
b@1478 9164
b@1478 9165 // Note that for maximum portability, libraries that are not jQuery should
b@1478 9166 // declare themselves as anonymous modules, and avoid setting a global if an
b@1478 9167 // AMD loader is present. jQuery is a special case. For more information, see
b@1478 9168 // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
b@1478 9169
b@1478 9170 if ( typeof define === "function" && define.amd ) {
b@1478 9171 define( "jquery", [], function() {
b@1478 9172 return jQuery;
b@1478 9173 });
b@1478 9174 }
b@1478 9175
b@1478 9176
b@1478 9177
b@1478 9178
b@1478 9179 var
b@1478 9180 // Map over jQuery in case of overwrite
b@1478 9181 _jQuery = window.jQuery,
b@1478 9182
b@1478 9183 // Map over the $ in case of overwrite
b@1478 9184 _$ = window.$;
b@1478 9185
b@1478 9186 jQuery.noConflict = function( deep ) {
b@1478 9187 if ( window.$ === jQuery ) {
b@1478 9188 window.$ = _$;
b@1478 9189 }
b@1478 9190
b@1478 9191 if ( deep && window.jQuery === jQuery ) {
b@1478 9192 window.jQuery = _jQuery;
b@1478 9193 }
b@1478 9194
b@1478 9195 return jQuery;
b@1478 9196 };
b@1478 9197
b@1478 9198 // Expose jQuery and $ identifiers, even in AMD
b@1478 9199 // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
b@1478 9200 // and CommonJS for browser emulators (#13566)
b@1478 9201 if ( typeof noGlobal === strundefined ) {
b@1478 9202 window.jQuery = window.$ = jQuery;
b@1478 9203 }
b@1478 9204
b@1478 9205
b@1478 9206
b@1478 9207
b@1478 9208 return jQuery;
b@1478 9209
b@1478 9210 }));