annotate jquery-2.1.4.js @ 1482:81e2a7162d18

Addition of HULTI-GEN interfaces to WAC paper.
author Dave <djmoffat@users.noreply.github.com>
date Wed, 23 Sep 2015 09:13:38 +0100
parents 8be2d08fbe15
children
rev   line source
b@1481 1 /*!
b@1481 2 * jQuery JavaScript Library v2.1.4
b@1481 3 * http://jquery.com/
b@1481 4 *
b@1481 5 * Includes Sizzle.js
b@1481 6 * http://sizzlejs.com/
b@1481 7 *
b@1481 8 * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
b@1481 9 * Released under the MIT license
b@1481 10 * http://jquery.org/license
b@1481 11 *
b@1481 12 * Date: 2015-04-28T16:01Z
b@1481 13 */
b@1481 14
b@1481 15 (function( global, factory ) {
b@1481 16
b@1481 17 if ( typeof module === "object" && typeof module.exports === "object" ) {
b@1481 18 // For CommonJS and CommonJS-like environments where a proper `window`
b@1481 19 // is present, execute the factory and get jQuery.
b@1481 20 // For environments that do not have a `window` with a `document`
b@1481 21 // (such as Node.js), expose a factory as module.exports.
b@1481 22 // This accentuates the need for the creation of a real `window`.
b@1481 23 // e.g. var jQuery = require("jquery")(window);
b@1481 24 // See ticket #14549 for more info.
b@1481 25 module.exports = global.document ?
b@1481 26 factory( global, true ) :
b@1481 27 function( w ) {
b@1481 28 if ( !w.document ) {
b@1481 29 throw new Error( "jQuery requires a window with a document" );
b@1481 30 }
b@1481 31 return factory( w );
b@1481 32 };
b@1481 33 } else {
b@1481 34 factory( global );
b@1481 35 }
b@1481 36
b@1481 37 // Pass this if window is not defined yet
b@1481 38 }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
b@1481 39
b@1481 40 // Support: Firefox 18+
b@1481 41 // Can't be in strict mode, several libs including ASP.NET trace
b@1481 42 // the stack via arguments.caller.callee and Firefox dies if
b@1481 43 // you try to trace through "use strict" call chains. (#13335)
b@1481 44 //
b@1481 45
b@1481 46 var arr = [];
b@1481 47
b@1481 48 var slice = arr.slice;
b@1481 49
b@1481 50 var concat = arr.concat;
b@1481 51
b@1481 52 var push = arr.push;
b@1481 53
b@1481 54 var indexOf = arr.indexOf;
b@1481 55
b@1481 56 var class2type = {};
b@1481 57
b@1481 58 var toString = class2type.toString;
b@1481 59
b@1481 60 var hasOwn = class2type.hasOwnProperty;
b@1481 61
b@1481 62 var support = {};
b@1481 63
b@1481 64
b@1481 65
b@1481 66 var
b@1481 67 // Use the correct document accordingly with window argument (sandbox)
b@1481 68 document = window.document,
b@1481 69
b@1481 70 version = "2.1.4",
b@1481 71
b@1481 72 // Define a local copy of jQuery
b@1481 73 jQuery = function( selector, context ) {
b@1481 74 // The jQuery object is actually just the init constructor 'enhanced'
b@1481 75 // Need init if jQuery is called (just allow error to be thrown if not included)
b@1481 76 return new jQuery.fn.init( selector, context );
b@1481 77 },
b@1481 78
b@1481 79 // Support: Android<4.1
b@1481 80 // Make sure we trim BOM and NBSP
b@1481 81 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
b@1481 82
b@1481 83 // Matches dashed string for camelizing
b@1481 84 rmsPrefix = /^-ms-/,
b@1481 85 rdashAlpha = /-([\da-z])/gi,
b@1481 86
b@1481 87 // Used by jQuery.camelCase as callback to replace()
b@1481 88 fcamelCase = function( all, letter ) {
b@1481 89 return letter.toUpperCase();
b@1481 90 };
b@1481 91
b@1481 92 jQuery.fn = jQuery.prototype = {
b@1481 93 // The current version of jQuery being used
b@1481 94 jquery: version,
b@1481 95
b@1481 96 constructor: jQuery,
b@1481 97
b@1481 98 // Start with an empty selector
b@1481 99 selector: "",
b@1481 100
b@1481 101 // The default length of a jQuery object is 0
b@1481 102 length: 0,
b@1481 103
b@1481 104 toArray: function() {
b@1481 105 return slice.call( this );
b@1481 106 },
b@1481 107
b@1481 108 // Get the Nth element in the matched element set OR
b@1481 109 // Get the whole matched element set as a clean array
b@1481 110 get: function( num ) {
b@1481 111 return num != null ?
b@1481 112
b@1481 113 // Return just the one element from the set
b@1481 114 ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
b@1481 115
b@1481 116 // Return all the elements in a clean array
b@1481 117 slice.call( this );
b@1481 118 },
b@1481 119
b@1481 120 // Take an array of elements and push it onto the stack
b@1481 121 // (returning the new matched element set)
b@1481 122 pushStack: function( elems ) {
b@1481 123
b@1481 124 // Build a new jQuery matched element set
b@1481 125 var ret = jQuery.merge( this.constructor(), elems );
b@1481 126
b@1481 127 // Add the old object onto the stack (as a reference)
b@1481 128 ret.prevObject = this;
b@1481 129 ret.context = this.context;
b@1481 130
b@1481 131 // Return the newly-formed element set
b@1481 132 return ret;
b@1481 133 },
b@1481 134
b@1481 135 // Execute a callback for every element in the matched set.
b@1481 136 // (You can seed the arguments with an array of args, but this is
b@1481 137 // only used internally.)
b@1481 138 each: function( callback, args ) {
b@1481 139 return jQuery.each( this, callback, args );
b@1481 140 },
b@1481 141
b@1481 142 map: function( callback ) {
b@1481 143 return this.pushStack( jQuery.map(this, function( elem, i ) {
b@1481 144 return callback.call( elem, i, elem );
b@1481 145 }));
b@1481 146 },
b@1481 147
b@1481 148 slice: function() {
b@1481 149 return this.pushStack( slice.apply( this, arguments ) );
b@1481 150 },
b@1481 151
b@1481 152 first: function() {
b@1481 153 return this.eq( 0 );
b@1481 154 },
b@1481 155
b@1481 156 last: function() {
b@1481 157 return this.eq( -1 );
b@1481 158 },
b@1481 159
b@1481 160 eq: function( i ) {
b@1481 161 var len = this.length,
b@1481 162 j = +i + ( i < 0 ? len : 0 );
b@1481 163 return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
b@1481 164 },
b@1481 165
b@1481 166 end: function() {
b@1481 167 return this.prevObject || this.constructor(null);
b@1481 168 },
b@1481 169
b@1481 170 // For internal use only.
b@1481 171 // Behaves like an Array's method, not like a jQuery method.
b@1481 172 push: push,
b@1481 173 sort: arr.sort,
b@1481 174 splice: arr.splice
b@1481 175 };
b@1481 176
b@1481 177 jQuery.extend = jQuery.fn.extend = function() {
b@1481 178 var options, name, src, copy, copyIsArray, clone,
b@1481 179 target = arguments[0] || {},
b@1481 180 i = 1,
b@1481 181 length = arguments.length,
b@1481 182 deep = false;
b@1481 183
b@1481 184 // Handle a deep copy situation
b@1481 185 if ( typeof target === "boolean" ) {
b@1481 186 deep = target;
b@1481 187
b@1481 188 // Skip the boolean and the target
b@1481 189 target = arguments[ i ] || {};
b@1481 190 i++;
b@1481 191 }
b@1481 192
b@1481 193 // Handle case when target is a string or something (possible in deep copy)
b@1481 194 if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
b@1481 195 target = {};
b@1481 196 }
b@1481 197
b@1481 198 // Extend jQuery itself if only one argument is passed
b@1481 199 if ( i === length ) {
b@1481 200 target = this;
b@1481 201 i--;
b@1481 202 }
b@1481 203
b@1481 204 for ( ; i < length; i++ ) {
b@1481 205 // Only deal with non-null/undefined values
b@1481 206 if ( (options = arguments[ i ]) != null ) {
b@1481 207 // Extend the base object
b@1481 208 for ( name in options ) {
b@1481 209 src = target[ name ];
b@1481 210 copy = options[ name ];
b@1481 211
b@1481 212 // Prevent never-ending loop
b@1481 213 if ( target === copy ) {
b@1481 214 continue;
b@1481 215 }
b@1481 216
b@1481 217 // Recurse if we're merging plain objects or arrays
b@1481 218 if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
b@1481 219 if ( copyIsArray ) {
b@1481 220 copyIsArray = false;
b@1481 221 clone = src && jQuery.isArray(src) ? src : [];
b@1481 222
b@1481 223 } else {
b@1481 224 clone = src && jQuery.isPlainObject(src) ? src : {};
b@1481 225 }
b@1481 226
b@1481 227 // Never move original objects, clone them
b@1481 228 target[ name ] = jQuery.extend( deep, clone, copy );
b@1481 229
b@1481 230 // Don't bring in undefined values
b@1481 231 } else if ( copy !== undefined ) {
b@1481 232 target[ name ] = copy;
b@1481 233 }
b@1481 234 }
b@1481 235 }
b@1481 236 }
b@1481 237
b@1481 238 // Return the modified object
b@1481 239 return target;
b@1481 240 };
b@1481 241
b@1481 242 jQuery.extend({
b@1481 243 // Unique for each copy of jQuery on the page
b@1481 244 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
b@1481 245
b@1481 246 // Assume jQuery is ready without the ready module
b@1481 247 isReady: true,
b@1481 248
b@1481 249 error: function( msg ) {
b@1481 250 throw new Error( msg );
b@1481 251 },
b@1481 252
b@1481 253 noop: function() {},
b@1481 254
b@1481 255 isFunction: function( obj ) {
b@1481 256 return jQuery.type(obj) === "function";
b@1481 257 },
b@1481 258
b@1481 259 isArray: Array.isArray,
b@1481 260
b@1481 261 isWindow: function( obj ) {
b@1481 262 return obj != null && obj === obj.window;
b@1481 263 },
b@1481 264
b@1481 265 isNumeric: function( obj ) {
b@1481 266 // parseFloat NaNs numeric-cast false positives (null|true|false|"")
b@1481 267 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
b@1481 268 // subtraction forces infinities to NaN
b@1481 269 // adding 1 corrects loss of precision from parseFloat (#15100)
b@1481 270 return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0;
b@1481 271 },
b@1481 272
b@1481 273 isPlainObject: function( obj ) {
b@1481 274 // Not plain objects:
b@1481 275 // - Any object or value whose internal [[Class]] property is not "[object Object]"
b@1481 276 // - DOM nodes
b@1481 277 // - window
b@1481 278 if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
b@1481 279 return false;
b@1481 280 }
b@1481 281
b@1481 282 if ( obj.constructor &&
b@1481 283 !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
b@1481 284 return false;
b@1481 285 }
b@1481 286
b@1481 287 // If the function hasn't returned already, we're confident that
b@1481 288 // |obj| is a plain object, created by {} or constructed with new Object
b@1481 289 return true;
b@1481 290 },
b@1481 291
b@1481 292 isEmptyObject: function( obj ) {
b@1481 293 var name;
b@1481 294 for ( name in obj ) {
b@1481 295 return false;
b@1481 296 }
b@1481 297 return true;
b@1481 298 },
b@1481 299
b@1481 300 type: function( obj ) {
b@1481 301 if ( obj == null ) {
b@1481 302 return obj + "";
b@1481 303 }
b@1481 304 // Support: Android<4.0, iOS<6 (functionish RegExp)
b@1481 305 return typeof obj === "object" || typeof obj === "function" ?
b@1481 306 class2type[ toString.call(obj) ] || "object" :
b@1481 307 typeof obj;
b@1481 308 },
b@1481 309
b@1481 310 // Evaluates a script in a global context
b@1481 311 globalEval: function( code ) {
b@1481 312 var script,
b@1481 313 indirect = eval;
b@1481 314
b@1481 315 code = jQuery.trim( code );
b@1481 316
b@1481 317 if ( code ) {
b@1481 318 // If the code includes a valid, prologue position
b@1481 319 // strict mode pragma, execute code by injecting a
b@1481 320 // script tag into the document.
b@1481 321 if ( code.indexOf("use strict") === 1 ) {
b@1481 322 script = document.createElement("script");
b@1481 323 script.text = code;
b@1481 324 document.head.appendChild( script ).parentNode.removeChild( script );
b@1481 325 } else {
b@1481 326 // Otherwise, avoid the DOM node creation, insertion
b@1481 327 // and removal by using an indirect global eval
b@1481 328 indirect( code );
b@1481 329 }
b@1481 330 }
b@1481 331 },
b@1481 332
b@1481 333 // Convert dashed to camelCase; used by the css and data modules
b@1481 334 // Support: IE9-11+
b@1481 335 // Microsoft forgot to hump their vendor prefix (#9572)
b@1481 336 camelCase: function( string ) {
b@1481 337 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
b@1481 338 },
b@1481 339
b@1481 340 nodeName: function( elem, name ) {
b@1481 341 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
b@1481 342 },
b@1481 343
b@1481 344 // args is for internal usage only
b@1481 345 each: function( obj, callback, args ) {
b@1481 346 var value,
b@1481 347 i = 0,
b@1481 348 length = obj.length,
b@1481 349 isArray = isArraylike( obj );
b@1481 350
b@1481 351 if ( args ) {
b@1481 352 if ( isArray ) {
b@1481 353 for ( ; i < length; i++ ) {
b@1481 354 value = callback.apply( obj[ i ], args );
b@1481 355
b@1481 356 if ( value === false ) {
b@1481 357 break;
b@1481 358 }
b@1481 359 }
b@1481 360 } else {
b@1481 361 for ( i in obj ) {
b@1481 362 value = callback.apply( obj[ i ], args );
b@1481 363
b@1481 364 if ( value === false ) {
b@1481 365 break;
b@1481 366 }
b@1481 367 }
b@1481 368 }
b@1481 369
b@1481 370 // A special, fast, case for the most common use of each
b@1481 371 } else {
b@1481 372 if ( isArray ) {
b@1481 373 for ( ; i < length; i++ ) {
b@1481 374 value = callback.call( obj[ i ], i, obj[ i ] );
b@1481 375
b@1481 376 if ( value === false ) {
b@1481 377 break;
b@1481 378 }
b@1481 379 }
b@1481 380 } else {
b@1481 381 for ( i in obj ) {
b@1481 382 value = callback.call( obj[ i ], i, obj[ i ] );
b@1481 383
b@1481 384 if ( value === false ) {
b@1481 385 break;
b@1481 386 }
b@1481 387 }
b@1481 388 }
b@1481 389 }
b@1481 390
b@1481 391 return obj;
b@1481 392 },
b@1481 393
b@1481 394 // Support: Android<4.1
b@1481 395 trim: function( text ) {
b@1481 396 return text == null ?
b@1481 397 "" :
b@1481 398 ( text + "" ).replace( rtrim, "" );
b@1481 399 },
b@1481 400
b@1481 401 // results is for internal usage only
b@1481 402 makeArray: function( arr, results ) {
b@1481 403 var ret = results || [];
b@1481 404
b@1481 405 if ( arr != null ) {
b@1481 406 if ( isArraylike( Object(arr) ) ) {
b@1481 407 jQuery.merge( ret,
b@1481 408 typeof arr === "string" ?
b@1481 409 [ arr ] : arr
b@1481 410 );
b@1481 411 } else {
b@1481 412 push.call( ret, arr );
b@1481 413 }
b@1481 414 }
b@1481 415
b@1481 416 return ret;
b@1481 417 },
b@1481 418
b@1481 419 inArray: function( elem, arr, i ) {
b@1481 420 return arr == null ? -1 : indexOf.call( arr, elem, i );
b@1481 421 },
b@1481 422
b@1481 423 merge: function( first, second ) {
b@1481 424 var len = +second.length,
b@1481 425 j = 0,
b@1481 426 i = first.length;
b@1481 427
b@1481 428 for ( ; j < len; j++ ) {
b@1481 429 first[ i++ ] = second[ j ];
b@1481 430 }
b@1481 431
b@1481 432 first.length = i;
b@1481 433
b@1481 434 return first;
b@1481 435 },
b@1481 436
b@1481 437 grep: function( elems, callback, invert ) {
b@1481 438 var callbackInverse,
b@1481 439 matches = [],
b@1481 440 i = 0,
b@1481 441 length = elems.length,
b@1481 442 callbackExpect = !invert;
b@1481 443
b@1481 444 // Go through the array, only saving the items
b@1481 445 // that pass the validator function
b@1481 446 for ( ; i < length; i++ ) {
b@1481 447 callbackInverse = !callback( elems[ i ], i );
b@1481 448 if ( callbackInverse !== callbackExpect ) {
b@1481 449 matches.push( elems[ i ] );
b@1481 450 }
b@1481 451 }
b@1481 452
b@1481 453 return matches;
b@1481 454 },
b@1481 455
b@1481 456 // arg is for internal usage only
b@1481 457 map: function( elems, callback, arg ) {
b@1481 458 var value,
b@1481 459 i = 0,
b@1481 460 length = elems.length,
b@1481 461 isArray = isArraylike( elems ),
b@1481 462 ret = [];
b@1481 463
b@1481 464 // Go through the array, translating each of the items to their new values
b@1481 465 if ( isArray ) {
b@1481 466 for ( ; i < length; i++ ) {
b@1481 467 value = callback( elems[ i ], i, arg );
b@1481 468
b@1481 469 if ( value != null ) {
b@1481 470 ret.push( value );
b@1481 471 }
b@1481 472 }
b@1481 473
b@1481 474 // Go through every key on the object,
b@1481 475 } else {
b@1481 476 for ( i in elems ) {
b@1481 477 value = callback( elems[ i ], i, arg );
b@1481 478
b@1481 479 if ( value != null ) {
b@1481 480 ret.push( value );
b@1481 481 }
b@1481 482 }
b@1481 483 }
b@1481 484
b@1481 485 // Flatten any nested arrays
b@1481 486 return concat.apply( [], ret );
b@1481 487 },
b@1481 488
b@1481 489 // A global GUID counter for objects
b@1481 490 guid: 1,
b@1481 491
b@1481 492 // Bind a function to a context, optionally partially applying any
b@1481 493 // arguments.
b@1481 494 proxy: function( fn, context ) {
b@1481 495 var tmp, args, proxy;
b@1481 496
b@1481 497 if ( typeof context === "string" ) {
b@1481 498 tmp = fn[ context ];
b@1481 499 context = fn;
b@1481 500 fn = tmp;
b@1481 501 }
b@1481 502
b@1481 503 // Quick check to determine if target is callable, in the spec
b@1481 504 // this throws a TypeError, but we will just return undefined.
b@1481 505 if ( !jQuery.isFunction( fn ) ) {
b@1481 506 return undefined;
b@1481 507 }
b@1481 508
b@1481 509 // Simulated bind
b@1481 510 args = slice.call( arguments, 2 );
b@1481 511 proxy = function() {
b@1481 512 return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
b@1481 513 };
b@1481 514
b@1481 515 // Set the guid of unique handler to the same of original handler, so it can be removed
b@1481 516 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
b@1481 517
b@1481 518 return proxy;
b@1481 519 },
b@1481 520
b@1481 521 now: Date.now,
b@1481 522
b@1481 523 // jQuery.support is not used in Core but other projects attach their
b@1481 524 // properties to it so it needs to exist.
b@1481 525 support: support
b@1481 526 });
b@1481 527
b@1481 528 // Populate the class2type map
b@1481 529 jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
b@1481 530 class2type[ "[object " + name + "]" ] = name.toLowerCase();
b@1481 531 });
b@1481 532
b@1481 533 function isArraylike( obj ) {
b@1481 534
b@1481 535 // Support: iOS 8.2 (not reproducible in simulator)
b@1481 536 // `in` check used to prevent JIT error (gh-2145)
b@1481 537 // hasOwn isn't used here due to false negatives
b@1481 538 // regarding Nodelist length in IE
b@1481 539 var length = "length" in obj && obj.length,
b@1481 540 type = jQuery.type( obj );
b@1481 541
b@1481 542 if ( type === "function" || jQuery.isWindow( obj ) ) {
b@1481 543 return false;
b@1481 544 }
b@1481 545
b@1481 546 if ( obj.nodeType === 1 && length ) {
b@1481 547 return true;
b@1481 548 }
b@1481 549
b@1481 550 return type === "array" || length === 0 ||
b@1481 551 typeof length === "number" && length > 0 && ( length - 1 ) in obj;
b@1481 552 }
b@1481 553 var Sizzle =
b@1481 554 /*!
b@1481 555 * Sizzle CSS Selector Engine v2.2.0-pre
b@1481 556 * http://sizzlejs.com/
b@1481 557 *
b@1481 558 * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors
b@1481 559 * Released under the MIT license
b@1481 560 * http://jquery.org/license
b@1481 561 *
b@1481 562 * Date: 2014-12-16
b@1481 563 */
b@1481 564 (function( window ) {
b@1481 565
b@1481 566 var i,
b@1481 567 support,
b@1481 568 Expr,
b@1481 569 getText,
b@1481 570 isXML,
b@1481 571 tokenize,
b@1481 572 compile,
b@1481 573 select,
b@1481 574 outermostContext,
b@1481 575 sortInput,
b@1481 576 hasDuplicate,
b@1481 577
b@1481 578 // Local document vars
b@1481 579 setDocument,
b@1481 580 document,
b@1481 581 docElem,
b@1481 582 documentIsHTML,
b@1481 583 rbuggyQSA,
b@1481 584 rbuggyMatches,
b@1481 585 matches,
b@1481 586 contains,
b@1481 587
b@1481 588 // Instance-specific data
b@1481 589 expando = "sizzle" + 1 * new Date(),
b@1481 590 preferredDoc = window.document,
b@1481 591 dirruns = 0,
b@1481 592 done = 0,
b@1481 593 classCache = createCache(),
b@1481 594 tokenCache = createCache(),
b@1481 595 compilerCache = createCache(),
b@1481 596 sortOrder = function( a, b ) {
b@1481 597 if ( a === b ) {
b@1481 598 hasDuplicate = true;
b@1481 599 }
b@1481 600 return 0;
b@1481 601 },
b@1481 602
b@1481 603 // General-purpose constants
b@1481 604 MAX_NEGATIVE = 1 << 31,
b@1481 605
b@1481 606 // Instance methods
b@1481 607 hasOwn = ({}).hasOwnProperty,
b@1481 608 arr = [],
b@1481 609 pop = arr.pop,
b@1481 610 push_native = arr.push,
b@1481 611 push = arr.push,
b@1481 612 slice = arr.slice,
b@1481 613 // Use a stripped-down indexOf as it's faster than native
b@1481 614 // http://jsperf.com/thor-indexof-vs-for/5
b@1481 615 indexOf = function( list, elem ) {
b@1481 616 var i = 0,
b@1481 617 len = list.length;
b@1481 618 for ( ; i < len; i++ ) {
b@1481 619 if ( list[i] === elem ) {
b@1481 620 return i;
b@1481 621 }
b@1481 622 }
b@1481 623 return -1;
b@1481 624 },
b@1481 625
b@1481 626 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
b@1481 627
b@1481 628 // Regular expressions
b@1481 629
b@1481 630 // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
b@1481 631 whitespace = "[\\x20\\t\\r\\n\\f]",
b@1481 632 // http://www.w3.org/TR/css3-syntax/#characters
b@1481 633 characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
b@1481 634
b@1481 635 // Loosely modeled on CSS identifier characters
b@1481 636 // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
b@1481 637 // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
b@1481 638 identifier = characterEncoding.replace( "w", "w#" ),
b@1481 639
b@1481 640 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
b@1481 641 attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace +
b@1481 642 // Operator (capture 2)
b@1481 643 "*([*^$|!~]?=)" + whitespace +
b@1481 644 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
b@1481 645 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
b@1481 646 "*\\]",
b@1481 647
b@1481 648 pseudos = ":(" + characterEncoding + ")(?:\\((" +
b@1481 649 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
b@1481 650 // 1. quoted (capture 3; capture 4 or capture 5)
b@1481 651 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
b@1481 652 // 2. simple (capture 6)
b@1481 653 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
b@1481 654 // 3. anything else (capture 2)
b@1481 655 ".*" +
b@1481 656 ")\\)|)",
b@1481 657
b@1481 658 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
b@1481 659 rwhitespace = new RegExp( whitespace + "+", "g" ),
b@1481 660 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
b@1481 661
b@1481 662 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
b@1481 663 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
b@1481 664
b@1481 665 rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
b@1481 666
b@1481 667 rpseudo = new RegExp( pseudos ),
b@1481 668 ridentifier = new RegExp( "^" + identifier + "$" ),
b@1481 669
b@1481 670 matchExpr = {
b@1481 671 "ID": new RegExp( "^#(" + characterEncoding + ")" ),
b@1481 672 "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
b@1481 673 "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
b@1481 674 "ATTR": new RegExp( "^" + attributes ),
b@1481 675 "PSEUDO": new RegExp( "^" + pseudos ),
b@1481 676 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
b@1481 677 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
b@1481 678 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
b@1481 679 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
b@1481 680 // For use in libraries implementing .is()
b@1481 681 // We use this for POS matching in `select`
b@1481 682 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
b@1481 683 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
b@1481 684 },
b@1481 685
b@1481 686 rinputs = /^(?:input|select|textarea|button)$/i,
b@1481 687 rheader = /^h\d$/i,
b@1481 688
b@1481 689 rnative = /^[^{]+\{\s*\[native \w/,
b@1481 690
b@1481 691 // Easily-parseable/retrievable ID or TAG or CLASS selectors
b@1481 692 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
b@1481 693
b@1481 694 rsibling = /[+~]/,
b@1481 695 rescape = /'|\\/g,
b@1481 696
b@1481 697 // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
b@1481 698 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
b@1481 699 funescape = function( _, escaped, escapedWhitespace ) {
b@1481 700 var high = "0x" + escaped - 0x10000;
b@1481 701 // NaN means non-codepoint
b@1481 702 // Support: Firefox<24
b@1481 703 // Workaround erroneous numeric interpretation of +"0x"
b@1481 704 return high !== high || escapedWhitespace ?
b@1481 705 escaped :
b@1481 706 high < 0 ?
b@1481 707 // BMP codepoint
b@1481 708 String.fromCharCode( high + 0x10000 ) :
b@1481 709 // Supplemental Plane codepoint (surrogate pair)
b@1481 710 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
b@1481 711 },
b@1481 712
b@1481 713 // Used for iframes
b@1481 714 // See setDocument()
b@1481 715 // Removing the function wrapper causes a "Permission Denied"
b@1481 716 // error in IE
b@1481 717 unloadHandler = function() {
b@1481 718 setDocument();
b@1481 719 };
b@1481 720
b@1481 721 // Optimize for push.apply( _, NodeList )
b@1481 722 try {
b@1481 723 push.apply(
b@1481 724 (arr = slice.call( preferredDoc.childNodes )),
b@1481 725 preferredDoc.childNodes
b@1481 726 );
b@1481 727 // Support: Android<4.0
b@1481 728 // Detect silently failing push.apply
b@1481 729 arr[ preferredDoc.childNodes.length ].nodeType;
b@1481 730 } catch ( e ) {
b@1481 731 push = { apply: arr.length ?
b@1481 732
b@1481 733 // Leverage slice if possible
b@1481 734 function( target, els ) {
b@1481 735 push_native.apply( target, slice.call(els) );
b@1481 736 } :
b@1481 737
b@1481 738 // Support: IE<9
b@1481 739 // Otherwise append directly
b@1481 740 function( target, els ) {
b@1481 741 var j = target.length,
b@1481 742 i = 0;
b@1481 743 // Can't trust NodeList.length
b@1481 744 while ( (target[j++] = els[i++]) ) {}
b@1481 745 target.length = j - 1;
b@1481 746 }
b@1481 747 };
b@1481 748 }
b@1481 749
b@1481 750 function Sizzle( selector, context, results, seed ) {
b@1481 751 var match, elem, m, nodeType,
b@1481 752 // QSA vars
b@1481 753 i, groups, old, nid, newContext, newSelector;
b@1481 754
b@1481 755 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
b@1481 756 setDocument( context );
b@1481 757 }
b@1481 758
b@1481 759 context = context || document;
b@1481 760 results = results || [];
b@1481 761 nodeType = context.nodeType;
b@1481 762
b@1481 763 if ( typeof selector !== "string" || !selector ||
b@1481 764 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
b@1481 765
b@1481 766 return results;
b@1481 767 }
b@1481 768
b@1481 769 if ( !seed && documentIsHTML ) {
b@1481 770
b@1481 771 // Try to shortcut find operations when possible (e.g., not under DocumentFragment)
b@1481 772 if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
b@1481 773 // Speed-up: Sizzle("#ID")
b@1481 774 if ( (m = match[1]) ) {
b@1481 775 if ( nodeType === 9 ) {
b@1481 776 elem = context.getElementById( m );
b@1481 777 // Check parentNode to catch when Blackberry 4.6 returns
b@1481 778 // nodes that are no longer in the document (jQuery #6963)
b@1481 779 if ( elem && elem.parentNode ) {
b@1481 780 // Handle the case where IE, Opera, and Webkit return items
b@1481 781 // by name instead of ID
b@1481 782 if ( elem.id === m ) {
b@1481 783 results.push( elem );
b@1481 784 return results;
b@1481 785 }
b@1481 786 } else {
b@1481 787 return results;
b@1481 788 }
b@1481 789 } else {
b@1481 790 // Context is not a document
b@1481 791 if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
b@1481 792 contains( context, elem ) && elem.id === m ) {
b@1481 793 results.push( elem );
b@1481 794 return results;
b@1481 795 }
b@1481 796 }
b@1481 797
b@1481 798 // Speed-up: Sizzle("TAG")
b@1481 799 } else if ( match[2] ) {
b@1481 800 push.apply( results, context.getElementsByTagName( selector ) );
b@1481 801 return results;
b@1481 802
b@1481 803 // Speed-up: Sizzle(".CLASS")
b@1481 804 } else if ( (m = match[3]) && support.getElementsByClassName ) {
b@1481 805 push.apply( results, context.getElementsByClassName( m ) );
b@1481 806 return results;
b@1481 807 }
b@1481 808 }
b@1481 809
b@1481 810 // QSA path
b@1481 811 if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
b@1481 812 nid = old = expando;
b@1481 813 newContext = context;
b@1481 814 newSelector = nodeType !== 1 && selector;
b@1481 815
b@1481 816 // qSA works strangely on Element-rooted queries
b@1481 817 // We can work around this by specifying an extra ID on the root
b@1481 818 // and working up from there (Thanks to Andrew Dupont for the technique)
b@1481 819 // IE 8 doesn't work on object elements
b@1481 820 if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
b@1481 821 groups = tokenize( selector );
b@1481 822
b@1481 823 if ( (old = context.getAttribute("id")) ) {
b@1481 824 nid = old.replace( rescape, "\\$&" );
b@1481 825 } else {
b@1481 826 context.setAttribute( "id", nid );
b@1481 827 }
b@1481 828 nid = "[id='" + nid + "'] ";
b@1481 829
b@1481 830 i = groups.length;
b@1481 831 while ( i-- ) {
b@1481 832 groups[i] = nid + toSelector( groups[i] );
b@1481 833 }
b@1481 834 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context;
b@1481 835 newSelector = groups.join(",");
b@1481 836 }
b@1481 837
b@1481 838 if ( newSelector ) {
b@1481 839 try {
b@1481 840 push.apply( results,
b@1481 841 newContext.querySelectorAll( newSelector )
b@1481 842 );
b@1481 843 return results;
b@1481 844 } catch(qsaError) {
b@1481 845 } finally {
b@1481 846 if ( !old ) {
b@1481 847 context.removeAttribute("id");
b@1481 848 }
b@1481 849 }
b@1481 850 }
b@1481 851 }
b@1481 852 }
b@1481 853
b@1481 854 // All others
b@1481 855 return select( selector.replace( rtrim, "$1" ), context, results, seed );
b@1481 856 }
b@1481 857
b@1481 858 /**
b@1481 859 * Create key-value caches of limited size
b@1481 860 * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
b@1481 861 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
b@1481 862 * deleting the oldest entry
b@1481 863 */
b@1481 864 function createCache() {
b@1481 865 var keys = [];
b@1481 866
b@1481 867 function cache( key, value ) {
b@1481 868 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
b@1481 869 if ( keys.push( key + " " ) > Expr.cacheLength ) {
b@1481 870 // Only keep the most recent entries
b@1481 871 delete cache[ keys.shift() ];
b@1481 872 }
b@1481 873 return (cache[ key + " " ] = value);
b@1481 874 }
b@1481 875 return cache;
b@1481 876 }
b@1481 877
b@1481 878 /**
b@1481 879 * Mark a function for special use by Sizzle
b@1481 880 * @param {Function} fn The function to mark
b@1481 881 */
b@1481 882 function markFunction( fn ) {
b@1481 883 fn[ expando ] = true;
b@1481 884 return fn;
b@1481 885 }
b@1481 886
b@1481 887 /**
b@1481 888 * Support testing using an element
b@1481 889 * @param {Function} fn Passed the created div and expects a boolean result
b@1481 890 */
b@1481 891 function assert( fn ) {
b@1481 892 var div = document.createElement("div");
b@1481 893
b@1481 894 try {
b@1481 895 return !!fn( div );
b@1481 896 } catch (e) {
b@1481 897 return false;
b@1481 898 } finally {
b@1481 899 // Remove from its parent by default
b@1481 900 if ( div.parentNode ) {
b@1481 901 div.parentNode.removeChild( div );
b@1481 902 }
b@1481 903 // release memory in IE
b@1481 904 div = null;
b@1481 905 }
b@1481 906 }
b@1481 907
b@1481 908 /**
b@1481 909 * Adds the same handler for all of the specified attrs
b@1481 910 * @param {String} attrs Pipe-separated list of attributes
b@1481 911 * @param {Function} handler The method that will be applied
b@1481 912 */
b@1481 913 function addHandle( attrs, handler ) {
b@1481 914 var arr = attrs.split("|"),
b@1481 915 i = attrs.length;
b@1481 916
b@1481 917 while ( i-- ) {
b@1481 918 Expr.attrHandle[ arr[i] ] = handler;
b@1481 919 }
b@1481 920 }
b@1481 921
b@1481 922 /**
b@1481 923 * Checks document order of two siblings
b@1481 924 * @param {Element} a
b@1481 925 * @param {Element} b
b@1481 926 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
b@1481 927 */
b@1481 928 function siblingCheck( a, b ) {
b@1481 929 var cur = b && a,
b@1481 930 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
b@1481 931 ( ~b.sourceIndex || MAX_NEGATIVE ) -
b@1481 932 ( ~a.sourceIndex || MAX_NEGATIVE );
b@1481 933
b@1481 934 // Use IE sourceIndex if available on both nodes
b@1481 935 if ( diff ) {
b@1481 936 return diff;
b@1481 937 }
b@1481 938
b@1481 939 // Check if b follows a
b@1481 940 if ( cur ) {
b@1481 941 while ( (cur = cur.nextSibling) ) {
b@1481 942 if ( cur === b ) {
b@1481 943 return -1;
b@1481 944 }
b@1481 945 }
b@1481 946 }
b@1481 947
b@1481 948 return a ? 1 : -1;
b@1481 949 }
b@1481 950
b@1481 951 /**
b@1481 952 * Returns a function to use in pseudos for input types
b@1481 953 * @param {String} type
b@1481 954 */
b@1481 955 function createInputPseudo( type ) {
b@1481 956 return function( elem ) {
b@1481 957 var name = elem.nodeName.toLowerCase();
b@1481 958 return name === "input" && elem.type === type;
b@1481 959 };
b@1481 960 }
b@1481 961
b@1481 962 /**
b@1481 963 * Returns a function to use in pseudos for buttons
b@1481 964 * @param {String} type
b@1481 965 */
b@1481 966 function createButtonPseudo( type ) {
b@1481 967 return function( elem ) {
b@1481 968 var name = elem.nodeName.toLowerCase();
b@1481 969 return (name === "input" || name === "button") && elem.type === type;
b@1481 970 };
b@1481 971 }
b@1481 972
b@1481 973 /**
b@1481 974 * Returns a function to use in pseudos for positionals
b@1481 975 * @param {Function} fn
b@1481 976 */
b@1481 977 function createPositionalPseudo( fn ) {
b@1481 978 return markFunction(function( argument ) {
b@1481 979 argument = +argument;
b@1481 980 return markFunction(function( seed, matches ) {
b@1481 981 var j,
b@1481 982 matchIndexes = fn( [], seed.length, argument ),
b@1481 983 i = matchIndexes.length;
b@1481 984
b@1481 985 // Match elements found at the specified indexes
b@1481 986 while ( i-- ) {
b@1481 987 if ( seed[ (j = matchIndexes[i]) ] ) {
b@1481 988 seed[j] = !(matches[j] = seed[j]);
b@1481 989 }
b@1481 990 }
b@1481 991 });
b@1481 992 });
b@1481 993 }
b@1481 994
b@1481 995 /**
b@1481 996 * Checks a node for validity as a Sizzle context
b@1481 997 * @param {Element|Object=} context
b@1481 998 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
b@1481 999 */
b@1481 1000 function testContext( context ) {
b@1481 1001 return context && typeof context.getElementsByTagName !== "undefined" && context;
b@1481 1002 }
b@1481 1003
b@1481 1004 // Expose support vars for convenience
b@1481 1005 support = Sizzle.support = {};
b@1481 1006
b@1481 1007 /**
b@1481 1008 * Detects XML nodes
b@1481 1009 * @param {Element|Object} elem An element or a document
b@1481 1010 * @returns {Boolean} True iff elem is a non-HTML XML node
b@1481 1011 */
b@1481 1012 isXML = Sizzle.isXML = function( elem ) {
b@1481 1013 // documentElement is verified for cases where it doesn't yet exist
b@1481 1014 // (such as loading iframes in IE - #4833)
b@1481 1015 var documentElement = elem && (elem.ownerDocument || elem).documentElement;
b@1481 1016 return documentElement ? documentElement.nodeName !== "HTML" : false;
b@1481 1017 };
b@1481 1018
b@1481 1019 /**
b@1481 1020 * Sets document-related variables once based on the current document
b@1481 1021 * @param {Element|Object} [doc] An element or document object to use to set the document
b@1481 1022 * @returns {Object} Returns the current document
b@1481 1023 */
b@1481 1024 setDocument = Sizzle.setDocument = function( node ) {
b@1481 1025 var hasCompare, parent,
b@1481 1026 doc = node ? node.ownerDocument || node : preferredDoc;
b@1481 1027
b@1481 1028 // If no document and documentElement is available, return
b@1481 1029 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
b@1481 1030 return document;
b@1481 1031 }
b@1481 1032
b@1481 1033 // Set our document
b@1481 1034 document = doc;
b@1481 1035 docElem = doc.documentElement;
b@1481 1036 parent = doc.defaultView;
b@1481 1037
b@1481 1038 // Support: IE>8
b@1481 1039 // If iframe document is assigned to "document" variable and if iframe has been reloaded,
b@1481 1040 // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
b@1481 1041 // IE6-8 do not support the defaultView property so parent will be undefined
b@1481 1042 if ( parent && parent !== parent.top ) {
b@1481 1043 // IE11 does not have attachEvent, so all must suffer
b@1481 1044 if ( parent.addEventListener ) {
b@1481 1045 parent.addEventListener( "unload", unloadHandler, false );
b@1481 1046 } else if ( parent.attachEvent ) {
b@1481 1047 parent.attachEvent( "onunload", unloadHandler );
b@1481 1048 }
b@1481 1049 }
b@1481 1050
b@1481 1051 /* Support tests
b@1481 1052 ---------------------------------------------------------------------- */
b@1481 1053 documentIsHTML = !isXML( doc );
b@1481 1054
b@1481 1055 /* Attributes
b@1481 1056 ---------------------------------------------------------------------- */
b@1481 1057
b@1481 1058 // Support: IE<8
b@1481 1059 // Verify that getAttribute really returns attributes and not properties
b@1481 1060 // (excepting IE8 booleans)
b@1481 1061 support.attributes = assert(function( div ) {
b@1481 1062 div.className = "i";
b@1481 1063 return !div.getAttribute("className");
b@1481 1064 });
b@1481 1065
b@1481 1066 /* getElement(s)By*
b@1481 1067 ---------------------------------------------------------------------- */
b@1481 1068
b@1481 1069 // Check if getElementsByTagName("*") returns only elements
b@1481 1070 support.getElementsByTagName = assert(function( div ) {
b@1481 1071 div.appendChild( doc.createComment("") );
b@1481 1072 return !div.getElementsByTagName("*").length;
b@1481 1073 });
b@1481 1074
b@1481 1075 // Support: IE<9
b@1481 1076 support.getElementsByClassName = rnative.test( doc.getElementsByClassName );
b@1481 1077
b@1481 1078 // Support: IE<10
b@1481 1079 // Check if getElementById returns elements by name
b@1481 1080 // The broken getElementById methods don't pick up programatically-set names,
b@1481 1081 // so use a roundabout getElementsByName test
b@1481 1082 support.getById = assert(function( div ) {
b@1481 1083 docElem.appendChild( div ).id = expando;
b@1481 1084 return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
b@1481 1085 });
b@1481 1086
b@1481 1087 // ID find and filter
b@1481 1088 if ( support.getById ) {
b@1481 1089 Expr.find["ID"] = function( id, context ) {
b@1481 1090 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
b@1481 1091 var m = context.getElementById( id );
b@1481 1092 // Check parentNode to catch when Blackberry 4.6 returns
b@1481 1093 // nodes that are no longer in the document #6963
b@1481 1094 return m && m.parentNode ? [ m ] : [];
b@1481 1095 }
b@1481 1096 };
b@1481 1097 Expr.filter["ID"] = function( id ) {
b@1481 1098 var attrId = id.replace( runescape, funescape );
b@1481 1099 return function( elem ) {
b@1481 1100 return elem.getAttribute("id") === attrId;
b@1481 1101 };
b@1481 1102 };
b@1481 1103 } else {
b@1481 1104 // Support: IE6/7
b@1481 1105 // getElementById is not reliable as a find shortcut
b@1481 1106 delete Expr.find["ID"];
b@1481 1107
b@1481 1108 Expr.filter["ID"] = function( id ) {
b@1481 1109 var attrId = id.replace( runescape, funescape );
b@1481 1110 return function( elem ) {
b@1481 1111 var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
b@1481 1112 return node && node.value === attrId;
b@1481 1113 };
b@1481 1114 };
b@1481 1115 }
b@1481 1116
b@1481 1117 // Tag
b@1481 1118 Expr.find["TAG"] = support.getElementsByTagName ?
b@1481 1119 function( tag, context ) {
b@1481 1120 if ( typeof context.getElementsByTagName !== "undefined" ) {
b@1481 1121 return context.getElementsByTagName( tag );
b@1481 1122
b@1481 1123 // DocumentFragment nodes don't have gEBTN
b@1481 1124 } else if ( support.qsa ) {
b@1481 1125 return context.querySelectorAll( tag );
b@1481 1126 }
b@1481 1127 } :
b@1481 1128
b@1481 1129 function( tag, context ) {
b@1481 1130 var elem,
b@1481 1131 tmp = [],
b@1481 1132 i = 0,
b@1481 1133 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
b@1481 1134 results = context.getElementsByTagName( tag );
b@1481 1135
b@1481 1136 // Filter out possible comments
b@1481 1137 if ( tag === "*" ) {
b@1481 1138 while ( (elem = results[i++]) ) {
b@1481 1139 if ( elem.nodeType === 1 ) {
b@1481 1140 tmp.push( elem );
b@1481 1141 }
b@1481 1142 }
b@1481 1143
b@1481 1144 return tmp;
b@1481 1145 }
b@1481 1146 return results;
b@1481 1147 };
b@1481 1148
b@1481 1149 // Class
b@1481 1150 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
b@1481 1151 if ( documentIsHTML ) {
b@1481 1152 return context.getElementsByClassName( className );
b@1481 1153 }
b@1481 1154 };
b@1481 1155
b@1481 1156 /* QSA/matchesSelector
b@1481 1157 ---------------------------------------------------------------------- */
b@1481 1158
b@1481 1159 // QSA and matchesSelector support
b@1481 1160
b@1481 1161 // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
b@1481 1162 rbuggyMatches = [];
b@1481 1163
b@1481 1164 // qSa(:focus) reports false when true (Chrome 21)
b@1481 1165 // We allow this because of a bug in IE8/9 that throws an error
b@1481 1166 // whenever `document.activeElement` is accessed on an iframe
b@1481 1167 // So, we allow :focus to pass through QSA all the time to avoid the IE error
b@1481 1168 // See http://bugs.jquery.com/ticket/13378
b@1481 1169 rbuggyQSA = [];
b@1481 1170
b@1481 1171 if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
b@1481 1172 // Build QSA regex
b@1481 1173 // Regex strategy adopted from Diego Perini
b@1481 1174 assert(function( div ) {
b@1481 1175 // Select is set to empty string on purpose
b@1481 1176 // This is to test IE's treatment of not explicitly
b@1481 1177 // setting a boolean content attribute,
b@1481 1178 // since its presence should be enough
b@1481 1179 // http://bugs.jquery.com/ticket/12359
b@1481 1180 docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" +
b@1481 1181 "<select id='" + expando + "-\f]' msallowcapture=''>" +
b@1481 1182 "<option selected=''></option></select>";
b@1481 1183
b@1481 1184 // Support: IE8, Opera 11-12.16
b@1481 1185 // Nothing should be selected when empty strings follow ^= or $= or *=
b@1481 1186 // The test attribute must be unknown in Opera but "safe" for WinRT
b@1481 1187 // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
b@1481 1188 if ( div.querySelectorAll("[msallowcapture^='']").length ) {
b@1481 1189 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
b@1481 1190 }
b@1481 1191
b@1481 1192 // Support: IE8
b@1481 1193 // Boolean attributes and "value" are not treated correctly
b@1481 1194 if ( !div.querySelectorAll("[selected]").length ) {
b@1481 1195 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
b@1481 1196 }
b@1481 1197
b@1481 1198 // Support: Chrome<29, Android<4.2+, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.7+
b@1481 1199 if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
b@1481 1200 rbuggyQSA.push("~=");
b@1481 1201 }
b@1481 1202
b@1481 1203 // Webkit/Opera - :checked should return selected option elements
b@1481 1204 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
b@1481 1205 // IE8 throws error here and will not see later tests
b@1481 1206 if ( !div.querySelectorAll(":checked").length ) {
b@1481 1207 rbuggyQSA.push(":checked");
b@1481 1208 }
b@1481 1209
b@1481 1210 // Support: Safari 8+, iOS 8+
b@1481 1211 // https://bugs.webkit.org/show_bug.cgi?id=136851
b@1481 1212 // In-page `selector#id sibing-combinator selector` fails
b@1481 1213 if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) {
b@1481 1214 rbuggyQSA.push(".#.+[+~]");
b@1481 1215 }
b@1481 1216 });
b@1481 1217
b@1481 1218 assert(function( div ) {
b@1481 1219 // Support: Windows 8 Native Apps
b@1481 1220 // The type and name attributes are restricted during .innerHTML assignment
b@1481 1221 var input = doc.createElement("input");
b@1481 1222 input.setAttribute( "type", "hidden" );
b@1481 1223 div.appendChild( input ).setAttribute( "name", "D" );
b@1481 1224
b@1481 1225 // Support: IE8
b@1481 1226 // Enforce case-sensitivity of name attribute
b@1481 1227 if ( div.querySelectorAll("[name=d]").length ) {
b@1481 1228 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
b@1481 1229 }
b@1481 1230
b@1481 1231 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
b@1481 1232 // IE8 throws error here and will not see later tests
b@1481 1233 if ( !div.querySelectorAll(":enabled").length ) {
b@1481 1234 rbuggyQSA.push( ":enabled", ":disabled" );
b@1481 1235 }
b@1481 1236
b@1481 1237 // Opera 10-11 does not throw on post-comma invalid pseudos
b@1481 1238 div.querySelectorAll("*,:x");
b@1481 1239 rbuggyQSA.push(",.*:");
b@1481 1240 });
b@1481 1241 }
b@1481 1242
b@1481 1243 if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
b@1481 1244 docElem.webkitMatchesSelector ||
b@1481 1245 docElem.mozMatchesSelector ||
b@1481 1246 docElem.oMatchesSelector ||
b@1481 1247 docElem.msMatchesSelector) )) ) {
b@1481 1248
b@1481 1249 assert(function( div ) {
b@1481 1250 // Check to see if it's possible to do matchesSelector
b@1481 1251 // on a disconnected node (IE 9)
b@1481 1252 support.disconnectedMatch = matches.call( div, "div" );
b@1481 1253
b@1481 1254 // This should fail with an exception
b@1481 1255 // Gecko does not error, returns false instead
b@1481 1256 matches.call( div, "[s!='']:x" );
b@1481 1257 rbuggyMatches.push( "!=", pseudos );
b@1481 1258 });
b@1481 1259 }
b@1481 1260
b@1481 1261 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
b@1481 1262 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
b@1481 1263
b@1481 1264 /* Contains
b@1481 1265 ---------------------------------------------------------------------- */
b@1481 1266 hasCompare = rnative.test( docElem.compareDocumentPosition );
b@1481 1267
b@1481 1268 // Element contains another
b@1481 1269 // Purposefully does not implement inclusive descendent
b@1481 1270 // As in, an element does not contain itself
b@1481 1271 contains = hasCompare || rnative.test( docElem.contains ) ?
b@1481 1272 function( a, b ) {
b@1481 1273 var adown = a.nodeType === 9 ? a.documentElement : a,
b@1481 1274 bup = b && b.parentNode;
b@1481 1275 return a === bup || !!( bup && bup.nodeType === 1 && (
b@1481 1276 adown.contains ?
b@1481 1277 adown.contains( bup ) :
b@1481 1278 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
b@1481 1279 ));
b@1481 1280 } :
b@1481 1281 function( a, b ) {
b@1481 1282 if ( b ) {
b@1481 1283 while ( (b = b.parentNode) ) {
b@1481 1284 if ( b === a ) {
b@1481 1285 return true;
b@1481 1286 }
b@1481 1287 }
b@1481 1288 }
b@1481 1289 return false;
b@1481 1290 };
b@1481 1291
b@1481 1292 /* Sorting
b@1481 1293 ---------------------------------------------------------------------- */
b@1481 1294
b@1481 1295 // Document order sorting
b@1481 1296 sortOrder = hasCompare ?
b@1481 1297 function( a, b ) {
b@1481 1298
b@1481 1299 // Flag for duplicate removal
b@1481 1300 if ( a === b ) {
b@1481 1301 hasDuplicate = true;
b@1481 1302 return 0;
b@1481 1303 }
b@1481 1304
b@1481 1305 // Sort on method existence if only one input has compareDocumentPosition
b@1481 1306 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
b@1481 1307 if ( compare ) {
b@1481 1308 return compare;
b@1481 1309 }
b@1481 1310
b@1481 1311 // Calculate position if both inputs belong to the same document
b@1481 1312 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
b@1481 1313 a.compareDocumentPosition( b ) :
b@1481 1314
b@1481 1315 // Otherwise we know they are disconnected
b@1481 1316 1;
b@1481 1317
b@1481 1318 // Disconnected nodes
b@1481 1319 if ( compare & 1 ||
b@1481 1320 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
b@1481 1321
b@1481 1322 // Choose the first element that is related to our preferred document
b@1481 1323 if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
b@1481 1324 return -1;
b@1481 1325 }
b@1481 1326 if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
b@1481 1327 return 1;
b@1481 1328 }
b@1481 1329
b@1481 1330 // Maintain original order
b@1481 1331 return sortInput ?
b@1481 1332 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
b@1481 1333 0;
b@1481 1334 }
b@1481 1335
b@1481 1336 return compare & 4 ? -1 : 1;
b@1481 1337 } :
b@1481 1338 function( a, b ) {
b@1481 1339 // Exit early if the nodes are identical
b@1481 1340 if ( a === b ) {
b@1481 1341 hasDuplicate = true;
b@1481 1342 return 0;
b@1481 1343 }
b@1481 1344
b@1481 1345 var cur,
b@1481 1346 i = 0,
b@1481 1347 aup = a.parentNode,
b@1481 1348 bup = b.parentNode,
b@1481 1349 ap = [ a ],
b@1481 1350 bp = [ b ];
b@1481 1351
b@1481 1352 // Parentless nodes are either documents or disconnected
b@1481 1353 if ( !aup || !bup ) {
b@1481 1354 return a === doc ? -1 :
b@1481 1355 b === doc ? 1 :
b@1481 1356 aup ? -1 :
b@1481 1357 bup ? 1 :
b@1481 1358 sortInput ?
b@1481 1359 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
b@1481 1360 0;
b@1481 1361
b@1481 1362 // If the nodes are siblings, we can do a quick check
b@1481 1363 } else if ( aup === bup ) {
b@1481 1364 return siblingCheck( a, b );
b@1481 1365 }
b@1481 1366
b@1481 1367 // Otherwise we need full lists of their ancestors for comparison
b@1481 1368 cur = a;
b@1481 1369 while ( (cur = cur.parentNode) ) {
b@1481 1370 ap.unshift( cur );
b@1481 1371 }
b@1481 1372 cur = b;
b@1481 1373 while ( (cur = cur.parentNode) ) {
b@1481 1374 bp.unshift( cur );
b@1481 1375 }
b@1481 1376
b@1481 1377 // Walk down the tree looking for a discrepancy
b@1481 1378 while ( ap[i] === bp[i] ) {
b@1481 1379 i++;
b@1481 1380 }
b@1481 1381
b@1481 1382 return i ?
b@1481 1383 // Do a sibling check if the nodes have a common ancestor
b@1481 1384 siblingCheck( ap[i], bp[i] ) :
b@1481 1385
b@1481 1386 // Otherwise nodes in our document sort first
b@1481 1387 ap[i] === preferredDoc ? -1 :
b@1481 1388 bp[i] === preferredDoc ? 1 :
b@1481 1389 0;
b@1481 1390 };
b@1481 1391
b@1481 1392 return doc;
b@1481 1393 };
b@1481 1394
b@1481 1395 Sizzle.matches = function( expr, elements ) {
b@1481 1396 return Sizzle( expr, null, null, elements );
b@1481 1397 };
b@1481 1398
b@1481 1399 Sizzle.matchesSelector = function( elem, expr ) {
b@1481 1400 // Set document vars if needed
b@1481 1401 if ( ( elem.ownerDocument || elem ) !== document ) {
b@1481 1402 setDocument( elem );
b@1481 1403 }
b@1481 1404
b@1481 1405 // Make sure that attribute selectors are quoted
b@1481 1406 expr = expr.replace( rattributeQuotes, "='$1']" );
b@1481 1407
b@1481 1408 if ( support.matchesSelector && documentIsHTML &&
b@1481 1409 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
b@1481 1410 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
b@1481 1411
b@1481 1412 try {
b@1481 1413 var ret = matches.call( elem, expr );
b@1481 1414
b@1481 1415 // IE 9's matchesSelector returns false on disconnected nodes
b@1481 1416 if ( ret || support.disconnectedMatch ||
b@1481 1417 // As well, disconnected nodes are said to be in a document
b@1481 1418 // fragment in IE 9
b@1481 1419 elem.document && elem.document.nodeType !== 11 ) {
b@1481 1420 return ret;
b@1481 1421 }
b@1481 1422 } catch (e) {}
b@1481 1423 }
b@1481 1424
b@1481 1425 return Sizzle( expr, document, null, [ elem ] ).length > 0;
b@1481 1426 };
b@1481 1427
b@1481 1428 Sizzle.contains = function( context, elem ) {
b@1481 1429 // Set document vars if needed
b@1481 1430 if ( ( context.ownerDocument || context ) !== document ) {
b@1481 1431 setDocument( context );
b@1481 1432 }
b@1481 1433 return contains( context, elem );
b@1481 1434 };
b@1481 1435
b@1481 1436 Sizzle.attr = function( elem, name ) {
b@1481 1437 // Set document vars if needed
b@1481 1438 if ( ( elem.ownerDocument || elem ) !== document ) {
b@1481 1439 setDocument( elem );
b@1481 1440 }
b@1481 1441
b@1481 1442 var fn = Expr.attrHandle[ name.toLowerCase() ],
b@1481 1443 // Don't get fooled by Object.prototype properties (jQuery #13807)
b@1481 1444 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
b@1481 1445 fn( elem, name, !documentIsHTML ) :
b@1481 1446 undefined;
b@1481 1447
b@1481 1448 return val !== undefined ?
b@1481 1449 val :
b@1481 1450 support.attributes || !documentIsHTML ?
b@1481 1451 elem.getAttribute( name ) :
b@1481 1452 (val = elem.getAttributeNode(name)) && val.specified ?
b@1481 1453 val.value :
b@1481 1454 null;
b@1481 1455 };
b@1481 1456
b@1481 1457 Sizzle.error = function( msg ) {
b@1481 1458 throw new Error( "Syntax error, unrecognized expression: " + msg );
b@1481 1459 };
b@1481 1460
b@1481 1461 /**
b@1481 1462 * Document sorting and removing duplicates
b@1481 1463 * @param {ArrayLike} results
b@1481 1464 */
b@1481 1465 Sizzle.uniqueSort = function( results ) {
b@1481 1466 var elem,
b@1481 1467 duplicates = [],
b@1481 1468 j = 0,
b@1481 1469 i = 0;
b@1481 1470
b@1481 1471 // Unless we *know* we can detect duplicates, assume their presence
b@1481 1472 hasDuplicate = !support.detectDuplicates;
b@1481 1473 sortInput = !support.sortStable && results.slice( 0 );
b@1481 1474 results.sort( sortOrder );
b@1481 1475
b@1481 1476 if ( hasDuplicate ) {
b@1481 1477 while ( (elem = results[i++]) ) {
b@1481 1478 if ( elem === results[ i ] ) {
b@1481 1479 j = duplicates.push( i );
b@1481 1480 }
b@1481 1481 }
b@1481 1482 while ( j-- ) {
b@1481 1483 results.splice( duplicates[ j ], 1 );
b@1481 1484 }
b@1481 1485 }
b@1481 1486
b@1481 1487 // Clear input after sorting to release objects
b@1481 1488 // See https://github.com/jquery/sizzle/pull/225
b@1481 1489 sortInput = null;
b@1481 1490
b@1481 1491 return results;
b@1481 1492 };
b@1481 1493
b@1481 1494 /**
b@1481 1495 * Utility function for retrieving the text value of an array of DOM nodes
b@1481 1496 * @param {Array|Element} elem
b@1481 1497 */
b@1481 1498 getText = Sizzle.getText = function( elem ) {
b@1481 1499 var node,
b@1481 1500 ret = "",
b@1481 1501 i = 0,
b@1481 1502 nodeType = elem.nodeType;
b@1481 1503
b@1481 1504 if ( !nodeType ) {
b@1481 1505 // If no nodeType, this is expected to be an array
b@1481 1506 while ( (node = elem[i++]) ) {
b@1481 1507 // Do not traverse comment nodes
b@1481 1508 ret += getText( node );
b@1481 1509 }
b@1481 1510 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
b@1481 1511 // Use textContent for elements
b@1481 1512 // innerText usage removed for consistency of new lines (jQuery #11153)
b@1481 1513 if ( typeof elem.textContent === "string" ) {
b@1481 1514 return elem.textContent;
b@1481 1515 } else {
b@1481 1516 // Traverse its children
b@1481 1517 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
b@1481 1518 ret += getText( elem );
b@1481 1519 }
b@1481 1520 }
b@1481 1521 } else if ( nodeType === 3 || nodeType === 4 ) {
b@1481 1522 return elem.nodeValue;
b@1481 1523 }
b@1481 1524 // Do not include comment or processing instruction nodes
b@1481 1525
b@1481 1526 return ret;
b@1481 1527 };
b@1481 1528
b@1481 1529 Expr = Sizzle.selectors = {
b@1481 1530
b@1481 1531 // Can be adjusted by the user
b@1481 1532 cacheLength: 50,
b@1481 1533
b@1481 1534 createPseudo: markFunction,
b@1481 1535
b@1481 1536 match: matchExpr,
b@1481 1537
b@1481 1538 attrHandle: {},
b@1481 1539
b@1481 1540 find: {},
b@1481 1541
b@1481 1542 relative: {
b@1481 1543 ">": { dir: "parentNode", first: true },
b@1481 1544 " ": { dir: "parentNode" },
b@1481 1545 "+": { dir: "previousSibling", first: true },
b@1481 1546 "~": { dir: "previousSibling" }
b@1481 1547 },
b@1481 1548
b@1481 1549 preFilter: {
b@1481 1550 "ATTR": function( match ) {
b@1481 1551 match[1] = match[1].replace( runescape, funescape );
b@1481 1552
b@1481 1553 // Move the given value to match[3] whether quoted or unquoted
b@1481 1554 match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
b@1481 1555
b@1481 1556 if ( match[2] === "~=" ) {
b@1481 1557 match[3] = " " + match[3] + " ";
b@1481 1558 }
b@1481 1559
b@1481 1560 return match.slice( 0, 4 );
b@1481 1561 },
b@1481 1562
b@1481 1563 "CHILD": function( match ) {
b@1481 1564 /* matches from matchExpr["CHILD"]
b@1481 1565 1 type (only|nth|...)
b@1481 1566 2 what (child|of-type)
b@1481 1567 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
b@1481 1568 4 xn-component of xn+y argument ([+-]?\d*n|)
b@1481 1569 5 sign of xn-component
b@1481 1570 6 x of xn-component
b@1481 1571 7 sign of y-component
b@1481 1572 8 y of y-component
b@1481 1573 */
b@1481 1574 match[1] = match[1].toLowerCase();
b@1481 1575
b@1481 1576 if ( match[1].slice( 0, 3 ) === "nth" ) {
b@1481 1577 // nth-* requires argument
b@1481 1578 if ( !match[3] ) {
b@1481 1579 Sizzle.error( match[0] );
b@1481 1580 }
b@1481 1581
b@1481 1582 // numeric x and y parameters for Expr.filter.CHILD
b@1481 1583 // remember that false/true cast respectively to 0/1
b@1481 1584 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
b@1481 1585 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
b@1481 1586
b@1481 1587 // other types prohibit arguments
b@1481 1588 } else if ( match[3] ) {
b@1481 1589 Sizzle.error( match[0] );
b@1481 1590 }
b@1481 1591
b@1481 1592 return match;
b@1481 1593 },
b@1481 1594
b@1481 1595 "PSEUDO": function( match ) {
b@1481 1596 var excess,
b@1481 1597 unquoted = !match[6] && match[2];
b@1481 1598
b@1481 1599 if ( matchExpr["CHILD"].test( match[0] ) ) {
b@1481 1600 return null;
b@1481 1601 }
b@1481 1602
b@1481 1603 // Accept quoted arguments as-is
b@1481 1604 if ( match[3] ) {
b@1481 1605 match[2] = match[4] || match[5] || "";
b@1481 1606
b@1481 1607 // Strip excess characters from unquoted arguments
b@1481 1608 } else if ( unquoted && rpseudo.test( unquoted ) &&
b@1481 1609 // Get excess from tokenize (recursively)
b@1481 1610 (excess = tokenize( unquoted, true )) &&
b@1481 1611 // advance to the next closing parenthesis
b@1481 1612 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
b@1481 1613
b@1481 1614 // excess is a negative index
b@1481 1615 match[0] = match[0].slice( 0, excess );
b@1481 1616 match[2] = unquoted.slice( 0, excess );
b@1481 1617 }
b@1481 1618
b@1481 1619 // Return only captures needed by the pseudo filter method (type and argument)
b@1481 1620 return match.slice( 0, 3 );
b@1481 1621 }
b@1481 1622 },
b@1481 1623
b@1481 1624 filter: {
b@1481 1625
b@1481 1626 "TAG": function( nodeNameSelector ) {
b@1481 1627 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
b@1481 1628 return nodeNameSelector === "*" ?
b@1481 1629 function() { return true; } :
b@1481 1630 function( elem ) {
b@1481 1631 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
b@1481 1632 };
b@1481 1633 },
b@1481 1634
b@1481 1635 "CLASS": function( className ) {
b@1481 1636 var pattern = classCache[ className + " " ];
b@1481 1637
b@1481 1638 return pattern ||
b@1481 1639 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
b@1481 1640 classCache( className, function( elem ) {
b@1481 1641 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
b@1481 1642 });
b@1481 1643 },
b@1481 1644
b@1481 1645 "ATTR": function( name, operator, check ) {
b@1481 1646 return function( elem ) {
b@1481 1647 var result = Sizzle.attr( elem, name );
b@1481 1648
b@1481 1649 if ( result == null ) {
b@1481 1650 return operator === "!=";
b@1481 1651 }
b@1481 1652 if ( !operator ) {
b@1481 1653 return true;
b@1481 1654 }
b@1481 1655
b@1481 1656 result += "";
b@1481 1657
b@1481 1658 return operator === "=" ? result === check :
b@1481 1659 operator === "!=" ? result !== check :
b@1481 1660 operator === "^=" ? check && result.indexOf( check ) === 0 :
b@1481 1661 operator === "*=" ? check && result.indexOf( check ) > -1 :
b@1481 1662 operator === "$=" ? check && result.slice( -check.length ) === check :
b@1481 1663 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
b@1481 1664 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
b@1481 1665 false;
b@1481 1666 };
b@1481 1667 },
b@1481 1668
b@1481 1669 "CHILD": function( type, what, argument, first, last ) {
b@1481 1670 var simple = type.slice( 0, 3 ) !== "nth",
b@1481 1671 forward = type.slice( -4 ) !== "last",
b@1481 1672 ofType = what === "of-type";
b@1481 1673
b@1481 1674 return first === 1 && last === 0 ?
b@1481 1675
b@1481 1676 // Shortcut for :nth-*(n)
b@1481 1677 function( elem ) {
b@1481 1678 return !!elem.parentNode;
b@1481 1679 } :
b@1481 1680
b@1481 1681 function( elem, context, xml ) {
b@1481 1682 var cache, outerCache, node, diff, nodeIndex, start,
b@1481 1683 dir = simple !== forward ? "nextSibling" : "previousSibling",
b@1481 1684 parent = elem.parentNode,
b@1481 1685 name = ofType && elem.nodeName.toLowerCase(),
b@1481 1686 useCache = !xml && !ofType;
b@1481 1687
b@1481 1688 if ( parent ) {
b@1481 1689
b@1481 1690 // :(first|last|only)-(child|of-type)
b@1481 1691 if ( simple ) {
b@1481 1692 while ( dir ) {
b@1481 1693 node = elem;
b@1481 1694 while ( (node = node[ dir ]) ) {
b@1481 1695 if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
b@1481 1696 return false;
b@1481 1697 }
b@1481 1698 }
b@1481 1699 // Reverse direction for :only-* (if we haven't yet done so)
b@1481 1700 start = dir = type === "only" && !start && "nextSibling";
b@1481 1701 }
b@1481 1702 return true;
b@1481 1703 }
b@1481 1704
b@1481 1705 start = [ forward ? parent.firstChild : parent.lastChild ];
b@1481 1706
b@1481 1707 // non-xml :nth-child(...) stores cache data on `parent`
b@1481 1708 if ( forward && useCache ) {
b@1481 1709 // Seek `elem` from a previously-cached index
b@1481 1710 outerCache = parent[ expando ] || (parent[ expando ] = {});
b@1481 1711 cache = outerCache[ type ] || [];
b@1481 1712 nodeIndex = cache[0] === dirruns && cache[1];
b@1481 1713 diff = cache[0] === dirruns && cache[2];
b@1481 1714 node = nodeIndex && parent.childNodes[ nodeIndex ];
b@1481 1715
b@1481 1716 while ( (node = ++nodeIndex && node && node[ dir ] ||
b@1481 1717
b@1481 1718 // Fallback to seeking `elem` from the start
b@1481 1719 (diff = nodeIndex = 0) || start.pop()) ) {
b@1481 1720
b@1481 1721 // When found, cache indexes on `parent` and break
b@1481 1722 if ( node.nodeType === 1 && ++diff && node === elem ) {
b@1481 1723 outerCache[ type ] = [ dirruns, nodeIndex, diff ];
b@1481 1724 break;
b@1481 1725 }
b@1481 1726 }
b@1481 1727
b@1481 1728 // Use previously-cached element index if available
b@1481 1729 } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
b@1481 1730 diff = cache[1];
b@1481 1731
b@1481 1732 // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
b@1481 1733 } else {
b@1481 1734 // Use the same loop as above to seek `elem` from the start
b@1481 1735 while ( (node = ++nodeIndex && node && node[ dir ] ||
b@1481 1736 (diff = nodeIndex = 0) || start.pop()) ) {
b@1481 1737
b@1481 1738 if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
b@1481 1739 // Cache the index of each encountered element
b@1481 1740 if ( useCache ) {
b@1481 1741 (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
b@1481 1742 }
b@1481 1743
b@1481 1744 if ( node === elem ) {
b@1481 1745 break;
b@1481 1746 }
b@1481 1747 }
b@1481 1748 }
b@1481 1749 }
b@1481 1750
b@1481 1751 // Incorporate the offset, then check against cycle size
b@1481 1752 diff -= last;
b@1481 1753 return diff === first || ( diff % first === 0 && diff / first >= 0 );
b@1481 1754 }
b@1481 1755 };
b@1481 1756 },
b@1481 1757
b@1481 1758 "PSEUDO": function( pseudo, argument ) {
b@1481 1759 // pseudo-class names are case-insensitive
b@1481 1760 // http://www.w3.org/TR/selectors/#pseudo-classes
b@1481 1761 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
b@1481 1762 // Remember that setFilters inherits from pseudos
b@1481 1763 var args,
b@1481 1764 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
b@1481 1765 Sizzle.error( "unsupported pseudo: " + pseudo );
b@1481 1766
b@1481 1767 // The user may use createPseudo to indicate that
b@1481 1768 // arguments are needed to create the filter function
b@1481 1769 // just as Sizzle does
b@1481 1770 if ( fn[ expando ] ) {
b@1481 1771 return fn( argument );
b@1481 1772 }
b@1481 1773
b@1481 1774 // But maintain support for old signatures
b@1481 1775 if ( fn.length > 1 ) {
b@1481 1776 args = [ pseudo, pseudo, "", argument ];
b@1481 1777 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
b@1481 1778 markFunction(function( seed, matches ) {
b@1481 1779 var idx,
b@1481 1780 matched = fn( seed, argument ),
b@1481 1781 i = matched.length;
b@1481 1782 while ( i-- ) {
b@1481 1783 idx = indexOf( seed, matched[i] );
b@1481 1784 seed[ idx ] = !( matches[ idx ] = matched[i] );
b@1481 1785 }
b@1481 1786 }) :
b@1481 1787 function( elem ) {
b@1481 1788 return fn( elem, 0, args );
b@1481 1789 };
b@1481 1790 }
b@1481 1791
b@1481 1792 return fn;
b@1481 1793 }
b@1481 1794 },
b@1481 1795
b@1481 1796 pseudos: {
b@1481 1797 // Potentially complex pseudos
b@1481 1798 "not": markFunction(function( selector ) {
b@1481 1799 // Trim the selector passed to compile
b@1481 1800 // to avoid treating leading and trailing
b@1481 1801 // spaces as combinators
b@1481 1802 var input = [],
b@1481 1803 results = [],
b@1481 1804 matcher = compile( selector.replace( rtrim, "$1" ) );
b@1481 1805
b@1481 1806 return matcher[ expando ] ?
b@1481 1807 markFunction(function( seed, matches, context, xml ) {
b@1481 1808 var elem,
b@1481 1809 unmatched = matcher( seed, null, xml, [] ),
b@1481 1810 i = seed.length;
b@1481 1811
b@1481 1812 // Match elements unmatched by `matcher`
b@1481 1813 while ( i-- ) {
b@1481 1814 if ( (elem = unmatched[i]) ) {
b@1481 1815 seed[i] = !(matches[i] = elem);
b@1481 1816 }
b@1481 1817 }
b@1481 1818 }) :
b@1481 1819 function( elem, context, xml ) {
b@1481 1820 input[0] = elem;
b@1481 1821 matcher( input, null, xml, results );
b@1481 1822 // Don't keep the element (issue #299)
b@1481 1823 input[0] = null;
b@1481 1824 return !results.pop();
b@1481 1825 };
b@1481 1826 }),
b@1481 1827
b@1481 1828 "has": markFunction(function( selector ) {
b@1481 1829 return function( elem ) {
b@1481 1830 return Sizzle( selector, elem ).length > 0;
b@1481 1831 };
b@1481 1832 }),
b@1481 1833
b@1481 1834 "contains": markFunction(function( text ) {
b@1481 1835 text = text.replace( runescape, funescape );
b@1481 1836 return function( elem ) {
b@1481 1837 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
b@1481 1838 };
b@1481 1839 }),
b@1481 1840
b@1481 1841 // "Whether an element is represented by a :lang() selector
b@1481 1842 // is based solely on the element's language value
b@1481 1843 // being equal to the identifier C,
b@1481 1844 // or beginning with the identifier C immediately followed by "-".
b@1481 1845 // The matching of C against the element's language value is performed case-insensitively.
b@1481 1846 // The identifier C does not have to be a valid language name."
b@1481 1847 // http://www.w3.org/TR/selectors/#lang-pseudo
b@1481 1848 "lang": markFunction( function( lang ) {
b@1481 1849 // lang value must be a valid identifier
b@1481 1850 if ( !ridentifier.test(lang || "") ) {
b@1481 1851 Sizzle.error( "unsupported lang: " + lang );
b@1481 1852 }
b@1481 1853 lang = lang.replace( runescape, funescape ).toLowerCase();
b@1481 1854 return function( elem ) {
b@1481 1855 var elemLang;
b@1481 1856 do {
b@1481 1857 if ( (elemLang = documentIsHTML ?
b@1481 1858 elem.lang :
b@1481 1859 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
b@1481 1860
b@1481 1861 elemLang = elemLang.toLowerCase();
b@1481 1862 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
b@1481 1863 }
b@1481 1864 } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
b@1481 1865 return false;
b@1481 1866 };
b@1481 1867 }),
b@1481 1868
b@1481 1869 // Miscellaneous
b@1481 1870 "target": function( elem ) {
b@1481 1871 var hash = window.location && window.location.hash;
b@1481 1872 return hash && hash.slice( 1 ) === elem.id;
b@1481 1873 },
b@1481 1874
b@1481 1875 "root": function( elem ) {
b@1481 1876 return elem === docElem;
b@1481 1877 },
b@1481 1878
b@1481 1879 "focus": function( elem ) {
b@1481 1880 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
b@1481 1881 },
b@1481 1882
b@1481 1883 // Boolean properties
b@1481 1884 "enabled": function( elem ) {
b@1481 1885 return elem.disabled === false;
b@1481 1886 },
b@1481 1887
b@1481 1888 "disabled": function( elem ) {
b@1481 1889 return elem.disabled === true;
b@1481 1890 },
b@1481 1891
b@1481 1892 "checked": function( elem ) {
b@1481 1893 // In CSS3, :checked should return both checked and selected elements
b@1481 1894 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
b@1481 1895 var nodeName = elem.nodeName.toLowerCase();
b@1481 1896 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
b@1481 1897 },
b@1481 1898
b@1481 1899 "selected": function( elem ) {
b@1481 1900 // Accessing this property makes selected-by-default
b@1481 1901 // options in Safari work properly
b@1481 1902 if ( elem.parentNode ) {
b@1481 1903 elem.parentNode.selectedIndex;
b@1481 1904 }
b@1481 1905
b@1481 1906 return elem.selected === true;
b@1481 1907 },
b@1481 1908
b@1481 1909 // Contents
b@1481 1910 "empty": function( elem ) {
b@1481 1911 // http://www.w3.org/TR/selectors/#empty-pseudo
b@1481 1912 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
b@1481 1913 // but not by others (comment: 8; processing instruction: 7; etc.)
b@1481 1914 // nodeType < 6 works because attributes (2) do not appear as children
b@1481 1915 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
b@1481 1916 if ( elem.nodeType < 6 ) {
b@1481 1917 return false;
b@1481 1918 }
b@1481 1919 }
b@1481 1920 return true;
b@1481 1921 },
b@1481 1922
b@1481 1923 "parent": function( elem ) {
b@1481 1924 return !Expr.pseudos["empty"]( elem );
b@1481 1925 },
b@1481 1926
b@1481 1927 // Element/input types
b@1481 1928 "header": function( elem ) {
b@1481 1929 return rheader.test( elem.nodeName );
b@1481 1930 },
b@1481 1931
b@1481 1932 "input": function( elem ) {
b@1481 1933 return rinputs.test( elem.nodeName );
b@1481 1934 },
b@1481 1935
b@1481 1936 "button": function( elem ) {
b@1481 1937 var name = elem.nodeName.toLowerCase();
b@1481 1938 return name === "input" && elem.type === "button" || name === "button";
b@1481 1939 },
b@1481 1940
b@1481 1941 "text": function( elem ) {
b@1481 1942 var attr;
b@1481 1943 return elem.nodeName.toLowerCase() === "input" &&
b@1481 1944 elem.type === "text" &&
b@1481 1945
b@1481 1946 // Support: IE<8
b@1481 1947 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
b@1481 1948 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
b@1481 1949 },
b@1481 1950
b@1481 1951 // Position-in-collection
b@1481 1952 "first": createPositionalPseudo(function() {
b@1481 1953 return [ 0 ];
b@1481 1954 }),
b@1481 1955
b@1481 1956 "last": createPositionalPseudo(function( matchIndexes, length ) {
b@1481 1957 return [ length - 1 ];
b@1481 1958 }),
b@1481 1959
b@1481 1960 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
b@1481 1961 return [ argument < 0 ? argument + length : argument ];
b@1481 1962 }),
b@1481 1963
b@1481 1964 "even": createPositionalPseudo(function( matchIndexes, length ) {
b@1481 1965 var i = 0;
b@1481 1966 for ( ; i < length; i += 2 ) {
b@1481 1967 matchIndexes.push( i );
b@1481 1968 }
b@1481 1969 return matchIndexes;
b@1481 1970 }),
b@1481 1971
b@1481 1972 "odd": createPositionalPseudo(function( matchIndexes, length ) {
b@1481 1973 var i = 1;
b@1481 1974 for ( ; i < length; i += 2 ) {
b@1481 1975 matchIndexes.push( i );
b@1481 1976 }
b@1481 1977 return matchIndexes;
b@1481 1978 }),
b@1481 1979
b@1481 1980 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
b@1481 1981 var i = argument < 0 ? argument + length : argument;
b@1481 1982 for ( ; --i >= 0; ) {
b@1481 1983 matchIndexes.push( i );
b@1481 1984 }
b@1481 1985 return matchIndexes;
b@1481 1986 }),
b@1481 1987
b@1481 1988 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
b@1481 1989 var i = argument < 0 ? argument + length : argument;
b@1481 1990 for ( ; ++i < length; ) {
b@1481 1991 matchIndexes.push( i );
b@1481 1992 }
b@1481 1993 return matchIndexes;
b@1481 1994 })
b@1481 1995 }
b@1481 1996 };
b@1481 1997
b@1481 1998 Expr.pseudos["nth"] = Expr.pseudos["eq"];
b@1481 1999
b@1481 2000 // Add button/input type pseudos
b@1481 2001 for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
b@1481 2002 Expr.pseudos[ i ] = createInputPseudo( i );
b@1481 2003 }
b@1481 2004 for ( i in { submit: true, reset: true } ) {
b@1481 2005 Expr.pseudos[ i ] = createButtonPseudo( i );
b@1481 2006 }
b@1481 2007
b@1481 2008 // Easy API for creating new setFilters
b@1481 2009 function setFilters() {}
b@1481 2010 setFilters.prototype = Expr.filters = Expr.pseudos;
b@1481 2011 Expr.setFilters = new setFilters();
b@1481 2012
b@1481 2013 tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
b@1481 2014 var matched, match, tokens, type,
b@1481 2015 soFar, groups, preFilters,
b@1481 2016 cached = tokenCache[ selector + " " ];
b@1481 2017
b@1481 2018 if ( cached ) {
b@1481 2019 return parseOnly ? 0 : cached.slice( 0 );
b@1481 2020 }
b@1481 2021
b@1481 2022 soFar = selector;
b@1481 2023 groups = [];
b@1481 2024 preFilters = Expr.preFilter;
b@1481 2025
b@1481 2026 while ( soFar ) {
b@1481 2027
b@1481 2028 // Comma and first run
b@1481 2029 if ( !matched || (match = rcomma.exec( soFar )) ) {
b@1481 2030 if ( match ) {
b@1481 2031 // Don't consume trailing commas as valid
b@1481 2032 soFar = soFar.slice( match[0].length ) || soFar;
b@1481 2033 }
b@1481 2034 groups.push( (tokens = []) );
b@1481 2035 }
b@1481 2036
b@1481 2037 matched = false;
b@1481 2038
b@1481 2039 // Combinators
b@1481 2040 if ( (match = rcombinators.exec( soFar )) ) {
b@1481 2041 matched = match.shift();
b@1481 2042 tokens.push({
b@1481 2043 value: matched,
b@1481 2044 // Cast descendant combinators to space
b@1481 2045 type: match[0].replace( rtrim, " " )
b@1481 2046 });
b@1481 2047 soFar = soFar.slice( matched.length );
b@1481 2048 }
b@1481 2049
b@1481 2050 // Filters
b@1481 2051 for ( type in Expr.filter ) {
b@1481 2052 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
b@1481 2053 (match = preFilters[ type ]( match ))) ) {
b@1481 2054 matched = match.shift();
b@1481 2055 tokens.push({
b@1481 2056 value: matched,
b@1481 2057 type: type,
b@1481 2058 matches: match
b@1481 2059 });
b@1481 2060 soFar = soFar.slice( matched.length );
b@1481 2061 }
b@1481 2062 }
b@1481 2063
b@1481 2064 if ( !matched ) {
b@1481 2065 break;
b@1481 2066 }
b@1481 2067 }
b@1481 2068
b@1481 2069 // Return the length of the invalid excess
b@1481 2070 // if we're just parsing
b@1481 2071 // Otherwise, throw an error or return tokens
b@1481 2072 return parseOnly ?
b@1481 2073 soFar.length :
b@1481 2074 soFar ?
b@1481 2075 Sizzle.error( selector ) :
b@1481 2076 // Cache the tokens
b@1481 2077 tokenCache( selector, groups ).slice( 0 );
b@1481 2078 };
b@1481 2079
b@1481 2080 function toSelector( tokens ) {
b@1481 2081 var i = 0,
b@1481 2082 len = tokens.length,
b@1481 2083 selector = "";
b@1481 2084 for ( ; i < len; i++ ) {
b@1481 2085 selector += tokens[i].value;
b@1481 2086 }
b@1481 2087 return selector;
b@1481 2088 }
b@1481 2089
b@1481 2090 function addCombinator( matcher, combinator, base ) {
b@1481 2091 var dir = combinator.dir,
b@1481 2092 checkNonElements = base && dir === "parentNode",
b@1481 2093 doneName = done++;
b@1481 2094
b@1481 2095 return combinator.first ?
b@1481 2096 // Check against closest ancestor/preceding element
b@1481 2097 function( elem, context, xml ) {
b@1481 2098 while ( (elem = elem[ dir ]) ) {
b@1481 2099 if ( elem.nodeType === 1 || checkNonElements ) {
b@1481 2100 return matcher( elem, context, xml );
b@1481 2101 }
b@1481 2102 }
b@1481 2103 } :
b@1481 2104
b@1481 2105 // Check against all ancestor/preceding elements
b@1481 2106 function( elem, context, xml ) {
b@1481 2107 var oldCache, outerCache,
b@1481 2108 newCache = [ dirruns, doneName ];
b@1481 2109
b@1481 2110 // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
b@1481 2111 if ( xml ) {
b@1481 2112 while ( (elem = elem[ dir ]) ) {
b@1481 2113 if ( elem.nodeType === 1 || checkNonElements ) {
b@1481 2114 if ( matcher( elem, context, xml ) ) {
b@1481 2115 return true;
b@1481 2116 }
b@1481 2117 }
b@1481 2118 }
b@1481 2119 } else {
b@1481 2120 while ( (elem = elem[ dir ]) ) {
b@1481 2121 if ( elem.nodeType === 1 || checkNonElements ) {
b@1481 2122 outerCache = elem[ expando ] || (elem[ expando ] = {});
b@1481 2123 if ( (oldCache = outerCache[ dir ]) &&
b@1481 2124 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
b@1481 2125
b@1481 2126 // Assign to newCache so results back-propagate to previous elements
b@1481 2127 return (newCache[ 2 ] = oldCache[ 2 ]);
b@1481 2128 } else {
b@1481 2129 // Reuse newcache so results back-propagate to previous elements
b@1481 2130 outerCache[ dir ] = newCache;
b@1481 2131
b@1481 2132 // A match means we're done; a fail means we have to keep checking
b@1481 2133 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
b@1481 2134 return true;
b@1481 2135 }
b@1481 2136 }
b@1481 2137 }
b@1481 2138 }
b@1481 2139 }
b@1481 2140 };
b@1481 2141 }
b@1481 2142
b@1481 2143 function elementMatcher( matchers ) {
b@1481 2144 return matchers.length > 1 ?
b@1481 2145 function( elem, context, xml ) {
b@1481 2146 var i = matchers.length;
b@1481 2147 while ( i-- ) {
b@1481 2148 if ( !matchers[i]( elem, context, xml ) ) {
b@1481 2149 return false;
b@1481 2150 }
b@1481 2151 }
b@1481 2152 return true;
b@1481 2153 } :
b@1481 2154 matchers[0];
b@1481 2155 }
b@1481 2156
b@1481 2157 function multipleContexts( selector, contexts, results ) {
b@1481 2158 var i = 0,
b@1481 2159 len = contexts.length;
b@1481 2160 for ( ; i < len; i++ ) {
b@1481 2161 Sizzle( selector, contexts[i], results );
b@1481 2162 }
b@1481 2163 return results;
b@1481 2164 }
b@1481 2165
b@1481 2166 function condense( unmatched, map, filter, context, xml ) {
b@1481 2167 var elem,
b@1481 2168 newUnmatched = [],
b@1481 2169 i = 0,
b@1481 2170 len = unmatched.length,
b@1481 2171 mapped = map != null;
b@1481 2172
b@1481 2173 for ( ; i < len; i++ ) {
b@1481 2174 if ( (elem = unmatched[i]) ) {
b@1481 2175 if ( !filter || filter( elem, context, xml ) ) {
b@1481 2176 newUnmatched.push( elem );
b@1481 2177 if ( mapped ) {
b@1481 2178 map.push( i );
b@1481 2179 }
b@1481 2180 }
b@1481 2181 }
b@1481 2182 }
b@1481 2183
b@1481 2184 return newUnmatched;
b@1481 2185 }
b@1481 2186
b@1481 2187 function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
b@1481 2188 if ( postFilter && !postFilter[ expando ] ) {
b@1481 2189 postFilter = setMatcher( postFilter );
b@1481 2190 }
b@1481 2191 if ( postFinder && !postFinder[ expando ] ) {
b@1481 2192 postFinder = setMatcher( postFinder, postSelector );
b@1481 2193 }
b@1481 2194 return markFunction(function( seed, results, context, xml ) {
b@1481 2195 var temp, i, elem,
b@1481 2196 preMap = [],
b@1481 2197 postMap = [],
b@1481 2198 preexisting = results.length,
b@1481 2199
b@1481 2200 // Get initial elements from seed or context
b@1481 2201 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
b@1481 2202
b@1481 2203 // Prefilter to get matcher input, preserving a map for seed-results synchronization
b@1481 2204 matcherIn = preFilter && ( seed || !selector ) ?
b@1481 2205 condense( elems, preMap, preFilter, context, xml ) :
b@1481 2206 elems,
b@1481 2207
b@1481 2208 matcherOut = matcher ?
b@1481 2209 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
b@1481 2210 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
b@1481 2211
b@1481 2212 // ...intermediate processing is necessary
b@1481 2213 [] :
b@1481 2214
b@1481 2215 // ...otherwise use results directly
b@1481 2216 results :
b@1481 2217 matcherIn;
b@1481 2218
b@1481 2219 // Find primary matches
b@1481 2220 if ( matcher ) {
b@1481 2221 matcher( matcherIn, matcherOut, context, xml );
b@1481 2222 }
b@1481 2223
b@1481 2224 // Apply postFilter
b@1481 2225 if ( postFilter ) {
b@1481 2226 temp = condense( matcherOut, postMap );
b@1481 2227 postFilter( temp, [], context, xml );
b@1481 2228
b@1481 2229 // Un-match failing elements by moving them back to matcherIn
b@1481 2230 i = temp.length;
b@1481 2231 while ( i-- ) {
b@1481 2232 if ( (elem = temp[i]) ) {
b@1481 2233 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
b@1481 2234 }
b@1481 2235 }
b@1481 2236 }
b@1481 2237
b@1481 2238 if ( seed ) {
b@1481 2239 if ( postFinder || preFilter ) {
b@1481 2240 if ( postFinder ) {
b@1481 2241 // Get the final matcherOut by condensing this intermediate into postFinder contexts
b@1481 2242 temp = [];
b@1481 2243 i = matcherOut.length;
b@1481 2244 while ( i-- ) {
b@1481 2245 if ( (elem = matcherOut[i]) ) {
b@1481 2246 // Restore matcherIn since elem is not yet a final match
b@1481 2247 temp.push( (matcherIn[i] = elem) );
b@1481 2248 }
b@1481 2249 }
b@1481 2250 postFinder( null, (matcherOut = []), temp, xml );
b@1481 2251 }
b@1481 2252
b@1481 2253 // Move matched elements from seed to results to keep them synchronized
b@1481 2254 i = matcherOut.length;
b@1481 2255 while ( i-- ) {
b@1481 2256 if ( (elem = matcherOut[i]) &&
b@1481 2257 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
b@1481 2258
b@1481 2259 seed[temp] = !(results[temp] = elem);
b@1481 2260 }
b@1481 2261 }
b@1481 2262 }
b@1481 2263
b@1481 2264 // Add elements to results, through postFinder if defined
b@1481 2265 } else {
b@1481 2266 matcherOut = condense(
b@1481 2267 matcherOut === results ?
b@1481 2268 matcherOut.splice( preexisting, matcherOut.length ) :
b@1481 2269 matcherOut
b@1481 2270 );
b@1481 2271 if ( postFinder ) {
b@1481 2272 postFinder( null, results, matcherOut, xml );
b@1481 2273 } else {
b@1481 2274 push.apply( results, matcherOut );
b@1481 2275 }
b@1481 2276 }
b@1481 2277 });
b@1481 2278 }
b@1481 2279
b@1481 2280 function matcherFromTokens( tokens ) {
b@1481 2281 var checkContext, matcher, j,
b@1481 2282 len = tokens.length,
b@1481 2283 leadingRelative = Expr.relative[ tokens[0].type ],
b@1481 2284 implicitRelative = leadingRelative || Expr.relative[" "],
b@1481 2285 i = leadingRelative ? 1 : 0,
b@1481 2286
b@1481 2287 // The foundational matcher ensures that elements are reachable from top-level context(s)
b@1481 2288 matchContext = addCombinator( function( elem ) {
b@1481 2289 return elem === checkContext;
b@1481 2290 }, implicitRelative, true ),
b@1481 2291 matchAnyContext = addCombinator( function( elem ) {
b@1481 2292 return indexOf( checkContext, elem ) > -1;
b@1481 2293 }, implicitRelative, true ),
b@1481 2294 matchers = [ function( elem, context, xml ) {
b@1481 2295 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
b@1481 2296 (checkContext = context).nodeType ?
b@1481 2297 matchContext( elem, context, xml ) :
b@1481 2298 matchAnyContext( elem, context, xml ) );
b@1481 2299 // Avoid hanging onto element (issue #299)
b@1481 2300 checkContext = null;
b@1481 2301 return ret;
b@1481 2302 } ];
b@1481 2303
b@1481 2304 for ( ; i < len; i++ ) {
b@1481 2305 if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
b@1481 2306 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
b@1481 2307 } else {
b@1481 2308 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
b@1481 2309
b@1481 2310 // Return special upon seeing a positional matcher
b@1481 2311 if ( matcher[ expando ] ) {
b@1481 2312 // Find the next relative operator (if any) for proper handling
b@1481 2313 j = ++i;
b@1481 2314 for ( ; j < len; j++ ) {
b@1481 2315 if ( Expr.relative[ tokens[j].type ] ) {
b@1481 2316 break;
b@1481 2317 }
b@1481 2318 }
b@1481 2319 return setMatcher(
b@1481 2320 i > 1 && elementMatcher( matchers ),
b@1481 2321 i > 1 && toSelector(
b@1481 2322 // If the preceding token was a descendant combinator, insert an implicit any-element `*`
b@1481 2323 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
b@1481 2324 ).replace( rtrim, "$1" ),
b@1481 2325 matcher,
b@1481 2326 i < j && matcherFromTokens( tokens.slice( i, j ) ),
b@1481 2327 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
b@1481 2328 j < len && toSelector( tokens )
b@1481 2329 );
b@1481 2330 }
b@1481 2331 matchers.push( matcher );
b@1481 2332 }
b@1481 2333 }
b@1481 2334
b@1481 2335 return elementMatcher( matchers );
b@1481 2336 }
b@1481 2337
b@1481 2338 function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
b@1481 2339 var bySet = setMatchers.length > 0,
b@1481 2340 byElement = elementMatchers.length > 0,
b@1481 2341 superMatcher = function( seed, context, xml, results, outermost ) {
b@1481 2342 var elem, j, matcher,
b@1481 2343 matchedCount = 0,
b@1481 2344 i = "0",
b@1481 2345 unmatched = seed && [],
b@1481 2346 setMatched = [],
b@1481 2347 contextBackup = outermostContext,
b@1481 2348 // We must always have either seed elements or outermost context
b@1481 2349 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
b@1481 2350 // Use integer dirruns iff this is the outermost matcher
b@1481 2351 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
b@1481 2352 len = elems.length;
b@1481 2353
b@1481 2354 if ( outermost ) {
b@1481 2355 outermostContext = context !== document && context;
b@1481 2356 }
b@1481 2357
b@1481 2358 // Add elements passing elementMatchers directly to results
b@1481 2359 // Keep `i` a string if there are no elements so `matchedCount` will be "00" below
b@1481 2360 // Support: IE<9, Safari
b@1481 2361 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
b@1481 2362 for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
b@1481 2363 if ( byElement && elem ) {
b@1481 2364 j = 0;
b@1481 2365 while ( (matcher = elementMatchers[j++]) ) {
b@1481 2366 if ( matcher( elem, context, xml ) ) {
b@1481 2367 results.push( elem );
b@1481 2368 break;
b@1481 2369 }
b@1481 2370 }
b@1481 2371 if ( outermost ) {
b@1481 2372 dirruns = dirrunsUnique;
b@1481 2373 }
b@1481 2374 }
b@1481 2375
b@1481 2376 // Track unmatched elements for set filters
b@1481 2377 if ( bySet ) {
b@1481 2378 // They will have gone through all possible matchers
b@1481 2379 if ( (elem = !matcher && elem) ) {
b@1481 2380 matchedCount--;
b@1481 2381 }
b@1481 2382
b@1481 2383 // Lengthen the array for every element, matched or not
b@1481 2384 if ( seed ) {
b@1481 2385 unmatched.push( elem );
b@1481 2386 }
b@1481 2387 }
b@1481 2388 }
b@1481 2389
b@1481 2390 // Apply set filters to unmatched elements
b@1481 2391 matchedCount += i;
b@1481 2392 if ( bySet && i !== matchedCount ) {
b@1481 2393 j = 0;
b@1481 2394 while ( (matcher = setMatchers[j++]) ) {
b@1481 2395 matcher( unmatched, setMatched, context, xml );
b@1481 2396 }
b@1481 2397
b@1481 2398 if ( seed ) {
b@1481 2399 // Reintegrate element matches to eliminate the need for sorting
b@1481 2400 if ( matchedCount > 0 ) {
b@1481 2401 while ( i-- ) {
b@1481 2402 if ( !(unmatched[i] || setMatched[i]) ) {
b@1481 2403 setMatched[i] = pop.call( results );
b@1481 2404 }
b@1481 2405 }
b@1481 2406 }
b@1481 2407
b@1481 2408 // Discard index placeholder values to get only actual matches
b@1481 2409 setMatched = condense( setMatched );
b@1481 2410 }
b@1481 2411
b@1481 2412 // Add matches to results
b@1481 2413 push.apply( results, setMatched );
b@1481 2414
b@1481 2415 // Seedless set matches succeeding multiple successful matchers stipulate sorting
b@1481 2416 if ( outermost && !seed && setMatched.length > 0 &&
b@1481 2417 ( matchedCount + setMatchers.length ) > 1 ) {
b@1481 2418
b@1481 2419 Sizzle.uniqueSort( results );
b@1481 2420 }
b@1481 2421 }
b@1481 2422
b@1481 2423 // Override manipulation of globals by nested matchers
b@1481 2424 if ( outermost ) {
b@1481 2425 dirruns = dirrunsUnique;
b@1481 2426 outermostContext = contextBackup;
b@1481 2427 }
b@1481 2428
b@1481 2429 return unmatched;
b@1481 2430 };
b@1481 2431
b@1481 2432 return bySet ?
b@1481 2433 markFunction( superMatcher ) :
b@1481 2434 superMatcher;
b@1481 2435 }
b@1481 2436
b@1481 2437 compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
b@1481 2438 var i,
b@1481 2439 setMatchers = [],
b@1481 2440 elementMatchers = [],
b@1481 2441 cached = compilerCache[ selector + " " ];
b@1481 2442
b@1481 2443 if ( !cached ) {
b@1481 2444 // Generate a function of recursive functions that can be used to check each element
b@1481 2445 if ( !match ) {
b@1481 2446 match = tokenize( selector );
b@1481 2447 }
b@1481 2448 i = match.length;
b@1481 2449 while ( i-- ) {
b@1481 2450 cached = matcherFromTokens( match[i] );
b@1481 2451 if ( cached[ expando ] ) {
b@1481 2452 setMatchers.push( cached );
b@1481 2453 } else {
b@1481 2454 elementMatchers.push( cached );
b@1481 2455 }
b@1481 2456 }
b@1481 2457
b@1481 2458 // Cache the compiled function
b@1481 2459 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
b@1481 2460
b@1481 2461 // Save selector and tokenization
b@1481 2462 cached.selector = selector;
b@1481 2463 }
b@1481 2464 return cached;
b@1481 2465 };
b@1481 2466
b@1481 2467 /**
b@1481 2468 * A low-level selection function that works with Sizzle's compiled
b@1481 2469 * selector functions
b@1481 2470 * @param {String|Function} selector A selector or a pre-compiled
b@1481 2471 * selector function built with Sizzle.compile
b@1481 2472 * @param {Element} context
b@1481 2473 * @param {Array} [results]
b@1481 2474 * @param {Array} [seed] A set of elements to match against
b@1481 2475 */
b@1481 2476 select = Sizzle.select = function( selector, context, results, seed ) {
b@1481 2477 var i, tokens, token, type, find,
b@1481 2478 compiled = typeof selector === "function" && selector,
b@1481 2479 match = !seed && tokenize( (selector = compiled.selector || selector) );
b@1481 2480
b@1481 2481 results = results || [];
b@1481 2482
b@1481 2483 // Try to minimize operations if there is no seed and only one group
b@1481 2484 if ( match.length === 1 ) {
b@1481 2485
b@1481 2486 // Take a shortcut and set the context if the root selector is an ID
b@1481 2487 tokens = match[0] = match[0].slice( 0 );
b@1481 2488 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
b@1481 2489 support.getById && context.nodeType === 9 && documentIsHTML &&
b@1481 2490 Expr.relative[ tokens[1].type ] ) {
b@1481 2491
b@1481 2492 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
b@1481 2493 if ( !context ) {
b@1481 2494 return results;
b@1481 2495
b@1481 2496 // Precompiled matchers will still verify ancestry, so step up a level
b@1481 2497 } else if ( compiled ) {
b@1481 2498 context = context.parentNode;
b@1481 2499 }
b@1481 2500
b@1481 2501 selector = selector.slice( tokens.shift().value.length );
b@1481 2502 }
b@1481 2503
b@1481 2504 // Fetch a seed set for right-to-left matching
b@1481 2505 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
b@1481 2506 while ( i-- ) {
b@1481 2507 token = tokens[i];
b@1481 2508
b@1481 2509 // Abort if we hit a combinator
b@1481 2510 if ( Expr.relative[ (type = token.type) ] ) {
b@1481 2511 break;
b@1481 2512 }
b@1481 2513 if ( (find = Expr.find[ type ]) ) {
b@1481 2514 // Search, expanding context for leading sibling combinators
b@1481 2515 if ( (seed = find(
b@1481 2516 token.matches[0].replace( runescape, funescape ),
b@1481 2517 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
b@1481 2518 )) ) {
b@1481 2519
b@1481 2520 // If seed is empty or no tokens remain, we can return early
b@1481 2521 tokens.splice( i, 1 );
b@1481 2522 selector = seed.length && toSelector( tokens );
b@1481 2523 if ( !selector ) {
b@1481 2524 push.apply( results, seed );
b@1481 2525 return results;
b@1481 2526 }
b@1481 2527
b@1481 2528 break;
b@1481 2529 }
b@1481 2530 }
b@1481 2531 }
b@1481 2532 }
b@1481 2533
b@1481 2534 // Compile and execute a filtering function if one is not provided
b@1481 2535 // Provide `match` to avoid retokenization if we modified the selector above
b@1481 2536 ( compiled || compile( selector, match ) )(
b@1481 2537 seed,
b@1481 2538 context,
b@1481 2539 !documentIsHTML,
b@1481 2540 results,
b@1481 2541 rsibling.test( selector ) && testContext( context.parentNode ) || context
b@1481 2542 );
b@1481 2543 return results;
b@1481 2544 };
b@1481 2545
b@1481 2546 // One-time assignments
b@1481 2547
b@1481 2548 // Sort stability
b@1481 2549 support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
b@1481 2550
b@1481 2551 // Support: Chrome 14-35+
b@1481 2552 // Always assume duplicates if they aren't passed to the comparison function
b@1481 2553 support.detectDuplicates = !!hasDuplicate;
b@1481 2554
b@1481 2555 // Initialize against the default document
b@1481 2556 setDocument();
b@1481 2557
b@1481 2558 // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
b@1481 2559 // Detached nodes confoundingly follow *each other*
b@1481 2560 support.sortDetached = assert(function( div1 ) {
b@1481 2561 // Should return 1, but returns 4 (following)
b@1481 2562 return div1.compareDocumentPosition( document.createElement("div") ) & 1;
b@1481 2563 });
b@1481 2564
b@1481 2565 // Support: IE<8
b@1481 2566 // Prevent attribute/property "interpolation"
b@1481 2567 // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
b@1481 2568 if ( !assert(function( div ) {
b@1481 2569 div.innerHTML = "<a href='#'></a>";
b@1481 2570 return div.firstChild.getAttribute("href") === "#" ;
b@1481 2571 }) ) {
b@1481 2572 addHandle( "type|href|height|width", function( elem, name, isXML ) {
b@1481 2573 if ( !isXML ) {
b@1481 2574 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
b@1481 2575 }
b@1481 2576 });
b@1481 2577 }
b@1481 2578
b@1481 2579 // Support: IE<9
b@1481 2580 // Use defaultValue in place of getAttribute("value")
b@1481 2581 if ( !support.attributes || !assert(function( div ) {
b@1481 2582 div.innerHTML = "<input/>";
b@1481 2583 div.firstChild.setAttribute( "value", "" );
b@1481 2584 return div.firstChild.getAttribute( "value" ) === "";
b@1481 2585 }) ) {
b@1481 2586 addHandle( "value", function( elem, name, isXML ) {
b@1481 2587 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
b@1481 2588 return elem.defaultValue;
b@1481 2589 }
b@1481 2590 });
b@1481 2591 }
b@1481 2592
b@1481 2593 // Support: IE<9
b@1481 2594 // Use getAttributeNode to fetch booleans when getAttribute lies
b@1481 2595 if ( !assert(function( div ) {
b@1481 2596 return div.getAttribute("disabled") == null;
b@1481 2597 }) ) {
b@1481 2598 addHandle( booleans, function( elem, name, isXML ) {
b@1481 2599 var val;
b@1481 2600 if ( !isXML ) {
b@1481 2601 return elem[ name ] === true ? name.toLowerCase() :
b@1481 2602 (val = elem.getAttributeNode( name )) && val.specified ?
b@1481 2603 val.value :
b@1481 2604 null;
b@1481 2605 }
b@1481 2606 });
b@1481 2607 }
b@1481 2608
b@1481 2609 return Sizzle;
b@1481 2610
b@1481 2611 })( window );
b@1481 2612
b@1481 2613
b@1481 2614
b@1481 2615 jQuery.find = Sizzle;
b@1481 2616 jQuery.expr = Sizzle.selectors;
b@1481 2617 jQuery.expr[":"] = jQuery.expr.pseudos;
b@1481 2618 jQuery.unique = Sizzle.uniqueSort;
b@1481 2619 jQuery.text = Sizzle.getText;
b@1481 2620 jQuery.isXMLDoc = Sizzle.isXML;
b@1481 2621 jQuery.contains = Sizzle.contains;
b@1481 2622
b@1481 2623
b@1481 2624
b@1481 2625 var rneedsContext = jQuery.expr.match.needsContext;
b@1481 2626
b@1481 2627 var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
b@1481 2628
b@1481 2629
b@1481 2630
b@1481 2631 var risSimple = /^.[^:#\[\.,]*$/;
b@1481 2632
b@1481 2633 // Implement the identical functionality for filter and not
b@1481 2634 function winnow( elements, qualifier, not ) {
b@1481 2635 if ( jQuery.isFunction( qualifier ) ) {
b@1481 2636 return jQuery.grep( elements, function( elem, i ) {
b@1481 2637 /* jshint -W018 */
b@1481 2638 return !!qualifier.call( elem, i, elem ) !== not;
b@1481 2639 });
b@1481 2640
b@1481 2641 }
b@1481 2642
b@1481 2643 if ( qualifier.nodeType ) {
b@1481 2644 return jQuery.grep( elements, function( elem ) {
b@1481 2645 return ( elem === qualifier ) !== not;
b@1481 2646 });
b@1481 2647
b@1481 2648 }
b@1481 2649
b@1481 2650 if ( typeof qualifier === "string" ) {
b@1481 2651 if ( risSimple.test( qualifier ) ) {
b@1481 2652 return jQuery.filter( qualifier, elements, not );
b@1481 2653 }
b@1481 2654
b@1481 2655 qualifier = jQuery.filter( qualifier, elements );
b@1481 2656 }
b@1481 2657
b@1481 2658 return jQuery.grep( elements, function( elem ) {
b@1481 2659 return ( indexOf.call( qualifier, elem ) >= 0 ) !== not;
b@1481 2660 });
b@1481 2661 }
b@1481 2662
b@1481 2663 jQuery.filter = function( expr, elems, not ) {
b@1481 2664 var elem = elems[ 0 ];
b@1481 2665
b@1481 2666 if ( not ) {
b@1481 2667 expr = ":not(" + expr + ")";
b@1481 2668 }
b@1481 2669
b@1481 2670 return elems.length === 1 && elem.nodeType === 1 ?
b@1481 2671 jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
b@1481 2672 jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
b@1481 2673 return elem.nodeType === 1;
b@1481 2674 }));
b@1481 2675 };
b@1481 2676
b@1481 2677 jQuery.fn.extend({
b@1481 2678 find: function( selector ) {
b@1481 2679 var i,
b@1481 2680 len = this.length,
b@1481 2681 ret = [],
b@1481 2682 self = this;
b@1481 2683
b@1481 2684 if ( typeof selector !== "string" ) {
b@1481 2685 return this.pushStack( jQuery( selector ).filter(function() {
b@1481 2686 for ( i = 0; i < len; i++ ) {
b@1481 2687 if ( jQuery.contains( self[ i ], this ) ) {
b@1481 2688 return true;
b@1481 2689 }
b@1481 2690 }
b@1481 2691 }) );
b@1481 2692 }
b@1481 2693
b@1481 2694 for ( i = 0; i < len; i++ ) {
b@1481 2695 jQuery.find( selector, self[ i ], ret );
b@1481 2696 }
b@1481 2697
b@1481 2698 // Needed because $( selector, context ) becomes $( context ).find( selector )
b@1481 2699 ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
b@1481 2700 ret.selector = this.selector ? this.selector + " " + selector : selector;
b@1481 2701 return ret;
b@1481 2702 },
b@1481 2703 filter: function( selector ) {
b@1481 2704 return this.pushStack( winnow(this, selector || [], false) );
b@1481 2705 },
b@1481 2706 not: function( selector ) {
b@1481 2707 return this.pushStack( winnow(this, selector || [], true) );
b@1481 2708 },
b@1481 2709 is: function( selector ) {
b@1481 2710 return !!winnow(
b@1481 2711 this,
b@1481 2712
b@1481 2713 // If this is a positional/relative selector, check membership in the returned set
b@1481 2714 // so $("p:first").is("p:last") won't return true for a doc with two "p".
b@1481 2715 typeof selector === "string" && rneedsContext.test( selector ) ?
b@1481 2716 jQuery( selector ) :
b@1481 2717 selector || [],
b@1481 2718 false
b@1481 2719 ).length;
b@1481 2720 }
b@1481 2721 });
b@1481 2722
b@1481 2723
b@1481 2724 // Initialize a jQuery object
b@1481 2725
b@1481 2726
b@1481 2727 // A central reference to the root jQuery(document)
b@1481 2728 var rootjQuery,
b@1481 2729
b@1481 2730 // A simple way to check for HTML strings
b@1481 2731 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
b@1481 2732 // Strict HTML recognition (#11290: must start with <)
b@1481 2733 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
b@1481 2734
b@1481 2735 init = jQuery.fn.init = function( selector, context ) {
b@1481 2736 var match, elem;
b@1481 2737
b@1481 2738 // HANDLE: $(""), $(null), $(undefined), $(false)
b@1481 2739 if ( !selector ) {
b@1481 2740 return this;
b@1481 2741 }
b@1481 2742
b@1481 2743 // Handle HTML strings
b@1481 2744 if ( typeof selector === "string" ) {
b@1481 2745 if ( selector[0] === "<" && selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) {
b@1481 2746 // Assume that strings that start and end with <> are HTML and skip the regex check
b@1481 2747 match = [ null, selector, null ];
b@1481 2748
b@1481 2749 } else {
b@1481 2750 match = rquickExpr.exec( selector );
b@1481 2751 }
b@1481 2752
b@1481 2753 // Match html or make sure no context is specified for #id
b@1481 2754 if ( match && (match[1] || !context) ) {
b@1481 2755
b@1481 2756 // HANDLE: $(html) -> $(array)
b@1481 2757 if ( match[1] ) {
b@1481 2758 context = context instanceof jQuery ? context[0] : context;
b@1481 2759
b@1481 2760 // Option to run scripts is true for back-compat
b@1481 2761 // Intentionally let the error be thrown if parseHTML is not present
b@1481 2762 jQuery.merge( this, jQuery.parseHTML(
b@1481 2763 match[1],
b@1481 2764 context && context.nodeType ? context.ownerDocument || context : document,
b@1481 2765 true
b@1481 2766 ) );
b@1481 2767
b@1481 2768 // HANDLE: $(html, props)
b@1481 2769 if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
b@1481 2770 for ( match in context ) {
b@1481 2771 // Properties of context are called as methods if possible
b@1481 2772 if ( jQuery.isFunction( this[ match ] ) ) {
b@1481 2773 this[ match ]( context[ match ] );
b@1481 2774
b@1481 2775 // ...and otherwise set as attributes
b@1481 2776 } else {
b@1481 2777 this.attr( match, context[ match ] );
b@1481 2778 }
b@1481 2779 }
b@1481 2780 }
b@1481 2781
b@1481 2782 return this;
b@1481 2783
b@1481 2784 // HANDLE: $(#id)
b@1481 2785 } else {
b@1481 2786 elem = document.getElementById( match[2] );
b@1481 2787
b@1481 2788 // Support: Blackberry 4.6
b@1481 2789 // gEBID returns nodes no longer in the document (#6963)
b@1481 2790 if ( elem && elem.parentNode ) {
b@1481 2791 // Inject the element directly into the jQuery object
b@1481 2792 this.length = 1;
b@1481 2793 this[0] = elem;
b@1481 2794 }
b@1481 2795
b@1481 2796 this.context = document;
b@1481 2797 this.selector = selector;
b@1481 2798 return this;
b@1481 2799 }
b@1481 2800
b@1481 2801 // HANDLE: $(expr, $(...))
b@1481 2802 } else if ( !context || context.jquery ) {
b@1481 2803 return ( context || rootjQuery ).find( selector );
b@1481 2804
b@1481 2805 // HANDLE: $(expr, context)
b@1481 2806 // (which is just equivalent to: $(context).find(expr)
b@1481 2807 } else {
b@1481 2808 return this.constructor( context ).find( selector );
b@1481 2809 }
b@1481 2810
b@1481 2811 // HANDLE: $(DOMElement)
b@1481 2812 } else if ( selector.nodeType ) {
b@1481 2813 this.context = this[0] = selector;
b@1481 2814 this.length = 1;
b@1481 2815 return this;
b@1481 2816
b@1481 2817 // HANDLE: $(function)
b@1481 2818 // Shortcut for document ready
b@1481 2819 } else if ( jQuery.isFunction( selector ) ) {
b@1481 2820 return typeof rootjQuery.ready !== "undefined" ?
b@1481 2821 rootjQuery.ready( selector ) :
b@1481 2822 // Execute immediately if ready is not present
b@1481 2823 selector( jQuery );
b@1481 2824 }
b@1481 2825
b@1481 2826 if ( selector.selector !== undefined ) {
b@1481 2827 this.selector = selector.selector;
b@1481 2828 this.context = selector.context;
b@1481 2829 }
b@1481 2830
b@1481 2831 return jQuery.makeArray( selector, this );
b@1481 2832 };
b@1481 2833
b@1481 2834 // Give the init function the jQuery prototype for later instantiation
b@1481 2835 init.prototype = jQuery.fn;
b@1481 2836
b@1481 2837 // Initialize central reference
b@1481 2838 rootjQuery = jQuery( document );
b@1481 2839
b@1481 2840
b@1481 2841 var rparentsprev = /^(?:parents|prev(?:Until|All))/,
b@1481 2842 // Methods guaranteed to produce a unique set when starting from a unique set
b@1481 2843 guaranteedUnique = {
b@1481 2844 children: true,
b@1481 2845 contents: true,
b@1481 2846 next: true,
b@1481 2847 prev: true
b@1481 2848 };
b@1481 2849
b@1481 2850 jQuery.extend({
b@1481 2851 dir: function( elem, dir, until ) {
b@1481 2852 var matched = [],
b@1481 2853 truncate = until !== undefined;
b@1481 2854
b@1481 2855 while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) {
b@1481 2856 if ( elem.nodeType === 1 ) {
b@1481 2857 if ( truncate && jQuery( elem ).is( until ) ) {
b@1481 2858 break;
b@1481 2859 }
b@1481 2860 matched.push( elem );
b@1481 2861 }
b@1481 2862 }
b@1481 2863 return matched;
b@1481 2864 },
b@1481 2865
b@1481 2866 sibling: function( n, elem ) {
b@1481 2867 var matched = [];
b@1481 2868
b@1481 2869 for ( ; n; n = n.nextSibling ) {
b@1481 2870 if ( n.nodeType === 1 && n !== elem ) {
b@1481 2871 matched.push( n );
b@1481 2872 }
b@1481 2873 }
b@1481 2874
b@1481 2875 return matched;
b@1481 2876 }
b@1481 2877 });
b@1481 2878
b@1481 2879 jQuery.fn.extend({
b@1481 2880 has: function( target ) {
b@1481 2881 var targets = jQuery( target, this ),
b@1481 2882 l = targets.length;
b@1481 2883
b@1481 2884 return this.filter(function() {
b@1481 2885 var i = 0;
b@1481 2886 for ( ; i < l; i++ ) {
b@1481 2887 if ( jQuery.contains( this, targets[i] ) ) {
b@1481 2888 return true;
b@1481 2889 }
b@1481 2890 }
b@1481 2891 });
b@1481 2892 },
b@1481 2893
b@1481 2894 closest: function( selectors, context ) {
b@1481 2895 var cur,
b@1481 2896 i = 0,
b@1481 2897 l = this.length,
b@1481 2898 matched = [],
b@1481 2899 pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
b@1481 2900 jQuery( selectors, context || this.context ) :
b@1481 2901 0;
b@1481 2902
b@1481 2903 for ( ; i < l; i++ ) {
b@1481 2904 for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
b@1481 2905 // Always skip document fragments
b@1481 2906 if ( cur.nodeType < 11 && (pos ?
b@1481 2907 pos.index(cur) > -1 :
b@1481 2908
b@1481 2909 // Don't pass non-elements to Sizzle
b@1481 2910 cur.nodeType === 1 &&
b@1481 2911 jQuery.find.matchesSelector(cur, selectors)) ) {
b@1481 2912
b@1481 2913 matched.push( cur );
b@1481 2914 break;
b@1481 2915 }
b@1481 2916 }
b@1481 2917 }
b@1481 2918
b@1481 2919 return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched );
b@1481 2920 },
b@1481 2921
b@1481 2922 // Determine the position of an element within the set
b@1481 2923 index: function( elem ) {
b@1481 2924
b@1481 2925 // No argument, return index in parent
b@1481 2926 if ( !elem ) {
b@1481 2927 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
b@1481 2928 }
b@1481 2929
b@1481 2930 // Index in selector
b@1481 2931 if ( typeof elem === "string" ) {
b@1481 2932 return indexOf.call( jQuery( elem ), this[ 0 ] );
b@1481 2933 }
b@1481 2934
b@1481 2935 // Locate the position of the desired element
b@1481 2936 return indexOf.call( this,
b@1481 2937
b@1481 2938 // If it receives a jQuery object, the first element is used
b@1481 2939 elem.jquery ? elem[ 0 ] : elem
b@1481 2940 );
b@1481 2941 },
b@1481 2942
b@1481 2943 add: function( selector, context ) {
b@1481 2944 return this.pushStack(
b@1481 2945 jQuery.unique(
b@1481 2946 jQuery.merge( this.get(), jQuery( selector, context ) )
b@1481 2947 )
b@1481 2948 );
b@1481 2949 },
b@1481 2950
b@1481 2951 addBack: function( selector ) {
b@1481 2952 return this.add( selector == null ?
b@1481 2953 this.prevObject : this.prevObject.filter(selector)
b@1481 2954 );
b@1481 2955 }
b@1481 2956 });
b@1481 2957
b@1481 2958 function sibling( cur, dir ) {
b@1481 2959 while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {}
b@1481 2960 return cur;
b@1481 2961 }
b@1481 2962
b@1481 2963 jQuery.each({
b@1481 2964 parent: function( elem ) {
b@1481 2965 var parent = elem.parentNode;
b@1481 2966 return parent && parent.nodeType !== 11 ? parent : null;
b@1481 2967 },
b@1481 2968 parents: function( elem ) {
b@1481 2969 return jQuery.dir( elem, "parentNode" );
b@1481 2970 },
b@1481 2971 parentsUntil: function( elem, i, until ) {
b@1481 2972 return jQuery.dir( elem, "parentNode", until );
b@1481 2973 },
b@1481 2974 next: function( elem ) {
b@1481 2975 return sibling( elem, "nextSibling" );
b@1481 2976 },
b@1481 2977 prev: function( elem ) {
b@1481 2978 return sibling( elem, "previousSibling" );
b@1481 2979 },
b@1481 2980 nextAll: function( elem ) {
b@1481 2981 return jQuery.dir( elem, "nextSibling" );
b@1481 2982 },
b@1481 2983 prevAll: function( elem ) {
b@1481 2984 return jQuery.dir( elem, "previousSibling" );
b@1481 2985 },
b@1481 2986 nextUntil: function( elem, i, until ) {
b@1481 2987 return jQuery.dir( elem, "nextSibling", until );
b@1481 2988 },
b@1481 2989 prevUntil: function( elem, i, until ) {
b@1481 2990 return jQuery.dir( elem, "previousSibling", until );
b@1481 2991 },
b@1481 2992 siblings: function( elem ) {
b@1481 2993 return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
b@1481 2994 },
b@1481 2995 children: function( elem ) {
b@1481 2996 return jQuery.sibling( elem.firstChild );
b@1481 2997 },
b@1481 2998 contents: function( elem ) {
b@1481 2999 return elem.contentDocument || jQuery.merge( [], elem.childNodes );
b@1481 3000 }
b@1481 3001 }, function( name, fn ) {
b@1481 3002 jQuery.fn[ name ] = function( until, selector ) {
b@1481 3003 var matched = jQuery.map( this, fn, until );
b@1481 3004
b@1481 3005 if ( name.slice( -5 ) !== "Until" ) {
b@1481 3006 selector = until;
b@1481 3007 }
b@1481 3008
b@1481 3009 if ( selector && typeof selector === "string" ) {
b@1481 3010 matched = jQuery.filter( selector, matched );
b@1481 3011 }
b@1481 3012
b@1481 3013 if ( this.length > 1 ) {
b@1481 3014 // Remove duplicates
b@1481 3015 if ( !guaranteedUnique[ name ] ) {
b@1481 3016 jQuery.unique( matched );
b@1481 3017 }
b@1481 3018
b@1481 3019 // Reverse order for parents* and prev-derivatives
b@1481 3020 if ( rparentsprev.test( name ) ) {
b@1481 3021 matched.reverse();
b@1481 3022 }
b@1481 3023 }
b@1481 3024
b@1481 3025 return this.pushStack( matched );
b@1481 3026 };
b@1481 3027 });
b@1481 3028 var rnotwhite = (/\S+/g);
b@1481 3029
b@1481 3030
b@1481 3031
b@1481 3032 // String to Object options format cache
b@1481 3033 var optionsCache = {};
b@1481 3034
b@1481 3035 // Convert String-formatted options into Object-formatted ones and store in cache
b@1481 3036 function createOptions( options ) {
b@1481 3037 var object = optionsCache[ options ] = {};
b@1481 3038 jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
b@1481 3039 object[ flag ] = true;
b@1481 3040 });
b@1481 3041 return object;
b@1481 3042 }
b@1481 3043
b@1481 3044 /*
b@1481 3045 * Create a callback list using the following parameters:
b@1481 3046 *
b@1481 3047 * options: an optional list of space-separated options that will change how
b@1481 3048 * the callback list behaves or a more traditional option object
b@1481 3049 *
b@1481 3050 * By default a callback list will act like an event callback list and can be
b@1481 3051 * "fired" multiple times.
b@1481 3052 *
b@1481 3053 * Possible options:
b@1481 3054 *
b@1481 3055 * once: will ensure the callback list can only be fired once (like a Deferred)
b@1481 3056 *
b@1481 3057 * memory: will keep track of previous values and will call any callback added
b@1481 3058 * after the list has been fired right away with the latest "memorized"
b@1481 3059 * values (like a Deferred)
b@1481 3060 *
b@1481 3061 * unique: will ensure a callback can only be added once (no duplicate in the list)
b@1481 3062 *
b@1481 3063 * stopOnFalse: interrupt callings when a callback returns false
b@1481 3064 *
b@1481 3065 */
b@1481 3066 jQuery.Callbacks = function( options ) {
b@1481 3067
b@1481 3068 // Convert options from String-formatted to Object-formatted if needed
b@1481 3069 // (we check in cache first)
b@1481 3070 options = typeof options === "string" ?
b@1481 3071 ( optionsCache[ options ] || createOptions( options ) ) :
b@1481 3072 jQuery.extend( {}, options );
b@1481 3073
b@1481 3074 var // Last fire value (for non-forgettable lists)
b@1481 3075 memory,
b@1481 3076 // Flag to know if list was already fired
b@1481 3077 fired,
b@1481 3078 // Flag to know if list is currently firing
b@1481 3079 firing,
b@1481 3080 // First callback to fire (used internally by add and fireWith)
b@1481 3081 firingStart,
b@1481 3082 // End of the loop when firing
b@1481 3083 firingLength,
b@1481 3084 // Index of currently firing callback (modified by remove if needed)
b@1481 3085 firingIndex,
b@1481 3086 // Actual callback list
b@1481 3087 list = [],
b@1481 3088 // Stack of fire calls for repeatable lists
b@1481 3089 stack = !options.once && [],
b@1481 3090 // Fire callbacks
b@1481 3091 fire = function( data ) {
b@1481 3092 memory = options.memory && data;
b@1481 3093 fired = true;
b@1481 3094 firingIndex = firingStart || 0;
b@1481 3095 firingStart = 0;
b@1481 3096 firingLength = list.length;
b@1481 3097 firing = true;
b@1481 3098 for ( ; list && firingIndex < firingLength; firingIndex++ ) {
b@1481 3099 if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
b@1481 3100 memory = false; // To prevent further calls using add
b@1481 3101 break;
b@1481 3102 }
b@1481 3103 }
b@1481 3104 firing = false;
b@1481 3105 if ( list ) {
b@1481 3106 if ( stack ) {
b@1481 3107 if ( stack.length ) {
b@1481 3108 fire( stack.shift() );
b@1481 3109 }
b@1481 3110 } else if ( memory ) {
b@1481 3111 list = [];
b@1481 3112 } else {
b@1481 3113 self.disable();
b@1481 3114 }
b@1481 3115 }
b@1481 3116 },
b@1481 3117 // Actual Callbacks object
b@1481 3118 self = {
b@1481 3119 // Add a callback or a collection of callbacks to the list
b@1481 3120 add: function() {
b@1481 3121 if ( list ) {
b@1481 3122 // First, we save the current length
b@1481 3123 var start = list.length;
b@1481 3124 (function add( args ) {
b@1481 3125 jQuery.each( args, function( _, arg ) {
b@1481 3126 var type = jQuery.type( arg );
b@1481 3127 if ( type === "function" ) {
b@1481 3128 if ( !options.unique || !self.has( arg ) ) {
b@1481 3129 list.push( arg );
b@1481 3130 }
b@1481 3131 } else if ( arg && arg.length && type !== "string" ) {
b@1481 3132 // Inspect recursively
b@1481 3133 add( arg );
b@1481 3134 }
b@1481 3135 });
b@1481 3136 })( arguments );
b@1481 3137 // Do we need to add the callbacks to the
b@1481 3138 // current firing batch?
b@1481 3139 if ( firing ) {
b@1481 3140 firingLength = list.length;
b@1481 3141 // With memory, if we're not firing then
b@1481 3142 // we should call right away
b@1481 3143 } else if ( memory ) {
b@1481 3144 firingStart = start;
b@1481 3145 fire( memory );
b@1481 3146 }
b@1481 3147 }
b@1481 3148 return this;
b@1481 3149 },
b@1481 3150 // Remove a callback from the list
b@1481 3151 remove: function() {
b@1481 3152 if ( list ) {
b@1481 3153 jQuery.each( arguments, function( _, arg ) {
b@1481 3154 var index;
b@1481 3155 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
b@1481 3156 list.splice( index, 1 );
b@1481 3157 // Handle firing indexes
b@1481 3158 if ( firing ) {
b@1481 3159 if ( index <= firingLength ) {
b@1481 3160 firingLength--;
b@1481 3161 }
b@1481 3162 if ( index <= firingIndex ) {
b@1481 3163 firingIndex--;
b@1481 3164 }
b@1481 3165 }
b@1481 3166 }
b@1481 3167 });
b@1481 3168 }
b@1481 3169 return this;
b@1481 3170 },
b@1481 3171 // Check if a given callback is in the list.
b@1481 3172 // If no argument is given, return whether or not list has callbacks attached.
b@1481 3173 has: function( fn ) {
b@1481 3174 return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
b@1481 3175 },
b@1481 3176 // Remove all callbacks from the list
b@1481 3177 empty: function() {
b@1481 3178 list = [];
b@1481 3179 firingLength = 0;
b@1481 3180 return this;
b@1481 3181 },
b@1481 3182 // Have the list do nothing anymore
b@1481 3183 disable: function() {
b@1481 3184 list = stack = memory = undefined;
b@1481 3185 return this;
b@1481 3186 },
b@1481 3187 // Is it disabled?
b@1481 3188 disabled: function() {
b@1481 3189 return !list;
b@1481 3190 },
b@1481 3191 // Lock the list in its current state
b@1481 3192 lock: function() {
b@1481 3193 stack = undefined;
b@1481 3194 if ( !memory ) {
b@1481 3195 self.disable();
b@1481 3196 }
b@1481 3197 return this;
b@1481 3198 },
b@1481 3199 // Is it locked?
b@1481 3200 locked: function() {
b@1481 3201 return !stack;
b@1481 3202 },
b@1481 3203 // Call all callbacks with the given context and arguments
b@1481 3204 fireWith: function( context, args ) {
b@1481 3205 if ( list && ( !fired || stack ) ) {
b@1481 3206 args = args || [];
b@1481 3207 args = [ context, args.slice ? args.slice() : args ];
b@1481 3208 if ( firing ) {
b@1481 3209 stack.push( args );
b@1481 3210 } else {
b@1481 3211 fire( args );
b@1481 3212 }
b@1481 3213 }
b@1481 3214 return this;
b@1481 3215 },
b@1481 3216 // Call all the callbacks with the given arguments
b@1481 3217 fire: function() {
b@1481 3218 self.fireWith( this, arguments );
b@1481 3219 return this;
b@1481 3220 },
b@1481 3221 // To know if the callbacks have already been called at least once
b@1481 3222 fired: function() {
b@1481 3223 return !!fired;
b@1481 3224 }
b@1481 3225 };
b@1481 3226
b@1481 3227 return self;
b@1481 3228 };
b@1481 3229
b@1481 3230
b@1481 3231 jQuery.extend({
b@1481 3232
b@1481 3233 Deferred: function( func ) {
b@1481 3234 var tuples = [
b@1481 3235 // action, add listener, listener list, final state
b@1481 3236 [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
b@1481 3237 [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
b@1481 3238 [ "notify", "progress", jQuery.Callbacks("memory") ]
b@1481 3239 ],
b@1481 3240 state = "pending",
b@1481 3241 promise = {
b@1481 3242 state: function() {
b@1481 3243 return state;
b@1481 3244 },
b@1481 3245 always: function() {
b@1481 3246 deferred.done( arguments ).fail( arguments );
b@1481 3247 return this;
b@1481 3248 },
b@1481 3249 then: function( /* fnDone, fnFail, fnProgress */ ) {
b@1481 3250 var fns = arguments;
b@1481 3251 return jQuery.Deferred(function( newDefer ) {
b@1481 3252 jQuery.each( tuples, function( i, tuple ) {
b@1481 3253 var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
b@1481 3254 // deferred[ done | fail | progress ] for forwarding actions to newDefer
b@1481 3255 deferred[ tuple[1] ](function() {
b@1481 3256 var returned = fn && fn.apply( this, arguments );
b@1481 3257 if ( returned && jQuery.isFunction( returned.promise ) ) {
b@1481 3258 returned.promise()
b@1481 3259 .done( newDefer.resolve )
b@1481 3260 .fail( newDefer.reject )
b@1481 3261 .progress( newDefer.notify );
b@1481 3262 } else {
b@1481 3263 newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
b@1481 3264 }
b@1481 3265 });
b@1481 3266 });
b@1481 3267 fns = null;
b@1481 3268 }).promise();
b@1481 3269 },
b@1481 3270 // Get a promise for this deferred
b@1481 3271 // If obj is provided, the promise aspect is added to the object
b@1481 3272 promise: function( obj ) {
b@1481 3273 return obj != null ? jQuery.extend( obj, promise ) : promise;
b@1481 3274 }
b@1481 3275 },
b@1481 3276 deferred = {};
b@1481 3277
b@1481 3278 // Keep pipe for back-compat
b@1481 3279 promise.pipe = promise.then;
b@1481 3280
b@1481 3281 // Add list-specific methods
b@1481 3282 jQuery.each( tuples, function( i, tuple ) {
b@1481 3283 var list = tuple[ 2 ],
b@1481 3284 stateString = tuple[ 3 ];
b@1481 3285
b@1481 3286 // promise[ done | fail | progress ] = list.add
b@1481 3287 promise[ tuple[1] ] = list.add;
b@1481 3288
b@1481 3289 // Handle state
b@1481 3290 if ( stateString ) {
b@1481 3291 list.add(function() {
b@1481 3292 // state = [ resolved | rejected ]
b@1481 3293 state = stateString;
b@1481 3294
b@1481 3295 // [ reject_list | resolve_list ].disable; progress_list.lock
b@1481 3296 }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
b@1481 3297 }
b@1481 3298
b@1481 3299 // deferred[ resolve | reject | notify ]
b@1481 3300 deferred[ tuple[0] ] = function() {
b@1481 3301 deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
b@1481 3302 return this;
b@1481 3303 };
b@1481 3304 deferred[ tuple[0] + "With" ] = list.fireWith;
b@1481 3305 });
b@1481 3306
b@1481 3307 // Make the deferred a promise
b@1481 3308 promise.promise( deferred );
b@1481 3309
b@1481 3310 // Call given func if any
b@1481 3311 if ( func ) {
b@1481 3312 func.call( deferred, deferred );
b@1481 3313 }
b@1481 3314
b@1481 3315 // All done!
b@1481 3316 return deferred;
b@1481 3317 },
b@1481 3318
b@1481 3319 // Deferred helper
b@1481 3320 when: function( subordinate /* , ..., subordinateN */ ) {
b@1481 3321 var i = 0,
b@1481 3322 resolveValues = slice.call( arguments ),
b@1481 3323 length = resolveValues.length,
b@1481 3324
b@1481 3325 // the count of uncompleted subordinates
b@1481 3326 remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
b@1481 3327
b@1481 3328 // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
b@1481 3329 deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
b@1481 3330
b@1481 3331 // Update function for both resolve and progress values
b@1481 3332 updateFunc = function( i, contexts, values ) {
b@1481 3333 return function( value ) {
b@1481 3334 contexts[ i ] = this;
b@1481 3335 values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
b@1481 3336 if ( values === progressValues ) {
b@1481 3337 deferred.notifyWith( contexts, values );
b@1481 3338 } else if ( !( --remaining ) ) {
b@1481 3339 deferred.resolveWith( contexts, values );
b@1481 3340 }
b@1481 3341 };
b@1481 3342 },
b@1481 3343
b@1481 3344 progressValues, progressContexts, resolveContexts;
b@1481 3345
b@1481 3346 // Add listeners to Deferred subordinates; treat others as resolved
b@1481 3347 if ( length > 1 ) {
b@1481 3348 progressValues = new Array( length );
b@1481 3349 progressContexts = new Array( length );
b@1481 3350 resolveContexts = new Array( length );
b@1481 3351 for ( ; i < length; i++ ) {
b@1481 3352 if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
b@1481 3353 resolveValues[ i ].promise()
b@1481 3354 .done( updateFunc( i, resolveContexts, resolveValues ) )
b@1481 3355 .fail( deferred.reject )
b@1481 3356 .progress( updateFunc( i, progressContexts, progressValues ) );
b@1481 3357 } else {
b@1481 3358 --remaining;
b@1481 3359 }
b@1481 3360 }
b@1481 3361 }
b@1481 3362
b@1481 3363 // If we're not waiting on anything, resolve the master
b@1481 3364 if ( !remaining ) {
b@1481 3365 deferred.resolveWith( resolveContexts, resolveValues );
b@1481 3366 }
b@1481 3367
b@1481 3368 return deferred.promise();
b@1481 3369 }
b@1481 3370 });
b@1481 3371
b@1481 3372
b@1481 3373 // The deferred used on DOM ready
b@1481 3374 var readyList;
b@1481 3375
b@1481 3376 jQuery.fn.ready = function( fn ) {
b@1481 3377 // Add the callback
b@1481 3378 jQuery.ready.promise().done( fn );
b@1481 3379
b@1481 3380 return this;
b@1481 3381 };
b@1481 3382
b@1481 3383 jQuery.extend({
b@1481 3384 // Is the DOM ready to be used? Set to true once it occurs.
b@1481 3385 isReady: false,
b@1481 3386
b@1481 3387 // A counter to track how many items to wait for before
b@1481 3388 // the ready event fires. See #6781
b@1481 3389 readyWait: 1,
b@1481 3390
b@1481 3391 // Hold (or release) the ready event
b@1481 3392 holdReady: function( hold ) {
b@1481 3393 if ( hold ) {
b@1481 3394 jQuery.readyWait++;
b@1481 3395 } else {
b@1481 3396 jQuery.ready( true );
b@1481 3397 }
b@1481 3398 },
b@1481 3399
b@1481 3400 // Handle when the DOM is ready
b@1481 3401 ready: function( wait ) {
b@1481 3402
b@1481 3403 // Abort if there are pending holds or we're already ready
b@1481 3404 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
b@1481 3405 return;
b@1481 3406 }
b@1481 3407
b@1481 3408 // Remember that the DOM is ready
b@1481 3409 jQuery.isReady = true;
b@1481 3410
b@1481 3411 // If a normal DOM Ready event fired, decrement, and wait if need be
b@1481 3412 if ( wait !== true && --jQuery.readyWait > 0 ) {
b@1481 3413 return;
b@1481 3414 }
b@1481 3415
b@1481 3416 // If there are functions bound, to execute
b@1481 3417 readyList.resolveWith( document, [ jQuery ] );
b@1481 3418
b@1481 3419 // Trigger any bound ready events
b@1481 3420 if ( jQuery.fn.triggerHandler ) {
b@1481 3421 jQuery( document ).triggerHandler( "ready" );
b@1481 3422 jQuery( document ).off( "ready" );
b@1481 3423 }
b@1481 3424 }
b@1481 3425 });
b@1481 3426
b@1481 3427 /**
b@1481 3428 * The ready event handler and self cleanup method
b@1481 3429 */
b@1481 3430 function completed() {
b@1481 3431 document.removeEventListener( "DOMContentLoaded", completed, false );
b@1481 3432 window.removeEventListener( "load", completed, false );
b@1481 3433 jQuery.ready();
b@1481 3434 }
b@1481 3435
b@1481 3436 jQuery.ready.promise = function( obj ) {
b@1481 3437 if ( !readyList ) {
b@1481 3438
b@1481 3439 readyList = jQuery.Deferred();
b@1481 3440
b@1481 3441 // Catch cases where $(document).ready() is called after the browser event has already occurred.
b@1481 3442 // We once tried to use readyState "interactive" here, but it caused issues like the one
b@1481 3443 // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
b@1481 3444 if ( document.readyState === "complete" ) {
b@1481 3445 // Handle it asynchronously to allow scripts the opportunity to delay ready
b@1481 3446 setTimeout( jQuery.ready );
b@1481 3447
b@1481 3448 } else {
b@1481 3449
b@1481 3450 // Use the handy event callback
b@1481 3451 document.addEventListener( "DOMContentLoaded", completed, false );
b@1481 3452
b@1481 3453 // A fallback to window.onload, that will always work
b@1481 3454 window.addEventListener( "load", completed, false );
b@1481 3455 }
b@1481 3456 }
b@1481 3457 return readyList.promise( obj );
b@1481 3458 };
b@1481 3459
b@1481 3460 // Kick off the DOM ready check even if the user does not
b@1481 3461 jQuery.ready.promise();
b@1481 3462
b@1481 3463
b@1481 3464
b@1481 3465
b@1481 3466 // Multifunctional method to get and set values of a collection
b@1481 3467 // The value/s can optionally be executed if it's a function
b@1481 3468 var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
b@1481 3469 var i = 0,
b@1481 3470 len = elems.length,
b@1481 3471 bulk = key == null;
b@1481 3472
b@1481 3473 // Sets many values
b@1481 3474 if ( jQuery.type( key ) === "object" ) {
b@1481 3475 chainable = true;
b@1481 3476 for ( i in key ) {
b@1481 3477 jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
b@1481 3478 }
b@1481 3479
b@1481 3480 // Sets one value
b@1481 3481 } else if ( value !== undefined ) {
b@1481 3482 chainable = true;
b@1481 3483
b@1481 3484 if ( !jQuery.isFunction( value ) ) {
b@1481 3485 raw = true;
b@1481 3486 }
b@1481 3487
b@1481 3488 if ( bulk ) {
b@1481 3489 // Bulk operations run against the entire set
b@1481 3490 if ( raw ) {
b@1481 3491 fn.call( elems, value );
b@1481 3492 fn = null;
b@1481 3493
b@1481 3494 // ...except when executing function values
b@1481 3495 } else {
b@1481 3496 bulk = fn;
b@1481 3497 fn = function( elem, key, value ) {
b@1481 3498 return bulk.call( jQuery( elem ), value );
b@1481 3499 };
b@1481 3500 }
b@1481 3501 }
b@1481 3502
b@1481 3503 if ( fn ) {
b@1481 3504 for ( ; i < len; i++ ) {
b@1481 3505 fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
b@1481 3506 }
b@1481 3507 }
b@1481 3508 }
b@1481 3509
b@1481 3510 return chainable ?
b@1481 3511 elems :
b@1481 3512
b@1481 3513 // Gets
b@1481 3514 bulk ?
b@1481 3515 fn.call( elems ) :
b@1481 3516 len ? fn( elems[0], key ) : emptyGet;
b@1481 3517 };
b@1481 3518
b@1481 3519
b@1481 3520 /**
b@1481 3521 * Determines whether an object can have data
b@1481 3522 */
b@1481 3523 jQuery.acceptData = function( owner ) {
b@1481 3524 // Accepts only:
b@1481 3525 // - Node
b@1481 3526 // - Node.ELEMENT_NODE
b@1481 3527 // - Node.DOCUMENT_NODE
b@1481 3528 // - Object
b@1481 3529 // - Any
b@1481 3530 /* jshint -W018 */
b@1481 3531 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
b@1481 3532 };
b@1481 3533
b@1481 3534
b@1481 3535 function Data() {
b@1481 3536 // Support: Android<4,
b@1481 3537 // Old WebKit does not have Object.preventExtensions/freeze method,
b@1481 3538 // return new empty object instead with no [[set]] accessor
b@1481 3539 Object.defineProperty( this.cache = {}, 0, {
b@1481 3540 get: function() {
b@1481 3541 return {};
b@1481 3542 }
b@1481 3543 });
b@1481 3544
b@1481 3545 this.expando = jQuery.expando + Data.uid++;
b@1481 3546 }
b@1481 3547
b@1481 3548 Data.uid = 1;
b@1481 3549 Data.accepts = jQuery.acceptData;
b@1481 3550
b@1481 3551 Data.prototype = {
b@1481 3552 key: function( owner ) {
b@1481 3553 // We can accept data for non-element nodes in modern browsers,
b@1481 3554 // but we should not, see #8335.
b@1481 3555 // Always return the key for a frozen object.
b@1481 3556 if ( !Data.accepts( owner ) ) {
b@1481 3557 return 0;
b@1481 3558 }
b@1481 3559
b@1481 3560 var descriptor = {},
b@1481 3561 // Check if the owner object already has a cache key
b@1481 3562 unlock = owner[ this.expando ];
b@1481 3563
b@1481 3564 // If not, create one
b@1481 3565 if ( !unlock ) {
b@1481 3566 unlock = Data.uid++;
b@1481 3567
b@1481 3568 // Secure it in a non-enumerable, non-writable property
b@1481 3569 try {
b@1481 3570 descriptor[ this.expando ] = { value: unlock };
b@1481 3571 Object.defineProperties( owner, descriptor );
b@1481 3572
b@1481 3573 // Support: Android<4
b@1481 3574 // Fallback to a less secure definition
b@1481 3575 } catch ( e ) {
b@1481 3576 descriptor[ this.expando ] = unlock;
b@1481 3577 jQuery.extend( owner, descriptor );
b@1481 3578 }
b@1481 3579 }
b@1481 3580
b@1481 3581 // Ensure the cache object
b@1481 3582 if ( !this.cache[ unlock ] ) {
b@1481 3583 this.cache[ unlock ] = {};
b@1481 3584 }
b@1481 3585
b@1481 3586 return unlock;
b@1481 3587 },
b@1481 3588 set: function( owner, data, value ) {
b@1481 3589 var prop,
b@1481 3590 // There may be an unlock assigned to this node,
b@1481 3591 // if there is no entry for this "owner", create one inline
b@1481 3592 // and set the unlock as though an owner entry had always existed
b@1481 3593 unlock = this.key( owner ),
b@1481 3594 cache = this.cache[ unlock ];
b@1481 3595
b@1481 3596 // Handle: [ owner, key, value ] args
b@1481 3597 if ( typeof data === "string" ) {
b@1481 3598 cache[ data ] = value;
b@1481 3599
b@1481 3600 // Handle: [ owner, { properties } ] args
b@1481 3601 } else {
b@1481 3602 // Fresh assignments by object are shallow copied
b@1481 3603 if ( jQuery.isEmptyObject( cache ) ) {
b@1481 3604 jQuery.extend( this.cache[ unlock ], data );
b@1481 3605 // Otherwise, copy the properties one-by-one to the cache object
b@1481 3606 } else {
b@1481 3607 for ( prop in data ) {
b@1481 3608 cache[ prop ] = data[ prop ];
b@1481 3609 }
b@1481 3610 }
b@1481 3611 }
b@1481 3612 return cache;
b@1481 3613 },
b@1481 3614 get: function( owner, key ) {
b@1481 3615 // Either a valid cache is found, or will be created.
b@1481 3616 // New caches will be created and the unlock returned,
b@1481 3617 // allowing direct access to the newly created
b@1481 3618 // empty data object. A valid owner object must be provided.
b@1481 3619 var cache = this.cache[ this.key( owner ) ];
b@1481 3620
b@1481 3621 return key === undefined ?
b@1481 3622 cache : cache[ key ];
b@1481 3623 },
b@1481 3624 access: function( owner, key, value ) {
b@1481 3625 var stored;
b@1481 3626 // In cases where either:
b@1481 3627 //
b@1481 3628 // 1. No key was specified
b@1481 3629 // 2. A string key was specified, but no value provided
b@1481 3630 //
b@1481 3631 // Take the "read" path and allow the get method to determine
b@1481 3632 // which value to return, respectively either:
b@1481 3633 //
b@1481 3634 // 1. The entire cache object
b@1481 3635 // 2. The data stored at the key
b@1481 3636 //
b@1481 3637 if ( key === undefined ||
b@1481 3638 ((key && typeof key === "string") && value === undefined) ) {
b@1481 3639
b@1481 3640 stored = this.get( owner, key );
b@1481 3641
b@1481 3642 return stored !== undefined ?
b@1481 3643 stored : this.get( owner, jQuery.camelCase(key) );
b@1481 3644 }
b@1481 3645
b@1481 3646 // [*]When the key is not a string, or both a key and value
b@1481 3647 // are specified, set or extend (existing objects) with either:
b@1481 3648 //
b@1481 3649 // 1. An object of properties
b@1481 3650 // 2. A key and value
b@1481 3651 //
b@1481 3652 this.set( owner, key, value );
b@1481 3653
b@1481 3654 // Since the "set" path can have two possible entry points
b@1481 3655 // return the expected data based on which path was taken[*]
b@1481 3656 return value !== undefined ? value : key;
b@1481 3657 },
b@1481 3658 remove: function( owner, key ) {
b@1481 3659 var i, name, camel,
b@1481 3660 unlock = this.key( owner ),
b@1481 3661 cache = this.cache[ unlock ];
b@1481 3662
b@1481 3663 if ( key === undefined ) {
b@1481 3664 this.cache[ unlock ] = {};
b@1481 3665
b@1481 3666 } else {
b@1481 3667 // Support array or space separated string of keys
b@1481 3668 if ( jQuery.isArray( key ) ) {
b@1481 3669 // If "name" is an array of keys...
b@1481 3670 // When data is initially created, via ("key", "val") signature,
b@1481 3671 // keys will be converted to camelCase.
b@1481 3672 // Since there is no way to tell _how_ a key was added, remove
b@1481 3673 // both plain key and camelCase key. #12786
b@1481 3674 // This will only penalize the array argument path.
b@1481 3675 name = key.concat( key.map( jQuery.camelCase ) );
b@1481 3676 } else {
b@1481 3677 camel = jQuery.camelCase( key );
b@1481 3678 // Try the string as a key before any manipulation
b@1481 3679 if ( key in cache ) {
b@1481 3680 name = [ key, camel ];
b@1481 3681 } else {
b@1481 3682 // If a key with the spaces exists, use it.
b@1481 3683 // Otherwise, create an array by matching non-whitespace
b@1481 3684 name = camel;
b@1481 3685 name = name in cache ?
b@1481 3686 [ name ] : ( name.match( rnotwhite ) || [] );
b@1481 3687 }
b@1481 3688 }
b@1481 3689
b@1481 3690 i = name.length;
b@1481 3691 while ( i-- ) {
b@1481 3692 delete cache[ name[ i ] ];
b@1481 3693 }
b@1481 3694 }
b@1481 3695 },
b@1481 3696 hasData: function( owner ) {
b@1481 3697 return !jQuery.isEmptyObject(
b@1481 3698 this.cache[ owner[ this.expando ] ] || {}
b@1481 3699 );
b@1481 3700 },
b@1481 3701 discard: function( owner ) {
b@1481 3702 if ( owner[ this.expando ] ) {
b@1481 3703 delete this.cache[ owner[ this.expando ] ];
b@1481 3704 }
b@1481 3705 }
b@1481 3706 };
b@1481 3707 var data_priv = new Data();
b@1481 3708
b@1481 3709 var data_user = new Data();
b@1481 3710
b@1481 3711
b@1481 3712
b@1481 3713 // Implementation Summary
b@1481 3714 //
b@1481 3715 // 1. Enforce API surface and semantic compatibility with 1.9.x branch
b@1481 3716 // 2. Improve the module's maintainability by reducing the storage
b@1481 3717 // paths to a single mechanism.
b@1481 3718 // 3. Use the same single mechanism to support "private" and "user" data.
b@1481 3719 // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
b@1481 3720 // 5. Avoid exposing implementation details on user objects (eg. expando properties)
b@1481 3721 // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
b@1481 3722
b@1481 3723 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
b@1481 3724 rmultiDash = /([A-Z])/g;
b@1481 3725
b@1481 3726 function dataAttr( elem, key, data ) {
b@1481 3727 var name;
b@1481 3728
b@1481 3729 // If nothing was found internally, try to fetch any
b@1481 3730 // data from the HTML5 data-* attribute
b@1481 3731 if ( data === undefined && elem.nodeType === 1 ) {
b@1481 3732 name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
b@1481 3733 data = elem.getAttribute( name );
b@1481 3734
b@1481 3735 if ( typeof data === "string" ) {
b@1481 3736 try {
b@1481 3737 data = data === "true" ? true :
b@1481 3738 data === "false" ? false :
b@1481 3739 data === "null" ? null :
b@1481 3740 // Only convert to a number if it doesn't change the string
b@1481 3741 +data + "" === data ? +data :
b@1481 3742 rbrace.test( data ) ? jQuery.parseJSON( data ) :
b@1481 3743 data;
b@1481 3744 } catch( e ) {}
b@1481 3745
b@1481 3746 // Make sure we set the data so it isn't changed later
b@1481 3747 data_user.set( elem, key, data );
b@1481 3748 } else {
b@1481 3749 data = undefined;
b@1481 3750 }
b@1481 3751 }
b@1481 3752 return data;
b@1481 3753 }
b@1481 3754
b@1481 3755 jQuery.extend({
b@1481 3756 hasData: function( elem ) {
b@1481 3757 return data_user.hasData( elem ) || data_priv.hasData( elem );
b@1481 3758 },
b@1481 3759
b@1481 3760 data: function( elem, name, data ) {
b@1481 3761 return data_user.access( elem, name, data );
b@1481 3762 },
b@1481 3763
b@1481 3764 removeData: function( elem, name ) {
b@1481 3765 data_user.remove( elem, name );
b@1481 3766 },
b@1481 3767
b@1481 3768 // TODO: Now that all calls to _data and _removeData have been replaced
b@1481 3769 // with direct calls to data_priv methods, these can be deprecated.
b@1481 3770 _data: function( elem, name, data ) {
b@1481 3771 return data_priv.access( elem, name, data );
b@1481 3772 },
b@1481 3773
b@1481 3774 _removeData: function( elem, name ) {
b@1481 3775 data_priv.remove( elem, name );
b@1481 3776 }
b@1481 3777 });
b@1481 3778
b@1481 3779 jQuery.fn.extend({
b@1481 3780 data: function( key, value ) {
b@1481 3781 var i, name, data,
b@1481 3782 elem = this[ 0 ],
b@1481 3783 attrs = elem && elem.attributes;
b@1481 3784
b@1481 3785 // Gets all values
b@1481 3786 if ( key === undefined ) {
b@1481 3787 if ( this.length ) {
b@1481 3788 data = data_user.get( elem );
b@1481 3789
b@1481 3790 if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) {
b@1481 3791 i = attrs.length;
b@1481 3792 while ( i-- ) {
b@1481 3793
b@1481 3794 // Support: IE11+
b@1481 3795 // The attrs elements can be null (#14894)
b@1481 3796 if ( attrs[ i ] ) {
b@1481 3797 name = attrs[ i ].name;
b@1481 3798 if ( name.indexOf( "data-" ) === 0 ) {
b@1481 3799 name = jQuery.camelCase( name.slice(5) );
b@1481 3800 dataAttr( elem, name, data[ name ] );
b@1481 3801 }
b@1481 3802 }
b@1481 3803 }
b@1481 3804 data_priv.set( elem, "hasDataAttrs", true );
b@1481 3805 }
b@1481 3806 }
b@1481 3807
b@1481 3808 return data;
b@1481 3809 }
b@1481 3810
b@1481 3811 // Sets multiple values
b@1481 3812 if ( typeof key === "object" ) {
b@1481 3813 return this.each(function() {
b@1481 3814 data_user.set( this, key );
b@1481 3815 });
b@1481 3816 }
b@1481 3817
b@1481 3818 return access( this, function( value ) {
b@1481 3819 var data,
b@1481 3820 camelKey = jQuery.camelCase( key );
b@1481 3821
b@1481 3822 // The calling jQuery object (element matches) is not empty
b@1481 3823 // (and therefore has an element appears at this[ 0 ]) and the
b@1481 3824 // `value` parameter was not undefined. An empty jQuery object
b@1481 3825 // will result in `undefined` for elem = this[ 0 ] which will
b@1481 3826 // throw an exception if an attempt to read a data cache is made.
b@1481 3827 if ( elem && value === undefined ) {
b@1481 3828 // Attempt to get data from the cache
b@1481 3829 // with the key as-is
b@1481 3830 data = data_user.get( elem, key );
b@1481 3831 if ( data !== undefined ) {
b@1481 3832 return data;
b@1481 3833 }
b@1481 3834
b@1481 3835 // Attempt to get data from the cache
b@1481 3836 // with the key camelized
b@1481 3837 data = data_user.get( elem, camelKey );
b@1481 3838 if ( data !== undefined ) {
b@1481 3839 return data;
b@1481 3840 }
b@1481 3841
b@1481 3842 // Attempt to "discover" the data in
b@1481 3843 // HTML5 custom data-* attrs
b@1481 3844 data = dataAttr( elem, camelKey, undefined );
b@1481 3845 if ( data !== undefined ) {
b@1481 3846 return data;
b@1481 3847 }
b@1481 3848
b@1481 3849 // We tried really hard, but the data doesn't exist.
b@1481 3850 return;
b@1481 3851 }
b@1481 3852
b@1481 3853 // Set the data...
b@1481 3854 this.each(function() {
b@1481 3855 // First, attempt to store a copy or reference of any
b@1481 3856 // data that might've been store with a camelCased key.
b@1481 3857 var data = data_user.get( this, camelKey );
b@1481 3858
b@1481 3859 // For HTML5 data-* attribute interop, we have to
b@1481 3860 // store property names with dashes in a camelCase form.
b@1481 3861 // This might not apply to all properties...*
b@1481 3862 data_user.set( this, camelKey, value );
b@1481 3863
b@1481 3864 // *... In the case of properties that might _actually_
b@1481 3865 // have dashes, we need to also store a copy of that
b@1481 3866 // unchanged property.
b@1481 3867 if ( key.indexOf("-") !== -1 && data !== undefined ) {
b@1481 3868 data_user.set( this, key, value );
b@1481 3869 }
b@1481 3870 });
b@1481 3871 }, null, value, arguments.length > 1, null, true );
b@1481 3872 },
b@1481 3873
b@1481 3874 removeData: function( key ) {
b@1481 3875 return this.each(function() {
b@1481 3876 data_user.remove( this, key );
b@1481 3877 });
b@1481 3878 }
b@1481 3879 });
b@1481 3880
b@1481 3881
b@1481 3882 jQuery.extend({
b@1481 3883 queue: function( elem, type, data ) {
b@1481 3884 var queue;
b@1481 3885
b@1481 3886 if ( elem ) {
b@1481 3887 type = ( type || "fx" ) + "queue";
b@1481 3888 queue = data_priv.get( elem, type );
b@1481 3889
b@1481 3890 // Speed up dequeue by getting out quickly if this is just a lookup
b@1481 3891 if ( data ) {
b@1481 3892 if ( !queue || jQuery.isArray( data ) ) {
b@1481 3893 queue = data_priv.access( elem, type, jQuery.makeArray(data) );
b@1481 3894 } else {
b@1481 3895 queue.push( data );
b@1481 3896 }
b@1481 3897 }
b@1481 3898 return queue || [];
b@1481 3899 }
b@1481 3900 },
b@1481 3901
b@1481 3902 dequeue: function( elem, type ) {
b@1481 3903 type = type || "fx";
b@1481 3904
b@1481 3905 var queue = jQuery.queue( elem, type ),
b@1481 3906 startLength = queue.length,
b@1481 3907 fn = queue.shift(),
b@1481 3908 hooks = jQuery._queueHooks( elem, type ),
b@1481 3909 next = function() {
b@1481 3910 jQuery.dequeue( elem, type );
b@1481 3911 };
b@1481 3912
b@1481 3913 // If the fx queue is dequeued, always remove the progress sentinel
b@1481 3914 if ( fn === "inprogress" ) {
b@1481 3915 fn = queue.shift();
b@1481 3916 startLength--;
b@1481 3917 }
b@1481 3918
b@1481 3919 if ( fn ) {
b@1481 3920
b@1481 3921 // Add a progress sentinel to prevent the fx queue from being
b@1481 3922 // automatically dequeued
b@1481 3923 if ( type === "fx" ) {
b@1481 3924 queue.unshift( "inprogress" );
b@1481 3925 }
b@1481 3926
b@1481 3927 // Clear up the last queue stop function
b@1481 3928 delete hooks.stop;
b@1481 3929 fn.call( elem, next, hooks );
b@1481 3930 }
b@1481 3931
b@1481 3932 if ( !startLength && hooks ) {
b@1481 3933 hooks.empty.fire();
b@1481 3934 }
b@1481 3935 },
b@1481 3936
b@1481 3937 // Not public - generate a queueHooks object, or return the current one
b@1481 3938 _queueHooks: function( elem, type ) {
b@1481 3939 var key = type + "queueHooks";
b@1481 3940 return data_priv.get( elem, key ) || data_priv.access( elem, key, {
b@1481 3941 empty: jQuery.Callbacks("once memory").add(function() {
b@1481 3942 data_priv.remove( elem, [ type + "queue", key ] );
b@1481 3943 })
b@1481 3944 });
b@1481 3945 }
b@1481 3946 });
b@1481 3947
b@1481 3948 jQuery.fn.extend({
b@1481 3949 queue: function( type, data ) {
b@1481 3950 var setter = 2;
b@1481 3951
b@1481 3952 if ( typeof type !== "string" ) {
b@1481 3953 data = type;
b@1481 3954 type = "fx";
b@1481 3955 setter--;
b@1481 3956 }
b@1481 3957
b@1481 3958 if ( arguments.length < setter ) {
b@1481 3959 return jQuery.queue( this[0], type );
b@1481 3960 }
b@1481 3961
b@1481 3962 return data === undefined ?
b@1481 3963 this :
b@1481 3964 this.each(function() {
b@1481 3965 var queue = jQuery.queue( this, type, data );
b@1481 3966
b@1481 3967 // Ensure a hooks for this queue
b@1481 3968 jQuery._queueHooks( this, type );
b@1481 3969
b@1481 3970 if ( type === "fx" && queue[0] !== "inprogress" ) {
b@1481 3971 jQuery.dequeue( this, type );
b@1481 3972 }
b@1481 3973 });
b@1481 3974 },
b@1481 3975 dequeue: function( type ) {
b@1481 3976 return this.each(function() {
b@1481 3977 jQuery.dequeue( this, type );
b@1481 3978 });
b@1481 3979 },
b@1481 3980 clearQueue: function( type ) {
b@1481 3981 return this.queue( type || "fx", [] );
b@1481 3982 },
b@1481 3983 // Get a promise resolved when queues of a certain type
b@1481 3984 // are emptied (fx is the type by default)
b@1481 3985 promise: function( type, obj ) {
b@1481 3986 var tmp,
b@1481 3987 count = 1,
b@1481 3988 defer = jQuery.Deferred(),
b@1481 3989 elements = this,
b@1481 3990 i = this.length,
b@1481 3991 resolve = function() {
b@1481 3992 if ( !( --count ) ) {
b@1481 3993 defer.resolveWith( elements, [ elements ] );
b@1481 3994 }
b@1481 3995 };
b@1481 3996
b@1481 3997 if ( typeof type !== "string" ) {
b@1481 3998 obj = type;
b@1481 3999 type = undefined;
b@1481 4000 }
b@1481 4001 type = type || "fx";
b@1481 4002
b@1481 4003 while ( i-- ) {
b@1481 4004 tmp = data_priv.get( elements[ i ], type + "queueHooks" );
b@1481 4005 if ( tmp && tmp.empty ) {
b@1481 4006 count++;
b@1481 4007 tmp.empty.add( resolve );
b@1481 4008 }
b@1481 4009 }
b@1481 4010 resolve();
b@1481 4011 return defer.promise( obj );
b@1481 4012 }
b@1481 4013 });
b@1481 4014 var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;
b@1481 4015
b@1481 4016 var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
b@1481 4017
b@1481 4018 var isHidden = function( elem, el ) {
b@1481 4019 // isHidden might be called from jQuery#filter function;
b@1481 4020 // in that case, element will be second argument
b@1481 4021 elem = el || elem;
b@1481 4022 return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
b@1481 4023 };
b@1481 4024
b@1481 4025 var rcheckableType = (/^(?:checkbox|radio)$/i);
b@1481 4026
b@1481 4027
b@1481 4028
b@1481 4029 (function() {
b@1481 4030 var fragment = document.createDocumentFragment(),
b@1481 4031 div = fragment.appendChild( document.createElement( "div" ) ),
b@1481 4032 input = document.createElement( "input" );
b@1481 4033
b@1481 4034 // Support: Safari<=5.1
b@1481 4035 // Check state lost if the name is set (#11217)
b@1481 4036 // Support: Windows Web Apps (WWA)
b@1481 4037 // `name` and `type` must use .setAttribute for WWA (#14901)
b@1481 4038 input.setAttribute( "type", "radio" );
b@1481 4039 input.setAttribute( "checked", "checked" );
b@1481 4040 input.setAttribute( "name", "t" );
b@1481 4041
b@1481 4042 div.appendChild( input );
b@1481 4043
b@1481 4044 // Support: Safari<=5.1, Android<4.2
b@1481 4045 // Older WebKit doesn't clone checked state correctly in fragments
b@1481 4046 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
b@1481 4047
b@1481 4048 // Support: IE<=11+
b@1481 4049 // Make sure textarea (and checkbox) defaultValue is properly cloned
b@1481 4050 div.innerHTML = "<textarea>x</textarea>";
b@1481 4051 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
b@1481 4052 })();
b@1481 4053 var strundefined = typeof undefined;
b@1481 4054
b@1481 4055
b@1481 4056
b@1481 4057 support.focusinBubbles = "onfocusin" in window;
b@1481 4058
b@1481 4059
b@1481 4060 var
b@1481 4061 rkeyEvent = /^key/,
b@1481 4062 rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/,
b@1481 4063 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
b@1481 4064 rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
b@1481 4065
b@1481 4066 function returnTrue() {
b@1481 4067 return true;
b@1481 4068 }
b@1481 4069
b@1481 4070 function returnFalse() {
b@1481 4071 return false;
b@1481 4072 }
b@1481 4073
b@1481 4074 function safeActiveElement() {
b@1481 4075 try {
b@1481 4076 return document.activeElement;
b@1481 4077 } catch ( err ) { }
b@1481 4078 }
b@1481 4079
b@1481 4080 /*
b@1481 4081 * Helper functions for managing events -- not part of the public interface.
b@1481 4082 * Props to Dean Edwards' addEvent library for many of the ideas.
b@1481 4083 */
b@1481 4084 jQuery.event = {
b@1481 4085
b@1481 4086 global: {},
b@1481 4087
b@1481 4088 add: function( elem, types, handler, data, selector ) {
b@1481 4089
b@1481 4090 var handleObjIn, eventHandle, tmp,
b@1481 4091 events, t, handleObj,
b@1481 4092 special, handlers, type, namespaces, origType,
b@1481 4093 elemData = data_priv.get( elem );
b@1481 4094
b@1481 4095 // Don't attach events to noData or text/comment nodes (but allow plain objects)
b@1481 4096 if ( !elemData ) {
b@1481 4097 return;
b@1481 4098 }
b@1481 4099
b@1481 4100 // Caller can pass in an object of custom data in lieu of the handler
b@1481 4101 if ( handler.handler ) {
b@1481 4102 handleObjIn = handler;
b@1481 4103 handler = handleObjIn.handler;
b@1481 4104 selector = handleObjIn.selector;
b@1481 4105 }
b@1481 4106
b@1481 4107 // Make sure that the handler has a unique ID, used to find/remove it later
b@1481 4108 if ( !handler.guid ) {
b@1481 4109 handler.guid = jQuery.guid++;
b@1481 4110 }
b@1481 4111
b@1481 4112 // Init the element's event structure and main handler, if this is the first
b@1481 4113 if ( !(events = elemData.events) ) {
b@1481 4114 events = elemData.events = {};
b@1481 4115 }
b@1481 4116 if ( !(eventHandle = elemData.handle) ) {
b@1481 4117 eventHandle = elemData.handle = function( e ) {
b@1481 4118 // Discard the second event of a jQuery.event.trigger() and
b@1481 4119 // when an event is called after a page has unloaded
b@1481 4120 return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ?
b@1481 4121 jQuery.event.dispatch.apply( elem, arguments ) : undefined;
b@1481 4122 };
b@1481 4123 }
b@1481 4124
b@1481 4125 // Handle multiple events separated by a space
b@1481 4126 types = ( types || "" ).match( rnotwhite ) || [ "" ];
b@1481 4127 t = types.length;
b@1481 4128 while ( t-- ) {
b@1481 4129 tmp = rtypenamespace.exec( types[t] ) || [];
b@1481 4130 type = origType = tmp[1];
b@1481 4131 namespaces = ( tmp[2] || "" ).split( "." ).sort();
b@1481 4132
b@1481 4133 // There *must* be a type, no attaching namespace-only handlers
b@1481 4134 if ( !type ) {
b@1481 4135 continue;
b@1481 4136 }
b@1481 4137
b@1481 4138 // If event changes its type, use the special event handlers for the changed type
b@1481 4139 special = jQuery.event.special[ type ] || {};
b@1481 4140
b@1481 4141 // If selector defined, determine special event api type, otherwise given type
b@1481 4142 type = ( selector ? special.delegateType : special.bindType ) || type;
b@1481 4143
b@1481 4144 // Update special based on newly reset type
b@1481 4145 special = jQuery.event.special[ type ] || {};
b@1481 4146
b@1481 4147 // handleObj is passed to all event handlers
b@1481 4148 handleObj = jQuery.extend({
b@1481 4149 type: type,
b@1481 4150 origType: origType,
b@1481 4151 data: data,
b@1481 4152 handler: handler,
b@1481 4153 guid: handler.guid,
b@1481 4154 selector: selector,
b@1481 4155 needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
b@1481 4156 namespace: namespaces.join(".")
b@1481 4157 }, handleObjIn );
b@1481 4158
b@1481 4159 // Init the event handler queue if we're the first
b@1481 4160 if ( !(handlers = events[ type ]) ) {
b@1481 4161 handlers = events[ type ] = [];
b@1481 4162 handlers.delegateCount = 0;
b@1481 4163
b@1481 4164 // Only use addEventListener if the special events handler returns false
b@1481 4165 if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
b@1481 4166 if ( elem.addEventListener ) {
b@1481 4167 elem.addEventListener( type, eventHandle, false );
b@1481 4168 }
b@1481 4169 }
b@1481 4170 }
b@1481 4171
b@1481 4172 if ( special.add ) {
b@1481 4173 special.add.call( elem, handleObj );
b@1481 4174
b@1481 4175 if ( !handleObj.handler.guid ) {
b@1481 4176 handleObj.handler.guid = handler.guid;
b@1481 4177 }
b@1481 4178 }
b@1481 4179
b@1481 4180 // Add to the element's handler list, delegates in front
b@1481 4181 if ( selector ) {
b@1481 4182 handlers.splice( handlers.delegateCount++, 0, handleObj );
b@1481 4183 } else {
b@1481 4184 handlers.push( handleObj );
b@1481 4185 }
b@1481 4186
b@1481 4187 // Keep track of which events have ever been used, for event optimization
b@1481 4188 jQuery.event.global[ type ] = true;
b@1481 4189 }
b@1481 4190
b@1481 4191 },
b@1481 4192
b@1481 4193 // Detach an event or set of events from an element
b@1481 4194 remove: function( elem, types, handler, selector, mappedTypes ) {
b@1481 4195
b@1481 4196 var j, origCount, tmp,
b@1481 4197 events, t, handleObj,
b@1481 4198 special, handlers, type, namespaces, origType,
b@1481 4199 elemData = data_priv.hasData( elem ) && data_priv.get( elem );
b@1481 4200
b@1481 4201 if ( !elemData || !(events = elemData.events) ) {
b@1481 4202 return;
b@1481 4203 }
b@1481 4204
b@1481 4205 // Once for each type.namespace in types; type may be omitted
b@1481 4206 types = ( types || "" ).match( rnotwhite ) || [ "" ];
b@1481 4207 t = types.length;
b@1481 4208 while ( t-- ) {
b@1481 4209 tmp = rtypenamespace.exec( types[t] ) || [];
b@1481 4210 type = origType = tmp[1];
b@1481 4211 namespaces = ( tmp[2] || "" ).split( "." ).sort();
b@1481 4212
b@1481 4213 // Unbind all events (on this namespace, if provided) for the element
b@1481 4214 if ( !type ) {
b@1481 4215 for ( type in events ) {
b@1481 4216 jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
b@1481 4217 }
b@1481 4218 continue;
b@1481 4219 }
b@1481 4220
b@1481 4221 special = jQuery.event.special[ type ] || {};
b@1481 4222 type = ( selector ? special.delegateType : special.bindType ) || type;
b@1481 4223 handlers = events[ type ] || [];
b@1481 4224 tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
b@1481 4225
b@1481 4226 // Remove matching events
b@1481 4227 origCount = j = handlers.length;
b@1481 4228 while ( j-- ) {
b@1481 4229 handleObj = handlers[ j ];
b@1481 4230
b@1481 4231 if ( ( mappedTypes || origType === handleObj.origType ) &&
b@1481 4232 ( !handler || handler.guid === handleObj.guid ) &&
b@1481 4233 ( !tmp || tmp.test( handleObj.namespace ) ) &&
b@1481 4234 ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
b@1481 4235 handlers.splice( j, 1 );
b@1481 4236
b@1481 4237 if ( handleObj.selector ) {
b@1481 4238 handlers.delegateCount--;
b@1481 4239 }
b@1481 4240 if ( special.remove ) {
b@1481 4241 special.remove.call( elem, handleObj );
b@1481 4242 }
b@1481 4243 }
b@1481 4244 }
b@1481 4245
b@1481 4246 // Remove generic event handler if we removed something and no more handlers exist
b@1481 4247 // (avoids potential for endless recursion during removal of special event handlers)
b@1481 4248 if ( origCount && !handlers.length ) {
b@1481 4249 if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
b@1481 4250 jQuery.removeEvent( elem, type, elemData.handle );
b@1481 4251 }
b@1481 4252
b@1481 4253 delete events[ type ];
b@1481 4254 }
b@1481 4255 }
b@1481 4256
b@1481 4257 // Remove the expando if it's no longer used
b@1481 4258 if ( jQuery.isEmptyObject( events ) ) {
b@1481 4259 delete elemData.handle;
b@1481 4260 data_priv.remove( elem, "events" );
b@1481 4261 }
b@1481 4262 },
b@1481 4263
b@1481 4264 trigger: function( event, data, elem, onlyHandlers ) {
b@1481 4265
b@1481 4266 var i, cur, tmp, bubbleType, ontype, handle, special,
b@1481 4267 eventPath = [ elem || document ],
b@1481 4268 type = hasOwn.call( event, "type" ) ? event.type : event,
b@1481 4269 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
b@1481 4270
b@1481 4271 cur = tmp = elem = elem || document;
b@1481 4272
b@1481 4273 // Don't do events on text and comment nodes
b@1481 4274 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
b@1481 4275 return;
b@1481 4276 }
b@1481 4277
b@1481 4278 // focus/blur morphs to focusin/out; ensure we're not firing them right now
b@1481 4279 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
b@1481 4280 return;
b@1481 4281 }
b@1481 4282
b@1481 4283 if ( type.indexOf(".") >= 0 ) {
b@1481 4284 // Namespaced trigger; create a regexp to match event type in handle()
b@1481 4285 namespaces = type.split(".");
b@1481 4286 type = namespaces.shift();
b@1481 4287 namespaces.sort();
b@1481 4288 }
b@1481 4289 ontype = type.indexOf(":") < 0 && "on" + type;
b@1481 4290
b@1481 4291 // Caller can pass in a jQuery.Event object, Object, or just an event type string
b@1481 4292 event = event[ jQuery.expando ] ?
b@1481 4293 event :
b@1481 4294 new jQuery.Event( type, typeof event === "object" && event );
b@1481 4295
b@1481 4296 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
b@1481 4297 event.isTrigger = onlyHandlers ? 2 : 3;
b@1481 4298 event.namespace = namespaces.join(".");
b@1481 4299 event.namespace_re = event.namespace ?
b@1481 4300 new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
b@1481 4301 null;
b@1481 4302
b@1481 4303 // Clean up the event in case it is being reused
b@1481 4304 event.result = undefined;
b@1481 4305 if ( !event.target ) {
b@1481 4306 event.target = elem;
b@1481 4307 }
b@1481 4308
b@1481 4309 // Clone any incoming data and prepend the event, creating the handler arg list
b@1481 4310 data = data == null ?
b@1481 4311 [ event ] :
b@1481 4312 jQuery.makeArray( data, [ event ] );
b@1481 4313
b@1481 4314 // Allow special events to draw outside the lines
b@1481 4315 special = jQuery.event.special[ type ] || {};
b@1481 4316 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
b@1481 4317 return;
b@1481 4318 }
b@1481 4319
b@1481 4320 // Determine event propagation path in advance, per W3C events spec (#9951)
b@1481 4321 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
b@1481 4322 if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
b@1481 4323
b@1481 4324 bubbleType = special.delegateType || type;
b@1481 4325 if ( !rfocusMorph.test( bubbleType + type ) ) {
b@1481 4326 cur = cur.parentNode;
b@1481 4327 }
b@1481 4328 for ( ; cur; cur = cur.parentNode ) {
b@1481 4329 eventPath.push( cur );
b@1481 4330 tmp = cur;
b@1481 4331 }
b@1481 4332
b@1481 4333 // Only add window if we got to document (e.g., not plain obj or detached DOM)
b@1481 4334 if ( tmp === (elem.ownerDocument || document) ) {
b@1481 4335 eventPath.push( tmp.defaultView || tmp.parentWindow || window );
b@1481 4336 }
b@1481 4337 }
b@1481 4338
b@1481 4339 // Fire handlers on the event path
b@1481 4340 i = 0;
b@1481 4341 while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
b@1481 4342
b@1481 4343 event.type = i > 1 ?
b@1481 4344 bubbleType :
b@1481 4345 special.bindType || type;
b@1481 4346
b@1481 4347 // jQuery handler
b@1481 4348 handle = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( cur, "handle" );
b@1481 4349 if ( handle ) {
b@1481 4350 handle.apply( cur, data );
b@1481 4351 }
b@1481 4352
b@1481 4353 // Native handler
b@1481 4354 handle = ontype && cur[ ontype ];
b@1481 4355 if ( handle && handle.apply && jQuery.acceptData( cur ) ) {
b@1481 4356 event.result = handle.apply( cur, data );
b@1481 4357 if ( event.result === false ) {
b@1481 4358 event.preventDefault();
b@1481 4359 }
b@1481 4360 }
b@1481 4361 }
b@1481 4362 event.type = type;
b@1481 4363
b@1481 4364 // If nobody prevented the default action, do it now
b@1481 4365 if ( !onlyHandlers && !event.isDefaultPrevented() ) {
b@1481 4366
b@1481 4367 if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&
b@1481 4368 jQuery.acceptData( elem ) ) {
b@1481 4369
b@1481 4370 // Call a native DOM method on the target with the same name name as the event.
b@1481 4371 // Don't do default actions on window, that's where global variables be (#6170)
b@1481 4372 if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
b@1481 4373
b@1481 4374 // Don't re-trigger an onFOO event when we call its FOO() method
b@1481 4375 tmp = elem[ ontype ];
b@1481 4376
b@1481 4377 if ( tmp ) {
b@1481 4378 elem[ ontype ] = null;
b@1481 4379 }
b@1481 4380
b@1481 4381 // Prevent re-triggering of the same event, since we already bubbled it above
b@1481 4382 jQuery.event.triggered = type;
b@1481 4383 elem[ type ]();
b@1481 4384 jQuery.event.triggered = undefined;
b@1481 4385
b@1481 4386 if ( tmp ) {
b@1481 4387 elem[ ontype ] = tmp;
b@1481 4388 }
b@1481 4389 }
b@1481 4390 }
b@1481 4391 }
b@1481 4392
b@1481 4393 return event.result;
b@1481 4394 },
b@1481 4395
b@1481 4396 dispatch: function( event ) {
b@1481 4397
b@1481 4398 // Make a writable jQuery.Event from the native event object
b@1481 4399 event = jQuery.event.fix( event );
b@1481 4400
b@1481 4401 var i, j, ret, matched, handleObj,
b@1481 4402 handlerQueue = [],
b@1481 4403 args = slice.call( arguments ),
b@1481 4404 handlers = ( data_priv.get( this, "events" ) || {} )[ event.type ] || [],
b@1481 4405 special = jQuery.event.special[ event.type ] || {};
b@1481 4406
b@1481 4407 // Use the fix-ed jQuery.Event rather than the (read-only) native event
b@1481 4408 args[0] = event;
b@1481 4409 event.delegateTarget = this;
b@1481 4410
b@1481 4411 // Call the preDispatch hook for the mapped type, and let it bail if desired
b@1481 4412 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
b@1481 4413 return;
b@1481 4414 }
b@1481 4415
b@1481 4416 // Determine handlers
b@1481 4417 handlerQueue = jQuery.event.handlers.call( this, event, handlers );
b@1481 4418
b@1481 4419 // Run delegates first; they may want to stop propagation beneath us
b@1481 4420 i = 0;
b@1481 4421 while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
b@1481 4422 event.currentTarget = matched.elem;
b@1481 4423
b@1481 4424 j = 0;
b@1481 4425 while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
b@1481 4426
b@1481 4427 // Triggered event must either 1) have no namespace, or 2) have namespace(s)
b@1481 4428 // a subset or equal to those in the bound event (both can have no namespace).
b@1481 4429 if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
b@1481 4430
b@1481 4431 event.handleObj = handleObj;
b@1481 4432 event.data = handleObj.data;
b@1481 4433
b@1481 4434 ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
b@1481 4435 .apply( matched.elem, args );
b@1481 4436
b@1481 4437 if ( ret !== undefined ) {
b@1481 4438 if ( (event.result = ret) === false ) {
b@1481 4439 event.preventDefault();
b@1481 4440 event.stopPropagation();
b@1481 4441 }
b@1481 4442 }
b@1481 4443 }
b@1481 4444 }
b@1481 4445 }
b@1481 4446
b@1481 4447 // Call the postDispatch hook for the mapped type
b@1481 4448 if ( special.postDispatch ) {
b@1481 4449 special.postDispatch.call( this, event );
b@1481 4450 }
b@1481 4451
b@1481 4452 return event.result;
b@1481 4453 },
b@1481 4454
b@1481 4455 handlers: function( event, handlers ) {
b@1481 4456 var i, matches, sel, handleObj,
b@1481 4457 handlerQueue = [],
b@1481 4458 delegateCount = handlers.delegateCount,
b@1481 4459 cur = event.target;
b@1481 4460
b@1481 4461 // Find delegate handlers
b@1481 4462 // Black-hole SVG <use> instance trees (#13180)
b@1481 4463 // Avoid non-left-click bubbling in Firefox (#3861)
b@1481 4464 if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
b@1481 4465
b@1481 4466 for ( ; cur !== this; cur = cur.parentNode || this ) {
b@1481 4467
b@1481 4468 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
b@1481 4469 if ( cur.disabled !== true || event.type !== "click" ) {
b@1481 4470 matches = [];
b@1481 4471 for ( i = 0; i < delegateCount; i++ ) {
b@1481 4472 handleObj = handlers[ i ];
b@1481 4473
b@1481 4474 // Don't conflict with Object.prototype properties (#13203)
b@1481 4475 sel = handleObj.selector + " ";
b@1481 4476
b@1481 4477 if ( matches[ sel ] === undefined ) {
b@1481 4478 matches[ sel ] = handleObj.needsContext ?
b@1481 4479 jQuery( sel, this ).index( cur ) >= 0 :
b@1481 4480 jQuery.find( sel, this, null, [ cur ] ).length;
b@1481 4481 }
b@1481 4482 if ( matches[ sel ] ) {
b@1481 4483 matches.push( handleObj );
b@1481 4484 }
b@1481 4485 }
b@1481 4486 if ( matches.length ) {
b@1481 4487 handlerQueue.push({ elem: cur, handlers: matches });
b@1481 4488 }
b@1481 4489 }
b@1481 4490 }
b@1481 4491 }
b@1481 4492
b@1481 4493 // Add the remaining (directly-bound) handlers
b@1481 4494 if ( delegateCount < handlers.length ) {
b@1481 4495 handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
b@1481 4496 }
b@1481 4497
b@1481 4498 return handlerQueue;
b@1481 4499 },
b@1481 4500
b@1481 4501 // Includes some event props shared by KeyEvent and MouseEvent
b@1481 4502 props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
b@1481 4503
b@1481 4504 fixHooks: {},
b@1481 4505
b@1481 4506 keyHooks: {
b@1481 4507 props: "char charCode key keyCode".split(" "),
b@1481 4508 filter: function( event, original ) {
b@1481 4509
b@1481 4510 // Add which for key events
b@1481 4511 if ( event.which == null ) {
b@1481 4512 event.which = original.charCode != null ? original.charCode : original.keyCode;
b@1481 4513 }
b@1481 4514
b@1481 4515 return event;
b@1481 4516 }
b@1481 4517 },
b@1481 4518
b@1481 4519 mouseHooks: {
b@1481 4520 props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
b@1481 4521 filter: function( event, original ) {
b@1481 4522 var eventDoc, doc, body,
b@1481 4523 button = original.button;
b@1481 4524
b@1481 4525 // Calculate pageX/Y if missing and clientX/Y available
b@1481 4526 if ( event.pageX == null && original.clientX != null ) {
b@1481 4527 eventDoc = event.target.ownerDocument || document;
b@1481 4528 doc = eventDoc.documentElement;
b@1481 4529 body = eventDoc.body;
b@1481 4530
b@1481 4531 event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
b@1481 4532 event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
b@1481 4533 }
b@1481 4534
b@1481 4535 // Add which for click: 1 === left; 2 === middle; 3 === right
b@1481 4536 // Note: button is not normalized, so don't use it
b@1481 4537 if ( !event.which && button !== undefined ) {
b@1481 4538 event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
b@1481 4539 }
b@1481 4540
b@1481 4541 return event;
b@1481 4542 }
b@1481 4543 },
b@1481 4544
b@1481 4545 fix: function( event ) {
b@1481 4546 if ( event[ jQuery.expando ] ) {
b@1481 4547 return event;
b@1481 4548 }
b@1481 4549
b@1481 4550 // Create a writable copy of the event object and normalize some properties
b@1481 4551 var i, prop, copy,
b@1481 4552 type = event.type,
b@1481 4553 originalEvent = event,
b@1481 4554 fixHook = this.fixHooks[ type ];
b@1481 4555
b@1481 4556 if ( !fixHook ) {
b@1481 4557 this.fixHooks[ type ] = fixHook =
b@1481 4558 rmouseEvent.test( type ) ? this.mouseHooks :
b@1481 4559 rkeyEvent.test( type ) ? this.keyHooks :
b@1481 4560 {};
b@1481 4561 }
b@1481 4562 copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
b@1481 4563
b@1481 4564 event = new jQuery.Event( originalEvent );
b@1481 4565
b@1481 4566 i = copy.length;
b@1481 4567 while ( i-- ) {
b@1481 4568 prop = copy[ i ];
b@1481 4569 event[ prop ] = originalEvent[ prop ];
b@1481 4570 }
b@1481 4571
b@1481 4572 // Support: Cordova 2.5 (WebKit) (#13255)
b@1481 4573 // All events should have a target; Cordova deviceready doesn't
b@1481 4574 if ( !event.target ) {
b@1481 4575 event.target = document;
b@1481 4576 }
b@1481 4577
b@1481 4578 // Support: Safari 6.0+, Chrome<28
b@1481 4579 // Target should not be a text node (#504, #13143)
b@1481 4580 if ( event.target.nodeType === 3 ) {
b@1481 4581 event.target = event.target.parentNode;
b@1481 4582 }
b@1481 4583
b@1481 4584 return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
b@1481 4585 },
b@1481 4586
b@1481 4587 special: {
b@1481 4588 load: {
b@1481 4589 // Prevent triggered image.load events from bubbling to window.load
b@1481 4590 noBubble: true
b@1481 4591 },
b@1481 4592 focus: {
b@1481 4593 // Fire native event if possible so blur/focus sequence is correct
b@1481 4594 trigger: function() {
b@1481 4595 if ( this !== safeActiveElement() && this.focus ) {
b@1481 4596 this.focus();
b@1481 4597 return false;
b@1481 4598 }
b@1481 4599 },
b@1481 4600 delegateType: "focusin"
b@1481 4601 },
b@1481 4602 blur: {
b@1481 4603 trigger: function() {
b@1481 4604 if ( this === safeActiveElement() && this.blur ) {
b@1481 4605 this.blur();
b@1481 4606 return false;
b@1481 4607 }
b@1481 4608 },
b@1481 4609 delegateType: "focusout"
b@1481 4610 },
b@1481 4611 click: {
b@1481 4612 // For checkbox, fire native event so checked state will be right
b@1481 4613 trigger: function() {
b@1481 4614 if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
b@1481 4615 this.click();
b@1481 4616 return false;
b@1481 4617 }
b@1481 4618 },
b@1481 4619
b@1481 4620 // For cross-browser consistency, don't fire native .click() on links
b@1481 4621 _default: function( event ) {
b@1481 4622 return jQuery.nodeName( event.target, "a" );
b@1481 4623 }
b@1481 4624 },
b@1481 4625
b@1481 4626 beforeunload: {
b@1481 4627 postDispatch: function( event ) {
b@1481 4628
b@1481 4629 // Support: Firefox 20+
b@1481 4630 // Firefox doesn't alert if the returnValue field is not set.
b@1481 4631 if ( event.result !== undefined && event.originalEvent ) {
b@1481 4632 event.originalEvent.returnValue = event.result;
b@1481 4633 }
b@1481 4634 }
b@1481 4635 }
b@1481 4636 },
b@1481 4637
b@1481 4638 simulate: function( type, elem, event, bubble ) {
b@1481 4639 // Piggyback on a donor event to simulate a different one.
b@1481 4640 // Fake originalEvent to avoid donor's stopPropagation, but if the
b@1481 4641 // simulated event prevents default then we do the same on the donor.
b@1481 4642 var e = jQuery.extend(
b@1481 4643 new jQuery.Event(),
b@1481 4644 event,
b@1481 4645 {
b@1481 4646 type: type,
b@1481 4647 isSimulated: true,
b@1481 4648 originalEvent: {}
b@1481 4649 }
b@1481 4650 );
b@1481 4651 if ( bubble ) {
b@1481 4652 jQuery.event.trigger( e, null, elem );
b@1481 4653 } else {
b@1481 4654 jQuery.event.dispatch.call( elem, e );
b@1481 4655 }
b@1481 4656 if ( e.isDefaultPrevented() ) {
b@1481 4657 event.preventDefault();
b@1481 4658 }
b@1481 4659 }
b@1481 4660 };
b@1481 4661
b@1481 4662 jQuery.removeEvent = function( elem, type, handle ) {
b@1481 4663 if ( elem.removeEventListener ) {
b@1481 4664 elem.removeEventListener( type, handle, false );
b@1481 4665 }
b@1481 4666 };
b@1481 4667
b@1481 4668 jQuery.Event = function( src, props ) {
b@1481 4669 // Allow instantiation without the 'new' keyword
b@1481 4670 if ( !(this instanceof jQuery.Event) ) {
b@1481 4671 return new jQuery.Event( src, props );
b@1481 4672 }
b@1481 4673
b@1481 4674 // Event object
b@1481 4675 if ( src && src.type ) {
b@1481 4676 this.originalEvent = src;
b@1481 4677 this.type = src.type;
b@1481 4678
b@1481 4679 // Events bubbling up the document may have been marked as prevented
b@1481 4680 // by a handler lower down the tree; reflect the correct value.
b@1481 4681 this.isDefaultPrevented = src.defaultPrevented ||
b@1481 4682 src.defaultPrevented === undefined &&
b@1481 4683 // Support: Android<4.0
b@1481 4684 src.returnValue === false ?
b@1481 4685 returnTrue :
b@1481 4686 returnFalse;
b@1481 4687
b@1481 4688 // Event type
b@1481 4689 } else {
b@1481 4690 this.type = src;
b@1481 4691 }
b@1481 4692
b@1481 4693 // Put explicitly provided properties onto the event object
b@1481 4694 if ( props ) {
b@1481 4695 jQuery.extend( this, props );
b@1481 4696 }
b@1481 4697
b@1481 4698 // Create a timestamp if incoming event doesn't have one
b@1481 4699 this.timeStamp = src && src.timeStamp || jQuery.now();
b@1481 4700
b@1481 4701 // Mark it as fixed
b@1481 4702 this[ jQuery.expando ] = true;
b@1481 4703 };
b@1481 4704
b@1481 4705 // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
b@1481 4706 // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
b@1481 4707 jQuery.Event.prototype = {
b@1481 4708 isDefaultPrevented: returnFalse,
b@1481 4709 isPropagationStopped: returnFalse,
b@1481 4710 isImmediatePropagationStopped: returnFalse,
b@1481 4711
b@1481 4712 preventDefault: function() {
b@1481 4713 var e = this.originalEvent;
b@1481 4714
b@1481 4715 this.isDefaultPrevented = returnTrue;
b@1481 4716
b@1481 4717 if ( e && e.preventDefault ) {
b@1481 4718 e.preventDefault();
b@1481 4719 }
b@1481 4720 },
b@1481 4721 stopPropagation: function() {
b@1481 4722 var e = this.originalEvent;
b@1481 4723
b@1481 4724 this.isPropagationStopped = returnTrue;
b@1481 4725
b@1481 4726 if ( e && e.stopPropagation ) {
b@1481 4727 e.stopPropagation();
b@1481 4728 }
b@1481 4729 },
b@1481 4730 stopImmediatePropagation: function() {
b@1481 4731 var e = this.originalEvent;
b@1481 4732
b@1481 4733 this.isImmediatePropagationStopped = returnTrue;
b@1481 4734
b@1481 4735 if ( e && e.stopImmediatePropagation ) {
b@1481 4736 e.stopImmediatePropagation();
b@1481 4737 }
b@1481 4738
b@1481 4739 this.stopPropagation();
b@1481 4740 }
b@1481 4741 };
b@1481 4742
b@1481 4743 // Create mouseenter/leave events using mouseover/out and event-time checks
b@1481 4744 // Support: Chrome 15+
b@1481 4745 jQuery.each({
b@1481 4746 mouseenter: "mouseover",
b@1481 4747 mouseleave: "mouseout",
b@1481 4748 pointerenter: "pointerover",
b@1481 4749 pointerleave: "pointerout"
b@1481 4750 }, function( orig, fix ) {
b@1481 4751 jQuery.event.special[ orig ] = {
b@1481 4752 delegateType: fix,
b@1481 4753 bindType: fix,
b@1481 4754
b@1481 4755 handle: function( event ) {
b@1481 4756 var ret,
b@1481 4757 target = this,
b@1481 4758 related = event.relatedTarget,
b@1481 4759 handleObj = event.handleObj;
b@1481 4760
b@1481 4761 // For mousenter/leave call the handler if related is outside the target.
b@1481 4762 // NB: No relatedTarget if the mouse left/entered the browser window
b@1481 4763 if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
b@1481 4764 event.type = handleObj.origType;
b@1481 4765 ret = handleObj.handler.apply( this, arguments );
b@1481 4766 event.type = fix;
b@1481 4767 }
b@1481 4768 return ret;
b@1481 4769 }
b@1481 4770 };
b@1481 4771 });
b@1481 4772
b@1481 4773 // Support: Firefox, Chrome, Safari
b@1481 4774 // Create "bubbling" focus and blur events
b@1481 4775 if ( !support.focusinBubbles ) {
b@1481 4776 jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
b@1481 4777
b@1481 4778 // Attach a single capturing handler on the document while someone wants focusin/focusout
b@1481 4779 var handler = function( event ) {
b@1481 4780 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
b@1481 4781 };
b@1481 4782
b@1481 4783 jQuery.event.special[ fix ] = {
b@1481 4784 setup: function() {
b@1481 4785 var doc = this.ownerDocument || this,
b@1481 4786 attaches = data_priv.access( doc, fix );
b@1481 4787
b@1481 4788 if ( !attaches ) {
b@1481 4789 doc.addEventListener( orig, handler, true );
b@1481 4790 }
b@1481 4791 data_priv.access( doc, fix, ( attaches || 0 ) + 1 );
b@1481 4792 },
b@1481 4793 teardown: function() {
b@1481 4794 var doc = this.ownerDocument || this,
b@1481 4795 attaches = data_priv.access( doc, fix ) - 1;
b@1481 4796
b@1481 4797 if ( !attaches ) {
b@1481 4798 doc.removeEventListener( orig, handler, true );
b@1481 4799 data_priv.remove( doc, fix );
b@1481 4800
b@1481 4801 } else {
b@1481 4802 data_priv.access( doc, fix, attaches );
b@1481 4803 }
b@1481 4804 }
b@1481 4805 };
b@1481 4806 });
b@1481 4807 }
b@1481 4808
b@1481 4809 jQuery.fn.extend({
b@1481 4810
b@1481 4811 on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
b@1481 4812 var origFn, type;
b@1481 4813
b@1481 4814 // Types can be a map of types/handlers
b@1481 4815 if ( typeof types === "object" ) {
b@1481 4816 // ( types-Object, selector, data )
b@1481 4817 if ( typeof selector !== "string" ) {
b@1481 4818 // ( types-Object, data )
b@1481 4819 data = data || selector;
b@1481 4820 selector = undefined;
b@1481 4821 }
b@1481 4822 for ( type in types ) {
b@1481 4823 this.on( type, selector, data, types[ type ], one );
b@1481 4824 }
b@1481 4825 return this;
b@1481 4826 }
b@1481 4827
b@1481 4828 if ( data == null && fn == null ) {
b@1481 4829 // ( types, fn )
b@1481 4830 fn = selector;
b@1481 4831 data = selector = undefined;
b@1481 4832 } else if ( fn == null ) {
b@1481 4833 if ( typeof selector === "string" ) {
b@1481 4834 // ( types, selector, fn )
b@1481 4835 fn = data;
b@1481 4836 data = undefined;
b@1481 4837 } else {
b@1481 4838 // ( types, data, fn )
b@1481 4839 fn = data;
b@1481 4840 data = selector;
b@1481 4841 selector = undefined;
b@1481 4842 }
b@1481 4843 }
b@1481 4844 if ( fn === false ) {
b@1481 4845 fn = returnFalse;
b@1481 4846 } else if ( !fn ) {
b@1481 4847 return this;
b@1481 4848 }
b@1481 4849
b@1481 4850 if ( one === 1 ) {
b@1481 4851 origFn = fn;
b@1481 4852 fn = function( event ) {
b@1481 4853 // Can use an empty set, since event contains the info
b@1481 4854 jQuery().off( event );
b@1481 4855 return origFn.apply( this, arguments );
b@1481 4856 };
b@1481 4857 // Use same guid so caller can remove using origFn
b@1481 4858 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
b@1481 4859 }
b@1481 4860 return this.each( function() {
b@1481 4861 jQuery.event.add( this, types, fn, data, selector );
b@1481 4862 });
b@1481 4863 },
b@1481 4864 one: function( types, selector, data, fn ) {
b@1481 4865 return this.on( types, selector, data, fn, 1 );
b@1481 4866 },
b@1481 4867 off: function( types, selector, fn ) {
b@1481 4868 var handleObj, type;
b@1481 4869 if ( types && types.preventDefault && types.handleObj ) {
b@1481 4870 // ( event ) dispatched jQuery.Event
b@1481 4871 handleObj = types.handleObj;
b@1481 4872 jQuery( types.delegateTarget ).off(
b@1481 4873 handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
b@1481 4874 handleObj.selector,
b@1481 4875 handleObj.handler
b@1481 4876 );
b@1481 4877 return this;
b@1481 4878 }
b@1481 4879 if ( typeof types === "object" ) {
b@1481 4880 // ( types-object [, selector] )
b@1481 4881 for ( type in types ) {
b@1481 4882 this.off( type, selector, types[ type ] );
b@1481 4883 }
b@1481 4884 return this;
b@1481 4885 }
b@1481 4886 if ( selector === false || typeof selector === "function" ) {
b@1481 4887 // ( types [, fn] )
b@1481 4888 fn = selector;
b@1481 4889 selector = undefined;
b@1481 4890 }
b@1481 4891 if ( fn === false ) {
b@1481 4892 fn = returnFalse;
b@1481 4893 }
b@1481 4894 return this.each(function() {
b@1481 4895 jQuery.event.remove( this, types, fn, selector );
b@1481 4896 });
b@1481 4897 },
b@1481 4898
b@1481 4899 trigger: function( type, data ) {
b@1481 4900 return this.each(function() {
b@1481 4901 jQuery.event.trigger( type, data, this );
b@1481 4902 });
b@1481 4903 },
b@1481 4904 triggerHandler: function( type, data ) {
b@1481 4905 var elem = this[0];
b@1481 4906 if ( elem ) {
b@1481 4907 return jQuery.event.trigger( type, data, elem, true );
b@1481 4908 }
b@1481 4909 }
b@1481 4910 });
b@1481 4911
b@1481 4912
b@1481 4913 var
b@1481 4914 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
b@1481 4915 rtagName = /<([\w:]+)/,
b@1481 4916 rhtml = /<|&#?\w+;/,
b@1481 4917 rnoInnerhtml = /<(?:script|style|link)/i,
b@1481 4918 // checked="checked" or checked
b@1481 4919 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
b@1481 4920 rscriptType = /^$|\/(?:java|ecma)script/i,
b@1481 4921 rscriptTypeMasked = /^true\/(.*)/,
b@1481 4922 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
b@1481 4923
b@1481 4924 // We have to close these tags to support XHTML (#13200)
b@1481 4925 wrapMap = {
b@1481 4926
b@1481 4927 // Support: IE9
b@1481 4928 option: [ 1, "<select multiple='multiple'>", "</select>" ],
b@1481 4929
b@1481 4930 thead: [ 1, "<table>", "</table>" ],
b@1481 4931 col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
b@1481 4932 tr: [ 2, "<table><tbody>", "</tbody></table>" ],
b@1481 4933 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
b@1481 4934
b@1481 4935 _default: [ 0, "", "" ]
b@1481 4936 };
b@1481 4937
b@1481 4938 // Support: IE9
b@1481 4939 wrapMap.optgroup = wrapMap.option;
b@1481 4940
b@1481 4941 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
b@1481 4942 wrapMap.th = wrapMap.td;
b@1481 4943
b@1481 4944 // Support: 1.x compatibility
b@1481 4945 // Manipulating tables requires a tbody
b@1481 4946 function manipulationTarget( elem, content ) {
b@1481 4947 return jQuery.nodeName( elem, "table" ) &&
b@1481 4948 jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
b@1481 4949
b@1481 4950 elem.getElementsByTagName("tbody")[0] ||
b@1481 4951 elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
b@1481 4952 elem;
b@1481 4953 }
b@1481 4954
b@1481 4955 // Replace/restore the type attribute of script elements for safe DOM manipulation
b@1481 4956 function disableScript( elem ) {
b@1481 4957 elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
b@1481 4958 return elem;
b@1481 4959 }
b@1481 4960 function restoreScript( elem ) {
b@1481 4961 var match = rscriptTypeMasked.exec( elem.type );
b@1481 4962
b@1481 4963 if ( match ) {
b@1481 4964 elem.type = match[ 1 ];
b@1481 4965 } else {
b@1481 4966 elem.removeAttribute("type");
b@1481 4967 }
b@1481 4968
b@1481 4969 return elem;
b@1481 4970 }
b@1481 4971
b@1481 4972 // Mark scripts as having already been evaluated
b@1481 4973 function setGlobalEval( elems, refElements ) {
b@1481 4974 var i = 0,
b@1481 4975 l = elems.length;
b@1481 4976
b@1481 4977 for ( ; i < l; i++ ) {
b@1481 4978 data_priv.set(
b@1481 4979 elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" )
b@1481 4980 );
b@1481 4981 }
b@1481 4982 }
b@1481 4983
b@1481 4984 function cloneCopyEvent( src, dest ) {
b@1481 4985 var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
b@1481 4986
b@1481 4987 if ( dest.nodeType !== 1 ) {
b@1481 4988 return;
b@1481 4989 }
b@1481 4990
b@1481 4991 // 1. Copy private data: events, handlers, etc.
b@1481 4992 if ( data_priv.hasData( src ) ) {
b@1481 4993 pdataOld = data_priv.access( src );
b@1481 4994 pdataCur = data_priv.set( dest, pdataOld );
b@1481 4995 events = pdataOld.events;
b@1481 4996
b@1481 4997 if ( events ) {
b@1481 4998 delete pdataCur.handle;
b@1481 4999 pdataCur.events = {};
b@1481 5000
b@1481 5001 for ( type in events ) {
b@1481 5002 for ( i = 0, l = events[ type ].length; i < l; i++ ) {
b@1481 5003 jQuery.event.add( dest, type, events[ type ][ i ] );
b@1481 5004 }
b@1481 5005 }
b@1481 5006 }
b@1481 5007 }
b@1481 5008
b@1481 5009 // 2. Copy user data
b@1481 5010 if ( data_user.hasData( src ) ) {
b@1481 5011 udataOld = data_user.access( src );
b@1481 5012 udataCur = jQuery.extend( {}, udataOld );
b@1481 5013
b@1481 5014 data_user.set( dest, udataCur );
b@1481 5015 }
b@1481 5016 }
b@1481 5017
b@1481 5018 function getAll( context, tag ) {
b@1481 5019 var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) :
b@1481 5020 context.querySelectorAll ? context.querySelectorAll( tag || "*" ) :
b@1481 5021 [];
b@1481 5022
b@1481 5023 return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
b@1481 5024 jQuery.merge( [ context ], ret ) :
b@1481 5025 ret;
b@1481 5026 }
b@1481 5027
b@1481 5028 // Fix IE bugs, see support tests
b@1481 5029 function fixInput( src, dest ) {
b@1481 5030 var nodeName = dest.nodeName.toLowerCase();
b@1481 5031
b@1481 5032 // Fails to persist the checked state of a cloned checkbox or radio button.
b@1481 5033 if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
b@1481 5034 dest.checked = src.checked;
b@1481 5035
b@1481 5036 // Fails to return the selected option to the default selected state when cloning options
b@1481 5037 } else if ( nodeName === "input" || nodeName === "textarea" ) {
b@1481 5038 dest.defaultValue = src.defaultValue;
b@1481 5039 }
b@1481 5040 }
b@1481 5041
b@1481 5042 jQuery.extend({
b@1481 5043 clone: function( elem, dataAndEvents, deepDataAndEvents ) {
b@1481 5044 var i, l, srcElements, destElements,
b@1481 5045 clone = elem.cloneNode( true ),
b@1481 5046 inPage = jQuery.contains( elem.ownerDocument, elem );
b@1481 5047
b@1481 5048 // Fix IE cloning issues
b@1481 5049 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
b@1481 5050 !jQuery.isXMLDoc( elem ) ) {
b@1481 5051
b@1481 5052 // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
b@1481 5053 destElements = getAll( clone );
b@1481 5054 srcElements = getAll( elem );
b@1481 5055
b@1481 5056 for ( i = 0, l = srcElements.length; i < l; i++ ) {
b@1481 5057 fixInput( srcElements[ i ], destElements[ i ] );
b@1481 5058 }
b@1481 5059 }
b@1481 5060
b@1481 5061 // Copy the events from the original to the clone
b@1481 5062 if ( dataAndEvents ) {
b@1481 5063 if ( deepDataAndEvents ) {
b@1481 5064 srcElements = srcElements || getAll( elem );
b@1481 5065 destElements = destElements || getAll( clone );
b@1481 5066
b@1481 5067 for ( i = 0, l = srcElements.length; i < l; i++ ) {
b@1481 5068 cloneCopyEvent( srcElements[ i ], destElements[ i ] );
b@1481 5069 }
b@1481 5070 } else {
b@1481 5071 cloneCopyEvent( elem, clone );
b@1481 5072 }
b@1481 5073 }
b@1481 5074
b@1481 5075 // Preserve script evaluation history
b@1481 5076 destElements = getAll( clone, "script" );
b@1481 5077 if ( destElements.length > 0 ) {
b@1481 5078 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
b@1481 5079 }
b@1481 5080
b@1481 5081 // Return the cloned set
b@1481 5082 return clone;
b@1481 5083 },
b@1481 5084
b@1481 5085 buildFragment: function( elems, context, scripts, selection ) {
b@1481 5086 var elem, tmp, tag, wrap, contains, j,
b@1481 5087 fragment = context.createDocumentFragment(),
b@1481 5088 nodes = [],
b@1481 5089 i = 0,
b@1481 5090 l = elems.length;
b@1481 5091
b@1481 5092 for ( ; i < l; i++ ) {
b@1481 5093 elem = elems[ i ];
b@1481 5094
b@1481 5095 if ( elem || elem === 0 ) {
b@1481 5096
b@1481 5097 // Add nodes directly
b@1481 5098 if ( jQuery.type( elem ) === "object" ) {
b@1481 5099 // Support: QtWebKit, PhantomJS
b@1481 5100 // push.apply(_, arraylike) throws on ancient WebKit
b@1481 5101 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
b@1481 5102
b@1481 5103 // Convert non-html into a text node
b@1481 5104 } else if ( !rhtml.test( elem ) ) {
b@1481 5105 nodes.push( context.createTextNode( elem ) );
b@1481 5106
b@1481 5107 // Convert html into DOM nodes
b@1481 5108 } else {
b@1481 5109 tmp = tmp || fragment.appendChild( context.createElement("div") );
b@1481 5110
b@1481 5111 // Deserialize a standard representation
b@1481 5112 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
b@1481 5113 wrap = wrapMap[ tag ] || wrapMap._default;
b@1481 5114 tmp.innerHTML = wrap[ 1 ] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[ 2 ];
b@1481 5115
b@1481 5116 // Descend through wrappers to the right content
b@1481 5117 j = wrap[ 0 ];
b@1481 5118 while ( j-- ) {
b@1481 5119 tmp = tmp.lastChild;
b@1481 5120 }
b@1481 5121
b@1481 5122 // Support: QtWebKit, PhantomJS
b@1481 5123 // push.apply(_, arraylike) throws on ancient WebKit
b@1481 5124 jQuery.merge( nodes, tmp.childNodes );
b@1481 5125
b@1481 5126 // Remember the top-level container
b@1481 5127 tmp = fragment.firstChild;
b@1481 5128
b@1481 5129 // Ensure the created nodes are orphaned (#12392)
b@1481 5130 tmp.textContent = "";
b@1481 5131 }
b@1481 5132 }
b@1481 5133 }
b@1481 5134
b@1481 5135 // Remove wrapper from fragment
b@1481 5136 fragment.textContent = "";
b@1481 5137
b@1481 5138 i = 0;
b@1481 5139 while ( (elem = nodes[ i++ ]) ) {
b@1481 5140
b@1481 5141 // #4087 - If origin and destination elements are the same, and this is
b@1481 5142 // that element, do not do anything
b@1481 5143 if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
b@1481 5144 continue;
b@1481 5145 }
b@1481 5146
b@1481 5147 contains = jQuery.contains( elem.ownerDocument, elem );
b@1481 5148
b@1481 5149 // Append to fragment
b@1481 5150 tmp = getAll( fragment.appendChild( elem ), "script" );
b@1481 5151
b@1481 5152 // Preserve script evaluation history
b@1481 5153 if ( contains ) {
b@1481 5154 setGlobalEval( tmp );
b@1481 5155 }
b@1481 5156
b@1481 5157 // Capture executables
b@1481 5158 if ( scripts ) {
b@1481 5159 j = 0;
b@1481 5160 while ( (elem = tmp[ j++ ]) ) {
b@1481 5161 if ( rscriptType.test( elem.type || "" ) ) {
b@1481 5162 scripts.push( elem );
b@1481 5163 }
b@1481 5164 }
b@1481 5165 }
b@1481 5166 }
b@1481 5167
b@1481 5168 return fragment;
b@1481 5169 },
b@1481 5170
b@1481 5171 cleanData: function( elems ) {
b@1481 5172 var data, elem, type, key,
b@1481 5173 special = jQuery.event.special,
b@1481 5174 i = 0;
b@1481 5175
b@1481 5176 for ( ; (elem = elems[ i ]) !== undefined; i++ ) {
b@1481 5177 if ( jQuery.acceptData( elem ) ) {
b@1481 5178 key = elem[ data_priv.expando ];
b@1481 5179
b@1481 5180 if ( key && (data = data_priv.cache[ key ]) ) {
b@1481 5181 if ( data.events ) {
b@1481 5182 for ( type in data.events ) {
b@1481 5183 if ( special[ type ] ) {
b@1481 5184 jQuery.event.remove( elem, type );
b@1481 5185
b@1481 5186 // This is a shortcut to avoid jQuery.event.remove's overhead
b@1481 5187 } else {
b@1481 5188 jQuery.removeEvent( elem, type, data.handle );
b@1481 5189 }
b@1481 5190 }
b@1481 5191 }
b@1481 5192 if ( data_priv.cache[ key ] ) {
b@1481 5193 // Discard any remaining `private` data
b@1481 5194 delete data_priv.cache[ key ];
b@1481 5195 }
b@1481 5196 }
b@1481 5197 }
b@1481 5198 // Discard any remaining `user` data
b@1481 5199 delete data_user.cache[ elem[ data_user.expando ] ];
b@1481 5200 }
b@1481 5201 }
b@1481 5202 });
b@1481 5203
b@1481 5204 jQuery.fn.extend({
b@1481 5205 text: function( value ) {
b@1481 5206 return access( this, function( value ) {
b@1481 5207 return value === undefined ?
b@1481 5208 jQuery.text( this ) :
b@1481 5209 this.empty().each(function() {
b@1481 5210 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
b@1481 5211 this.textContent = value;
b@1481 5212 }
b@1481 5213 });
b@1481 5214 }, null, value, arguments.length );
b@1481 5215 },
b@1481 5216
b@1481 5217 append: function() {
b@1481 5218 return this.domManip( arguments, function( elem ) {
b@1481 5219 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
b@1481 5220 var target = manipulationTarget( this, elem );
b@1481 5221 target.appendChild( elem );
b@1481 5222 }
b@1481 5223 });
b@1481 5224 },
b@1481 5225
b@1481 5226 prepend: function() {
b@1481 5227 return this.domManip( arguments, function( elem ) {
b@1481 5228 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
b@1481 5229 var target = manipulationTarget( this, elem );
b@1481 5230 target.insertBefore( elem, target.firstChild );
b@1481 5231 }
b@1481 5232 });
b@1481 5233 },
b@1481 5234
b@1481 5235 before: function() {
b@1481 5236 return this.domManip( arguments, function( elem ) {
b@1481 5237 if ( this.parentNode ) {
b@1481 5238 this.parentNode.insertBefore( elem, this );
b@1481 5239 }
b@1481 5240 });
b@1481 5241 },
b@1481 5242
b@1481 5243 after: function() {
b@1481 5244 return this.domManip( arguments, function( elem ) {
b@1481 5245 if ( this.parentNode ) {
b@1481 5246 this.parentNode.insertBefore( elem, this.nextSibling );
b@1481 5247 }
b@1481 5248 });
b@1481 5249 },
b@1481 5250
b@1481 5251 remove: function( selector, keepData /* Internal Use Only */ ) {
b@1481 5252 var elem,
b@1481 5253 elems = selector ? jQuery.filter( selector, this ) : this,
b@1481 5254 i = 0;
b@1481 5255
b@1481 5256 for ( ; (elem = elems[i]) != null; i++ ) {
b@1481 5257 if ( !keepData && elem.nodeType === 1 ) {
b@1481 5258 jQuery.cleanData( getAll( elem ) );
b@1481 5259 }
b@1481 5260
b@1481 5261 if ( elem.parentNode ) {
b@1481 5262 if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
b@1481 5263 setGlobalEval( getAll( elem, "script" ) );
b@1481 5264 }
b@1481 5265 elem.parentNode.removeChild( elem );
b@1481 5266 }
b@1481 5267 }
b@1481 5268
b@1481 5269 return this;
b@1481 5270 },
b@1481 5271
b@1481 5272 empty: function() {
b@1481 5273 var elem,
b@1481 5274 i = 0;
b@1481 5275
b@1481 5276 for ( ; (elem = this[i]) != null; i++ ) {
b@1481 5277 if ( elem.nodeType === 1 ) {
b@1481 5278
b@1481 5279 // Prevent memory leaks
b@1481 5280 jQuery.cleanData( getAll( elem, false ) );
b@1481 5281
b@1481 5282 // Remove any remaining nodes
b@1481 5283 elem.textContent = "";
b@1481 5284 }
b@1481 5285 }
b@1481 5286
b@1481 5287 return this;
b@1481 5288 },
b@1481 5289
b@1481 5290 clone: function( dataAndEvents, deepDataAndEvents ) {
b@1481 5291 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
b@1481 5292 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
b@1481 5293
b@1481 5294 return this.map(function() {
b@1481 5295 return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
b@1481 5296 });
b@1481 5297 },
b@1481 5298
b@1481 5299 html: function( value ) {
b@1481 5300 return access( this, function( value ) {
b@1481 5301 var elem = this[ 0 ] || {},
b@1481 5302 i = 0,
b@1481 5303 l = this.length;
b@1481 5304
b@1481 5305 if ( value === undefined && elem.nodeType === 1 ) {
b@1481 5306 return elem.innerHTML;
b@1481 5307 }
b@1481 5308
b@1481 5309 // See if we can take a shortcut and just use innerHTML
b@1481 5310 if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
b@1481 5311 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
b@1481 5312
b@1481 5313 value = value.replace( rxhtmlTag, "<$1></$2>" );
b@1481 5314
b@1481 5315 try {
b@1481 5316 for ( ; i < l; i++ ) {
b@1481 5317 elem = this[ i ] || {};
b@1481 5318
b@1481 5319 // Remove element nodes and prevent memory leaks
b@1481 5320 if ( elem.nodeType === 1 ) {
b@1481 5321 jQuery.cleanData( getAll( elem, false ) );
b@1481 5322 elem.innerHTML = value;
b@1481 5323 }
b@1481 5324 }
b@1481 5325
b@1481 5326 elem = 0;
b@1481 5327
b@1481 5328 // If using innerHTML throws an exception, use the fallback method
b@1481 5329 } catch( e ) {}
b@1481 5330 }
b@1481 5331
b@1481 5332 if ( elem ) {
b@1481 5333 this.empty().append( value );
b@1481 5334 }
b@1481 5335 }, null, value, arguments.length );
b@1481 5336 },
b@1481 5337
b@1481 5338 replaceWith: function() {
b@1481 5339 var arg = arguments[ 0 ];
b@1481 5340
b@1481 5341 // Make the changes, replacing each context element with the new content
b@1481 5342 this.domManip( arguments, function( elem ) {
b@1481 5343 arg = this.parentNode;
b@1481 5344
b@1481 5345 jQuery.cleanData( getAll( this ) );
b@1481 5346
b@1481 5347 if ( arg ) {
b@1481 5348 arg.replaceChild( elem, this );
b@1481 5349 }
b@1481 5350 });
b@1481 5351
b@1481 5352 // Force removal if there was no new content (e.g., from empty arguments)
b@1481 5353 return arg && (arg.length || arg.nodeType) ? this : this.remove();
b@1481 5354 },
b@1481 5355
b@1481 5356 detach: function( selector ) {
b@1481 5357 return this.remove( selector, true );
b@1481 5358 },
b@1481 5359
b@1481 5360 domManip: function( args, callback ) {
b@1481 5361
b@1481 5362 // Flatten any nested arrays
b@1481 5363 args = concat.apply( [], args );
b@1481 5364
b@1481 5365 var fragment, first, scripts, hasScripts, node, doc,
b@1481 5366 i = 0,
b@1481 5367 l = this.length,
b@1481 5368 set = this,
b@1481 5369 iNoClone = l - 1,
b@1481 5370 value = args[ 0 ],
b@1481 5371 isFunction = jQuery.isFunction( value );
b@1481 5372
b@1481 5373 // We can't cloneNode fragments that contain checked, in WebKit
b@1481 5374 if ( isFunction ||
b@1481 5375 ( l > 1 && typeof value === "string" &&
b@1481 5376 !support.checkClone && rchecked.test( value ) ) ) {
b@1481 5377 return this.each(function( index ) {
b@1481 5378 var self = set.eq( index );
b@1481 5379 if ( isFunction ) {
b@1481 5380 args[ 0 ] = value.call( this, index, self.html() );
b@1481 5381 }
b@1481 5382 self.domManip( args, callback );
b@1481 5383 });
b@1481 5384 }
b@1481 5385
b@1481 5386 if ( l ) {
b@1481 5387 fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
b@1481 5388 first = fragment.firstChild;
b@1481 5389
b@1481 5390 if ( fragment.childNodes.length === 1 ) {
b@1481 5391 fragment = first;
b@1481 5392 }
b@1481 5393
b@1481 5394 if ( first ) {
b@1481 5395 scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
b@1481 5396 hasScripts = scripts.length;
b@1481 5397
b@1481 5398 // Use the original fragment for the last item instead of the first because it can end up
b@1481 5399 // being emptied incorrectly in certain situations (#8070).
b@1481 5400 for ( ; i < l; i++ ) {
b@1481 5401 node = fragment;
b@1481 5402
b@1481 5403 if ( i !== iNoClone ) {
b@1481 5404 node = jQuery.clone( node, true, true );
b@1481 5405
b@1481 5406 // Keep references to cloned scripts for later restoration
b@1481 5407 if ( hasScripts ) {
b@1481 5408 // Support: QtWebKit
b@1481 5409 // jQuery.merge because push.apply(_, arraylike) throws
b@1481 5410 jQuery.merge( scripts, getAll( node, "script" ) );
b@1481 5411 }
b@1481 5412 }
b@1481 5413
b@1481 5414 callback.call( this[ i ], node, i );
b@1481 5415 }
b@1481 5416
b@1481 5417 if ( hasScripts ) {
b@1481 5418 doc = scripts[ scripts.length - 1 ].ownerDocument;
b@1481 5419
b@1481 5420 // Reenable scripts
b@1481 5421 jQuery.map( scripts, restoreScript );
b@1481 5422
b@1481 5423 // Evaluate executable scripts on first document insertion
b@1481 5424 for ( i = 0; i < hasScripts; i++ ) {
b@1481 5425 node = scripts[ i ];
b@1481 5426 if ( rscriptType.test( node.type || "" ) &&
b@1481 5427 !data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
b@1481 5428
b@1481 5429 if ( node.src ) {
b@1481 5430 // Optional AJAX dependency, but won't run scripts if not present
b@1481 5431 if ( jQuery._evalUrl ) {
b@1481 5432 jQuery._evalUrl( node.src );
b@1481 5433 }
b@1481 5434 } else {
b@1481 5435 jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) );
b@1481 5436 }
b@1481 5437 }
b@1481 5438 }
b@1481 5439 }
b@1481 5440 }
b@1481 5441 }
b@1481 5442
b@1481 5443 return this;
b@1481 5444 }
b@1481 5445 });
b@1481 5446
b@1481 5447 jQuery.each({
b@1481 5448 appendTo: "append",
b@1481 5449 prependTo: "prepend",
b@1481 5450 insertBefore: "before",
b@1481 5451 insertAfter: "after",
b@1481 5452 replaceAll: "replaceWith"
b@1481 5453 }, function( name, original ) {
b@1481 5454 jQuery.fn[ name ] = function( selector ) {
b@1481 5455 var elems,
b@1481 5456 ret = [],
b@1481 5457 insert = jQuery( selector ),
b@1481 5458 last = insert.length - 1,
b@1481 5459 i = 0;
b@1481 5460
b@1481 5461 for ( ; i <= last; i++ ) {
b@1481 5462 elems = i === last ? this : this.clone( true );
b@1481 5463 jQuery( insert[ i ] )[ original ]( elems );
b@1481 5464
b@1481 5465 // Support: QtWebKit
b@1481 5466 // .get() because push.apply(_, arraylike) throws
b@1481 5467 push.apply( ret, elems.get() );
b@1481 5468 }
b@1481 5469
b@1481 5470 return this.pushStack( ret );
b@1481 5471 };
b@1481 5472 });
b@1481 5473
b@1481 5474
b@1481 5475 var iframe,
b@1481 5476 elemdisplay = {};
b@1481 5477
b@1481 5478 /**
b@1481 5479 * Retrieve the actual display of a element
b@1481 5480 * @param {String} name nodeName of the element
b@1481 5481 * @param {Object} doc Document object
b@1481 5482 */
b@1481 5483 // Called only from within defaultDisplay
b@1481 5484 function actualDisplay( name, doc ) {
b@1481 5485 var style,
b@1481 5486 elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
b@1481 5487
b@1481 5488 // getDefaultComputedStyle might be reliably used only on attached element
b@1481 5489 display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ?
b@1481 5490
b@1481 5491 // Use of this method is a temporary fix (more like optimization) until something better comes along,
b@1481 5492 // since it was removed from specification and supported only in FF
b@1481 5493 style.display : jQuery.css( elem[ 0 ], "display" );
b@1481 5494
b@1481 5495 // We don't have any data stored on the element,
b@1481 5496 // so use "detach" method as fast way to get rid of the element
b@1481 5497 elem.detach();
b@1481 5498
b@1481 5499 return display;
b@1481 5500 }
b@1481 5501
b@1481 5502 /**
b@1481 5503 * Try to determine the default display value of an element
b@1481 5504 * @param {String} nodeName
b@1481 5505 */
b@1481 5506 function defaultDisplay( nodeName ) {
b@1481 5507 var doc = document,
b@1481 5508 display = elemdisplay[ nodeName ];
b@1481 5509
b@1481 5510 if ( !display ) {
b@1481 5511 display = actualDisplay( nodeName, doc );
b@1481 5512
b@1481 5513 // If the simple way fails, read from inside an iframe
b@1481 5514 if ( display === "none" || !display ) {
b@1481 5515
b@1481 5516 // Use the already-created iframe if possible
b@1481 5517 iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement );
b@1481 5518
b@1481 5519 // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
b@1481 5520 doc = iframe[ 0 ].contentDocument;
b@1481 5521
b@1481 5522 // Support: IE
b@1481 5523 doc.write();
b@1481 5524 doc.close();
b@1481 5525
b@1481 5526 display = actualDisplay( nodeName, doc );
b@1481 5527 iframe.detach();
b@1481 5528 }
b@1481 5529
b@1481 5530 // Store the correct default display
b@1481 5531 elemdisplay[ nodeName ] = display;
b@1481 5532 }
b@1481 5533
b@1481 5534 return display;
b@1481 5535 }
b@1481 5536 var rmargin = (/^margin/);
b@1481 5537
b@1481 5538 var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
b@1481 5539
b@1481 5540 var getStyles = function( elem ) {
b@1481 5541 // Support: IE<=11+, Firefox<=30+ (#15098, #14150)
b@1481 5542 // IE throws on elements created in popups
b@1481 5543 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
b@1481 5544 if ( elem.ownerDocument.defaultView.opener ) {
b@1481 5545 return elem.ownerDocument.defaultView.getComputedStyle( elem, null );
b@1481 5546 }
b@1481 5547
b@1481 5548 return window.getComputedStyle( elem, null );
b@1481 5549 };
b@1481 5550
b@1481 5551
b@1481 5552
b@1481 5553 function curCSS( elem, name, computed ) {
b@1481 5554 var width, minWidth, maxWidth, ret,
b@1481 5555 style = elem.style;
b@1481 5556
b@1481 5557 computed = computed || getStyles( elem );
b@1481 5558
b@1481 5559 // Support: IE9
b@1481 5560 // getPropertyValue is only needed for .css('filter') (#12537)
b@1481 5561 if ( computed ) {
b@1481 5562 ret = computed.getPropertyValue( name ) || computed[ name ];
b@1481 5563 }
b@1481 5564
b@1481 5565 if ( computed ) {
b@1481 5566
b@1481 5567 if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
b@1481 5568 ret = jQuery.style( elem, name );
b@1481 5569 }
b@1481 5570
b@1481 5571 // Support: iOS < 6
b@1481 5572 // A tribute to the "awesome hack by Dean Edwards"
b@1481 5573 // iOS < 6 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
b@1481 5574 // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
b@1481 5575 if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
b@1481 5576
b@1481 5577 // Remember the original values
b@1481 5578 width = style.width;
b@1481 5579 minWidth = style.minWidth;
b@1481 5580 maxWidth = style.maxWidth;
b@1481 5581
b@1481 5582 // Put in the new values to get a computed value out
b@1481 5583 style.minWidth = style.maxWidth = style.width = ret;
b@1481 5584 ret = computed.width;
b@1481 5585
b@1481 5586 // Revert the changed values
b@1481 5587 style.width = width;
b@1481 5588 style.minWidth = minWidth;
b@1481 5589 style.maxWidth = maxWidth;
b@1481 5590 }
b@1481 5591 }
b@1481 5592
b@1481 5593 return ret !== undefined ?
b@1481 5594 // Support: IE
b@1481 5595 // IE returns zIndex value as an integer.
b@1481 5596 ret + "" :
b@1481 5597 ret;
b@1481 5598 }
b@1481 5599
b@1481 5600
b@1481 5601 function addGetHookIf( conditionFn, hookFn ) {
b@1481 5602 // Define the hook, we'll check on the first run if it's really needed.
b@1481 5603 return {
b@1481 5604 get: function() {
b@1481 5605 if ( conditionFn() ) {
b@1481 5606 // Hook not needed (or it's not possible to use it due
b@1481 5607 // to missing dependency), remove it.
b@1481 5608 delete this.get;
b@1481 5609 return;
b@1481 5610 }
b@1481 5611
b@1481 5612 // Hook needed; redefine it so that the support test is not executed again.
b@1481 5613 return (this.get = hookFn).apply( this, arguments );
b@1481 5614 }
b@1481 5615 };
b@1481 5616 }
b@1481 5617
b@1481 5618
b@1481 5619 (function() {
b@1481 5620 var pixelPositionVal, boxSizingReliableVal,
b@1481 5621 docElem = document.documentElement,
b@1481 5622 container = document.createElement( "div" ),
b@1481 5623 div = document.createElement( "div" );
b@1481 5624
b@1481 5625 if ( !div.style ) {
b@1481 5626 return;
b@1481 5627 }
b@1481 5628
b@1481 5629 // Support: IE9-11+
b@1481 5630 // Style of cloned element affects source element cloned (#8908)
b@1481 5631 div.style.backgroundClip = "content-box";
b@1481 5632 div.cloneNode( true ).style.backgroundClip = "";
b@1481 5633 support.clearCloneStyle = div.style.backgroundClip === "content-box";
b@1481 5634
b@1481 5635 container.style.cssText = "border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;" +
b@1481 5636 "position:absolute";
b@1481 5637 container.appendChild( div );
b@1481 5638
b@1481 5639 // Executing both pixelPosition & boxSizingReliable tests require only one layout
b@1481 5640 // so they're executed at the same time to save the second computation.
b@1481 5641 function computePixelPositionAndBoxSizingReliable() {
b@1481 5642 div.style.cssText =
b@1481 5643 // Support: Firefox<29, Android 2.3
b@1481 5644 // Vendor-prefix box-sizing
b@1481 5645 "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
b@1481 5646 "box-sizing:border-box;display:block;margin-top:1%;top:1%;" +
b@1481 5647 "border:1px;padding:1px;width:4px;position:absolute";
b@1481 5648 div.innerHTML = "";
b@1481 5649 docElem.appendChild( container );
b@1481 5650
b@1481 5651 var divStyle = window.getComputedStyle( div, null );
b@1481 5652 pixelPositionVal = divStyle.top !== "1%";
b@1481 5653 boxSizingReliableVal = divStyle.width === "4px";
b@1481 5654
b@1481 5655 docElem.removeChild( container );
b@1481 5656 }
b@1481 5657
b@1481 5658 // Support: node.js jsdom
b@1481 5659 // Don't assume that getComputedStyle is a property of the global object
b@1481 5660 if ( window.getComputedStyle ) {
b@1481 5661 jQuery.extend( support, {
b@1481 5662 pixelPosition: function() {
b@1481 5663
b@1481 5664 // This test is executed only once but we still do memoizing
b@1481 5665 // since we can use the boxSizingReliable pre-computing.
b@1481 5666 // No need to check if the test was already performed, though.
b@1481 5667 computePixelPositionAndBoxSizingReliable();
b@1481 5668 return pixelPositionVal;
b@1481 5669 },
b@1481 5670 boxSizingReliable: function() {
b@1481 5671 if ( boxSizingReliableVal == null ) {
b@1481 5672 computePixelPositionAndBoxSizingReliable();
b@1481 5673 }
b@1481 5674 return boxSizingReliableVal;
b@1481 5675 },
b@1481 5676 reliableMarginRight: function() {
b@1481 5677
b@1481 5678 // Support: Android 2.3
b@1481 5679 // Check if div with explicit width and no margin-right incorrectly
b@1481 5680 // gets computed margin-right based on width of container. (#3333)
b@1481 5681 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
b@1481 5682 // This support function is only executed once so no memoizing is needed.
b@1481 5683 var ret,
b@1481 5684 marginDiv = div.appendChild( document.createElement( "div" ) );
b@1481 5685
b@1481 5686 // Reset CSS: box-sizing; display; margin; border; padding
b@1481 5687 marginDiv.style.cssText = div.style.cssText =
b@1481 5688 // Support: Firefox<29, Android 2.3
b@1481 5689 // Vendor-prefix box-sizing
b@1481 5690 "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
b@1481 5691 "box-sizing:content-box;display:block;margin:0;border:0;padding:0";
b@1481 5692 marginDiv.style.marginRight = marginDiv.style.width = "0";
b@1481 5693 div.style.width = "1px";
b@1481 5694 docElem.appendChild( container );
b@1481 5695
b@1481 5696 ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight );
b@1481 5697
b@1481 5698 docElem.removeChild( container );
b@1481 5699 div.removeChild( marginDiv );
b@1481 5700
b@1481 5701 return ret;
b@1481 5702 }
b@1481 5703 });
b@1481 5704 }
b@1481 5705 })();
b@1481 5706
b@1481 5707
b@1481 5708 // A method for quickly swapping in/out CSS properties to get correct calculations.
b@1481 5709 jQuery.swap = function( elem, options, callback, args ) {
b@1481 5710 var ret, name,
b@1481 5711 old = {};
b@1481 5712
b@1481 5713 // Remember the old values, and insert the new ones
b@1481 5714 for ( name in options ) {
b@1481 5715 old[ name ] = elem.style[ name ];
b@1481 5716 elem.style[ name ] = options[ name ];
b@1481 5717 }
b@1481 5718
b@1481 5719 ret = callback.apply( elem, args || [] );
b@1481 5720
b@1481 5721 // Revert the old values
b@1481 5722 for ( name in options ) {
b@1481 5723 elem.style[ name ] = old[ name ];
b@1481 5724 }
b@1481 5725
b@1481 5726 return ret;
b@1481 5727 };
b@1481 5728
b@1481 5729
b@1481 5730 var
b@1481 5731 // Swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
b@1481 5732 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
b@1481 5733 rdisplayswap = /^(none|table(?!-c[ea]).+)/,
b@1481 5734 rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),
b@1481 5735 rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ),
b@1481 5736
b@1481 5737 cssShow = { position: "absolute", visibility: "hidden", display: "block" },
b@1481 5738 cssNormalTransform = {
b@1481 5739 letterSpacing: "0",
b@1481 5740 fontWeight: "400"
b@1481 5741 },
b@1481 5742
b@1481 5743 cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
b@1481 5744
b@1481 5745 // Return a css property mapped to a potentially vendor prefixed property
b@1481 5746 function vendorPropName( style, name ) {
b@1481 5747
b@1481 5748 // Shortcut for names that are not vendor prefixed
b@1481 5749 if ( name in style ) {
b@1481 5750 return name;
b@1481 5751 }
b@1481 5752
b@1481 5753 // Check for vendor prefixed names
b@1481 5754 var capName = name[0].toUpperCase() + name.slice(1),
b@1481 5755 origName = name,
b@1481 5756 i = cssPrefixes.length;
b@1481 5757
b@1481 5758 while ( i-- ) {
b@1481 5759 name = cssPrefixes[ i ] + capName;
b@1481 5760 if ( name in style ) {
b@1481 5761 return name;
b@1481 5762 }
b@1481 5763 }
b@1481 5764
b@1481 5765 return origName;
b@1481 5766 }
b@1481 5767
b@1481 5768 function setPositiveNumber( elem, value, subtract ) {
b@1481 5769 var matches = rnumsplit.exec( value );
b@1481 5770 return matches ?
b@1481 5771 // Guard against undefined "subtract", e.g., when used as in cssHooks
b@1481 5772 Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
b@1481 5773 value;
b@1481 5774 }
b@1481 5775
b@1481 5776 function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
b@1481 5777 var i = extra === ( isBorderBox ? "border" : "content" ) ?
b@1481 5778 // If we already have the right measurement, avoid augmentation
b@1481 5779 4 :
b@1481 5780 // Otherwise initialize for horizontal or vertical properties
b@1481 5781 name === "width" ? 1 : 0,
b@1481 5782
b@1481 5783 val = 0;
b@1481 5784
b@1481 5785 for ( ; i < 4; i += 2 ) {
b@1481 5786 // Both box models exclude margin, so add it if we want it
b@1481 5787 if ( extra === "margin" ) {
b@1481 5788 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
b@1481 5789 }
b@1481 5790
b@1481 5791 if ( isBorderBox ) {
b@1481 5792 // border-box includes padding, so remove it if we want content
b@1481 5793 if ( extra === "content" ) {
b@1481 5794 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
b@1481 5795 }
b@1481 5796
b@1481 5797 // At this point, extra isn't border nor margin, so remove border
b@1481 5798 if ( extra !== "margin" ) {
b@1481 5799 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
b@1481 5800 }
b@1481 5801 } else {
b@1481 5802 // At this point, extra isn't content, so add padding
b@1481 5803 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
b@1481 5804
b@1481 5805 // At this point, extra isn't content nor padding, so add border
b@1481 5806 if ( extra !== "padding" ) {
b@1481 5807 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
b@1481 5808 }
b@1481 5809 }
b@1481 5810 }
b@1481 5811
b@1481 5812 return val;
b@1481 5813 }
b@1481 5814
b@1481 5815 function getWidthOrHeight( elem, name, extra ) {
b@1481 5816
b@1481 5817 // Start with offset property, which is equivalent to the border-box value
b@1481 5818 var valueIsBorderBox = true,
b@1481 5819 val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
b@1481 5820 styles = getStyles( elem ),
b@1481 5821 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
b@1481 5822
b@1481 5823 // Some non-html elements return undefined for offsetWidth, so check for null/undefined
b@1481 5824 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
b@1481 5825 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
b@1481 5826 if ( val <= 0 || val == null ) {
b@1481 5827 // Fall back to computed then uncomputed css if necessary
b@1481 5828 val = curCSS( elem, name, styles );
b@1481 5829 if ( val < 0 || val == null ) {
b@1481 5830 val = elem.style[ name ];
b@1481 5831 }
b@1481 5832
b@1481 5833 // Computed unit is not pixels. Stop here and return.
b@1481 5834 if ( rnumnonpx.test(val) ) {
b@1481 5835 return val;
b@1481 5836 }
b@1481 5837
b@1481 5838 // Check for style in case a browser which returns unreliable values
b@1481 5839 // for getComputedStyle silently falls back to the reliable elem.style
b@1481 5840 valueIsBorderBox = isBorderBox &&
b@1481 5841 ( support.boxSizingReliable() || val === elem.style[ name ] );
b@1481 5842
b@1481 5843 // Normalize "", auto, and prepare for extra
b@1481 5844 val = parseFloat( val ) || 0;
b@1481 5845 }
b@1481 5846
b@1481 5847 // Use the active box-sizing model to add/subtract irrelevant styles
b@1481 5848 return ( val +
b@1481 5849 augmentWidthOrHeight(
b@1481 5850 elem,
b@1481 5851 name,
b@1481 5852 extra || ( isBorderBox ? "border" : "content" ),
b@1481 5853 valueIsBorderBox,
b@1481 5854 styles
b@1481 5855 )
b@1481 5856 ) + "px";
b@1481 5857 }
b@1481 5858
b@1481 5859 function showHide( elements, show ) {
b@1481 5860 var display, elem, hidden,
b@1481 5861 values = [],
b@1481 5862 index = 0,
b@1481 5863 length = elements.length;
b@1481 5864
b@1481 5865 for ( ; index < length; index++ ) {
b@1481 5866 elem = elements[ index ];
b@1481 5867 if ( !elem.style ) {
b@1481 5868 continue;
b@1481 5869 }
b@1481 5870
b@1481 5871 values[ index ] = data_priv.get( elem, "olddisplay" );
b@1481 5872 display = elem.style.display;
b@1481 5873 if ( show ) {
b@1481 5874 // Reset the inline display of this element to learn if it is
b@1481 5875 // being hidden by cascaded rules or not
b@1481 5876 if ( !values[ index ] && display === "none" ) {
b@1481 5877 elem.style.display = "";
b@1481 5878 }
b@1481 5879
b@1481 5880 // Set elements which have been overridden with display: none
b@1481 5881 // in a stylesheet to whatever the default browser style is
b@1481 5882 // for such an element
b@1481 5883 if ( elem.style.display === "" && isHidden( elem ) ) {
b@1481 5884 values[ index ] = data_priv.access( elem, "olddisplay", defaultDisplay(elem.nodeName) );
b@1481 5885 }
b@1481 5886 } else {
b@1481 5887 hidden = isHidden( elem );
b@1481 5888
b@1481 5889 if ( display !== "none" || !hidden ) {
b@1481 5890 data_priv.set( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
b@1481 5891 }
b@1481 5892 }
b@1481 5893 }
b@1481 5894
b@1481 5895 // Set the display of most of the elements in a second loop
b@1481 5896 // to avoid the constant reflow
b@1481 5897 for ( index = 0; index < length; index++ ) {
b@1481 5898 elem = elements[ index ];
b@1481 5899 if ( !elem.style ) {
b@1481 5900 continue;
b@1481 5901 }
b@1481 5902 if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
b@1481 5903 elem.style.display = show ? values[ index ] || "" : "none";
b@1481 5904 }
b@1481 5905 }
b@1481 5906
b@1481 5907 return elements;
b@1481 5908 }
b@1481 5909
b@1481 5910 jQuery.extend({
b@1481 5911
b@1481 5912 // Add in style property hooks for overriding the default
b@1481 5913 // behavior of getting and setting a style property
b@1481 5914 cssHooks: {
b@1481 5915 opacity: {
b@1481 5916 get: function( elem, computed ) {
b@1481 5917 if ( computed ) {
b@1481 5918
b@1481 5919 // We should always get a number back from opacity
b@1481 5920 var ret = curCSS( elem, "opacity" );
b@1481 5921 return ret === "" ? "1" : ret;
b@1481 5922 }
b@1481 5923 }
b@1481 5924 }
b@1481 5925 },
b@1481 5926
b@1481 5927 // Don't automatically add "px" to these possibly-unitless properties
b@1481 5928 cssNumber: {
b@1481 5929 "columnCount": true,
b@1481 5930 "fillOpacity": true,
b@1481 5931 "flexGrow": true,
b@1481 5932 "flexShrink": true,
b@1481 5933 "fontWeight": true,
b@1481 5934 "lineHeight": true,
b@1481 5935 "opacity": true,
b@1481 5936 "order": true,
b@1481 5937 "orphans": true,
b@1481 5938 "widows": true,
b@1481 5939 "zIndex": true,
b@1481 5940 "zoom": true
b@1481 5941 },
b@1481 5942
b@1481 5943 // Add in properties whose names you wish to fix before
b@1481 5944 // setting or getting the value
b@1481 5945 cssProps: {
b@1481 5946 "float": "cssFloat"
b@1481 5947 },
b@1481 5948
b@1481 5949 // Get and set the style property on a DOM Node
b@1481 5950 style: function( elem, name, value, extra ) {
b@1481 5951
b@1481 5952 // Don't set styles on text and comment nodes
b@1481 5953 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
b@1481 5954 return;
b@1481 5955 }
b@1481 5956
b@1481 5957 // Make sure that we're working with the right name
b@1481 5958 var ret, type, hooks,
b@1481 5959 origName = jQuery.camelCase( name ),
b@1481 5960 style = elem.style;
b@1481 5961
b@1481 5962 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
b@1481 5963
b@1481 5964 // Gets hook for the prefixed version, then unprefixed version
b@1481 5965 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
b@1481 5966
b@1481 5967 // Check if we're setting a value
b@1481 5968 if ( value !== undefined ) {
b@1481 5969 type = typeof value;
b@1481 5970
b@1481 5971 // Convert "+=" or "-=" to relative numbers (#7345)
b@1481 5972 if ( type === "string" && (ret = rrelNum.exec( value )) ) {
b@1481 5973 value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
b@1481 5974 // Fixes bug #9237
b@1481 5975 type = "number";
b@1481 5976 }
b@1481 5977
b@1481 5978 // Make sure that null and NaN values aren't set (#7116)
b@1481 5979 if ( value == null || value !== value ) {
b@1481 5980 return;
b@1481 5981 }
b@1481 5982
b@1481 5983 // If a number, add 'px' to the (except for certain CSS properties)
b@1481 5984 if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
b@1481 5985 value += "px";
b@1481 5986 }
b@1481 5987
b@1481 5988 // Support: IE9-11+
b@1481 5989 // background-* props affect original clone's values
b@1481 5990 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
b@1481 5991 style[ name ] = "inherit";
b@1481 5992 }
b@1481 5993
b@1481 5994 // If a hook was provided, use that value, otherwise just set the specified value
b@1481 5995 if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
b@1481 5996 style[ name ] = value;
b@1481 5997 }
b@1481 5998
b@1481 5999 } else {
b@1481 6000 // If a hook was provided get the non-computed value from there
b@1481 6001 if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
b@1481 6002 return ret;
b@1481 6003 }
b@1481 6004
b@1481 6005 // Otherwise just get the value from the style object
b@1481 6006 return style[ name ];
b@1481 6007 }
b@1481 6008 },
b@1481 6009
b@1481 6010 css: function( elem, name, extra, styles ) {
b@1481 6011 var val, num, hooks,
b@1481 6012 origName = jQuery.camelCase( name );
b@1481 6013
b@1481 6014 // Make sure that we're working with the right name
b@1481 6015 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
b@1481 6016
b@1481 6017 // Try prefixed name followed by the unprefixed name
b@1481 6018 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
b@1481 6019
b@1481 6020 // If a hook was provided get the computed value from there
b@1481 6021 if ( hooks && "get" in hooks ) {
b@1481 6022 val = hooks.get( elem, true, extra );
b@1481 6023 }
b@1481 6024
b@1481 6025 // Otherwise, if a way to get the computed value exists, use that
b@1481 6026 if ( val === undefined ) {
b@1481 6027 val = curCSS( elem, name, styles );
b@1481 6028 }
b@1481 6029
b@1481 6030 // Convert "normal" to computed value
b@1481 6031 if ( val === "normal" && name in cssNormalTransform ) {
b@1481 6032 val = cssNormalTransform[ name ];
b@1481 6033 }
b@1481 6034
b@1481 6035 // Make numeric if forced or a qualifier was provided and val looks numeric
b@1481 6036 if ( extra === "" || extra ) {
b@1481 6037 num = parseFloat( val );
b@1481 6038 return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
b@1481 6039 }
b@1481 6040 return val;
b@1481 6041 }
b@1481 6042 });
b@1481 6043
b@1481 6044 jQuery.each([ "height", "width" ], function( i, name ) {
b@1481 6045 jQuery.cssHooks[ name ] = {
b@1481 6046 get: function( elem, computed, extra ) {
b@1481 6047 if ( computed ) {
b@1481 6048
b@1481 6049 // Certain elements can have dimension info if we invisibly show them
b@1481 6050 // but it must have a current display style that would benefit
b@1481 6051 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ?
b@1481 6052 jQuery.swap( elem, cssShow, function() {
b@1481 6053 return getWidthOrHeight( elem, name, extra );
b@1481 6054 }) :
b@1481 6055 getWidthOrHeight( elem, name, extra );
b@1481 6056 }
b@1481 6057 },
b@1481 6058
b@1481 6059 set: function( elem, value, extra ) {
b@1481 6060 var styles = extra && getStyles( elem );
b@1481 6061 return setPositiveNumber( elem, value, extra ?
b@1481 6062 augmentWidthOrHeight(
b@1481 6063 elem,
b@1481 6064 name,
b@1481 6065 extra,
b@1481 6066 jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
b@1481 6067 styles
b@1481 6068 ) : 0
b@1481 6069 );
b@1481 6070 }
b@1481 6071 };
b@1481 6072 });
b@1481 6073
b@1481 6074 // Support: Android 2.3
b@1481 6075 jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
b@1481 6076 function( elem, computed ) {
b@1481 6077 if ( computed ) {
b@1481 6078 return jQuery.swap( elem, { "display": "inline-block" },
b@1481 6079 curCSS, [ elem, "marginRight" ] );
b@1481 6080 }
b@1481 6081 }
b@1481 6082 );
b@1481 6083
b@1481 6084 // These hooks are used by animate to expand properties
b@1481 6085 jQuery.each({
b@1481 6086 margin: "",
b@1481 6087 padding: "",
b@1481 6088 border: "Width"
b@1481 6089 }, function( prefix, suffix ) {
b@1481 6090 jQuery.cssHooks[ prefix + suffix ] = {
b@1481 6091 expand: function( value ) {
b@1481 6092 var i = 0,
b@1481 6093 expanded = {},
b@1481 6094
b@1481 6095 // Assumes a single number if not a string
b@1481 6096 parts = typeof value === "string" ? value.split(" ") : [ value ];
b@1481 6097
b@1481 6098 for ( ; i < 4; i++ ) {
b@1481 6099 expanded[ prefix + cssExpand[ i ] + suffix ] =
b@1481 6100 parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
b@1481 6101 }
b@1481 6102
b@1481 6103 return expanded;
b@1481 6104 }
b@1481 6105 };
b@1481 6106
b@1481 6107 if ( !rmargin.test( prefix ) ) {
b@1481 6108 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
b@1481 6109 }
b@1481 6110 });
b@1481 6111
b@1481 6112 jQuery.fn.extend({
b@1481 6113 css: function( name, value ) {
b@1481 6114 return access( this, function( elem, name, value ) {
b@1481 6115 var styles, len,
b@1481 6116 map = {},
b@1481 6117 i = 0;
b@1481 6118
b@1481 6119 if ( jQuery.isArray( name ) ) {
b@1481 6120 styles = getStyles( elem );
b@1481 6121 len = name.length;
b@1481 6122
b@1481 6123 for ( ; i < len; i++ ) {
b@1481 6124 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
b@1481 6125 }
b@1481 6126
b@1481 6127 return map;
b@1481 6128 }
b@1481 6129
b@1481 6130 return value !== undefined ?
b@1481 6131 jQuery.style( elem, name, value ) :
b@1481 6132 jQuery.css( elem, name );
b@1481 6133 }, name, value, arguments.length > 1 );
b@1481 6134 },
b@1481 6135 show: function() {
b@1481 6136 return showHide( this, true );
b@1481 6137 },
b@1481 6138 hide: function() {
b@1481 6139 return showHide( this );
b@1481 6140 },
b@1481 6141 toggle: function( state ) {
b@1481 6142 if ( typeof state === "boolean" ) {
b@1481 6143 return state ? this.show() : this.hide();
b@1481 6144 }
b@1481 6145
b@1481 6146 return this.each(function() {
b@1481 6147 if ( isHidden( this ) ) {
b@1481 6148 jQuery( this ).show();
b@1481 6149 } else {
b@1481 6150 jQuery( this ).hide();
b@1481 6151 }
b@1481 6152 });
b@1481 6153 }
b@1481 6154 });
b@1481 6155
b@1481 6156
b@1481 6157 function Tween( elem, options, prop, end, easing ) {
b@1481 6158 return new Tween.prototype.init( elem, options, prop, end, easing );
b@1481 6159 }
b@1481 6160 jQuery.Tween = Tween;
b@1481 6161
b@1481 6162 Tween.prototype = {
b@1481 6163 constructor: Tween,
b@1481 6164 init: function( elem, options, prop, end, easing, unit ) {
b@1481 6165 this.elem = elem;
b@1481 6166 this.prop = prop;
b@1481 6167 this.easing = easing || "swing";
b@1481 6168 this.options = options;
b@1481 6169 this.start = this.now = this.cur();
b@1481 6170 this.end = end;
b@1481 6171 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
b@1481 6172 },
b@1481 6173 cur: function() {
b@1481 6174 var hooks = Tween.propHooks[ this.prop ];
b@1481 6175
b@1481 6176 return hooks && hooks.get ?
b@1481 6177 hooks.get( this ) :
b@1481 6178 Tween.propHooks._default.get( this );
b@1481 6179 },
b@1481 6180 run: function( percent ) {
b@1481 6181 var eased,
b@1481 6182 hooks = Tween.propHooks[ this.prop ];
b@1481 6183
b@1481 6184 if ( this.options.duration ) {
b@1481 6185 this.pos = eased = jQuery.easing[ this.easing ](
b@1481 6186 percent, this.options.duration * percent, 0, 1, this.options.duration
b@1481 6187 );
b@1481 6188 } else {
b@1481 6189 this.pos = eased = percent;
b@1481 6190 }
b@1481 6191 this.now = ( this.end - this.start ) * eased + this.start;
b@1481 6192
b@1481 6193 if ( this.options.step ) {
b@1481 6194 this.options.step.call( this.elem, this.now, this );
b@1481 6195 }
b@1481 6196
b@1481 6197 if ( hooks && hooks.set ) {
b@1481 6198 hooks.set( this );
b@1481 6199 } else {
b@1481 6200 Tween.propHooks._default.set( this );
b@1481 6201 }
b@1481 6202 return this;
b@1481 6203 }
b@1481 6204 };
b@1481 6205
b@1481 6206 Tween.prototype.init.prototype = Tween.prototype;
b@1481 6207
b@1481 6208 Tween.propHooks = {
b@1481 6209 _default: {
b@1481 6210 get: function( tween ) {
b@1481 6211 var result;
b@1481 6212
b@1481 6213 if ( tween.elem[ tween.prop ] != null &&
b@1481 6214 (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
b@1481 6215 return tween.elem[ tween.prop ];
b@1481 6216 }
b@1481 6217
b@1481 6218 // Passing an empty string as a 3rd parameter to .css will automatically
b@1481 6219 // attempt a parseFloat and fallback to a string if the parse fails.
b@1481 6220 // Simple values such as "10px" are parsed to Float;
b@1481 6221 // complex values such as "rotate(1rad)" are returned as-is.
b@1481 6222 result = jQuery.css( tween.elem, tween.prop, "" );
b@1481 6223 // Empty strings, null, undefined and "auto" are converted to 0.
b@1481 6224 return !result || result === "auto" ? 0 : result;
b@1481 6225 },
b@1481 6226 set: function( tween ) {
b@1481 6227 // Use step hook for back compat.
b@1481 6228 // Use cssHook if its there.
b@1481 6229 // Use .style if available and use plain properties where available.
b@1481 6230 if ( jQuery.fx.step[ tween.prop ] ) {
b@1481 6231 jQuery.fx.step[ tween.prop ]( tween );
b@1481 6232 } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
b@1481 6233 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
b@1481 6234 } else {
b@1481 6235 tween.elem[ tween.prop ] = tween.now;
b@1481 6236 }
b@1481 6237 }
b@1481 6238 }
b@1481 6239 };
b@1481 6240
b@1481 6241 // Support: IE9
b@1481 6242 // Panic based approach to setting things on disconnected nodes
b@1481 6243 Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
b@1481 6244 set: function( tween ) {
b@1481 6245 if ( tween.elem.nodeType && tween.elem.parentNode ) {
b@1481 6246 tween.elem[ tween.prop ] = tween.now;
b@1481 6247 }
b@1481 6248 }
b@1481 6249 };
b@1481 6250
b@1481 6251 jQuery.easing = {
b@1481 6252 linear: function( p ) {
b@1481 6253 return p;
b@1481 6254 },
b@1481 6255 swing: function( p ) {
b@1481 6256 return 0.5 - Math.cos( p * Math.PI ) / 2;
b@1481 6257 }
b@1481 6258 };
b@1481 6259
b@1481 6260 jQuery.fx = Tween.prototype.init;
b@1481 6261
b@1481 6262 // Back Compat <1.8 extension point
b@1481 6263 jQuery.fx.step = {};
b@1481 6264
b@1481 6265
b@1481 6266
b@1481 6267
b@1481 6268 var
b@1481 6269 fxNow, timerId,
b@1481 6270 rfxtypes = /^(?:toggle|show|hide)$/,
b@1481 6271 rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ),
b@1481 6272 rrun = /queueHooks$/,
b@1481 6273 animationPrefilters = [ defaultPrefilter ],
b@1481 6274 tweeners = {
b@1481 6275 "*": [ function( prop, value ) {
b@1481 6276 var tween = this.createTween( prop, value ),
b@1481 6277 target = tween.cur(),
b@1481 6278 parts = rfxnum.exec( value ),
b@1481 6279 unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
b@1481 6280
b@1481 6281 // Starting value computation is required for potential unit mismatches
b@1481 6282 start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) &&
b@1481 6283 rfxnum.exec( jQuery.css( tween.elem, prop ) ),
b@1481 6284 scale = 1,
b@1481 6285 maxIterations = 20;
b@1481 6286
b@1481 6287 if ( start && start[ 3 ] !== unit ) {
b@1481 6288 // Trust units reported by jQuery.css
b@1481 6289 unit = unit || start[ 3 ];
b@1481 6290
b@1481 6291 // Make sure we update the tween properties later on
b@1481 6292 parts = parts || [];
b@1481 6293
b@1481 6294 // Iteratively approximate from a nonzero starting point
b@1481 6295 start = +target || 1;
b@1481 6296
b@1481 6297 do {
b@1481 6298 // If previous iteration zeroed out, double until we get *something*.
b@1481 6299 // Use string for doubling so we don't accidentally see scale as unchanged below
b@1481 6300 scale = scale || ".5";
b@1481 6301
b@1481 6302 // Adjust and apply
b@1481 6303 start = start / scale;
b@1481 6304 jQuery.style( tween.elem, prop, start + unit );
b@1481 6305
b@1481 6306 // Update scale, tolerating zero or NaN from tween.cur(),
b@1481 6307 // break the loop if scale is unchanged or perfect, or if we've just had enough
b@1481 6308 } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
b@1481 6309 }
b@1481 6310
b@1481 6311 // Update tween properties
b@1481 6312 if ( parts ) {
b@1481 6313 start = tween.start = +start || +target || 0;
b@1481 6314 tween.unit = unit;
b@1481 6315 // If a +=/-= token was provided, we're doing a relative animation
b@1481 6316 tween.end = parts[ 1 ] ?
b@1481 6317 start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :
b@1481 6318 +parts[ 2 ];
b@1481 6319 }
b@1481 6320
b@1481 6321 return tween;
b@1481 6322 } ]
b@1481 6323 };
b@1481 6324
b@1481 6325 // Animations created synchronously will run synchronously
b@1481 6326 function createFxNow() {
b@1481 6327 setTimeout(function() {
b@1481 6328 fxNow = undefined;
b@1481 6329 });
b@1481 6330 return ( fxNow = jQuery.now() );
b@1481 6331 }
b@1481 6332
b@1481 6333 // Generate parameters to create a standard animation
b@1481 6334 function genFx( type, includeWidth ) {
b@1481 6335 var which,
b@1481 6336 i = 0,
b@1481 6337 attrs = { height: type };
b@1481 6338
b@1481 6339 // If we include width, step value is 1 to do all cssExpand values,
b@1481 6340 // otherwise step value is 2 to skip over Left and Right
b@1481 6341 includeWidth = includeWidth ? 1 : 0;
b@1481 6342 for ( ; i < 4 ; i += 2 - includeWidth ) {
b@1481 6343 which = cssExpand[ i ];
b@1481 6344 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
b@1481 6345 }
b@1481 6346
b@1481 6347 if ( includeWidth ) {
b@1481 6348 attrs.opacity = attrs.width = type;
b@1481 6349 }
b@1481 6350
b@1481 6351 return attrs;
b@1481 6352 }
b@1481 6353
b@1481 6354 function createTween( value, prop, animation ) {
b@1481 6355 var tween,
b@1481 6356 collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
b@1481 6357 index = 0,
b@1481 6358 length = collection.length;
b@1481 6359 for ( ; index < length; index++ ) {
b@1481 6360 if ( (tween = collection[ index ].call( animation, prop, value )) ) {
b@1481 6361
b@1481 6362 // We're done with this property
b@1481 6363 return tween;
b@1481 6364 }
b@1481 6365 }
b@1481 6366 }
b@1481 6367
b@1481 6368 function defaultPrefilter( elem, props, opts ) {
b@1481 6369 /* jshint validthis: true */
b@1481 6370 var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
b@1481 6371 anim = this,
b@1481 6372 orig = {},
b@1481 6373 style = elem.style,
b@1481 6374 hidden = elem.nodeType && isHidden( elem ),
b@1481 6375 dataShow = data_priv.get( elem, "fxshow" );
b@1481 6376
b@1481 6377 // Handle queue: false promises
b@1481 6378 if ( !opts.queue ) {
b@1481 6379 hooks = jQuery._queueHooks( elem, "fx" );
b@1481 6380 if ( hooks.unqueued == null ) {
b@1481 6381 hooks.unqueued = 0;
b@1481 6382 oldfire = hooks.empty.fire;
b@1481 6383 hooks.empty.fire = function() {
b@1481 6384 if ( !hooks.unqueued ) {
b@1481 6385 oldfire();
b@1481 6386 }
b@1481 6387 };
b@1481 6388 }
b@1481 6389 hooks.unqueued++;
b@1481 6390
b@1481 6391 anim.always(function() {
b@1481 6392 // Ensure the complete handler is called before this completes
b@1481 6393 anim.always(function() {
b@1481 6394 hooks.unqueued--;
b@1481 6395 if ( !jQuery.queue( elem, "fx" ).length ) {
b@1481 6396 hooks.empty.fire();
b@1481 6397 }
b@1481 6398 });
b@1481 6399 });
b@1481 6400 }
b@1481 6401
b@1481 6402 // Height/width overflow pass
b@1481 6403 if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
b@1481 6404 // Make sure that nothing sneaks out
b@1481 6405 // Record all 3 overflow attributes because IE9-10 do not
b@1481 6406 // change the overflow attribute when overflowX and
b@1481 6407 // overflowY are set to the same value
b@1481 6408 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
b@1481 6409
b@1481 6410 // Set display property to inline-block for height/width
b@1481 6411 // animations on inline elements that are having width/height animated
b@1481 6412 display = jQuery.css( elem, "display" );
b@1481 6413
b@1481 6414 // Test default display if display is currently "none"
b@1481 6415 checkDisplay = display === "none" ?
b@1481 6416 data_priv.get( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
b@1481 6417
b@1481 6418 if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
b@1481 6419 style.display = "inline-block";
b@1481 6420 }
b@1481 6421 }
b@1481 6422
b@1481 6423 if ( opts.overflow ) {
b@1481 6424 style.overflow = "hidden";
b@1481 6425 anim.always(function() {
b@1481 6426 style.overflow = opts.overflow[ 0 ];
b@1481 6427 style.overflowX = opts.overflow[ 1 ];
b@1481 6428 style.overflowY = opts.overflow[ 2 ];
b@1481 6429 });
b@1481 6430 }
b@1481 6431
b@1481 6432 // show/hide pass
b@1481 6433 for ( prop in props ) {
b@1481 6434 value = props[ prop ];
b@1481 6435 if ( rfxtypes.exec( value ) ) {
b@1481 6436 delete props[ prop ];
b@1481 6437 toggle = toggle || value === "toggle";
b@1481 6438 if ( value === ( hidden ? "hide" : "show" ) ) {
b@1481 6439
b@1481 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@1481 6441 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
b@1481 6442 hidden = true;
b@1481 6443 } else {
b@1481 6444 continue;
b@1481 6445 }
b@1481 6446 }
b@1481 6447 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
b@1481 6448
b@1481 6449 // Any non-fx value stops us from restoring the original display value
b@1481 6450 } else {
b@1481 6451 display = undefined;
b@1481 6452 }
b@1481 6453 }
b@1481 6454
b@1481 6455 if ( !jQuery.isEmptyObject( orig ) ) {
b@1481 6456 if ( dataShow ) {
b@1481 6457 if ( "hidden" in dataShow ) {
b@1481 6458 hidden = dataShow.hidden;
b@1481 6459 }
b@1481 6460 } else {
b@1481 6461 dataShow = data_priv.access( elem, "fxshow", {} );
b@1481 6462 }
b@1481 6463
b@1481 6464 // Store state if its toggle - enables .stop().toggle() to "reverse"
b@1481 6465 if ( toggle ) {
b@1481 6466 dataShow.hidden = !hidden;
b@1481 6467 }
b@1481 6468 if ( hidden ) {
b@1481 6469 jQuery( elem ).show();
b@1481 6470 } else {
b@1481 6471 anim.done(function() {
b@1481 6472 jQuery( elem ).hide();
b@1481 6473 });
b@1481 6474 }
b@1481 6475 anim.done(function() {
b@1481 6476 var prop;
b@1481 6477
b@1481 6478 data_priv.remove( elem, "fxshow" );
b@1481 6479 for ( prop in orig ) {
b@1481 6480 jQuery.style( elem, prop, orig[ prop ] );
b@1481 6481 }
b@1481 6482 });
b@1481 6483 for ( prop in orig ) {
b@1481 6484 tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
b@1481 6485
b@1481 6486 if ( !( prop in dataShow ) ) {
b@1481 6487 dataShow[ prop ] = tween.start;
b@1481 6488 if ( hidden ) {
b@1481 6489 tween.end = tween.start;
b@1481 6490 tween.start = prop === "width" || prop === "height" ? 1 : 0;
b@1481 6491 }
b@1481 6492 }
b@1481 6493 }
b@1481 6494
b@1481 6495 // If this is a noop like .hide().hide(), restore an overwritten display value
b@1481 6496 } else if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" ) {
b@1481 6497 style.display = display;
b@1481 6498 }
b@1481 6499 }
b@1481 6500
b@1481 6501 function propFilter( props, specialEasing ) {
b@1481 6502 var index, name, easing, value, hooks;
b@1481 6503
b@1481 6504 // camelCase, specialEasing and expand cssHook pass
b@1481 6505 for ( index in props ) {
b@1481 6506 name = jQuery.camelCase( index );
b@1481 6507 easing = specialEasing[ name ];
b@1481 6508 value = props[ index ];
b@1481 6509 if ( jQuery.isArray( value ) ) {
b@1481 6510 easing = value[ 1 ];
b@1481 6511 value = props[ index ] = value[ 0 ];
b@1481 6512 }
b@1481 6513
b@1481 6514 if ( index !== name ) {
b@1481 6515 props[ name ] = value;
b@1481 6516 delete props[ index ];
b@1481 6517 }
b@1481 6518
b@1481 6519 hooks = jQuery.cssHooks[ name ];
b@1481 6520 if ( hooks && "expand" in hooks ) {
b@1481 6521 value = hooks.expand( value );
b@1481 6522 delete props[ name ];
b@1481 6523
b@1481 6524 // Not quite $.extend, this won't overwrite existing keys.
b@1481 6525 // Reusing 'index' because we have the correct "name"
b@1481 6526 for ( index in value ) {
b@1481 6527 if ( !( index in props ) ) {
b@1481 6528 props[ index ] = value[ index ];
b@1481 6529 specialEasing[ index ] = easing;
b@1481 6530 }
b@1481 6531 }
b@1481 6532 } else {
b@1481 6533 specialEasing[ name ] = easing;
b@1481 6534 }
b@1481 6535 }
b@1481 6536 }
b@1481 6537
b@1481 6538 function Animation( elem, properties, options ) {
b@1481 6539 var result,
b@1481 6540 stopped,
b@1481 6541 index = 0,
b@1481 6542 length = animationPrefilters.length,
b@1481 6543 deferred = jQuery.Deferred().always( function() {
b@1481 6544 // Don't match elem in the :animated selector
b@1481 6545 delete tick.elem;
b@1481 6546 }),
b@1481 6547 tick = function() {
b@1481 6548 if ( stopped ) {
b@1481 6549 return false;
b@1481 6550 }
b@1481 6551 var currentTime = fxNow || createFxNow(),
b@1481 6552 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
b@1481 6553 // Support: Android 2.3
b@1481 6554 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
b@1481 6555 temp = remaining / animation.duration || 0,
b@1481 6556 percent = 1 - temp,
b@1481 6557 index = 0,
b@1481 6558 length = animation.tweens.length;
b@1481 6559
b@1481 6560 for ( ; index < length ; index++ ) {
b@1481 6561 animation.tweens[ index ].run( percent );
b@1481 6562 }
b@1481 6563
b@1481 6564 deferred.notifyWith( elem, [ animation, percent, remaining ]);
b@1481 6565
b@1481 6566 if ( percent < 1 && length ) {
b@1481 6567 return remaining;
b@1481 6568 } else {
b@1481 6569 deferred.resolveWith( elem, [ animation ] );
b@1481 6570 return false;
b@1481 6571 }
b@1481 6572 },
b@1481 6573 animation = deferred.promise({
b@1481 6574 elem: elem,
b@1481 6575 props: jQuery.extend( {}, properties ),
b@1481 6576 opts: jQuery.extend( true, { specialEasing: {} }, options ),
b@1481 6577 originalProperties: properties,
b@1481 6578 originalOptions: options,
b@1481 6579 startTime: fxNow || createFxNow(),
b@1481 6580 duration: options.duration,
b@1481 6581 tweens: [],
b@1481 6582 createTween: function( prop, end ) {
b@1481 6583 var tween = jQuery.Tween( elem, animation.opts, prop, end,
b@1481 6584 animation.opts.specialEasing[ prop ] || animation.opts.easing );
b@1481 6585 animation.tweens.push( tween );
b@1481 6586 return tween;
b@1481 6587 },
b@1481 6588 stop: function( gotoEnd ) {
b@1481 6589 var index = 0,
b@1481 6590 // If we are going to the end, we want to run all the tweens
b@1481 6591 // otherwise we skip this part
b@1481 6592 length = gotoEnd ? animation.tweens.length : 0;
b@1481 6593 if ( stopped ) {
b@1481 6594 return this;
b@1481 6595 }
b@1481 6596 stopped = true;
b@1481 6597 for ( ; index < length ; index++ ) {
b@1481 6598 animation.tweens[ index ].run( 1 );
b@1481 6599 }
b@1481 6600
b@1481 6601 // Resolve when we played the last frame; otherwise, reject
b@1481 6602 if ( gotoEnd ) {
b@1481 6603 deferred.resolveWith( elem, [ animation, gotoEnd ] );
b@1481 6604 } else {
b@1481 6605 deferred.rejectWith( elem, [ animation, gotoEnd ] );
b@1481 6606 }
b@1481 6607 return this;
b@1481 6608 }
b@1481 6609 }),
b@1481 6610 props = animation.props;
b@1481 6611
b@1481 6612 propFilter( props, animation.opts.specialEasing );
b@1481 6613
b@1481 6614 for ( ; index < length ; index++ ) {
b@1481 6615 result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
b@1481 6616 if ( result ) {
b@1481 6617 return result;
b@1481 6618 }
b@1481 6619 }
b@1481 6620
b@1481 6621 jQuery.map( props, createTween, animation );
b@1481 6622
b@1481 6623 if ( jQuery.isFunction( animation.opts.start ) ) {
b@1481 6624 animation.opts.start.call( elem, animation );
b@1481 6625 }
b@1481 6626
b@1481 6627 jQuery.fx.timer(
b@1481 6628 jQuery.extend( tick, {
b@1481 6629 elem: elem,
b@1481 6630 anim: animation,
b@1481 6631 queue: animation.opts.queue
b@1481 6632 })
b@1481 6633 );
b@1481 6634
b@1481 6635 // attach callbacks from options
b@1481 6636 return animation.progress( animation.opts.progress )
b@1481 6637 .done( animation.opts.done, animation.opts.complete )
b@1481 6638 .fail( animation.opts.fail )
b@1481 6639 .always( animation.opts.always );
b@1481 6640 }
b@1481 6641
b@1481 6642 jQuery.Animation = jQuery.extend( Animation, {
b@1481 6643
b@1481 6644 tweener: function( props, callback ) {
b@1481 6645 if ( jQuery.isFunction( props ) ) {
b@1481 6646 callback = props;
b@1481 6647 props = [ "*" ];
b@1481 6648 } else {
b@1481 6649 props = props.split(" ");
b@1481 6650 }
b@1481 6651
b@1481 6652 var prop,
b@1481 6653 index = 0,
b@1481 6654 length = props.length;
b@1481 6655
b@1481 6656 for ( ; index < length ; index++ ) {
b@1481 6657 prop = props[ index ];
b@1481 6658 tweeners[ prop ] = tweeners[ prop ] || [];
b@1481 6659 tweeners[ prop ].unshift( callback );
b@1481 6660 }
b@1481 6661 },
b@1481 6662
b@1481 6663 prefilter: function( callback, prepend ) {
b@1481 6664 if ( prepend ) {
b@1481 6665 animationPrefilters.unshift( callback );
b@1481 6666 } else {
b@1481 6667 animationPrefilters.push( callback );
b@1481 6668 }
b@1481 6669 }
b@1481 6670 });
b@1481 6671
b@1481 6672 jQuery.speed = function( speed, easing, fn ) {
b@1481 6673 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
b@1481 6674 complete: fn || !fn && easing ||
b@1481 6675 jQuery.isFunction( speed ) && speed,
b@1481 6676 duration: speed,
b@1481 6677 easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
b@1481 6678 };
b@1481 6679
b@1481 6680 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
b@1481 6681 opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
b@1481 6682
b@1481 6683 // Normalize opt.queue - true/undefined/null -> "fx"
b@1481 6684 if ( opt.queue == null || opt.queue === true ) {
b@1481 6685 opt.queue = "fx";
b@1481 6686 }
b@1481 6687
b@1481 6688 // Queueing
b@1481 6689 opt.old = opt.complete;
b@1481 6690
b@1481 6691 opt.complete = function() {
b@1481 6692 if ( jQuery.isFunction( opt.old ) ) {
b@1481 6693 opt.old.call( this );
b@1481 6694 }
b@1481 6695
b@1481 6696 if ( opt.queue ) {
b@1481 6697 jQuery.dequeue( this, opt.queue );
b@1481 6698 }
b@1481 6699 };
b@1481 6700
b@1481 6701 return opt;
b@1481 6702 };
b@1481 6703
b@1481 6704 jQuery.fn.extend({
b@1481 6705 fadeTo: function( speed, to, easing, callback ) {
b@1481 6706
b@1481 6707 // Show any hidden elements after setting opacity to 0
b@1481 6708 return this.filter( isHidden ).css( "opacity", 0 ).show()
b@1481 6709
b@1481 6710 // Animate to the value specified
b@1481 6711 .end().animate({ opacity: to }, speed, easing, callback );
b@1481 6712 },
b@1481 6713 animate: function( prop, speed, easing, callback ) {
b@1481 6714 var empty = jQuery.isEmptyObject( prop ),
b@1481 6715 optall = jQuery.speed( speed, easing, callback ),
b@1481 6716 doAnimation = function() {
b@1481 6717 // Operate on a copy of prop so per-property easing won't be lost
b@1481 6718 var anim = Animation( this, jQuery.extend( {}, prop ), optall );
b@1481 6719
b@1481 6720 // Empty animations, or finishing resolves immediately
b@1481 6721 if ( empty || data_priv.get( this, "finish" ) ) {
b@1481 6722 anim.stop( true );
b@1481 6723 }
b@1481 6724 };
b@1481 6725 doAnimation.finish = doAnimation;
b@1481 6726
b@1481 6727 return empty || optall.queue === false ?
b@1481 6728 this.each( doAnimation ) :
b@1481 6729 this.queue( optall.queue, doAnimation );
b@1481 6730 },
b@1481 6731 stop: function( type, clearQueue, gotoEnd ) {
b@1481 6732 var stopQueue = function( hooks ) {
b@1481 6733 var stop = hooks.stop;
b@1481 6734 delete hooks.stop;
b@1481 6735 stop( gotoEnd );
b@1481 6736 };
b@1481 6737
b@1481 6738 if ( typeof type !== "string" ) {
b@1481 6739 gotoEnd = clearQueue;
b@1481 6740 clearQueue = type;
b@1481 6741 type = undefined;
b@1481 6742 }
b@1481 6743 if ( clearQueue && type !== false ) {
b@1481 6744 this.queue( type || "fx", [] );
b@1481 6745 }
b@1481 6746
b@1481 6747 return this.each(function() {
b@1481 6748 var dequeue = true,
b@1481 6749 index = type != null && type + "queueHooks",
b@1481 6750 timers = jQuery.timers,
b@1481 6751 data = data_priv.get( this );
b@1481 6752
b@1481 6753 if ( index ) {
b@1481 6754 if ( data[ index ] && data[ index ].stop ) {
b@1481 6755 stopQueue( data[ index ] );
b@1481 6756 }
b@1481 6757 } else {
b@1481 6758 for ( index in data ) {
b@1481 6759 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
b@1481 6760 stopQueue( data[ index ] );
b@1481 6761 }
b@1481 6762 }
b@1481 6763 }
b@1481 6764
b@1481 6765 for ( index = timers.length; index--; ) {
b@1481 6766 if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
b@1481 6767 timers[ index ].anim.stop( gotoEnd );
b@1481 6768 dequeue = false;
b@1481 6769 timers.splice( index, 1 );
b@1481 6770 }
b@1481 6771 }
b@1481 6772
b@1481 6773 // Start the next in the queue if the last step wasn't forced.
b@1481 6774 // Timers currently will call their complete callbacks, which
b@1481 6775 // will dequeue but only if they were gotoEnd.
b@1481 6776 if ( dequeue || !gotoEnd ) {
b@1481 6777 jQuery.dequeue( this, type );
b@1481 6778 }
b@1481 6779 });
b@1481 6780 },
b@1481 6781 finish: function( type ) {
b@1481 6782 if ( type !== false ) {
b@1481 6783 type = type || "fx";
b@1481 6784 }
b@1481 6785 return this.each(function() {
b@1481 6786 var index,
b@1481 6787 data = data_priv.get( this ),
b@1481 6788 queue = data[ type + "queue" ],
b@1481 6789 hooks = data[ type + "queueHooks" ],
b@1481 6790 timers = jQuery.timers,
b@1481 6791 length = queue ? queue.length : 0;
b@1481 6792
b@1481 6793 // Enable finishing flag on private data
b@1481 6794 data.finish = true;
b@1481 6795
b@1481 6796 // Empty the queue first
b@1481 6797 jQuery.queue( this, type, [] );
b@1481 6798
b@1481 6799 if ( hooks && hooks.stop ) {
b@1481 6800 hooks.stop.call( this, true );
b@1481 6801 }
b@1481 6802
b@1481 6803 // Look for any active animations, and finish them
b@1481 6804 for ( index = timers.length; index--; ) {
b@1481 6805 if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
b@1481 6806 timers[ index ].anim.stop( true );
b@1481 6807 timers.splice( index, 1 );
b@1481 6808 }
b@1481 6809 }
b@1481 6810
b@1481 6811 // Look for any animations in the old queue and finish them
b@1481 6812 for ( index = 0; index < length; index++ ) {
b@1481 6813 if ( queue[ index ] && queue[ index ].finish ) {
b@1481 6814 queue[ index ].finish.call( this );
b@1481 6815 }
b@1481 6816 }
b@1481 6817
b@1481 6818 // Turn off finishing flag
b@1481 6819 delete data.finish;
b@1481 6820 });
b@1481 6821 }
b@1481 6822 });
b@1481 6823
b@1481 6824 jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
b@1481 6825 var cssFn = jQuery.fn[ name ];
b@1481 6826 jQuery.fn[ name ] = function( speed, easing, callback ) {
b@1481 6827 return speed == null || typeof speed === "boolean" ?
b@1481 6828 cssFn.apply( this, arguments ) :
b@1481 6829 this.animate( genFx( name, true ), speed, easing, callback );
b@1481 6830 };
b@1481 6831 });
b@1481 6832
b@1481 6833 // Generate shortcuts for custom animations
b@1481 6834 jQuery.each({
b@1481 6835 slideDown: genFx("show"),
b@1481 6836 slideUp: genFx("hide"),
b@1481 6837 slideToggle: genFx("toggle"),
b@1481 6838 fadeIn: { opacity: "show" },
b@1481 6839 fadeOut: { opacity: "hide" },
b@1481 6840 fadeToggle: { opacity: "toggle" }
b@1481 6841 }, function( name, props ) {
b@1481 6842 jQuery.fn[ name ] = function( speed, easing, callback ) {
b@1481 6843 return this.animate( props, speed, easing, callback );
b@1481 6844 };
b@1481 6845 });
b@1481 6846
b@1481 6847 jQuery.timers = [];
b@1481 6848 jQuery.fx.tick = function() {
b@1481 6849 var timer,
b@1481 6850 i = 0,
b@1481 6851 timers = jQuery.timers;
b@1481 6852
b@1481 6853 fxNow = jQuery.now();
b@1481 6854
b@1481 6855 for ( ; i < timers.length; i++ ) {
b@1481 6856 timer = timers[ i ];
b@1481 6857 // Checks the timer has not already been removed
b@1481 6858 if ( !timer() && timers[ i ] === timer ) {
b@1481 6859 timers.splice( i--, 1 );
b@1481 6860 }
b@1481 6861 }
b@1481 6862
b@1481 6863 if ( !timers.length ) {
b@1481 6864 jQuery.fx.stop();
b@1481 6865 }
b@1481 6866 fxNow = undefined;
b@1481 6867 };
b@1481 6868
b@1481 6869 jQuery.fx.timer = function( timer ) {
b@1481 6870 jQuery.timers.push( timer );
b@1481 6871 if ( timer() ) {
b@1481 6872 jQuery.fx.start();
b@1481 6873 } else {
b@1481 6874 jQuery.timers.pop();
b@1481 6875 }
b@1481 6876 };
b@1481 6877
b@1481 6878 jQuery.fx.interval = 13;
b@1481 6879
b@1481 6880 jQuery.fx.start = function() {
b@1481 6881 if ( !timerId ) {
b@1481 6882 timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
b@1481 6883 }
b@1481 6884 };
b@1481 6885
b@1481 6886 jQuery.fx.stop = function() {
b@1481 6887 clearInterval( timerId );
b@1481 6888 timerId = null;
b@1481 6889 };
b@1481 6890
b@1481 6891 jQuery.fx.speeds = {
b@1481 6892 slow: 600,
b@1481 6893 fast: 200,
b@1481 6894 // Default speed
b@1481 6895 _default: 400
b@1481 6896 };
b@1481 6897
b@1481 6898
b@1481 6899 // Based off of the plugin by Clint Helfers, with permission.
b@1481 6900 // http://blindsignals.com/index.php/2009/07/jquery-delay/
b@1481 6901 jQuery.fn.delay = function( time, type ) {
b@1481 6902 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
b@1481 6903 type = type || "fx";
b@1481 6904
b@1481 6905 return this.queue( type, function( next, hooks ) {
b@1481 6906 var timeout = setTimeout( next, time );
b@1481 6907 hooks.stop = function() {
b@1481 6908 clearTimeout( timeout );
b@1481 6909 };
b@1481 6910 });
b@1481 6911 };
b@1481 6912
b@1481 6913
b@1481 6914 (function() {
b@1481 6915 var input = document.createElement( "input" ),
b@1481 6916 select = document.createElement( "select" ),
b@1481 6917 opt = select.appendChild( document.createElement( "option" ) );
b@1481 6918
b@1481 6919 input.type = "checkbox";
b@1481 6920
b@1481 6921 // Support: iOS<=5.1, Android<=4.2+
b@1481 6922 // Default value for a checkbox should be "on"
b@1481 6923 support.checkOn = input.value !== "";
b@1481 6924
b@1481 6925 // Support: IE<=11+
b@1481 6926 // Must access selectedIndex to make default options select
b@1481 6927 support.optSelected = opt.selected;
b@1481 6928
b@1481 6929 // Support: Android<=2.3
b@1481 6930 // Options inside disabled selects are incorrectly marked as disabled
b@1481 6931 select.disabled = true;
b@1481 6932 support.optDisabled = !opt.disabled;
b@1481 6933
b@1481 6934 // Support: IE<=11+
b@1481 6935 // An input loses its value after becoming a radio
b@1481 6936 input = document.createElement( "input" );
b@1481 6937 input.value = "t";
b@1481 6938 input.type = "radio";
b@1481 6939 support.radioValue = input.value === "t";
b@1481 6940 })();
b@1481 6941
b@1481 6942
b@1481 6943 var nodeHook, boolHook,
b@1481 6944 attrHandle = jQuery.expr.attrHandle;
b@1481 6945
b@1481 6946 jQuery.fn.extend({
b@1481 6947 attr: function( name, value ) {
b@1481 6948 return access( this, jQuery.attr, name, value, arguments.length > 1 );
b@1481 6949 },
b@1481 6950
b@1481 6951 removeAttr: function( name ) {
b@1481 6952 return this.each(function() {
b@1481 6953 jQuery.removeAttr( this, name );
b@1481 6954 });
b@1481 6955 }
b@1481 6956 });
b@1481 6957
b@1481 6958 jQuery.extend({
b@1481 6959 attr: function( elem, name, value ) {
b@1481 6960 var hooks, ret,
b@1481 6961 nType = elem.nodeType;
b@1481 6962
b@1481 6963 // don't get/set attributes on text, comment and attribute nodes
b@1481 6964 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
b@1481 6965 return;
b@1481 6966 }
b@1481 6967
b@1481 6968 // Fallback to prop when attributes are not supported
b@1481 6969 if ( typeof elem.getAttribute === strundefined ) {
b@1481 6970 return jQuery.prop( elem, name, value );
b@1481 6971 }
b@1481 6972
b@1481 6973 // All attributes are lowercase
b@1481 6974 // Grab necessary hook if one is defined
b@1481 6975 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
b@1481 6976 name = name.toLowerCase();
b@1481 6977 hooks = jQuery.attrHooks[ name ] ||
b@1481 6978 ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
b@1481 6979 }
b@1481 6980
b@1481 6981 if ( value !== undefined ) {
b@1481 6982
b@1481 6983 if ( value === null ) {
b@1481 6984 jQuery.removeAttr( elem, name );
b@1481 6985
b@1481 6986 } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
b@1481 6987 return ret;
b@1481 6988
b@1481 6989 } else {
b@1481 6990 elem.setAttribute( name, value + "" );
b@1481 6991 return value;
b@1481 6992 }
b@1481 6993
b@1481 6994 } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
b@1481 6995 return ret;
b@1481 6996
b@1481 6997 } else {
b@1481 6998 ret = jQuery.find.attr( elem, name );
b@1481 6999
b@1481 7000 // Non-existent attributes return null, we normalize to undefined
b@1481 7001 return ret == null ?
b@1481 7002 undefined :
b@1481 7003 ret;
b@1481 7004 }
b@1481 7005 },
b@1481 7006
b@1481 7007 removeAttr: function( elem, value ) {
b@1481 7008 var name, propName,
b@1481 7009 i = 0,
b@1481 7010 attrNames = value && value.match( rnotwhite );
b@1481 7011
b@1481 7012 if ( attrNames && elem.nodeType === 1 ) {
b@1481 7013 while ( (name = attrNames[i++]) ) {
b@1481 7014 propName = jQuery.propFix[ name ] || name;
b@1481 7015
b@1481 7016 // Boolean attributes get special treatment (#10870)
b@1481 7017 if ( jQuery.expr.match.bool.test( name ) ) {
b@1481 7018 // Set corresponding property to false
b@1481 7019 elem[ propName ] = false;
b@1481 7020 }
b@1481 7021
b@1481 7022 elem.removeAttribute( name );
b@1481 7023 }
b@1481 7024 }
b@1481 7025 },
b@1481 7026
b@1481 7027 attrHooks: {
b@1481 7028 type: {
b@1481 7029 set: function( elem, value ) {
b@1481 7030 if ( !support.radioValue && value === "radio" &&
b@1481 7031 jQuery.nodeName( elem, "input" ) ) {
b@1481 7032 var val = elem.value;
b@1481 7033 elem.setAttribute( "type", value );
b@1481 7034 if ( val ) {
b@1481 7035 elem.value = val;
b@1481 7036 }
b@1481 7037 return value;
b@1481 7038 }
b@1481 7039 }
b@1481 7040 }
b@1481 7041 }
b@1481 7042 });
b@1481 7043
b@1481 7044 // Hooks for boolean attributes
b@1481 7045 boolHook = {
b@1481 7046 set: function( elem, value, name ) {
b@1481 7047 if ( value === false ) {
b@1481 7048 // Remove boolean attributes when set to false
b@1481 7049 jQuery.removeAttr( elem, name );
b@1481 7050 } else {
b@1481 7051 elem.setAttribute( name, name );
b@1481 7052 }
b@1481 7053 return name;
b@1481 7054 }
b@1481 7055 };
b@1481 7056 jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
b@1481 7057 var getter = attrHandle[ name ] || jQuery.find.attr;
b@1481 7058
b@1481 7059 attrHandle[ name ] = function( elem, name, isXML ) {
b@1481 7060 var ret, handle;
b@1481 7061 if ( !isXML ) {
b@1481 7062 // Avoid an infinite loop by temporarily removing this function from the getter
b@1481 7063 handle = attrHandle[ name ];
b@1481 7064 attrHandle[ name ] = ret;
b@1481 7065 ret = getter( elem, name, isXML ) != null ?
b@1481 7066 name.toLowerCase() :
b@1481 7067 null;
b@1481 7068 attrHandle[ name ] = handle;
b@1481 7069 }
b@1481 7070 return ret;
b@1481 7071 };
b@1481 7072 });
b@1481 7073
b@1481 7074
b@1481 7075
b@1481 7076
b@1481 7077 var rfocusable = /^(?:input|select|textarea|button)$/i;
b@1481 7078
b@1481 7079 jQuery.fn.extend({
b@1481 7080 prop: function( name, value ) {
b@1481 7081 return access( this, jQuery.prop, name, value, arguments.length > 1 );
b@1481 7082 },
b@1481 7083
b@1481 7084 removeProp: function( name ) {
b@1481 7085 return this.each(function() {
b@1481 7086 delete this[ jQuery.propFix[ name ] || name ];
b@1481 7087 });
b@1481 7088 }
b@1481 7089 });
b@1481 7090
b@1481 7091 jQuery.extend({
b@1481 7092 propFix: {
b@1481 7093 "for": "htmlFor",
b@1481 7094 "class": "className"
b@1481 7095 },
b@1481 7096
b@1481 7097 prop: function( elem, name, value ) {
b@1481 7098 var ret, hooks, notxml,
b@1481 7099 nType = elem.nodeType;
b@1481 7100
b@1481 7101 // Don't get/set properties on text, comment and attribute nodes
b@1481 7102 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
b@1481 7103 return;
b@1481 7104 }
b@1481 7105
b@1481 7106 notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
b@1481 7107
b@1481 7108 if ( notxml ) {
b@1481 7109 // Fix name and attach hooks
b@1481 7110 name = jQuery.propFix[ name ] || name;
b@1481 7111 hooks = jQuery.propHooks[ name ];
b@1481 7112 }
b@1481 7113
b@1481 7114 if ( value !== undefined ) {
b@1481 7115 return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
b@1481 7116 ret :
b@1481 7117 ( elem[ name ] = value );
b@1481 7118
b@1481 7119 } else {
b@1481 7120 return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
b@1481 7121 ret :
b@1481 7122 elem[ name ];
b@1481 7123 }
b@1481 7124 },
b@1481 7125
b@1481 7126 propHooks: {
b@1481 7127 tabIndex: {
b@1481 7128 get: function( elem ) {
b@1481 7129 return elem.hasAttribute( "tabindex" ) || rfocusable.test( elem.nodeName ) || elem.href ?
b@1481 7130 elem.tabIndex :
b@1481 7131 -1;
b@1481 7132 }
b@1481 7133 }
b@1481 7134 }
b@1481 7135 });
b@1481 7136
b@1481 7137 if ( !support.optSelected ) {
b@1481 7138 jQuery.propHooks.selected = {
b@1481 7139 get: function( elem ) {
b@1481 7140 var parent = elem.parentNode;
b@1481 7141 if ( parent && parent.parentNode ) {
b@1481 7142 parent.parentNode.selectedIndex;
b@1481 7143 }
b@1481 7144 return null;
b@1481 7145 }
b@1481 7146 };
b@1481 7147 }
b@1481 7148
b@1481 7149 jQuery.each([
b@1481 7150 "tabIndex",
b@1481 7151 "readOnly",
b@1481 7152 "maxLength",
b@1481 7153 "cellSpacing",
b@1481 7154 "cellPadding",
b@1481 7155 "rowSpan",
b@1481 7156 "colSpan",
b@1481 7157 "useMap",
b@1481 7158 "frameBorder",
b@1481 7159 "contentEditable"
b@1481 7160 ], function() {
b@1481 7161 jQuery.propFix[ this.toLowerCase() ] = this;
b@1481 7162 });
b@1481 7163
b@1481 7164
b@1481 7165
b@1481 7166
b@1481 7167 var rclass = /[\t\r\n\f]/g;
b@1481 7168
b@1481 7169 jQuery.fn.extend({
b@1481 7170 addClass: function( value ) {
b@1481 7171 var classes, elem, cur, clazz, j, finalValue,
b@1481 7172 proceed = typeof value === "string" && value,
b@1481 7173 i = 0,
b@1481 7174 len = this.length;
b@1481 7175
b@1481 7176 if ( jQuery.isFunction( value ) ) {
b@1481 7177 return this.each(function( j ) {
b@1481 7178 jQuery( this ).addClass( value.call( this, j, this.className ) );
b@1481 7179 });
b@1481 7180 }
b@1481 7181
b@1481 7182 if ( proceed ) {
b@1481 7183 // The disjunction here is for better compressibility (see removeClass)
b@1481 7184 classes = ( value || "" ).match( rnotwhite ) || [];
b@1481 7185
b@1481 7186 for ( ; i < len; i++ ) {
b@1481 7187 elem = this[ i ];
b@1481 7188 cur = elem.nodeType === 1 && ( elem.className ?
b@1481 7189 ( " " + elem.className + " " ).replace( rclass, " " ) :
b@1481 7190 " "
b@1481 7191 );
b@1481 7192
b@1481 7193 if ( cur ) {
b@1481 7194 j = 0;
b@1481 7195 while ( (clazz = classes[j++]) ) {
b@1481 7196 if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
b@1481 7197 cur += clazz + " ";
b@1481 7198 }
b@1481 7199 }
b@1481 7200
b@1481 7201 // only assign if different to avoid unneeded rendering.
b@1481 7202 finalValue = jQuery.trim( cur );
b@1481 7203 if ( elem.className !== finalValue ) {
b@1481 7204 elem.className = finalValue;
b@1481 7205 }
b@1481 7206 }
b@1481 7207 }
b@1481 7208 }
b@1481 7209
b@1481 7210 return this;
b@1481 7211 },
b@1481 7212
b@1481 7213 removeClass: function( value ) {
b@1481 7214 var classes, elem, cur, clazz, j, finalValue,
b@1481 7215 proceed = arguments.length === 0 || typeof value === "string" && value,
b@1481 7216 i = 0,
b@1481 7217 len = this.length;
b@1481 7218
b@1481 7219 if ( jQuery.isFunction( value ) ) {
b@1481 7220 return this.each(function( j ) {
b@1481 7221 jQuery( this ).removeClass( value.call( this, j, this.className ) );
b@1481 7222 });
b@1481 7223 }
b@1481 7224 if ( proceed ) {
b@1481 7225 classes = ( value || "" ).match( rnotwhite ) || [];
b@1481 7226
b@1481 7227 for ( ; i < len; i++ ) {
b@1481 7228 elem = this[ i ];
b@1481 7229 // This expression is here for better compressibility (see addClass)
b@1481 7230 cur = elem.nodeType === 1 && ( elem.className ?
b@1481 7231 ( " " + elem.className + " " ).replace( rclass, " " ) :
b@1481 7232 ""
b@1481 7233 );
b@1481 7234
b@1481 7235 if ( cur ) {
b@1481 7236 j = 0;
b@1481 7237 while ( (clazz = classes[j++]) ) {
b@1481 7238 // Remove *all* instances
b@1481 7239 while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
b@1481 7240 cur = cur.replace( " " + clazz + " ", " " );
b@1481 7241 }
b@1481 7242 }
b@1481 7243
b@1481 7244 // Only assign if different to avoid unneeded rendering.
b@1481 7245 finalValue = value ? jQuery.trim( cur ) : "";
b@1481 7246 if ( elem.className !== finalValue ) {
b@1481 7247 elem.className = finalValue;
b@1481 7248 }
b@1481 7249 }
b@1481 7250 }
b@1481 7251 }
b@1481 7252
b@1481 7253 return this;
b@1481 7254 },
b@1481 7255
b@1481 7256 toggleClass: function( value, stateVal ) {
b@1481 7257 var type = typeof value;
b@1481 7258
b@1481 7259 if ( typeof stateVal === "boolean" && type === "string" ) {
b@1481 7260 return stateVal ? this.addClass( value ) : this.removeClass( value );
b@1481 7261 }
b@1481 7262
b@1481 7263 if ( jQuery.isFunction( value ) ) {
b@1481 7264 return this.each(function( i ) {
b@1481 7265 jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
b@1481 7266 });
b@1481 7267 }
b@1481 7268
b@1481 7269 return this.each(function() {
b@1481 7270 if ( type === "string" ) {
b@1481 7271 // Toggle individual class names
b@1481 7272 var className,
b@1481 7273 i = 0,
b@1481 7274 self = jQuery( this ),
b@1481 7275 classNames = value.match( rnotwhite ) || [];
b@1481 7276
b@1481 7277 while ( (className = classNames[ i++ ]) ) {
b@1481 7278 // Check each className given, space separated list
b@1481 7279 if ( self.hasClass( className ) ) {
b@1481 7280 self.removeClass( className );
b@1481 7281 } else {
b@1481 7282 self.addClass( className );
b@1481 7283 }
b@1481 7284 }
b@1481 7285
b@1481 7286 // Toggle whole class name
b@1481 7287 } else if ( type === strundefined || type === "boolean" ) {
b@1481 7288 if ( this.className ) {
b@1481 7289 // store className if set
b@1481 7290 data_priv.set( this, "__className__", this.className );
b@1481 7291 }
b@1481 7292
b@1481 7293 // If the element has a class name or if we're passed `false`,
b@1481 7294 // then remove the whole classname (if there was one, the above saved it).
b@1481 7295 // Otherwise bring back whatever was previously saved (if anything),
b@1481 7296 // falling back to the empty string if nothing was stored.
b@1481 7297 this.className = this.className || value === false ? "" : data_priv.get( this, "__className__" ) || "";
b@1481 7298 }
b@1481 7299 });
b@1481 7300 },
b@1481 7301
b@1481 7302 hasClass: function( selector ) {
b@1481 7303 var className = " " + selector + " ",
b@1481 7304 i = 0,
b@1481 7305 l = this.length;
b@1481 7306 for ( ; i < l; i++ ) {
b@1481 7307 if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
b@1481 7308 return true;
b@1481 7309 }
b@1481 7310 }
b@1481 7311
b@1481 7312 return false;
b@1481 7313 }
b@1481 7314 });
b@1481 7315
b@1481 7316
b@1481 7317
b@1481 7318
b@1481 7319 var rreturn = /\r/g;
b@1481 7320
b@1481 7321 jQuery.fn.extend({
b@1481 7322 val: function( value ) {
b@1481 7323 var hooks, ret, isFunction,
b@1481 7324 elem = this[0];
b@1481 7325
b@1481 7326 if ( !arguments.length ) {
b@1481 7327 if ( elem ) {
b@1481 7328 hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
b@1481 7329
b@1481 7330 if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
b@1481 7331 return ret;
b@1481 7332 }
b@1481 7333
b@1481 7334 ret = elem.value;
b@1481 7335
b@1481 7336 return typeof ret === "string" ?
b@1481 7337 // Handle most common string cases
b@1481 7338 ret.replace(rreturn, "") :
b@1481 7339 // Handle cases where value is null/undef or number
b@1481 7340 ret == null ? "" : ret;
b@1481 7341 }
b@1481 7342
b@1481 7343 return;
b@1481 7344 }
b@1481 7345
b@1481 7346 isFunction = jQuery.isFunction( value );
b@1481 7347
b@1481 7348 return this.each(function( i ) {
b@1481 7349 var val;
b@1481 7350
b@1481 7351 if ( this.nodeType !== 1 ) {
b@1481 7352 return;
b@1481 7353 }
b@1481 7354
b@1481 7355 if ( isFunction ) {
b@1481 7356 val = value.call( this, i, jQuery( this ).val() );
b@1481 7357 } else {
b@1481 7358 val = value;
b@1481 7359 }
b@1481 7360
b@1481 7361 // Treat null/undefined as ""; convert numbers to string
b@1481 7362 if ( val == null ) {
b@1481 7363 val = "";
b@1481 7364
b@1481 7365 } else if ( typeof val === "number" ) {
b@1481 7366 val += "";
b@1481 7367
b@1481 7368 } else if ( jQuery.isArray( val ) ) {
b@1481 7369 val = jQuery.map( val, function( value ) {
b@1481 7370 return value == null ? "" : value + "";
b@1481 7371 });
b@1481 7372 }
b@1481 7373
b@1481 7374 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
b@1481 7375
b@1481 7376 // If set returns undefined, fall back to normal setting
b@1481 7377 if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
b@1481 7378 this.value = val;
b@1481 7379 }
b@1481 7380 });
b@1481 7381 }
b@1481 7382 });
b@1481 7383
b@1481 7384 jQuery.extend({
b@1481 7385 valHooks: {
b@1481 7386 option: {
b@1481 7387 get: function( elem ) {
b@1481 7388 var val = jQuery.find.attr( elem, "value" );
b@1481 7389 return val != null ?
b@1481 7390 val :
b@1481 7391 // Support: IE10-11+
b@1481 7392 // option.text throws exceptions (#14686, #14858)
b@1481 7393 jQuery.trim( jQuery.text( elem ) );
b@1481 7394 }
b@1481 7395 },
b@1481 7396 select: {
b@1481 7397 get: function( elem ) {
b@1481 7398 var value, option,
b@1481 7399 options = elem.options,
b@1481 7400 index = elem.selectedIndex,
b@1481 7401 one = elem.type === "select-one" || index < 0,
b@1481 7402 values = one ? null : [],
b@1481 7403 max = one ? index + 1 : options.length,
b@1481 7404 i = index < 0 ?
b@1481 7405 max :
b@1481 7406 one ? index : 0;
b@1481 7407
b@1481 7408 // Loop through all the selected options
b@1481 7409 for ( ; i < max; i++ ) {
b@1481 7410 option = options[ i ];
b@1481 7411
b@1481 7412 // IE6-9 doesn't update selected after form reset (#2551)
b@1481 7413 if ( ( option.selected || i === index ) &&
b@1481 7414 // Don't return options that are disabled or in a disabled optgroup
b@1481 7415 ( support.optDisabled ? !option.disabled : option.getAttribute( "disabled" ) === null ) &&
b@1481 7416 ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
b@1481 7417
b@1481 7418 // Get the specific value for the option
b@1481 7419 value = jQuery( option ).val();
b@1481 7420
b@1481 7421 // We don't need an array for one selects
b@1481 7422 if ( one ) {
b@1481 7423 return value;
b@1481 7424 }
b@1481 7425
b@1481 7426 // Multi-Selects return an array
b@1481 7427 values.push( value );
b@1481 7428 }
b@1481 7429 }
b@1481 7430
b@1481 7431 return values;
b@1481 7432 },
b@1481 7433
b@1481 7434 set: function( elem, value ) {
b@1481 7435 var optionSet, option,
b@1481 7436 options = elem.options,
b@1481 7437 values = jQuery.makeArray( value ),
b@1481 7438 i = options.length;
b@1481 7439
b@1481 7440 while ( i-- ) {
b@1481 7441 option = options[ i ];
b@1481 7442 if ( (option.selected = jQuery.inArray( option.value, values ) >= 0) ) {
b@1481 7443 optionSet = true;
b@1481 7444 }
b@1481 7445 }
b@1481 7446
b@1481 7447 // Force browsers to behave consistently when non-matching value is set
b@1481 7448 if ( !optionSet ) {
b@1481 7449 elem.selectedIndex = -1;
b@1481 7450 }
b@1481 7451 return values;
b@1481 7452 }
b@1481 7453 }
b@1481 7454 }
b@1481 7455 });
b@1481 7456
b@1481 7457 // Radios and checkboxes getter/setter
b@1481 7458 jQuery.each([ "radio", "checkbox" ], function() {
b@1481 7459 jQuery.valHooks[ this ] = {
b@1481 7460 set: function( elem, value ) {
b@1481 7461 if ( jQuery.isArray( value ) ) {
b@1481 7462 return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
b@1481 7463 }
b@1481 7464 }
b@1481 7465 };
b@1481 7466 if ( !support.checkOn ) {
b@1481 7467 jQuery.valHooks[ this ].get = function( elem ) {
b@1481 7468 return elem.getAttribute("value") === null ? "on" : elem.value;
b@1481 7469 };
b@1481 7470 }
b@1481 7471 });
b@1481 7472
b@1481 7473
b@1481 7474
b@1481 7475
b@1481 7476 // Return jQuery for attributes-only inclusion
b@1481 7477
b@1481 7478
b@1481 7479 jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
b@1481 7480 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
b@1481 7481 "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
b@1481 7482
b@1481 7483 // Handle event binding
b@1481 7484 jQuery.fn[ name ] = function( data, fn ) {
b@1481 7485 return arguments.length > 0 ?
b@1481 7486 this.on( name, null, data, fn ) :
b@1481 7487 this.trigger( name );
b@1481 7488 };
b@1481 7489 });
b@1481 7490
b@1481 7491 jQuery.fn.extend({
b@1481 7492 hover: function( fnOver, fnOut ) {
b@1481 7493 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
b@1481 7494 },
b@1481 7495
b@1481 7496 bind: function( types, data, fn ) {
b@1481 7497 return this.on( types, null, data, fn );
b@1481 7498 },
b@1481 7499 unbind: function( types, fn ) {
b@1481 7500 return this.off( types, null, fn );
b@1481 7501 },
b@1481 7502
b@1481 7503 delegate: function( selector, types, data, fn ) {
b@1481 7504 return this.on( types, selector, data, fn );
b@1481 7505 },
b@1481 7506 undelegate: function( selector, types, fn ) {
b@1481 7507 // ( namespace ) or ( selector, types [, fn] )
b@1481 7508 return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
b@1481 7509 }
b@1481 7510 });
b@1481 7511
b@1481 7512
b@1481 7513 var nonce = jQuery.now();
b@1481 7514
b@1481 7515 var rquery = (/\?/);
b@1481 7516
b@1481 7517
b@1481 7518
b@1481 7519 // Support: Android 2.3
b@1481 7520 // Workaround failure to string-cast null input
b@1481 7521 jQuery.parseJSON = function( data ) {
b@1481 7522 return JSON.parse( data + "" );
b@1481 7523 };
b@1481 7524
b@1481 7525
b@1481 7526 // Cross-browser xml parsing
b@1481 7527 jQuery.parseXML = function( data ) {
b@1481 7528 var xml, tmp;
b@1481 7529 if ( !data || typeof data !== "string" ) {
b@1481 7530 return null;
b@1481 7531 }
b@1481 7532
b@1481 7533 // Support: IE9
b@1481 7534 try {
b@1481 7535 tmp = new DOMParser();
b@1481 7536 xml = tmp.parseFromString( data, "text/xml" );
b@1481 7537 } catch ( e ) {
b@1481 7538 xml = undefined;
b@1481 7539 }
b@1481 7540
b@1481 7541 if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
b@1481 7542 jQuery.error( "Invalid XML: " + data );
b@1481 7543 }
b@1481 7544 return xml;
b@1481 7545 };
b@1481 7546
b@1481 7547
b@1481 7548 var
b@1481 7549 rhash = /#.*$/,
b@1481 7550 rts = /([?&])_=[^&]*/,
b@1481 7551 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
b@1481 7552 // #7653, #8125, #8152: local protocol detection
b@1481 7553 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
b@1481 7554 rnoContent = /^(?:GET|HEAD)$/,
b@1481 7555 rprotocol = /^\/\//,
b@1481 7556 rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
b@1481 7557
b@1481 7558 /* Prefilters
b@1481 7559 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
b@1481 7560 * 2) These are called:
b@1481 7561 * - BEFORE asking for a transport
b@1481 7562 * - AFTER param serialization (s.data is a string if s.processData is true)
b@1481 7563 * 3) key is the dataType
b@1481 7564 * 4) the catchall symbol "*" can be used
b@1481 7565 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
b@1481 7566 */
b@1481 7567 prefilters = {},
b@1481 7568
b@1481 7569 /* Transports bindings
b@1481 7570 * 1) key is the dataType
b@1481 7571 * 2) the catchall symbol "*" can be used
b@1481 7572 * 3) selection will start with transport dataType and THEN go to "*" if needed
b@1481 7573 */
b@1481 7574 transports = {},
b@1481 7575
b@1481 7576 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
b@1481 7577 allTypes = "*/".concat( "*" ),
b@1481 7578
b@1481 7579 // Document location
b@1481 7580 ajaxLocation = window.location.href,
b@1481 7581
b@1481 7582 // Segment location into parts
b@1481 7583 ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
b@1481 7584
b@1481 7585 // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
b@1481 7586 function addToPrefiltersOrTransports( structure ) {
b@1481 7587
b@1481 7588 // dataTypeExpression is optional and defaults to "*"
b@1481 7589 return function( dataTypeExpression, func ) {
b@1481 7590
b@1481 7591 if ( typeof dataTypeExpression !== "string" ) {
b@1481 7592 func = dataTypeExpression;
b@1481 7593 dataTypeExpression = "*";
b@1481 7594 }
b@1481 7595
b@1481 7596 var dataType,
b@1481 7597 i = 0,
b@1481 7598 dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
b@1481 7599
b@1481 7600 if ( jQuery.isFunction( func ) ) {
b@1481 7601 // For each dataType in the dataTypeExpression
b@1481 7602 while ( (dataType = dataTypes[i++]) ) {
b@1481 7603 // Prepend if requested
b@1481 7604 if ( dataType[0] === "+" ) {
b@1481 7605 dataType = dataType.slice( 1 ) || "*";
b@1481 7606 (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
b@1481 7607
b@1481 7608 // Otherwise append
b@1481 7609 } else {
b@1481 7610 (structure[ dataType ] = structure[ dataType ] || []).push( func );
b@1481 7611 }
b@1481 7612 }
b@1481 7613 }
b@1481 7614 };
b@1481 7615 }
b@1481 7616
b@1481 7617 // Base inspection function for prefilters and transports
b@1481 7618 function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
b@1481 7619
b@1481 7620 var inspected = {},
b@1481 7621 seekingTransport = ( structure === transports );
b@1481 7622
b@1481 7623 function inspect( dataType ) {
b@1481 7624 var selected;
b@1481 7625 inspected[ dataType ] = true;
b@1481 7626 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
b@1481 7627 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
b@1481 7628 if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
b@1481 7629 options.dataTypes.unshift( dataTypeOrTransport );
b@1481 7630 inspect( dataTypeOrTransport );
b@1481 7631 return false;
b@1481 7632 } else if ( seekingTransport ) {
b@1481 7633 return !( selected = dataTypeOrTransport );
b@1481 7634 }
b@1481 7635 });
b@1481 7636 return selected;
b@1481 7637 }
b@1481 7638
b@1481 7639 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
b@1481 7640 }
b@1481 7641
b@1481 7642 // A special extend for ajax options
b@1481 7643 // that takes "flat" options (not to be deep extended)
b@1481 7644 // Fixes #9887
b@1481 7645 function ajaxExtend( target, src ) {
b@1481 7646 var key, deep,
b@1481 7647 flatOptions = jQuery.ajaxSettings.flatOptions || {};
b@1481 7648
b@1481 7649 for ( key in src ) {
b@1481 7650 if ( src[ key ] !== undefined ) {
b@1481 7651 ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
b@1481 7652 }
b@1481 7653 }
b@1481 7654 if ( deep ) {
b@1481 7655 jQuery.extend( true, target, deep );
b@1481 7656 }
b@1481 7657
b@1481 7658 return target;
b@1481 7659 }
b@1481 7660
b@1481 7661 /* Handles responses to an ajax request:
b@1481 7662 * - finds the right dataType (mediates between content-type and expected dataType)
b@1481 7663 * - returns the corresponding response
b@1481 7664 */
b@1481 7665 function ajaxHandleResponses( s, jqXHR, responses ) {
b@1481 7666
b@1481 7667 var ct, type, finalDataType, firstDataType,
b@1481 7668 contents = s.contents,
b@1481 7669 dataTypes = s.dataTypes;
b@1481 7670
b@1481 7671 // Remove auto dataType and get content-type in the process
b@1481 7672 while ( dataTypes[ 0 ] === "*" ) {
b@1481 7673 dataTypes.shift();
b@1481 7674 if ( ct === undefined ) {
b@1481 7675 ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
b@1481 7676 }
b@1481 7677 }
b@1481 7678
b@1481 7679 // Check if we're dealing with a known content-type
b@1481 7680 if ( ct ) {
b@1481 7681 for ( type in contents ) {
b@1481 7682 if ( contents[ type ] && contents[ type ].test( ct ) ) {
b@1481 7683 dataTypes.unshift( type );
b@1481 7684 break;
b@1481 7685 }
b@1481 7686 }
b@1481 7687 }
b@1481 7688
b@1481 7689 // Check to see if we have a response for the expected dataType
b@1481 7690 if ( dataTypes[ 0 ] in responses ) {
b@1481 7691 finalDataType = dataTypes[ 0 ];
b@1481 7692 } else {
b@1481 7693 // Try convertible dataTypes
b@1481 7694 for ( type in responses ) {
b@1481 7695 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
b@1481 7696 finalDataType = type;
b@1481 7697 break;
b@1481 7698 }
b@1481 7699 if ( !firstDataType ) {
b@1481 7700 firstDataType = type;
b@1481 7701 }
b@1481 7702 }
b@1481 7703 // Or just use first one
b@1481 7704 finalDataType = finalDataType || firstDataType;
b@1481 7705 }
b@1481 7706
b@1481 7707 // If we found a dataType
b@1481 7708 // We add the dataType to the list if needed
b@1481 7709 // and return the corresponding response
b@1481 7710 if ( finalDataType ) {
b@1481 7711 if ( finalDataType !== dataTypes[ 0 ] ) {
b@1481 7712 dataTypes.unshift( finalDataType );
b@1481 7713 }
b@1481 7714 return responses[ finalDataType ];
b@1481 7715 }
b@1481 7716 }
b@1481 7717
b@1481 7718 /* Chain conversions given the request and the original response
b@1481 7719 * Also sets the responseXXX fields on the jqXHR instance
b@1481 7720 */
b@1481 7721 function ajaxConvert( s, response, jqXHR, isSuccess ) {
b@1481 7722 var conv2, current, conv, tmp, prev,
b@1481 7723 converters = {},
b@1481 7724 // Work with a copy of dataTypes in case we need to modify it for conversion
b@1481 7725 dataTypes = s.dataTypes.slice();
b@1481 7726
b@1481 7727 // Create converters map with lowercased keys
b@1481 7728 if ( dataTypes[ 1 ] ) {
b@1481 7729 for ( conv in s.converters ) {
b@1481 7730 converters[ conv.toLowerCase() ] = s.converters[ conv ];
b@1481 7731 }
b@1481 7732 }
b@1481 7733
b@1481 7734 current = dataTypes.shift();
b@1481 7735
b@1481 7736 // Convert to each sequential dataType
b@1481 7737 while ( current ) {
b@1481 7738
b@1481 7739 if ( s.responseFields[ current ] ) {
b@1481 7740 jqXHR[ s.responseFields[ current ] ] = response;
b@1481 7741 }
b@1481 7742
b@1481 7743 // Apply the dataFilter if provided
b@1481 7744 if ( !prev && isSuccess && s.dataFilter ) {
b@1481 7745 response = s.dataFilter( response, s.dataType );
b@1481 7746 }
b@1481 7747
b@1481 7748 prev = current;
b@1481 7749 current = dataTypes.shift();
b@1481 7750
b@1481 7751 if ( current ) {
b@1481 7752
b@1481 7753 // There's only work to do if current dataType is non-auto
b@1481 7754 if ( current === "*" ) {
b@1481 7755
b@1481 7756 current = prev;
b@1481 7757
b@1481 7758 // Convert response if prev dataType is non-auto and differs from current
b@1481 7759 } else if ( prev !== "*" && prev !== current ) {
b@1481 7760
b@1481 7761 // Seek a direct converter
b@1481 7762 conv = converters[ prev + " " + current ] || converters[ "* " + current ];
b@1481 7763
b@1481 7764 // If none found, seek a pair
b@1481 7765 if ( !conv ) {
b@1481 7766 for ( conv2 in converters ) {
b@1481 7767
b@1481 7768 // If conv2 outputs current
b@1481 7769 tmp = conv2.split( " " );
b@1481 7770 if ( tmp[ 1 ] === current ) {
b@1481 7771
b@1481 7772 // If prev can be converted to accepted input
b@1481 7773 conv = converters[ prev + " " + tmp[ 0 ] ] ||
b@1481 7774 converters[ "* " + tmp[ 0 ] ];
b@1481 7775 if ( conv ) {
b@1481 7776 // Condense equivalence converters
b@1481 7777 if ( conv === true ) {
b@1481 7778 conv = converters[ conv2 ];
b@1481 7779
b@1481 7780 // Otherwise, insert the intermediate dataType
b@1481 7781 } else if ( converters[ conv2 ] !== true ) {
b@1481 7782 current = tmp[ 0 ];
b@1481 7783 dataTypes.unshift( tmp[ 1 ] );
b@1481 7784 }
b@1481 7785 break;
b@1481 7786 }
b@1481 7787 }
b@1481 7788 }
b@1481 7789 }
b@1481 7790
b@1481 7791 // Apply converter (if not an equivalence)
b@1481 7792 if ( conv !== true ) {
b@1481 7793
b@1481 7794 // Unless errors are allowed to bubble, catch and return them
b@1481 7795 if ( conv && s[ "throws" ] ) {
b@1481 7796 response = conv( response );
b@1481 7797 } else {
b@1481 7798 try {
b@1481 7799 response = conv( response );
b@1481 7800 } catch ( e ) {
b@1481 7801 return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
b@1481 7802 }
b@1481 7803 }
b@1481 7804 }
b@1481 7805 }
b@1481 7806 }
b@1481 7807 }
b@1481 7808
b@1481 7809 return { state: "success", data: response };
b@1481 7810 }
b@1481 7811
b@1481 7812 jQuery.extend({
b@1481 7813
b@1481 7814 // Counter for holding the number of active queries
b@1481 7815 active: 0,
b@1481 7816
b@1481 7817 // Last-Modified header cache for next request
b@1481 7818 lastModified: {},
b@1481 7819 etag: {},
b@1481 7820
b@1481 7821 ajaxSettings: {
b@1481 7822 url: ajaxLocation,
b@1481 7823 type: "GET",
b@1481 7824 isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
b@1481 7825 global: true,
b@1481 7826 processData: true,
b@1481 7827 async: true,
b@1481 7828 contentType: "application/x-www-form-urlencoded; charset=UTF-8",
b@1481 7829 /*
b@1481 7830 timeout: 0,
b@1481 7831 data: null,
b@1481 7832 dataType: null,
b@1481 7833 username: null,
b@1481 7834 password: null,
b@1481 7835 cache: null,
b@1481 7836 throws: false,
b@1481 7837 traditional: false,
b@1481 7838 headers: {},
b@1481 7839 */
b@1481 7840
b@1481 7841 accepts: {
b@1481 7842 "*": allTypes,
b@1481 7843 text: "text/plain",
b@1481 7844 html: "text/html",
b@1481 7845 xml: "application/xml, text/xml",
b@1481 7846 json: "application/json, text/javascript"
b@1481 7847 },
b@1481 7848
b@1481 7849 contents: {
b@1481 7850 xml: /xml/,
b@1481 7851 html: /html/,
b@1481 7852 json: /json/
b@1481 7853 },
b@1481 7854
b@1481 7855 responseFields: {
b@1481 7856 xml: "responseXML",
b@1481 7857 text: "responseText",
b@1481 7858 json: "responseJSON"
b@1481 7859 },
b@1481 7860
b@1481 7861 // Data converters
b@1481 7862 // Keys separate source (or catchall "*") and destination types with a single space
b@1481 7863 converters: {
b@1481 7864
b@1481 7865 // Convert anything to text
b@1481 7866 "* text": String,
b@1481 7867
b@1481 7868 // Text to html (true = no transformation)
b@1481 7869 "text html": true,
b@1481 7870
b@1481 7871 // Evaluate text as a json expression
b@1481 7872 "text json": jQuery.parseJSON,
b@1481 7873
b@1481 7874 // Parse text as xml
b@1481 7875 "text xml": jQuery.parseXML
b@1481 7876 },
b@1481 7877
b@1481 7878 // For options that shouldn't be deep extended:
b@1481 7879 // you can add your own custom options here if
b@1481 7880 // and when you create one that shouldn't be
b@1481 7881 // deep extended (see ajaxExtend)
b@1481 7882 flatOptions: {
b@1481 7883 url: true,
b@1481 7884 context: true
b@1481 7885 }
b@1481 7886 },
b@1481 7887
b@1481 7888 // Creates a full fledged settings object into target
b@1481 7889 // with both ajaxSettings and settings fields.
b@1481 7890 // If target is omitted, writes into ajaxSettings.
b@1481 7891 ajaxSetup: function( target, settings ) {
b@1481 7892 return settings ?
b@1481 7893
b@1481 7894 // Building a settings object
b@1481 7895 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
b@1481 7896
b@1481 7897 // Extending ajaxSettings
b@1481 7898 ajaxExtend( jQuery.ajaxSettings, target );
b@1481 7899 },
b@1481 7900
b@1481 7901 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
b@1481 7902 ajaxTransport: addToPrefiltersOrTransports( transports ),
b@1481 7903
b@1481 7904 // Main method
b@1481 7905 ajax: function( url, options ) {
b@1481 7906
b@1481 7907 // If url is an object, simulate pre-1.5 signature
b@1481 7908 if ( typeof url === "object" ) {
b@1481 7909 options = url;
b@1481 7910 url = undefined;
b@1481 7911 }
b@1481 7912
b@1481 7913 // Force options to be an object
b@1481 7914 options = options || {};
b@1481 7915
b@1481 7916 var transport,
b@1481 7917 // URL without anti-cache param
b@1481 7918 cacheURL,
b@1481 7919 // Response headers
b@1481 7920 responseHeadersString,
b@1481 7921 responseHeaders,
b@1481 7922 // timeout handle
b@1481 7923 timeoutTimer,
b@1481 7924 // Cross-domain detection vars
b@1481 7925 parts,
b@1481 7926 // To know if global events are to be dispatched
b@1481 7927 fireGlobals,
b@1481 7928 // Loop variable
b@1481 7929 i,
b@1481 7930 // Create the final options object
b@1481 7931 s = jQuery.ajaxSetup( {}, options ),
b@1481 7932 // Callbacks context
b@1481 7933 callbackContext = s.context || s,
b@1481 7934 // Context for global events is callbackContext if it is a DOM node or jQuery collection
b@1481 7935 globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
b@1481 7936 jQuery( callbackContext ) :
b@1481 7937 jQuery.event,
b@1481 7938 // Deferreds
b@1481 7939 deferred = jQuery.Deferred(),
b@1481 7940 completeDeferred = jQuery.Callbacks("once memory"),
b@1481 7941 // Status-dependent callbacks
b@1481 7942 statusCode = s.statusCode || {},
b@1481 7943 // Headers (they are sent all at once)
b@1481 7944 requestHeaders = {},
b@1481 7945 requestHeadersNames = {},
b@1481 7946 // The jqXHR state
b@1481 7947 state = 0,
b@1481 7948 // Default abort message
b@1481 7949 strAbort = "canceled",
b@1481 7950 // Fake xhr
b@1481 7951 jqXHR = {
b@1481 7952 readyState: 0,
b@1481 7953
b@1481 7954 // Builds headers hashtable if needed
b@1481 7955 getResponseHeader: function( key ) {
b@1481 7956 var match;
b@1481 7957 if ( state === 2 ) {
b@1481 7958 if ( !responseHeaders ) {
b@1481 7959 responseHeaders = {};
b@1481 7960 while ( (match = rheaders.exec( responseHeadersString )) ) {
b@1481 7961 responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
b@1481 7962 }
b@1481 7963 }
b@1481 7964 match = responseHeaders[ key.toLowerCase() ];
b@1481 7965 }
b@1481 7966 return match == null ? null : match;
b@1481 7967 },
b@1481 7968
b@1481 7969 // Raw string
b@1481 7970 getAllResponseHeaders: function() {
b@1481 7971 return state === 2 ? responseHeadersString : null;
b@1481 7972 },
b@1481 7973
b@1481 7974 // Caches the header
b@1481 7975 setRequestHeader: function( name, value ) {
b@1481 7976 var lname = name.toLowerCase();
b@1481 7977 if ( !state ) {
b@1481 7978 name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
b@1481 7979 requestHeaders[ name ] = value;
b@1481 7980 }
b@1481 7981 return this;
b@1481 7982 },
b@1481 7983
b@1481 7984 // Overrides response content-type header
b@1481 7985 overrideMimeType: function( type ) {
b@1481 7986 if ( !state ) {
b@1481 7987 s.mimeType = type;
b@1481 7988 }
b@1481 7989 return this;
b@1481 7990 },
b@1481 7991
b@1481 7992 // Status-dependent callbacks
b@1481 7993 statusCode: function( map ) {
b@1481 7994 var code;
b@1481 7995 if ( map ) {
b@1481 7996 if ( state < 2 ) {
b@1481 7997 for ( code in map ) {
b@1481 7998 // Lazy-add the new callback in a way that preserves old ones
b@1481 7999 statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
b@1481 8000 }
b@1481 8001 } else {
b@1481 8002 // Execute the appropriate callbacks
b@1481 8003 jqXHR.always( map[ jqXHR.status ] );
b@1481 8004 }
b@1481 8005 }
b@1481 8006 return this;
b@1481 8007 },
b@1481 8008
b@1481 8009 // Cancel the request
b@1481 8010 abort: function( statusText ) {
b@1481 8011 var finalText = statusText || strAbort;
b@1481 8012 if ( transport ) {
b@1481 8013 transport.abort( finalText );
b@1481 8014 }
b@1481 8015 done( 0, finalText );
b@1481 8016 return this;
b@1481 8017 }
b@1481 8018 };
b@1481 8019
b@1481 8020 // Attach deferreds
b@1481 8021 deferred.promise( jqXHR ).complete = completeDeferred.add;
b@1481 8022 jqXHR.success = jqXHR.done;
b@1481 8023 jqXHR.error = jqXHR.fail;
b@1481 8024
b@1481 8025 // Remove hash character (#7531: and string promotion)
b@1481 8026 // Add protocol if not provided (prefilters might expect it)
b@1481 8027 // Handle falsy url in the settings object (#10093: consistency with old signature)
b@1481 8028 // We also use the url parameter if available
b@1481 8029 s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" )
b@1481 8030 .replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
b@1481 8031
b@1481 8032 // Alias method option to type as per ticket #12004
b@1481 8033 s.type = options.method || options.type || s.method || s.type;
b@1481 8034
b@1481 8035 // Extract dataTypes list
b@1481 8036 s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
b@1481 8037
b@1481 8038 // A cross-domain request is in order when we have a protocol:host:port mismatch
b@1481 8039 if ( s.crossDomain == null ) {
b@1481 8040 parts = rurl.exec( s.url.toLowerCase() );
b@1481 8041 s.crossDomain = !!( parts &&
b@1481 8042 ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
b@1481 8043 ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
b@1481 8044 ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
b@1481 8045 );
b@1481 8046 }
b@1481 8047
b@1481 8048 // Convert data if not already a string
b@1481 8049 if ( s.data && s.processData && typeof s.data !== "string" ) {
b@1481 8050 s.data = jQuery.param( s.data, s.traditional );
b@1481 8051 }
b@1481 8052
b@1481 8053 // Apply prefilters
b@1481 8054 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
b@1481 8055
b@1481 8056 // If request was aborted inside a prefilter, stop there
b@1481 8057 if ( state === 2 ) {
b@1481 8058 return jqXHR;
b@1481 8059 }
b@1481 8060
b@1481 8061 // We can fire global events as of now if asked to
b@1481 8062 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
b@1481 8063 fireGlobals = jQuery.event && s.global;
b@1481 8064
b@1481 8065 // Watch for a new set of requests
b@1481 8066 if ( fireGlobals && jQuery.active++ === 0 ) {
b@1481 8067 jQuery.event.trigger("ajaxStart");
b@1481 8068 }
b@1481 8069
b@1481 8070 // Uppercase the type
b@1481 8071 s.type = s.type.toUpperCase();
b@1481 8072
b@1481 8073 // Determine if request has content
b@1481 8074 s.hasContent = !rnoContent.test( s.type );
b@1481 8075
b@1481 8076 // Save the URL in case we're toying with the If-Modified-Since
b@1481 8077 // and/or If-None-Match header later on
b@1481 8078 cacheURL = s.url;
b@1481 8079
b@1481 8080 // More options handling for requests with no content
b@1481 8081 if ( !s.hasContent ) {
b@1481 8082
b@1481 8083 // If data is available, append data to url
b@1481 8084 if ( s.data ) {
b@1481 8085 cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
b@1481 8086 // #9682: remove data so that it's not used in an eventual retry
b@1481 8087 delete s.data;
b@1481 8088 }
b@1481 8089
b@1481 8090 // Add anti-cache in url if needed
b@1481 8091 if ( s.cache === false ) {
b@1481 8092 s.url = rts.test( cacheURL ) ?
b@1481 8093
b@1481 8094 // If there is already a '_' parameter, set its value
b@1481 8095 cacheURL.replace( rts, "$1_=" + nonce++ ) :
b@1481 8096
b@1481 8097 // Otherwise add one to the end
b@1481 8098 cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
b@1481 8099 }
b@1481 8100 }
b@1481 8101
b@1481 8102 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
b@1481 8103 if ( s.ifModified ) {
b@1481 8104 if ( jQuery.lastModified[ cacheURL ] ) {
b@1481 8105 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
b@1481 8106 }
b@1481 8107 if ( jQuery.etag[ cacheURL ] ) {
b@1481 8108 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
b@1481 8109 }
b@1481 8110 }
b@1481 8111
b@1481 8112 // Set the correct header, if data is being sent
b@1481 8113 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
b@1481 8114 jqXHR.setRequestHeader( "Content-Type", s.contentType );
b@1481 8115 }
b@1481 8116
b@1481 8117 // Set the Accepts header for the server, depending on the dataType
b@1481 8118 jqXHR.setRequestHeader(
b@1481 8119 "Accept",
b@1481 8120 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
b@1481 8121 s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
b@1481 8122 s.accepts[ "*" ]
b@1481 8123 );
b@1481 8124
b@1481 8125 // Check for headers option
b@1481 8126 for ( i in s.headers ) {
b@1481 8127 jqXHR.setRequestHeader( i, s.headers[ i ] );
b@1481 8128 }
b@1481 8129
b@1481 8130 // Allow custom headers/mimetypes and early abort
b@1481 8131 if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
b@1481 8132 // Abort if not done already and return
b@1481 8133 return jqXHR.abort();
b@1481 8134 }
b@1481 8135
b@1481 8136 // Aborting is no longer a cancellation
b@1481 8137 strAbort = "abort";
b@1481 8138
b@1481 8139 // Install callbacks on deferreds
b@1481 8140 for ( i in { success: 1, error: 1, complete: 1 } ) {
b@1481 8141 jqXHR[ i ]( s[ i ] );
b@1481 8142 }
b@1481 8143
b@1481 8144 // Get transport
b@1481 8145 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
b@1481 8146
b@1481 8147 // If no transport, we auto-abort
b@1481 8148 if ( !transport ) {
b@1481 8149 done( -1, "No Transport" );
b@1481 8150 } else {
b@1481 8151 jqXHR.readyState = 1;
b@1481 8152
b@1481 8153 // Send global event
b@1481 8154 if ( fireGlobals ) {
b@1481 8155 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
b@1481 8156 }
b@1481 8157 // Timeout
b@1481 8158 if ( s.async && s.timeout > 0 ) {
b@1481 8159 timeoutTimer = setTimeout(function() {
b@1481 8160 jqXHR.abort("timeout");
b@1481 8161 }, s.timeout );
b@1481 8162 }
b@1481 8163
b@1481 8164 try {
b@1481 8165 state = 1;
b@1481 8166 transport.send( requestHeaders, done );
b@1481 8167 } catch ( e ) {
b@1481 8168 // Propagate exception as error if not done
b@1481 8169 if ( state < 2 ) {
b@1481 8170 done( -1, e );
b@1481 8171 // Simply rethrow otherwise
b@1481 8172 } else {
b@1481 8173 throw e;
b@1481 8174 }
b@1481 8175 }
b@1481 8176 }
b@1481 8177
b@1481 8178 // Callback for when everything is done
b@1481 8179 function done( status, nativeStatusText, responses, headers ) {
b@1481 8180 var isSuccess, success, error, response, modified,
b@1481 8181 statusText = nativeStatusText;
b@1481 8182
b@1481 8183 // Called once
b@1481 8184 if ( state === 2 ) {
b@1481 8185 return;
b@1481 8186 }
b@1481 8187
b@1481 8188 // State is "done" now
b@1481 8189 state = 2;
b@1481 8190
b@1481 8191 // Clear timeout if it exists
b@1481 8192 if ( timeoutTimer ) {
b@1481 8193 clearTimeout( timeoutTimer );
b@1481 8194 }
b@1481 8195
b@1481 8196 // Dereference transport for early garbage collection
b@1481 8197 // (no matter how long the jqXHR object will be used)
b@1481 8198 transport = undefined;
b@1481 8199
b@1481 8200 // Cache response headers
b@1481 8201 responseHeadersString = headers || "";
b@1481 8202
b@1481 8203 // Set readyState
b@1481 8204 jqXHR.readyState = status > 0 ? 4 : 0;
b@1481 8205
b@1481 8206 // Determine if successful
b@1481 8207 isSuccess = status >= 200 && status < 300 || status === 304;
b@1481 8208
b@1481 8209 // Get response data
b@1481 8210 if ( responses ) {
b@1481 8211 response = ajaxHandleResponses( s, jqXHR, responses );
b@1481 8212 }
b@1481 8213
b@1481 8214 // Convert no matter what (that way responseXXX fields are always set)
b@1481 8215 response = ajaxConvert( s, response, jqXHR, isSuccess );
b@1481 8216
b@1481 8217 // If successful, handle type chaining
b@1481 8218 if ( isSuccess ) {
b@1481 8219
b@1481 8220 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
b@1481 8221 if ( s.ifModified ) {
b@1481 8222 modified = jqXHR.getResponseHeader("Last-Modified");
b@1481 8223 if ( modified ) {
b@1481 8224 jQuery.lastModified[ cacheURL ] = modified;
b@1481 8225 }
b@1481 8226 modified = jqXHR.getResponseHeader("etag");
b@1481 8227 if ( modified ) {
b@1481 8228 jQuery.etag[ cacheURL ] = modified;
b@1481 8229 }
b@1481 8230 }
b@1481 8231
b@1481 8232 // if no content
b@1481 8233 if ( status === 204 || s.type === "HEAD" ) {
b@1481 8234 statusText = "nocontent";
b@1481 8235
b@1481 8236 // if not modified
b@1481 8237 } else if ( status === 304 ) {
b@1481 8238 statusText = "notmodified";
b@1481 8239
b@1481 8240 // If we have data, let's convert it
b@1481 8241 } else {
b@1481 8242 statusText = response.state;
b@1481 8243 success = response.data;
b@1481 8244 error = response.error;
b@1481 8245 isSuccess = !error;
b@1481 8246 }
b@1481 8247 } else {
b@1481 8248 // Extract error from statusText and normalize for non-aborts
b@1481 8249 error = statusText;
b@1481 8250 if ( status || !statusText ) {
b@1481 8251 statusText = "error";
b@1481 8252 if ( status < 0 ) {
b@1481 8253 status = 0;
b@1481 8254 }
b@1481 8255 }
b@1481 8256 }
b@1481 8257
b@1481 8258 // Set data for the fake xhr object
b@1481 8259 jqXHR.status = status;
b@1481 8260 jqXHR.statusText = ( nativeStatusText || statusText ) + "";
b@1481 8261
b@1481 8262 // Success/Error
b@1481 8263 if ( isSuccess ) {
b@1481 8264 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
b@1481 8265 } else {
b@1481 8266 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
b@1481 8267 }
b@1481 8268
b@1481 8269 // Status-dependent callbacks
b@1481 8270 jqXHR.statusCode( statusCode );
b@1481 8271 statusCode = undefined;
b@1481 8272
b@1481 8273 if ( fireGlobals ) {
b@1481 8274 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
b@1481 8275 [ jqXHR, s, isSuccess ? success : error ] );
b@1481 8276 }
b@1481 8277
b@1481 8278 // Complete
b@1481 8279 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
b@1481 8280
b@1481 8281 if ( fireGlobals ) {
b@1481 8282 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
b@1481 8283 // Handle the global AJAX counter
b@1481 8284 if ( !( --jQuery.active ) ) {
b@1481 8285 jQuery.event.trigger("ajaxStop");
b@1481 8286 }
b@1481 8287 }
b@1481 8288 }
b@1481 8289
b@1481 8290 return jqXHR;
b@1481 8291 },
b@1481 8292
b@1481 8293 getJSON: function( url, data, callback ) {
b@1481 8294 return jQuery.get( url, data, callback, "json" );
b@1481 8295 },
b@1481 8296
b@1481 8297 getScript: function( url, callback ) {
b@1481 8298 return jQuery.get( url, undefined, callback, "script" );
b@1481 8299 }
b@1481 8300 });
b@1481 8301
b@1481 8302 jQuery.each( [ "get", "post" ], function( i, method ) {
b@1481 8303 jQuery[ method ] = function( url, data, callback, type ) {
b@1481 8304 // Shift arguments if data argument was omitted
b@1481 8305 if ( jQuery.isFunction( data ) ) {
b@1481 8306 type = type || callback;
b@1481 8307 callback = data;
b@1481 8308 data = undefined;
b@1481 8309 }
b@1481 8310
b@1481 8311 return jQuery.ajax({
b@1481 8312 url: url,
b@1481 8313 type: method,
b@1481 8314 dataType: type,
b@1481 8315 data: data,
b@1481 8316 success: callback
b@1481 8317 });
b@1481 8318 };
b@1481 8319 });
b@1481 8320
b@1481 8321
b@1481 8322 jQuery._evalUrl = function( url ) {
b@1481 8323 return jQuery.ajax({
b@1481 8324 url: url,
b@1481 8325 type: "GET",
b@1481 8326 dataType: "script",
b@1481 8327 async: false,
b@1481 8328 global: false,
b@1481 8329 "throws": true
b@1481 8330 });
b@1481 8331 };
b@1481 8332
b@1481 8333
b@1481 8334 jQuery.fn.extend({
b@1481 8335 wrapAll: function( html ) {
b@1481 8336 var wrap;
b@1481 8337
b@1481 8338 if ( jQuery.isFunction( html ) ) {
b@1481 8339 return this.each(function( i ) {
b@1481 8340 jQuery( this ).wrapAll( html.call(this, i) );
b@1481 8341 });
b@1481 8342 }
b@1481 8343
b@1481 8344 if ( this[ 0 ] ) {
b@1481 8345
b@1481 8346 // The elements to wrap the target around
b@1481 8347 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
b@1481 8348
b@1481 8349 if ( this[ 0 ].parentNode ) {
b@1481 8350 wrap.insertBefore( this[ 0 ] );
b@1481 8351 }
b@1481 8352
b@1481 8353 wrap.map(function() {
b@1481 8354 var elem = this;
b@1481 8355
b@1481 8356 while ( elem.firstElementChild ) {
b@1481 8357 elem = elem.firstElementChild;
b@1481 8358 }
b@1481 8359
b@1481 8360 return elem;
b@1481 8361 }).append( this );
b@1481 8362 }
b@1481 8363
b@1481 8364 return this;
b@1481 8365 },
b@1481 8366
b@1481 8367 wrapInner: function( html ) {
b@1481 8368 if ( jQuery.isFunction( html ) ) {
b@1481 8369 return this.each(function( i ) {
b@1481 8370 jQuery( this ).wrapInner( html.call(this, i) );
b@1481 8371 });
b@1481 8372 }
b@1481 8373
b@1481 8374 return this.each(function() {
b@1481 8375 var self = jQuery( this ),
b@1481 8376 contents = self.contents();
b@1481 8377
b@1481 8378 if ( contents.length ) {
b@1481 8379 contents.wrapAll( html );
b@1481 8380
b@1481 8381 } else {
b@1481 8382 self.append( html );
b@1481 8383 }
b@1481 8384 });
b@1481 8385 },
b@1481 8386
b@1481 8387 wrap: function( html ) {
b@1481 8388 var isFunction = jQuery.isFunction( html );
b@1481 8389
b@1481 8390 return this.each(function( i ) {
b@1481 8391 jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
b@1481 8392 });
b@1481 8393 },
b@1481 8394
b@1481 8395 unwrap: function() {
b@1481 8396 return this.parent().each(function() {
b@1481 8397 if ( !jQuery.nodeName( this, "body" ) ) {
b@1481 8398 jQuery( this ).replaceWith( this.childNodes );
b@1481 8399 }
b@1481 8400 }).end();
b@1481 8401 }
b@1481 8402 });
b@1481 8403
b@1481 8404
b@1481 8405 jQuery.expr.filters.hidden = function( elem ) {
b@1481 8406 // Support: Opera <= 12.12
b@1481 8407 // Opera reports offsetWidths and offsetHeights less than zero on some elements
b@1481 8408 return elem.offsetWidth <= 0 && elem.offsetHeight <= 0;
b@1481 8409 };
b@1481 8410 jQuery.expr.filters.visible = function( elem ) {
b@1481 8411 return !jQuery.expr.filters.hidden( elem );
b@1481 8412 };
b@1481 8413
b@1481 8414
b@1481 8415
b@1481 8416
b@1481 8417 var r20 = /%20/g,
b@1481 8418 rbracket = /\[\]$/,
b@1481 8419 rCRLF = /\r?\n/g,
b@1481 8420 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
b@1481 8421 rsubmittable = /^(?:input|select|textarea|keygen)/i;
b@1481 8422
b@1481 8423 function buildParams( prefix, obj, traditional, add ) {
b@1481 8424 var name;
b@1481 8425
b@1481 8426 if ( jQuery.isArray( obj ) ) {
b@1481 8427 // Serialize array item.
b@1481 8428 jQuery.each( obj, function( i, v ) {
b@1481 8429 if ( traditional || rbracket.test( prefix ) ) {
b@1481 8430 // Treat each array item as a scalar.
b@1481 8431 add( prefix, v );
b@1481 8432
b@1481 8433 } else {
b@1481 8434 // Item is non-scalar (array or object), encode its numeric index.
b@1481 8435 buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
b@1481 8436 }
b@1481 8437 });
b@1481 8438
b@1481 8439 } else if ( !traditional && jQuery.type( obj ) === "object" ) {
b@1481 8440 // Serialize object item.
b@1481 8441 for ( name in obj ) {
b@1481 8442 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
b@1481 8443 }
b@1481 8444
b@1481 8445 } else {
b@1481 8446 // Serialize scalar item.
b@1481 8447 add( prefix, obj );
b@1481 8448 }
b@1481 8449 }
b@1481 8450
b@1481 8451 // Serialize an array of form elements or a set of
b@1481 8452 // key/values into a query string
b@1481 8453 jQuery.param = function( a, traditional ) {
b@1481 8454 var prefix,
b@1481 8455 s = [],
b@1481 8456 add = function( key, value ) {
b@1481 8457 // If value is a function, invoke it and return its value
b@1481 8458 value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
b@1481 8459 s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
b@1481 8460 };
b@1481 8461
b@1481 8462 // Set traditional to true for jQuery <= 1.3.2 behavior.
b@1481 8463 if ( traditional === undefined ) {
b@1481 8464 traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
b@1481 8465 }
b@1481 8466
b@1481 8467 // If an array was passed in, assume that it is an array of form elements.
b@1481 8468 if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
b@1481 8469 // Serialize the form elements
b@1481 8470 jQuery.each( a, function() {
b@1481 8471 add( this.name, this.value );
b@1481 8472 });
b@1481 8473
b@1481 8474 } else {
b@1481 8475 // If traditional, encode the "old" way (the way 1.3.2 or older
b@1481 8476 // did it), otherwise encode params recursively.
b@1481 8477 for ( prefix in a ) {
b@1481 8478 buildParams( prefix, a[ prefix ], traditional, add );
b@1481 8479 }
b@1481 8480 }
b@1481 8481
b@1481 8482 // Return the resulting serialization
b@1481 8483 return s.join( "&" ).replace( r20, "+" );
b@1481 8484 };
b@1481 8485
b@1481 8486 jQuery.fn.extend({
b@1481 8487 serialize: function() {
b@1481 8488 return jQuery.param( this.serializeArray() );
b@1481 8489 },
b@1481 8490 serializeArray: function() {
b@1481 8491 return this.map(function() {
b@1481 8492 // Can add propHook for "elements" to filter or add form elements
b@1481 8493 var elements = jQuery.prop( this, "elements" );
b@1481 8494 return elements ? jQuery.makeArray( elements ) : this;
b@1481 8495 })
b@1481 8496 .filter(function() {
b@1481 8497 var type = this.type;
b@1481 8498
b@1481 8499 // Use .is( ":disabled" ) so that fieldset[disabled] works
b@1481 8500 return this.name && !jQuery( this ).is( ":disabled" ) &&
b@1481 8501 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
b@1481 8502 ( this.checked || !rcheckableType.test( type ) );
b@1481 8503 })
b@1481 8504 .map(function( i, elem ) {
b@1481 8505 var val = jQuery( this ).val();
b@1481 8506
b@1481 8507 return val == null ?
b@1481 8508 null :
b@1481 8509 jQuery.isArray( val ) ?
b@1481 8510 jQuery.map( val, function( val ) {
b@1481 8511 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
b@1481 8512 }) :
b@1481 8513 { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
b@1481 8514 }).get();
b@1481 8515 }
b@1481 8516 });
b@1481 8517
b@1481 8518
b@1481 8519 jQuery.ajaxSettings.xhr = function() {
b@1481 8520 try {
b@1481 8521 return new XMLHttpRequest();
b@1481 8522 } catch( e ) {}
b@1481 8523 };
b@1481 8524
b@1481 8525 var xhrId = 0,
b@1481 8526 xhrCallbacks = {},
b@1481 8527 xhrSuccessStatus = {
b@1481 8528 // file protocol always yields status code 0, assume 200
b@1481 8529 0: 200,
b@1481 8530 // Support: IE9
b@1481 8531 // #1450: sometimes IE returns 1223 when it should be 204
b@1481 8532 1223: 204
b@1481 8533 },
b@1481 8534 xhrSupported = jQuery.ajaxSettings.xhr();
b@1481 8535
b@1481 8536 // Support: IE9
b@1481 8537 // Open requests must be manually aborted on unload (#5280)
b@1481 8538 // See https://support.microsoft.com/kb/2856746 for more info
b@1481 8539 if ( window.attachEvent ) {
b@1481 8540 window.attachEvent( "onunload", function() {
b@1481 8541 for ( var key in xhrCallbacks ) {
b@1481 8542 xhrCallbacks[ key ]();
b@1481 8543 }
b@1481 8544 });
b@1481 8545 }
b@1481 8546
b@1481 8547 support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
b@1481 8548 support.ajax = xhrSupported = !!xhrSupported;
b@1481 8549
b@1481 8550 jQuery.ajaxTransport(function( options ) {
b@1481 8551 var callback;
b@1481 8552
b@1481 8553 // Cross domain only allowed if supported through XMLHttpRequest
b@1481 8554 if ( support.cors || xhrSupported && !options.crossDomain ) {
b@1481 8555 return {
b@1481 8556 send: function( headers, complete ) {
b@1481 8557 var i,
b@1481 8558 xhr = options.xhr(),
b@1481 8559 id = ++xhrId;
b@1481 8560
b@1481 8561 xhr.open( options.type, options.url, options.async, options.username, options.password );
b@1481 8562
b@1481 8563 // Apply custom fields if provided
b@1481 8564 if ( options.xhrFields ) {
b@1481 8565 for ( i in options.xhrFields ) {
b@1481 8566 xhr[ i ] = options.xhrFields[ i ];
b@1481 8567 }
b@1481 8568 }
b@1481 8569
b@1481 8570 // Override mime type if needed
b@1481 8571 if ( options.mimeType && xhr.overrideMimeType ) {
b@1481 8572 xhr.overrideMimeType( options.mimeType );
b@1481 8573 }
b@1481 8574
b@1481 8575 // X-Requested-With header
b@1481 8576 // For cross-domain requests, seeing as conditions for a preflight are
b@1481 8577 // akin to a jigsaw puzzle, we simply never set it to be sure.
b@1481 8578 // (it can always be set on a per-request basis or even using ajaxSetup)
b@1481 8579 // For same-domain requests, won't change header if already provided.
b@1481 8580 if ( !options.crossDomain && !headers["X-Requested-With"] ) {
b@1481 8581 headers["X-Requested-With"] = "XMLHttpRequest";
b@1481 8582 }
b@1481 8583
b@1481 8584 // Set headers
b@1481 8585 for ( i in headers ) {
b@1481 8586 xhr.setRequestHeader( i, headers[ i ] );
b@1481 8587 }
b@1481 8588
b@1481 8589 // Callback
b@1481 8590 callback = function( type ) {
b@1481 8591 return function() {
b@1481 8592 if ( callback ) {
b@1481 8593 delete xhrCallbacks[ id ];
b@1481 8594 callback = xhr.onload = xhr.onerror = null;
b@1481 8595
b@1481 8596 if ( type === "abort" ) {
b@1481 8597 xhr.abort();
b@1481 8598 } else if ( type === "error" ) {
b@1481 8599 complete(
b@1481 8600 // file: protocol always yields status 0; see #8605, #14207
b@1481 8601 xhr.status,
b@1481 8602 xhr.statusText
b@1481 8603 );
b@1481 8604 } else {
b@1481 8605 complete(
b@1481 8606 xhrSuccessStatus[ xhr.status ] || xhr.status,
b@1481 8607 xhr.statusText,
b@1481 8608 // Support: IE9
b@1481 8609 // Accessing binary-data responseText throws an exception
b@1481 8610 // (#11426)
b@1481 8611 typeof xhr.responseText === "string" ? {
b@1481 8612 text: xhr.responseText
b@1481 8613 } : undefined,
b@1481 8614 xhr.getAllResponseHeaders()
b@1481 8615 );
b@1481 8616 }
b@1481 8617 }
b@1481 8618 };
b@1481 8619 };
b@1481 8620
b@1481 8621 // Listen to events
b@1481 8622 xhr.onload = callback();
b@1481 8623 xhr.onerror = callback("error");
b@1481 8624
b@1481 8625 // Create the abort callback
b@1481 8626 callback = xhrCallbacks[ id ] = callback("abort");
b@1481 8627
b@1481 8628 try {
b@1481 8629 // Do send the request (this may raise an exception)
b@1481 8630 xhr.send( options.hasContent && options.data || null );
b@1481 8631 } catch ( e ) {
b@1481 8632 // #14683: Only rethrow if this hasn't been notified as an error yet
b@1481 8633 if ( callback ) {
b@1481 8634 throw e;
b@1481 8635 }
b@1481 8636 }
b@1481 8637 },
b@1481 8638
b@1481 8639 abort: function() {
b@1481 8640 if ( callback ) {
b@1481 8641 callback();
b@1481 8642 }
b@1481 8643 }
b@1481 8644 };
b@1481 8645 }
b@1481 8646 });
b@1481 8647
b@1481 8648
b@1481 8649
b@1481 8650
b@1481 8651 // Install script dataType
b@1481 8652 jQuery.ajaxSetup({
b@1481 8653 accepts: {
b@1481 8654 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
b@1481 8655 },
b@1481 8656 contents: {
b@1481 8657 script: /(?:java|ecma)script/
b@1481 8658 },
b@1481 8659 converters: {
b@1481 8660 "text script": function( text ) {
b@1481 8661 jQuery.globalEval( text );
b@1481 8662 return text;
b@1481 8663 }
b@1481 8664 }
b@1481 8665 });
b@1481 8666
b@1481 8667 // Handle cache's special case and crossDomain
b@1481 8668 jQuery.ajaxPrefilter( "script", function( s ) {
b@1481 8669 if ( s.cache === undefined ) {
b@1481 8670 s.cache = false;
b@1481 8671 }
b@1481 8672 if ( s.crossDomain ) {
b@1481 8673 s.type = "GET";
b@1481 8674 }
b@1481 8675 });
b@1481 8676
b@1481 8677 // Bind script tag hack transport
b@1481 8678 jQuery.ajaxTransport( "script", function( s ) {
b@1481 8679 // This transport only deals with cross domain requests
b@1481 8680 if ( s.crossDomain ) {
b@1481 8681 var script, callback;
b@1481 8682 return {
b@1481 8683 send: function( _, complete ) {
b@1481 8684 script = jQuery("<script>").prop({
b@1481 8685 async: true,
b@1481 8686 charset: s.scriptCharset,
b@1481 8687 src: s.url
b@1481 8688 }).on(
b@1481 8689 "load error",
b@1481 8690 callback = function( evt ) {
b@1481 8691 script.remove();
b@1481 8692 callback = null;
b@1481 8693 if ( evt ) {
b@1481 8694 complete( evt.type === "error" ? 404 : 200, evt.type );
b@1481 8695 }
b@1481 8696 }
b@1481 8697 );
b@1481 8698 document.head.appendChild( script[ 0 ] );
b@1481 8699 },
b@1481 8700 abort: function() {
b@1481 8701 if ( callback ) {
b@1481 8702 callback();
b@1481 8703 }
b@1481 8704 }
b@1481 8705 };
b@1481 8706 }
b@1481 8707 });
b@1481 8708
b@1481 8709
b@1481 8710
b@1481 8711
b@1481 8712 var oldCallbacks = [],
b@1481 8713 rjsonp = /(=)\?(?=&|$)|\?\?/;
b@1481 8714
b@1481 8715 // Default jsonp settings
b@1481 8716 jQuery.ajaxSetup({
b@1481 8717 jsonp: "callback",
b@1481 8718 jsonpCallback: function() {
b@1481 8719 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
b@1481 8720 this[ callback ] = true;
b@1481 8721 return callback;
b@1481 8722 }
b@1481 8723 });
b@1481 8724
b@1481 8725 // Detect, normalize options and install callbacks for jsonp requests
b@1481 8726 jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
b@1481 8727
b@1481 8728 var callbackName, overwritten, responseContainer,
b@1481 8729 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
b@1481 8730 "url" :
b@1481 8731 typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
b@1481 8732 );
b@1481 8733
b@1481 8734 // Handle iff the expected data type is "jsonp" or we have a parameter to set
b@1481 8735 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
b@1481 8736
b@1481 8737 // Get callback name, remembering preexisting value associated with it
b@1481 8738 callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
b@1481 8739 s.jsonpCallback() :
b@1481 8740 s.jsonpCallback;
b@1481 8741
b@1481 8742 // Insert callback into url or form data
b@1481 8743 if ( jsonProp ) {
b@1481 8744 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
b@1481 8745 } else if ( s.jsonp !== false ) {
b@1481 8746 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
b@1481 8747 }
b@1481 8748
b@1481 8749 // Use data converter to retrieve json after script execution
b@1481 8750 s.converters["script json"] = function() {
b@1481 8751 if ( !responseContainer ) {
b@1481 8752 jQuery.error( callbackName + " was not called" );
b@1481 8753 }
b@1481 8754 return responseContainer[ 0 ];
b@1481 8755 };
b@1481 8756
b@1481 8757 // force json dataType
b@1481 8758 s.dataTypes[ 0 ] = "json";
b@1481 8759
b@1481 8760 // Install callback
b@1481 8761 overwritten = window[ callbackName ];
b@1481 8762 window[ callbackName ] = function() {
b@1481 8763 responseContainer = arguments;
b@1481 8764 };
b@1481 8765
b@1481 8766 // Clean-up function (fires after converters)
b@1481 8767 jqXHR.always(function() {
b@1481 8768 // Restore preexisting value
b@1481 8769 window[ callbackName ] = overwritten;
b@1481 8770
b@1481 8771 // Save back as free
b@1481 8772 if ( s[ callbackName ] ) {
b@1481 8773 // make sure that re-using the options doesn't screw things around
b@1481 8774 s.jsonpCallback = originalSettings.jsonpCallback;
b@1481 8775
b@1481 8776 // save the callback name for future use
b@1481 8777 oldCallbacks.push( callbackName );
b@1481 8778 }
b@1481 8779
b@1481 8780 // Call if it was a function and we have a response
b@1481 8781 if ( responseContainer && jQuery.isFunction( overwritten ) ) {
b@1481 8782 overwritten( responseContainer[ 0 ] );
b@1481 8783 }
b@1481 8784
b@1481 8785 responseContainer = overwritten = undefined;
b@1481 8786 });
b@1481 8787
b@1481 8788 // Delegate to script
b@1481 8789 return "script";
b@1481 8790 }
b@1481 8791 });
b@1481 8792
b@1481 8793
b@1481 8794
b@1481 8795
b@1481 8796 // data: string of html
b@1481 8797 // context (optional): If specified, the fragment will be created in this context, defaults to document
b@1481 8798 // keepScripts (optional): If true, will include scripts passed in the html string
b@1481 8799 jQuery.parseHTML = function( data, context, keepScripts ) {
b@1481 8800 if ( !data || typeof data !== "string" ) {
b@1481 8801 return null;
b@1481 8802 }
b@1481 8803 if ( typeof context === "boolean" ) {
b@1481 8804 keepScripts = context;
b@1481 8805 context = false;
b@1481 8806 }
b@1481 8807 context = context || document;
b@1481 8808
b@1481 8809 var parsed = rsingleTag.exec( data ),
b@1481 8810 scripts = !keepScripts && [];
b@1481 8811
b@1481 8812 // Single tag
b@1481 8813 if ( parsed ) {
b@1481 8814 return [ context.createElement( parsed[1] ) ];
b@1481 8815 }
b@1481 8816
b@1481 8817 parsed = jQuery.buildFragment( [ data ], context, scripts );
b@1481 8818
b@1481 8819 if ( scripts && scripts.length ) {
b@1481 8820 jQuery( scripts ).remove();
b@1481 8821 }
b@1481 8822
b@1481 8823 return jQuery.merge( [], parsed.childNodes );
b@1481 8824 };
b@1481 8825
b@1481 8826
b@1481 8827 // Keep a copy of the old load method
b@1481 8828 var _load = jQuery.fn.load;
b@1481 8829
b@1481 8830 /**
b@1481 8831 * Load a url into a page
b@1481 8832 */
b@1481 8833 jQuery.fn.load = function( url, params, callback ) {
b@1481 8834 if ( typeof url !== "string" && _load ) {
b@1481 8835 return _load.apply( this, arguments );
b@1481 8836 }
b@1481 8837
b@1481 8838 var selector, type, response,
b@1481 8839 self = this,
b@1481 8840 off = url.indexOf(" ");
b@1481 8841
b@1481 8842 if ( off >= 0 ) {
b@1481 8843 selector = jQuery.trim( url.slice( off ) );
b@1481 8844 url = url.slice( 0, off );
b@1481 8845 }
b@1481 8846
b@1481 8847 // If it's a function
b@1481 8848 if ( jQuery.isFunction( params ) ) {
b@1481 8849
b@1481 8850 // We assume that it's the callback
b@1481 8851 callback = params;
b@1481 8852 params = undefined;
b@1481 8853
b@1481 8854 // Otherwise, build a param string
b@1481 8855 } else if ( params && typeof params === "object" ) {
b@1481 8856 type = "POST";
b@1481 8857 }
b@1481 8858
b@1481 8859 // If we have elements to modify, make the request
b@1481 8860 if ( self.length > 0 ) {
b@1481 8861 jQuery.ajax({
b@1481 8862 url: url,
b@1481 8863
b@1481 8864 // if "type" variable is undefined, then "GET" method will be used
b@1481 8865 type: type,
b@1481 8866 dataType: "html",
b@1481 8867 data: params
b@1481 8868 }).done(function( responseText ) {
b@1481 8869
b@1481 8870 // Save response for use in complete callback
b@1481 8871 response = arguments;
b@1481 8872
b@1481 8873 self.html( selector ?
b@1481 8874
b@1481 8875 // If a selector was specified, locate the right elements in a dummy div
b@1481 8876 // Exclude scripts to avoid IE 'Permission Denied' errors
b@1481 8877 jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
b@1481 8878
b@1481 8879 // Otherwise use the full result
b@1481 8880 responseText );
b@1481 8881
b@1481 8882 }).complete( callback && function( jqXHR, status ) {
b@1481 8883 self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
b@1481 8884 });
b@1481 8885 }
b@1481 8886
b@1481 8887 return this;
b@1481 8888 };
b@1481 8889
b@1481 8890
b@1481 8891
b@1481 8892
b@1481 8893 // Attach a bunch of functions for handling common AJAX events
b@1481 8894 jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) {
b@1481 8895 jQuery.fn[ type ] = function( fn ) {
b@1481 8896 return this.on( type, fn );
b@1481 8897 };
b@1481 8898 });
b@1481 8899
b@1481 8900
b@1481 8901
b@1481 8902
b@1481 8903 jQuery.expr.filters.animated = function( elem ) {
b@1481 8904 return jQuery.grep(jQuery.timers, function( fn ) {
b@1481 8905 return elem === fn.elem;
b@1481 8906 }).length;
b@1481 8907 };
b@1481 8908
b@1481 8909
b@1481 8910
b@1481 8911
b@1481 8912 var docElem = window.document.documentElement;
b@1481 8913
b@1481 8914 /**
b@1481 8915 * Gets a window from an element
b@1481 8916 */
b@1481 8917 function getWindow( elem ) {
b@1481 8918 return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
b@1481 8919 }
b@1481 8920
b@1481 8921 jQuery.offset = {
b@1481 8922 setOffset: function( elem, options, i ) {
b@1481 8923 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
b@1481 8924 position = jQuery.css( elem, "position" ),
b@1481 8925 curElem = jQuery( elem ),
b@1481 8926 props = {};
b@1481 8927
b@1481 8928 // Set position first, in-case top/left are set even on static elem
b@1481 8929 if ( position === "static" ) {
b@1481 8930 elem.style.position = "relative";
b@1481 8931 }
b@1481 8932
b@1481 8933 curOffset = curElem.offset();
b@1481 8934 curCSSTop = jQuery.css( elem, "top" );
b@1481 8935 curCSSLeft = jQuery.css( elem, "left" );
b@1481 8936 calculatePosition = ( position === "absolute" || position === "fixed" ) &&
b@1481 8937 ( curCSSTop + curCSSLeft ).indexOf("auto") > -1;
b@1481 8938
b@1481 8939 // Need to be able to calculate position if either
b@1481 8940 // top or left is auto and position is either absolute or fixed
b@1481 8941 if ( calculatePosition ) {
b@1481 8942 curPosition = curElem.position();
b@1481 8943 curTop = curPosition.top;
b@1481 8944 curLeft = curPosition.left;
b@1481 8945
b@1481 8946 } else {
b@1481 8947 curTop = parseFloat( curCSSTop ) || 0;
b@1481 8948 curLeft = parseFloat( curCSSLeft ) || 0;
b@1481 8949 }
b@1481 8950
b@1481 8951 if ( jQuery.isFunction( options ) ) {
b@1481 8952 options = options.call( elem, i, curOffset );
b@1481 8953 }
b@1481 8954
b@1481 8955 if ( options.top != null ) {
b@1481 8956 props.top = ( options.top - curOffset.top ) + curTop;
b@1481 8957 }
b@1481 8958 if ( options.left != null ) {
b@1481 8959 props.left = ( options.left - curOffset.left ) + curLeft;
b@1481 8960 }
b@1481 8961
b@1481 8962 if ( "using" in options ) {
b@1481 8963 options.using.call( elem, props );
b@1481 8964
b@1481 8965 } else {
b@1481 8966 curElem.css( props );
b@1481 8967 }
b@1481 8968 }
b@1481 8969 };
b@1481 8970
b@1481 8971 jQuery.fn.extend({
b@1481 8972 offset: function( options ) {
b@1481 8973 if ( arguments.length ) {
b@1481 8974 return options === undefined ?
b@1481 8975 this :
b@1481 8976 this.each(function( i ) {
b@1481 8977 jQuery.offset.setOffset( this, options, i );
b@1481 8978 });
b@1481 8979 }
b@1481 8980
b@1481 8981 var docElem, win,
b@1481 8982 elem = this[ 0 ],
b@1481 8983 box = { top: 0, left: 0 },
b@1481 8984 doc = elem && elem.ownerDocument;
b@1481 8985
b@1481 8986 if ( !doc ) {
b@1481 8987 return;
b@1481 8988 }
b@1481 8989
b@1481 8990 docElem = doc.documentElement;
b@1481 8991
b@1481 8992 // Make sure it's not a disconnected DOM node
b@1481 8993 if ( !jQuery.contains( docElem, elem ) ) {
b@1481 8994 return box;
b@1481 8995 }
b@1481 8996
b@1481 8997 // Support: BlackBerry 5, iOS 3 (original iPhone)
b@1481 8998 // If we don't have gBCR, just use 0,0 rather than error
b@1481 8999 if ( typeof elem.getBoundingClientRect !== strundefined ) {
b@1481 9000 box = elem.getBoundingClientRect();
b@1481 9001 }
b@1481 9002 win = getWindow( doc );
b@1481 9003 return {
b@1481 9004 top: box.top + win.pageYOffset - docElem.clientTop,
b@1481 9005 left: box.left + win.pageXOffset - docElem.clientLeft
b@1481 9006 };
b@1481 9007 },
b@1481 9008
b@1481 9009 position: function() {
b@1481 9010 if ( !this[ 0 ] ) {
b@1481 9011 return;
b@1481 9012 }
b@1481 9013
b@1481 9014 var offsetParent, offset,
b@1481 9015 elem = this[ 0 ],
b@1481 9016 parentOffset = { top: 0, left: 0 };
b@1481 9017
b@1481 9018 // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent
b@1481 9019 if ( jQuery.css( elem, "position" ) === "fixed" ) {
b@1481 9020 // Assume getBoundingClientRect is there when computed position is fixed
b@1481 9021 offset = elem.getBoundingClientRect();
b@1481 9022
b@1481 9023 } else {
b@1481 9024 // Get *real* offsetParent
b@1481 9025 offsetParent = this.offsetParent();
b@1481 9026
b@1481 9027 // Get correct offsets
b@1481 9028 offset = this.offset();
b@1481 9029 if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
b@1481 9030 parentOffset = offsetParent.offset();
b@1481 9031 }
b@1481 9032
b@1481 9033 // Add offsetParent borders
b@1481 9034 parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
b@1481 9035 parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
b@1481 9036 }
b@1481 9037
b@1481 9038 // Subtract parent offsets and element margins
b@1481 9039 return {
b@1481 9040 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
b@1481 9041 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
b@1481 9042 };
b@1481 9043 },
b@1481 9044
b@1481 9045 offsetParent: function() {
b@1481 9046 return this.map(function() {
b@1481 9047 var offsetParent = this.offsetParent || docElem;
b@1481 9048
b@1481 9049 while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) {
b@1481 9050 offsetParent = offsetParent.offsetParent;
b@1481 9051 }
b@1481 9052
b@1481 9053 return offsetParent || docElem;
b@1481 9054 });
b@1481 9055 }
b@1481 9056 });
b@1481 9057
b@1481 9058 // Create scrollLeft and scrollTop methods
b@1481 9059 jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
b@1481 9060 var top = "pageYOffset" === prop;
b@1481 9061
b@1481 9062 jQuery.fn[ method ] = function( val ) {
b@1481 9063 return access( this, function( elem, method, val ) {
b@1481 9064 var win = getWindow( elem );
b@1481 9065
b@1481 9066 if ( val === undefined ) {
b@1481 9067 return win ? win[ prop ] : elem[ method ];
b@1481 9068 }
b@1481 9069
b@1481 9070 if ( win ) {
b@1481 9071 win.scrollTo(
b@1481 9072 !top ? val : window.pageXOffset,
b@1481 9073 top ? val : window.pageYOffset
b@1481 9074 );
b@1481 9075
b@1481 9076 } else {
b@1481 9077 elem[ method ] = val;
b@1481 9078 }
b@1481 9079 }, method, val, arguments.length, null );
b@1481 9080 };
b@1481 9081 });
b@1481 9082
b@1481 9083 // Support: Safari<7+, Chrome<37+
b@1481 9084 // Add the top/left cssHooks using jQuery.fn.position
b@1481 9085 // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
b@1481 9086 // Blink bug: https://code.google.com/p/chromium/issues/detail?id=229280
b@1481 9087 // getComputedStyle returns percent when specified for top/left/bottom/right;
b@1481 9088 // rather than make the css module depend on the offset module, just check for it here
b@1481 9089 jQuery.each( [ "top", "left" ], function( i, prop ) {
b@1481 9090 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
b@1481 9091 function( elem, computed ) {
b@1481 9092 if ( computed ) {
b@1481 9093 computed = curCSS( elem, prop );
b@1481 9094 // If curCSS returns percentage, fallback to offset
b@1481 9095 return rnumnonpx.test( computed ) ?
b@1481 9096 jQuery( elem ).position()[ prop ] + "px" :
b@1481 9097 computed;
b@1481 9098 }
b@1481 9099 }
b@1481 9100 );
b@1481 9101 });
b@1481 9102
b@1481 9103
b@1481 9104 // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
b@1481 9105 jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
b@1481 9106 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
b@1481 9107 // Margin is only for outerHeight, outerWidth
b@1481 9108 jQuery.fn[ funcName ] = function( margin, value ) {
b@1481 9109 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
b@1481 9110 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
b@1481 9111
b@1481 9112 return access( this, function( elem, type, value ) {
b@1481 9113 var doc;
b@1481 9114
b@1481 9115 if ( jQuery.isWindow( elem ) ) {
b@1481 9116 // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
b@1481 9117 // isn't a whole lot we can do. See pull request at this URL for discussion:
b@1481 9118 // https://github.com/jquery/jquery/pull/764
b@1481 9119 return elem.document.documentElement[ "client" + name ];
b@1481 9120 }
b@1481 9121
b@1481 9122 // Get document width or height
b@1481 9123 if ( elem.nodeType === 9 ) {
b@1481 9124 doc = elem.documentElement;
b@1481 9125
b@1481 9126 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
b@1481 9127 // whichever is greatest
b@1481 9128 return Math.max(
b@1481 9129 elem.body[ "scroll" + name ], doc[ "scroll" + name ],
b@1481 9130 elem.body[ "offset" + name ], doc[ "offset" + name ],
b@1481 9131 doc[ "client" + name ]
b@1481 9132 );
b@1481 9133 }
b@1481 9134
b@1481 9135 return value === undefined ?
b@1481 9136 // Get width or height on the element, requesting but not forcing parseFloat
b@1481 9137 jQuery.css( elem, type, extra ) :
b@1481 9138
b@1481 9139 // Set width or height on the element
b@1481 9140 jQuery.style( elem, type, value, extra );
b@1481 9141 }, type, chainable ? margin : undefined, chainable, null );
b@1481 9142 };
b@1481 9143 });
b@1481 9144 });
b@1481 9145
b@1481 9146
b@1481 9147 // The number of elements contained in the matched element set
b@1481 9148 jQuery.fn.size = function() {
b@1481 9149 return this.length;
b@1481 9150 };
b@1481 9151
b@1481 9152 jQuery.fn.andSelf = jQuery.fn.addBack;
b@1481 9153
b@1481 9154
b@1481 9155
b@1481 9156
b@1481 9157 // Register as a named AMD module, since jQuery can be concatenated with other
b@1481 9158 // files that may use define, but not via a proper concatenation script that
b@1481 9159 // understands anonymous AMD modules. A named AMD is safest and most robust
b@1481 9160 // way to register. Lowercase jquery is used because AMD module names are
b@1481 9161 // derived from file names, and jQuery is normally delivered in a lowercase
b@1481 9162 // file name. Do this after creating the global so that if an AMD module wants
b@1481 9163 // to call noConflict to hide this version of jQuery, it will work.
b@1481 9164
b@1481 9165 // Note that for maximum portability, libraries that are not jQuery should
b@1481 9166 // declare themselves as anonymous modules, and avoid setting a global if an
b@1481 9167 // AMD loader is present. jQuery is a special case. For more information, see
b@1481 9168 // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
b@1481 9169
b@1481 9170 if ( typeof define === "function" && define.amd ) {
b@1481 9171 define( "jquery", [], function() {
b@1481 9172 return jQuery;
b@1481 9173 });
b@1481 9174 }
b@1481 9175
b@1481 9176
b@1481 9177
b@1481 9178
b@1481 9179 var
b@1481 9180 // Map over jQuery in case of overwrite
b@1481 9181 _jQuery = window.jQuery,
b@1481 9182
b@1481 9183 // Map over the $ in case of overwrite
b@1481 9184 _$ = window.$;
b@1481 9185
b@1481 9186 jQuery.noConflict = function( deep ) {
b@1481 9187 if ( window.$ === jQuery ) {
b@1481 9188 window.$ = _$;
b@1481 9189 }
b@1481 9190
b@1481 9191 if ( deep && window.jQuery === jQuery ) {
b@1481 9192 window.jQuery = _jQuery;
b@1481 9193 }
b@1481 9194
b@1481 9195 return jQuery;
b@1481 9196 };
b@1481 9197
b@1481 9198 // Expose jQuery and $ identifiers, even in AMD
b@1481 9199 // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
b@1481 9200 // and CommonJS for browser emulators (#13566)
b@1481 9201 if ( typeof noGlobal === strundefined ) {
b@1481 9202 window.jQuery = window.$ = jQuery;
b@1481 9203 }
b@1481 9204
b@1481 9205
b@1481 9206
b@1481 9207
b@1481 9208 return jQuery;
b@1481 9209
b@1481 9210 }));