annotate jquery-2.1.4.js @ 1112:28aa066720ed

Fixed typo
author Giulio Moro <giuliomoro@yahoo.it>
date Sun, 21 Feb 2016 03:35:27 +0000
parents 282dfb8076f5
children
rev   line source
n@1106 1 /*!
n@1106 2 * jQuery JavaScript Library v2.1.4
n@1106 3 * http://jquery.com/
n@1106 4 *
n@1106 5 * Includes Sizzle.js
n@1106 6 * http://sizzlejs.com/
n@1106 7 *
n@1106 8 * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
n@1106 9 * Released under the MIT license
n@1106 10 * http://jquery.org/license
n@1106 11 *
n@1106 12 * Date: 2015-04-28T16:01Z
n@1106 13 */
n@1106 14
n@1106 15 (function( global, factory ) {
n@1106 16
n@1106 17 if ( typeof module === "object" && typeof module.exports === "object" ) {
n@1106 18 // For CommonJS and CommonJS-like environments where a proper `window`
n@1106 19 // is present, execute the factory and get jQuery.
n@1106 20 // For environments that do not have a `window` with a `document`
n@1106 21 // (such as Node.js), expose a factory as module.exports.
n@1106 22 // This accentuates the need for the creation of a real `window`.
n@1106 23 // e.g. var jQuery = require("jquery")(window);
n@1106 24 // See ticket #14549 for more info.
n@1106 25 module.exports = global.document ?
n@1106 26 factory( global, true ) :
n@1106 27 function( w ) {
n@1106 28 if ( !w.document ) {
n@1106 29 throw new Error( "jQuery requires a window with a document" );
n@1106 30 }
n@1106 31 return factory( w );
n@1106 32 };
n@1106 33 } else {
n@1106 34 factory( global );
n@1106 35 }
n@1106 36
n@1106 37 // Pass this if window is not defined yet
n@1106 38 }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
n@1106 39
n@1106 40 // Support: Firefox 18+
n@1106 41 // Can't be in strict mode, several libs including ASP.NET trace
n@1106 42 // the stack via arguments.caller.callee and Firefox dies if
n@1106 43 // you try to trace through "use strict" call chains. (#13335)
n@1106 44 //
n@1106 45
n@1106 46 var arr = [];
n@1106 47
n@1106 48 var slice = arr.slice;
n@1106 49
n@1106 50 var concat = arr.concat;
n@1106 51
n@1106 52 var push = arr.push;
n@1106 53
n@1106 54 var indexOf = arr.indexOf;
n@1106 55
n@1106 56 var class2type = {};
n@1106 57
n@1106 58 var toString = class2type.toString;
n@1106 59
n@1106 60 var hasOwn = class2type.hasOwnProperty;
n@1106 61
n@1106 62 var support = {};
n@1106 63
n@1106 64
n@1106 65
n@1106 66 var
n@1106 67 // Use the correct document accordingly with window argument (sandbox)
n@1106 68 document = window.document,
n@1106 69
n@1106 70 version = "2.1.4",
n@1106 71
n@1106 72 // Define a local copy of jQuery
n@1106 73 jQuery = function( selector, context ) {
n@1106 74 // The jQuery object is actually just the init constructor 'enhanced'
n@1106 75 // Need init if jQuery is called (just allow error to be thrown if not included)
n@1106 76 return new jQuery.fn.init( selector, context );
n@1106 77 },
n@1106 78
n@1106 79 // Support: Android<4.1
n@1106 80 // Make sure we trim BOM and NBSP
n@1106 81 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
n@1106 82
n@1106 83 // Matches dashed string for camelizing
n@1106 84 rmsPrefix = /^-ms-/,
n@1106 85 rdashAlpha = /-([\da-z])/gi,
n@1106 86
n@1106 87 // Used by jQuery.camelCase as callback to replace()
n@1106 88 fcamelCase = function( all, letter ) {
n@1106 89 return letter.toUpperCase();
n@1106 90 };
n@1106 91
n@1106 92 jQuery.fn = jQuery.prototype = {
n@1106 93 // The current version of jQuery being used
n@1106 94 jquery: version,
n@1106 95
n@1106 96 constructor: jQuery,
n@1106 97
n@1106 98 // Start with an empty selector
n@1106 99 selector: "",
n@1106 100
n@1106 101 // The default length of a jQuery object is 0
n@1106 102 length: 0,
n@1106 103
n@1106 104 toArray: function() {
n@1106 105 return slice.call( this );
n@1106 106 },
n@1106 107
n@1106 108 // Get the Nth element in the matched element set OR
n@1106 109 // Get the whole matched element set as a clean array
n@1106 110 get: function( num ) {
n@1106 111 return num != null ?
n@1106 112
n@1106 113 // Return just the one element from the set
n@1106 114 ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
n@1106 115
n@1106 116 // Return all the elements in a clean array
n@1106 117 slice.call( this );
n@1106 118 },
n@1106 119
n@1106 120 // Take an array of elements and push it onto the stack
n@1106 121 // (returning the new matched element set)
n@1106 122 pushStack: function( elems ) {
n@1106 123
n@1106 124 // Build a new jQuery matched element set
n@1106 125 var ret = jQuery.merge( this.constructor(), elems );
n@1106 126
n@1106 127 // Add the old object onto the stack (as a reference)
n@1106 128 ret.prevObject = this;
n@1106 129 ret.context = this.context;
n@1106 130
n@1106 131 // Return the newly-formed element set
n@1106 132 return ret;
n@1106 133 },
n@1106 134
n@1106 135 // Execute a callback for every element in the matched set.
n@1106 136 // (You can seed the arguments with an array of args, but this is
n@1106 137 // only used internally.)
n@1106 138 each: function( callback, args ) {
n@1106 139 return jQuery.each( this, callback, args );
n@1106 140 },
n@1106 141
n@1106 142 map: function( callback ) {
n@1106 143 return this.pushStack( jQuery.map(this, function( elem, i ) {
n@1106 144 return callback.call( elem, i, elem );
n@1106 145 }));
n@1106 146 },
n@1106 147
n@1106 148 slice: function() {
n@1106 149 return this.pushStack( slice.apply( this, arguments ) );
n@1106 150 },
n@1106 151
n@1106 152 first: function() {
n@1106 153 return this.eq( 0 );
n@1106 154 },
n@1106 155
n@1106 156 last: function() {
n@1106 157 return this.eq( -1 );
n@1106 158 },
n@1106 159
n@1106 160 eq: function( i ) {
n@1106 161 var len = this.length,
n@1106 162 j = +i + ( i < 0 ? len : 0 );
n@1106 163 return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
n@1106 164 },
n@1106 165
n@1106 166 end: function() {
n@1106 167 return this.prevObject || this.constructor(null);
n@1106 168 },
n@1106 169
n@1106 170 // For internal use only.
n@1106 171 // Behaves like an Array's method, not like a jQuery method.
n@1106 172 push: push,
n@1106 173 sort: arr.sort,
n@1106 174 splice: arr.splice
n@1106 175 };
n@1106 176
n@1106 177 jQuery.extend = jQuery.fn.extend = function() {
n@1106 178 var options, name, src, copy, copyIsArray, clone,
n@1106 179 target = arguments[0] || {},
n@1106 180 i = 1,
n@1106 181 length = arguments.length,
n@1106 182 deep = false;
n@1106 183
n@1106 184 // Handle a deep copy situation
n@1106 185 if ( typeof target === "boolean" ) {
n@1106 186 deep = target;
n@1106 187
n@1106 188 // Skip the boolean and the target
n@1106 189 target = arguments[ i ] || {};
n@1106 190 i++;
n@1106 191 }
n@1106 192
n@1106 193 // Handle case when target is a string or something (possible in deep copy)
n@1106 194 if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
n@1106 195 target = {};
n@1106 196 }
n@1106 197
n@1106 198 // Extend jQuery itself if only one argument is passed
n@1106 199 if ( i === length ) {
n@1106 200 target = this;
n@1106 201 i--;
n@1106 202 }
n@1106 203
n@1106 204 for ( ; i < length; i++ ) {
n@1106 205 // Only deal with non-null/undefined values
n@1106 206 if ( (options = arguments[ i ]) != null ) {
n@1106 207 // Extend the base object
n@1106 208 for ( name in options ) {
n@1106 209 src = target[ name ];
n@1106 210 copy = options[ name ];
n@1106 211
n@1106 212 // Prevent never-ending loop
n@1106 213 if ( target === copy ) {
n@1106 214 continue;
n@1106 215 }
n@1106 216
n@1106 217 // Recurse if we're merging plain objects or arrays
n@1106 218 if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
n@1106 219 if ( copyIsArray ) {
n@1106 220 copyIsArray = false;
n@1106 221 clone = src && jQuery.isArray(src) ? src : [];
n@1106 222
n@1106 223 } else {
n@1106 224 clone = src && jQuery.isPlainObject(src) ? src : {};
n@1106 225 }
n@1106 226
n@1106 227 // Never move original objects, clone them
n@1106 228 target[ name ] = jQuery.extend( deep, clone, copy );
n@1106 229
n@1106 230 // Don't bring in undefined values
n@1106 231 } else if ( copy !== undefined ) {
n@1106 232 target[ name ] = copy;
n@1106 233 }
n@1106 234 }
n@1106 235 }
n@1106 236 }
n@1106 237
n@1106 238 // Return the modified object
n@1106 239 return target;
n@1106 240 };
n@1106 241
n@1106 242 jQuery.extend({
n@1106 243 // Unique for each copy of jQuery on the page
n@1106 244 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
n@1106 245
n@1106 246 // Assume jQuery is ready without the ready module
n@1106 247 isReady: true,
n@1106 248
n@1106 249 error: function( msg ) {
n@1106 250 throw new Error( msg );
n@1106 251 },
n@1106 252
n@1106 253 noop: function() {},
n@1106 254
n@1106 255 isFunction: function( obj ) {
n@1106 256 return jQuery.type(obj) === "function";
n@1106 257 },
n@1106 258
n@1106 259 isArray: Array.isArray,
n@1106 260
n@1106 261 isWindow: function( obj ) {
n@1106 262 return obj != null && obj === obj.window;
n@1106 263 },
n@1106 264
n@1106 265 isNumeric: function( obj ) {
n@1106 266 // parseFloat NaNs numeric-cast false positives (null|true|false|"")
n@1106 267 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
n@1106 268 // subtraction forces infinities to NaN
n@1106 269 // adding 1 corrects loss of precision from parseFloat (#15100)
n@1106 270 return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0;
n@1106 271 },
n@1106 272
n@1106 273 isPlainObject: function( obj ) {
n@1106 274 // Not plain objects:
n@1106 275 // - Any object or value whose internal [[Class]] property is not "[object Object]"
n@1106 276 // - DOM nodes
n@1106 277 // - window
n@1106 278 if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
n@1106 279 return false;
n@1106 280 }
n@1106 281
n@1106 282 if ( obj.constructor &&
n@1106 283 !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
n@1106 284 return false;
n@1106 285 }
n@1106 286
n@1106 287 // If the function hasn't returned already, we're confident that
n@1106 288 // |obj| is a plain object, created by {} or constructed with new Object
n@1106 289 return true;
n@1106 290 },
n@1106 291
n@1106 292 isEmptyObject: function( obj ) {
n@1106 293 var name;
n@1106 294 for ( name in obj ) {
n@1106 295 return false;
n@1106 296 }
n@1106 297 return true;
n@1106 298 },
n@1106 299
n@1106 300 type: function( obj ) {
n@1106 301 if ( obj == null ) {
n@1106 302 return obj + "";
n@1106 303 }
n@1106 304 // Support: Android<4.0, iOS<6 (functionish RegExp)
n@1106 305 return typeof obj === "object" || typeof obj === "function" ?
n@1106 306 class2type[ toString.call(obj) ] || "object" :
n@1106 307 typeof obj;
n@1106 308 },
n@1106 309
n@1106 310 // Evaluates a script in a global context
n@1106 311 globalEval: function( code ) {
n@1106 312 var script,
n@1106 313 indirect = eval;
n@1106 314
n@1106 315 code = jQuery.trim( code );
n@1106 316
n@1106 317 if ( code ) {
n@1106 318 // If the code includes a valid, prologue position
n@1106 319 // strict mode pragma, execute code by injecting a
n@1106 320 // script tag into the document.
n@1106 321 if ( code.indexOf("use strict") === 1 ) {
n@1106 322 script = document.createElement("script");
n@1106 323 script.text = code;
n@1106 324 document.head.appendChild( script ).parentNode.removeChild( script );
n@1106 325 } else {
n@1106 326 // Otherwise, avoid the DOM node creation, insertion
n@1106 327 // and removal by using an indirect global eval
n@1106 328 indirect( code );
n@1106 329 }
n@1106 330 }
n@1106 331 },
n@1106 332
n@1106 333 // Convert dashed to camelCase; used by the css and data modules
n@1106 334 // Support: IE9-11+
n@1106 335 // Microsoft forgot to hump their vendor prefix (#9572)
n@1106 336 camelCase: function( string ) {
n@1106 337 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
n@1106 338 },
n@1106 339
n@1106 340 nodeName: function( elem, name ) {
n@1106 341 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
n@1106 342 },
n@1106 343
n@1106 344 // args is for internal usage only
n@1106 345 each: function( obj, callback, args ) {
n@1106 346 var value,
n@1106 347 i = 0,
n@1106 348 length = obj.length,
n@1106 349 isArray = isArraylike( obj );
n@1106 350
n@1106 351 if ( args ) {
n@1106 352 if ( isArray ) {
n@1106 353 for ( ; i < length; i++ ) {
n@1106 354 value = callback.apply( obj[ i ], args );
n@1106 355
n@1106 356 if ( value === false ) {
n@1106 357 break;
n@1106 358 }
n@1106 359 }
n@1106 360 } else {
n@1106 361 for ( i in obj ) {
n@1106 362 value = callback.apply( obj[ i ], args );
n@1106 363
n@1106 364 if ( value === false ) {
n@1106 365 break;
n@1106 366 }
n@1106 367 }
n@1106 368 }
n@1106 369
n@1106 370 // A special, fast, case for the most common use of each
n@1106 371 } else {
n@1106 372 if ( isArray ) {
n@1106 373 for ( ; i < length; i++ ) {
n@1106 374 value = callback.call( obj[ i ], i, obj[ i ] );
n@1106 375
n@1106 376 if ( value === false ) {
n@1106 377 break;
n@1106 378 }
n@1106 379 }
n@1106 380 } else {
n@1106 381 for ( i in obj ) {
n@1106 382 value = callback.call( obj[ i ], i, obj[ i ] );
n@1106 383
n@1106 384 if ( value === false ) {
n@1106 385 break;
n@1106 386 }
n@1106 387 }
n@1106 388 }
n@1106 389 }
n@1106 390
n@1106 391 return obj;
n@1106 392 },
n@1106 393
n@1106 394 // Support: Android<4.1
n@1106 395 trim: function( text ) {
n@1106 396 return text == null ?
n@1106 397 "" :
n@1106 398 ( text + "" ).replace( rtrim, "" );
n@1106 399 },
n@1106 400
n@1106 401 // results is for internal usage only
n@1106 402 makeArray: function( arr, results ) {
n@1106 403 var ret = results || [];
n@1106 404
n@1106 405 if ( arr != null ) {
n@1106 406 if ( isArraylike( Object(arr) ) ) {
n@1106 407 jQuery.merge( ret,
n@1106 408 typeof arr === "string" ?
n@1106 409 [ arr ] : arr
n@1106 410 );
n@1106 411 } else {
n@1106 412 push.call( ret, arr );
n@1106 413 }
n@1106 414 }
n@1106 415
n@1106 416 return ret;
n@1106 417 },
n@1106 418
n@1106 419 inArray: function( elem, arr, i ) {
n@1106 420 return arr == null ? -1 : indexOf.call( arr, elem, i );
n@1106 421 },
n@1106 422
n@1106 423 merge: function( first, second ) {
n@1106 424 var len = +second.length,
n@1106 425 j = 0,
n@1106 426 i = first.length;
n@1106 427
n@1106 428 for ( ; j < len; j++ ) {
n@1106 429 first[ i++ ] = second[ j ];
n@1106 430 }
n@1106 431
n@1106 432 first.length = i;
n@1106 433
n@1106 434 return first;
n@1106 435 },
n@1106 436
n@1106 437 grep: function( elems, callback, invert ) {
n@1106 438 var callbackInverse,
n@1106 439 matches = [],
n@1106 440 i = 0,
n@1106 441 length = elems.length,
n@1106 442 callbackExpect = !invert;
n@1106 443
n@1106 444 // Go through the array, only saving the items
n@1106 445 // that pass the validator function
n@1106 446 for ( ; i < length; i++ ) {
n@1106 447 callbackInverse = !callback( elems[ i ], i );
n@1106 448 if ( callbackInverse !== callbackExpect ) {
n@1106 449 matches.push( elems[ i ] );
n@1106 450 }
n@1106 451 }
n@1106 452
n@1106 453 return matches;
n@1106 454 },
n@1106 455
n@1106 456 // arg is for internal usage only
n@1106 457 map: function( elems, callback, arg ) {
n@1106 458 var value,
n@1106 459 i = 0,
n@1106 460 length = elems.length,
n@1106 461 isArray = isArraylike( elems ),
n@1106 462 ret = [];
n@1106 463
n@1106 464 // Go through the array, translating each of the items to their new values
n@1106 465 if ( isArray ) {
n@1106 466 for ( ; i < length; i++ ) {
n@1106 467 value = callback( elems[ i ], i, arg );
n@1106 468
n@1106 469 if ( value != null ) {
n@1106 470 ret.push( value );
n@1106 471 }
n@1106 472 }
n@1106 473
n@1106 474 // Go through every key on the object,
n@1106 475 } else {
n@1106 476 for ( i in elems ) {
n@1106 477 value = callback( elems[ i ], i, arg );
n@1106 478
n@1106 479 if ( value != null ) {
n@1106 480 ret.push( value );
n@1106 481 }
n@1106 482 }
n@1106 483 }
n@1106 484
n@1106 485 // Flatten any nested arrays
n@1106 486 return concat.apply( [], ret );
n@1106 487 },
n@1106 488
n@1106 489 // A global GUID counter for objects
n@1106 490 guid: 1,
n@1106 491
n@1106 492 // Bind a function to a context, optionally partially applying any
n@1106 493 // arguments.
n@1106 494 proxy: function( fn, context ) {
n@1106 495 var tmp, args, proxy;
n@1106 496
n@1106 497 if ( typeof context === "string" ) {
n@1106 498 tmp = fn[ context ];
n@1106 499 context = fn;
n@1106 500 fn = tmp;
n@1106 501 }
n@1106 502
n@1106 503 // Quick check to determine if target is callable, in the spec
n@1106 504 // this throws a TypeError, but we will just return undefined.
n@1106 505 if ( !jQuery.isFunction( fn ) ) {
n@1106 506 return undefined;
n@1106 507 }
n@1106 508
n@1106 509 // Simulated bind
n@1106 510 args = slice.call( arguments, 2 );
n@1106 511 proxy = function() {
n@1106 512 return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
n@1106 513 };
n@1106 514
n@1106 515 // Set the guid of unique handler to the same of original handler, so it can be removed
n@1106 516 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
n@1106 517
n@1106 518 return proxy;
n@1106 519 },
n@1106 520
n@1106 521 now: Date.now,
n@1106 522
n@1106 523 // jQuery.support is not used in Core but other projects attach their
n@1106 524 // properties to it so it needs to exist.
n@1106 525 support: support
n@1106 526 });
n@1106 527
n@1106 528 // Populate the class2type map
n@1106 529 jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
n@1106 530 class2type[ "[object " + name + "]" ] = name.toLowerCase();
n@1106 531 });
n@1106 532
n@1106 533 function isArraylike( obj ) {
n@1106 534
n@1106 535 // Support: iOS 8.2 (not reproducible in simulator)
n@1106 536 // `in` check used to prevent JIT error (gh-2145)
n@1106 537 // hasOwn isn't used here due to false negatives
n@1106 538 // regarding Nodelist length in IE
n@1106 539 var length = "length" in obj && obj.length,
n@1106 540 type = jQuery.type( obj );
n@1106 541
n@1106 542 if ( type === "function" || jQuery.isWindow( obj ) ) {
n@1106 543 return false;
n@1106 544 }
n@1106 545
n@1106 546 if ( obj.nodeType === 1 && length ) {
n@1106 547 return true;
n@1106 548 }
n@1106 549
n@1106 550 return type === "array" || length === 0 ||
n@1106 551 typeof length === "number" && length > 0 && ( length - 1 ) in obj;
n@1106 552 }
n@1106 553 var Sizzle =
n@1106 554 /*!
n@1106 555 * Sizzle CSS Selector Engine v2.2.0-pre
n@1106 556 * http://sizzlejs.com/
n@1106 557 *
n@1106 558 * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors
n@1106 559 * Released under the MIT license
n@1106 560 * http://jquery.org/license
n@1106 561 *
n@1106 562 * Date: 2014-12-16
n@1106 563 */
n@1106 564 (function( window ) {
n@1106 565
n@1106 566 var i,
n@1106 567 support,
n@1106 568 Expr,
n@1106 569 getText,
n@1106 570 isXML,
n@1106 571 tokenize,
n@1106 572 compile,
n@1106 573 select,
n@1106 574 outermostContext,
n@1106 575 sortInput,
n@1106 576 hasDuplicate,
n@1106 577
n@1106 578 // Local document vars
n@1106 579 setDocument,
n@1106 580 document,
n@1106 581 docElem,
n@1106 582 documentIsHTML,
n@1106 583 rbuggyQSA,
n@1106 584 rbuggyMatches,
n@1106 585 matches,
n@1106 586 contains,
n@1106 587
n@1106 588 // Instance-specific data
n@1106 589 expando = "sizzle" + 1 * new Date(),
n@1106 590 preferredDoc = window.document,
n@1106 591 dirruns = 0,
n@1106 592 done = 0,
n@1106 593 classCache = createCache(),
n@1106 594 tokenCache = createCache(),
n@1106 595 compilerCache = createCache(),
n@1106 596 sortOrder = function( a, b ) {
n@1106 597 if ( a === b ) {
n@1106 598 hasDuplicate = true;
n@1106 599 }
n@1106 600 return 0;
n@1106 601 },
n@1106 602
n@1106 603 // General-purpose constants
n@1106 604 MAX_NEGATIVE = 1 << 31,
n@1106 605
n@1106 606 // Instance methods
n@1106 607 hasOwn = ({}).hasOwnProperty,
n@1106 608 arr = [],
n@1106 609 pop = arr.pop,
n@1106 610 push_native = arr.push,
n@1106 611 push = arr.push,
n@1106 612 slice = arr.slice,
n@1106 613 // Use a stripped-down indexOf as it's faster than native
n@1106 614 // http://jsperf.com/thor-indexof-vs-for/5
n@1106 615 indexOf = function( list, elem ) {
n@1106 616 var i = 0,
n@1106 617 len = list.length;
n@1106 618 for ( ; i < len; i++ ) {
n@1106 619 if ( list[i] === elem ) {
n@1106 620 return i;
n@1106 621 }
n@1106 622 }
n@1106 623 return -1;
n@1106 624 },
n@1106 625
n@1106 626 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
n@1106 627
n@1106 628 // Regular expressions
n@1106 629
n@1106 630 // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
n@1106 631 whitespace = "[\\x20\\t\\r\\n\\f]",
n@1106 632 // http://www.w3.org/TR/css3-syntax/#characters
n@1106 633 characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
n@1106 634
n@1106 635 // Loosely modeled on CSS identifier characters
n@1106 636 // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
n@1106 637 // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
n@1106 638 identifier = characterEncoding.replace( "w", "w#" ),
n@1106 639
n@1106 640 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
n@1106 641 attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace +
n@1106 642 // Operator (capture 2)
n@1106 643 "*([*^$|!~]?=)" + whitespace +
n@1106 644 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
n@1106 645 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
n@1106 646 "*\\]",
n@1106 647
n@1106 648 pseudos = ":(" + characterEncoding + ")(?:\\((" +
n@1106 649 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
n@1106 650 // 1. quoted (capture 3; capture 4 or capture 5)
n@1106 651 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
n@1106 652 // 2. simple (capture 6)
n@1106 653 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
n@1106 654 // 3. anything else (capture 2)
n@1106 655 ".*" +
n@1106 656 ")\\)|)",
n@1106 657
n@1106 658 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
n@1106 659 rwhitespace = new RegExp( whitespace + "+", "g" ),
n@1106 660 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
n@1106 661
n@1106 662 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
n@1106 663 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
n@1106 664
n@1106 665 rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
n@1106 666
n@1106 667 rpseudo = new RegExp( pseudos ),
n@1106 668 ridentifier = new RegExp( "^" + identifier + "$" ),
n@1106 669
n@1106 670 matchExpr = {
n@1106 671 "ID": new RegExp( "^#(" + characterEncoding + ")" ),
n@1106 672 "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
n@1106 673 "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
n@1106 674 "ATTR": new RegExp( "^" + attributes ),
n@1106 675 "PSEUDO": new RegExp( "^" + pseudos ),
n@1106 676 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
n@1106 677 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
n@1106 678 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
n@1106 679 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
n@1106 680 // For use in libraries implementing .is()
n@1106 681 // We use this for POS matching in `select`
n@1106 682 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
n@1106 683 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
n@1106 684 },
n@1106 685
n@1106 686 rinputs = /^(?:input|select|textarea|button)$/i,
n@1106 687 rheader = /^h\d$/i,
n@1106 688
n@1106 689 rnative = /^[^{]+\{\s*\[native \w/,
n@1106 690
n@1106 691 // Easily-parseable/retrievable ID or TAG or CLASS selectors
n@1106 692 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
n@1106 693
n@1106 694 rsibling = /[+~]/,
n@1106 695 rescape = /'|\\/g,
n@1106 696
n@1106 697 // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
n@1106 698 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
n@1106 699 funescape = function( _, escaped, escapedWhitespace ) {
n@1106 700 var high = "0x" + escaped - 0x10000;
n@1106 701 // NaN means non-codepoint
n@1106 702 // Support: Firefox<24
n@1106 703 // Workaround erroneous numeric interpretation of +"0x"
n@1106 704 return high !== high || escapedWhitespace ?
n@1106 705 escaped :
n@1106 706 high < 0 ?
n@1106 707 // BMP codepoint
n@1106 708 String.fromCharCode( high + 0x10000 ) :
n@1106 709 // Supplemental Plane codepoint (surrogate pair)
n@1106 710 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
n@1106 711 },
n@1106 712
n@1106 713 // Used for iframes
n@1106 714 // See setDocument()
n@1106 715 // Removing the function wrapper causes a "Permission Denied"
n@1106 716 // error in IE
n@1106 717 unloadHandler = function() {
n@1106 718 setDocument();
n@1106 719 };
n@1106 720
n@1106 721 // Optimize for push.apply( _, NodeList )
n@1106 722 try {
n@1106 723 push.apply(
n@1106 724 (arr = slice.call( preferredDoc.childNodes )),
n@1106 725 preferredDoc.childNodes
n@1106 726 );
n@1106 727 // Support: Android<4.0
n@1106 728 // Detect silently failing push.apply
n@1106 729 arr[ preferredDoc.childNodes.length ].nodeType;
n@1106 730 } catch ( e ) {
n@1106 731 push = { apply: arr.length ?
n@1106 732
n@1106 733 // Leverage slice if possible
n@1106 734 function( target, els ) {
n@1106 735 push_native.apply( target, slice.call(els) );
n@1106 736 } :
n@1106 737
n@1106 738 // Support: IE<9
n@1106 739 // Otherwise append directly
n@1106 740 function( target, els ) {
n@1106 741 var j = target.length,
n@1106 742 i = 0;
n@1106 743 // Can't trust NodeList.length
n@1106 744 while ( (target[j++] = els[i++]) ) {}
n@1106 745 target.length = j - 1;
n@1106 746 }
n@1106 747 };
n@1106 748 }
n@1106 749
n@1106 750 function Sizzle( selector, context, results, seed ) {
n@1106 751 var match, elem, m, nodeType,
n@1106 752 // QSA vars
n@1106 753 i, groups, old, nid, newContext, newSelector;
n@1106 754
n@1106 755 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
n@1106 756 setDocument( context );
n@1106 757 }
n@1106 758
n@1106 759 context = context || document;
n@1106 760 results = results || [];
n@1106 761 nodeType = context.nodeType;
n@1106 762
n@1106 763 if ( typeof selector !== "string" || !selector ||
n@1106 764 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
n@1106 765
n@1106 766 return results;
n@1106 767 }
n@1106 768
n@1106 769 if ( !seed && documentIsHTML ) {
n@1106 770
n@1106 771 // Try to shortcut find operations when possible (e.g., not under DocumentFragment)
n@1106 772 if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
n@1106 773 // Speed-up: Sizzle("#ID")
n@1106 774 if ( (m = match[1]) ) {
n@1106 775 if ( nodeType === 9 ) {
n@1106 776 elem = context.getElementById( m );
n@1106 777 // Check parentNode to catch when Blackberry 4.6 returns
n@1106 778 // nodes that are no longer in the document (jQuery #6963)
n@1106 779 if ( elem && elem.parentNode ) {
n@1106 780 // Handle the case where IE, Opera, and Webkit return items
n@1106 781 // by name instead of ID
n@1106 782 if ( elem.id === m ) {
n@1106 783 results.push( elem );
n@1106 784 return results;
n@1106 785 }
n@1106 786 } else {
n@1106 787 return results;
n@1106 788 }
n@1106 789 } else {
n@1106 790 // Context is not a document
n@1106 791 if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
n@1106 792 contains( context, elem ) && elem.id === m ) {
n@1106 793 results.push( elem );
n@1106 794 return results;
n@1106 795 }
n@1106 796 }
n@1106 797
n@1106 798 // Speed-up: Sizzle("TAG")
n@1106 799 } else if ( match[2] ) {
n@1106 800 push.apply( results, context.getElementsByTagName( selector ) );
n@1106 801 return results;
n@1106 802
n@1106 803 // Speed-up: Sizzle(".CLASS")
n@1106 804 } else if ( (m = match[3]) && support.getElementsByClassName ) {
n@1106 805 push.apply( results, context.getElementsByClassName( m ) );
n@1106 806 return results;
n@1106 807 }
n@1106 808 }
n@1106 809
n@1106 810 // QSA path
n@1106 811 if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
n@1106 812 nid = old = expando;
n@1106 813 newContext = context;
n@1106 814 newSelector = nodeType !== 1 && selector;
n@1106 815
n@1106 816 // qSA works strangely on Element-rooted queries
n@1106 817 // We can work around this by specifying an extra ID on the root
n@1106 818 // and working up from there (Thanks to Andrew Dupont for the technique)
n@1106 819 // IE 8 doesn't work on object elements
n@1106 820 if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
n@1106 821 groups = tokenize( selector );
n@1106 822
n@1106 823 if ( (old = context.getAttribute("id")) ) {
n@1106 824 nid = old.replace( rescape, "\\$&" );
n@1106 825 } else {
n@1106 826 context.setAttribute( "id", nid );
n@1106 827 }
n@1106 828 nid = "[id='" + nid + "'] ";
n@1106 829
n@1106 830 i = groups.length;
n@1106 831 while ( i-- ) {
n@1106 832 groups[i] = nid + toSelector( groups[i] );
n@1106 833 }
n@1106 834 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context;
n@1106 835 newSelector = groups.join(",");
n@1106 836 }
n@1106 837
n@1106 838 if ( newSelector ) {
n@1106 839 try {
n@1106 840 push.apply( results,
n@1106 841 newContext.querySelectorAll( newSelector )
n@1106 842 );
n@1106 843 return results;
n@1106 844 } catch(qsaError) {
n@1106 845 } finally {
n@1106 846 if ( !old ) {
n@1106 847 context.removeAttribute("id");
n@1106 848 }
n@1106 849 }
n@1106 850 }
n@1106 851 }
n@1106 852 }
n@1106 853
n@1106 854 // All others
n@1106 855 return select( selector.replace( rtrim, "$1" ), context, results, seed );
n@1106 856 }
n@1106 857
n@1106 858 /**
n@1106 859 * Create key-value caches of limited size
n@1106 860 * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
n@1106 861 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
n@1106 862 * deleting the oldest entry
n@1106 863 */
n@1106 864 function createCache() {
n@1106 865 var keys = [];
n@1106 866
n@1106 867 function cache( key, value ) {
n@1106 868 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
n@1106 869 if ( keys.push( key + " " ) > Expr.cacheLength ) {
n@1106 870 // Only keep the most recent entries
n@1106 871 delete cache[ keys.shift() ];
n@1106 872 }
n@1106 873 return (cache[ key + " " ] = value);
n@1106 874 }
n@1106 875 return cache;
n@1106 876 }
n@1106 877
n@1106 878 /**
n@1106 879 * Mark a function for special use by Sizzle
n@1106 880 * @param {Function} fn The function to mark
n@1106 881 */
n@1106 882 function markFunction( fn ) {
n@1106 883 fn[ expando ] = true;
n@1106 884 return fn;
n@1106 885 }
n@1106 886
n@1106 887 /**
n@1106 888 * Support testing using an element
n@1106 889 * @param {Function} fn Passed the created div and expects a boolean result
n@1106 890 */
n@1106 891 function assert( fn ) {
n@1106 892 var div = document.createElement("div");
n@1106 893
n@1106 894 try {
n@1106 895 return !!fn( div );
n@1106 896 } catch (e) {
n@1106 897 return false;
n@1106 898 } finally {
n@1106 899 // Remove from its parent by default
n@1106 900 if ( div.parentNode ) {
n@1106 901 div.parentNode.removeChild( div );
n@1106 902 }
n@1106 903 // release memory in IE
n@1106 904 div = null;
n@1106 905 }
n@1106 906 }
n@1106 907
n@1106 908 /**
n@1106 909 * Adds the same handler for all of the specified attrs
n@1106 910 * @param {String} attrs Pipe-separated list of attributes
n@1106 911 * @param {Function} handler The method that will be applied
n@1106 912 */
n@1106 913 function addHandle( attrs, handler ) {
n@1106 914 var arr = attrs.split("|"),
n@1106 915 i = attrs.length;
n@1106 916
n@1106 917 while ( i-- ) {
n@1106 918 Expr.attrHandle[ arr[i] ] = handler;
n@1106 919 }
n@1106 920 }
n@1106 921
n@1106 922 /**
n@1106 923 * Checks document order of two siblings
n@1106 924 * @param {Element} a
n@1106 925 * @param {Element} b
n@1106 926 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
n@1106 927 */
n@1106 928 function siblingCheck( a, b ) {
n@1106 929 var cur = b && a,
n@1106 930 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
n@1106 931 ( ~b.sourceIndex || MAX_NEGATIVE ) -
n@1106 932 ( ~a.sourceIndex || MAX_NEGATIVE );
n@1106 933
n@1106 934 // Use IE sourceIndex if available on both nodes
n@1106 935 if ( diff ) {
n@1106 936 return diff;
n@1106 937 }
n@1106 938
n@1106 939 // Check if b follows a
n@1106 940 if ( cur ) {
n@1106 941 while ( (cur = cur.nextSibling) ) {
n@1106 942 if ( cur === b ) {
n@1106 943 return -1;
n@1106 944 }
n@1106 945 }
n@1106 946 }
n@1106 947
n@1106 948 return a ? 1 : -1;
n@1106 949 }
n@1106 950
n@1106 951 /**
n@1106 952 * Returns a function to use in pseudos for input types
n@1106 953 * @param {String} type
n@1106 954 */
n@1106 955 function createInputPseudo( type ) {
n@1106 956 return function( elem ) {
n@1106 957 var name = elem.nodeName.toLowerCase();
n@1106 958 return name === "input" && elem.type === type;
n@1106 959 };
n@1106 960 }
n@1106 961
n@1106 962 /**
n@1106 963 * Returns a function to use in pseudos for buttons
n@1106 964 * @param {String} type
n@1106 965 */
n@1106 966 function createButtonPseudo( type ) {
n@1106 967 return function( elem ) {
n@1106 968 var name = elem.nodeName.toLowerCase();
n@1106 969 return (name === "input" || name === "button") && elem.type === type;
n@1106 970 };
n@1106 971 }
n@1106 972
n@1106 973 /**
n@1106 974 * Returns a function to use in pseudos for positionals
n@1106 975 * @param {Function} fn
n@1106 976 */
n@1106 977 function createPositionalPseudo( fn ) {
n@1106 978 return markFunction(function( argument ) {
n@1106 979 argument = +argument;
n@1106 980 return markFunction(function( seed, matches ) {
n@1106 981 var j,
n@1106 982 matchIndexes = fn( [], seed.length, argument ),
n@1106 983 i = matchIndexes.length;
n@1106 984
n@1106 985 // Match elements found at the specified indexes
n@1106 986 while ( i-- ) {
n@1106 987 if ( seed[ (j = matchIndexes[i]) ] ) {
n@1106 988 seed[j] = !(matches[j] = seed[j]);
n@1106 989 }
n@1106 990 }
n@1106 991 });
n@1106 992 });
n@1106 993 }
n@1106 994
n@1106 995 /**
n@1106 996 * Checks a node for validity as a Sizzle context
n@1106 997 * @param {Element|Object=} context
n@1106 998 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
n@1106 999 */
n@1106 1000 function testContext( context ) {
n@1106 1001 return context && typeof context.getElementsByTagName !== "undefined" && context;
n@1106 1002 }
n@1106 1003
n@1106 1004 // Expose support vars for convenience
n@1106 1005 support = Sizzle.support = {};
n@1106 1006
n@1106 1007 /**
n@1106 1008 * Detects XML nodes
n@1106 1009 * @param {Element|Object} elem An element or a document
n@1106 1010 * @returns {Boolean} True iff elem is a non-HTML XML node
n@1106 1011 */
n@1106 1012 isXML = Sizzle.isXML = function( elem ) {
n@1106 1013 // documentElement is verified for cases where it doesn't yet exist
n@1106 1014 // (such as loading iframes in IE - #4833)
n@1106 1015 var documentElement = elem && (elem.ownerDocument || elem).documentElement;
n@1106 1016 return documentElement ? documentElement.nodeName !== "HTML" : false;
n@1106 1017 };
n@1106 1018
n@1106 1019 /**
n@1106 1020 * Sets document-related variables once based on the current document
n@1106 1021 * @param {Element|Object} [doc] An element or document object to use to set the document
n@1106 1022 * @returns {Object} Returns the current document
n@1106 1023 */
n@1106 1024 setDocument = Sizzle.setDocument = function( node ) {
n@1106 1025 var hasCompare, parent,
n@1106 1026 doc = node ? node.ownerDocument || node : preferredDoc;
n@1106 1027
n@1106 1028 // If no document and documentElement is available, return
n@1106 1029 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
n@1106 1030 return document;
n@1106 1031 }
n@1106 1032
n@1106 1033 // Set our document
n@1106 1034 document = doc;
n@1106 1035 docElem = doc.documentElement;
n@1106 1036 parent = doc.defaultView;
n@1106 1037
n@1106 1038 // Support: IE>8
n@1106 1039 // If iframe document is assigned to "document" variable and if iframe has been reloaded,
n@1106 1040 // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
n@1106 1041 // IE6-8 do not support the defaultView property so parent will be undefined
n@1106 1042 if ( parent && parent !== parent.top ) {
n@1106 1043 // IE11 does not have attachEvent, so all must suffer
n@1106 1044 if ( parent.addEventListener ) {
n@1106 1045 parent.addEventListener( "unload", unloadHandler, false );
n@1106 1046 } else if ( parent.attachEvent ) {
n@1106 1047 parent.attachEvent( "onunload", unloadHandler );
n@1106 1048 }
n@1106 1049 }
n@1106 1050
n@1106 1051 /* Support tests
n@1106 1052 ---------------------------------------------------------------------- */
n@1106 1053 documentIsHTML = !isXML( doc );
n@1106 1054
n@1106 1055 /* Attributes
n@1106 1056 ---------------------------------------------------------------------- */
n@1106 1057
n@1106 1058 // Support: IE<8
n@1106 1059 // Verify that getAttribute really returns attributes and not properties
n@1106 1060 // (excepting IE8 booleans)
n@1106 1061 support.attributes = assert(function( div ) {
n@1106 1062 div.className = "i";
n@1106 1063 return !div.getAttribute("className");
n@1106 1064 });
n@1106 1065
n@1106 1066 /* getElement(s)By*
n@1106 1067 ---------------------------------------------------------------------- */
n@1106 1068
n@1106 1069 // Check if getElementsByTagName("*") returns only elements
n@1106 1070 support.getElementsByTagName = assert(function( div ) {
n@1106 1071 div.appendChild( doc.createComment("") );
n@1106 1072 return !div.getElementsByTagName("*").length;
n@1106 1073 });
n@1106 1074
n@1106 1075 // Support: IE<9
n@1106 1076 support.getElementsByClassName = rnative.test( doc.getElementsByClassName );
n@1106 1077
n@1106 1078 // Support: IE<10
n@1106 1079 // Check if getElementById returns elements by name
n@1106 1080 // The broken getElementById methods don't pick up programatically-set names,
n@1106 1081 // so use a roundabout getElementsByName test
n@1106 1082 support.getById = assert(function( div ) {
n@1106 1083 docElem.appendChild( div ).id = expando;
n@1106 1084 return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
n@1106 1085 });
n@1106 1086
n@1106 1087 // ID find and filter
n@1106 1088 if ( support.getById ) {
n@1106 1089 Expr.find["ID"] = function( id, context ) {
n@1106 1090 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
n@1106 1091 var m = context.getElementById( id );
n@1106 1092 // Check parentNode to catch when Blackberry 4.6 returns
n@1106 1093 // nodes that are no longer in the document #6963
n@1106 1094 return m && m.parentNode ? [ m ] : [];
n@1106 1095 }
n@1106 1096 };
n@1106 1097 Expr.filter["ID"] = function( id ) {
n@1106 1098 var attrId = id.replace( runescape, funescape );
n@1106 1099 return function( elem ) {
n@1106 1100 return elem.getAttribute("id") === attrId;
n@1106 1101 };
n@1106 1102 };
n@1106 1103 } else {
n@1106 1104 // Support: IE6/7
n@1106 1105 // getElementById is not reliable as a find shortcut
n@1106 1106 delete Expr.find["ID"];
n@1106 1107
n@1106 1108 Expr.filter["ID"] = function( id ) {
n@1106 1109 var attrId = id.replace( runescape, funescape );
n@1106 1110 return function( elem ) {
n@1106 1111 var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
n@1106 1112 return node && node.value === attrId;
n@1106 1113 };
n@1106 1114 };
n@1106 1115 }
n@1106 1116
n@1106 1117 // Tag
n@1106 1118 Expr.find["TAG"] = support.getElementsByTagName ?
n@1106 1119 function( tag, context ) {
n@1106 1120 if ( typeof context.getElementsByTagName !== "undefined" ) {
n@1106 1121 return context.getElementsByTagName( tag );
n@1106 1122
n@1106 1123 // DocumentFragment nodes don't have gEBTN
n@1106 1124 } else if ( support.qsa ) {
n@1106 1125 return context.querySelectorAll( tag );
n@1106 1126 }
n@1106 1127 } :
n@1106 1128
n@1106 1129 function( tag, context ) {
n@1106 1130 var elem,
n@1106 1131 tmp = [],
n@1106 1132 i = 0,
n@1106 1133 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
n@1106 1134 results = context.getElementsByTagName( tag );
n@1106 1135
n@1106 1136 // Filter out possible comments
n@1106 1137 if ( tag === "*" ) {
n@1106 1138 while ( (elem = results[i++]) ) {
n@1106 1139 if ( elem.nodeType === 1 ) {
n@1106 1140 tmp.push( elem );
n@1106 1141 }
n@1106 1142 }
n@1106 1143
n@1106 1144 return tmp;
n@1106 1145 }
n@1106 1146 return results;
n@1106 1147 };
n@1106 1148
n@1106 1149 // Class
n@1106 1150 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
n@1106 1151 if ( documentIsHTML ) {
n@1106 1152 return context.getElementsByClassName( className );
n@1106 1153 }
n@1106 1154 };
n@1106 1155
n@1106 1156 /* QSA/matchesSelector
n@1106 1157 ---------------------------------------------------------------------- */
n@1106 1158
n@1106 1159 // QSA and matchesSelector support
n@1106 1160
n@1106 1161 // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
n@1106 1162 rbuggyMatches = [];
n@1106 1163
n@1106 1164 // qSa(:focus) reports false when true (Chrome 21)
n@1106 1165 // We allow this because of a bug in IE8/9 that throws an error
n@1106 1166 // whenever `document.activeElement` is accessed on an iframe
n@1106 1167 // So, we allow :focus to pass through QSA all the time to avoid the IE error
n@1106 1168 // See http://bugs.jquery.com/ticket/13378
n@1106 1169 rbuggyQSA = [];
n@1106 1170
n@1106 1171 if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
n@1106 1172 // Build QSA regex
n@1106 1173 // Regex strategy adopted from Diego Perini
n@1106 1174 assert(function( div ) {
n@1106 1175 // Select is set to empty string on purpose
n@1106 1176 // This is to test IE's treatment of not explicitly
n@1106 1177 // setting a boolean content attribute,
n@1106 1178 // since its presence should be enough
n@1106 1179 // http://bugs.jquery.com/ticket/12359
n@1106 1180 docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" +
n@1106 1181 "<select id='" + expando + "-\f]' msallowcapture=''>" +
n@1106 1182 "<option selected=''></option></select>";
n@1106 1183
n@1106 1184 // Support: IE8, Opera 11-12.16
n@1106 1185 // Nothing should be selected when empty strings follow ^= or $= or *=
n@1106 1186 // The test attribute must be unknown in Opera but "safe" for WinRT
n@1106 1187 // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
n@1106 1188 if ( div.querySelectorAll("[msallowcapture^='']").length ) {
n@1106 1189 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
n@1106 1190 }
n@1106 1191
n@1106 1192 // Support: IE8
n@1106 1193 // Boolean attributes and "value" are not treated correctly
n@1106 1194 if ( !div.querySelectorAll("[selected]").length ) {
n@1106 1195 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
n@1106 1196 }
n@1106 1197
n@1106 1198 // Support: Chrome<29, Android<4.2+, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.7+
n@1106 1199 if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
n@1106 1200 rbuggyQSA.push("~=");
n@1106 1201 }
n@1106 1202
n@1106 1203 // Webkit/Opera - :checked should return selected option elements
n@1106 1204 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
n@1106 1205 // IE8 throws error here and will not see later tests
n@1106 1206 if ( !div.querySelectorAll(":checked").length ) {
n@1106 1207 rbuggyQSA.push(":checked");
n@1106 1208 }
n@1106 1209
n@1106 1210 // Support: Safari 8+, iOS 8+
n@1106 1211 // https://bugs.webkit.org/show_bug.cgi?id=136851
n@1106 1212 // In-page `selector#id sibing-combinator selector` fails
n@1106 1213 if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) {
n@1106 1214 rbuggyQSA.push(".#.+[+~]");
n@1106 1215 }
n@1106 1216 });
n@1106 1217
n@1106 1218 assert(function( div ) {
n@1106 1219 // Support: Windows 8 Native Apps
n@1106 1220 // The type and name attributes are restricted during .innerHTML assignment
n@1106 1221 var input = doc.createElement("input");
n@1106 1222 input.setAttribute( "type", "hidden" );
n@1106 1223 div.appendChild( input ).setAttribute( "name", "D" );
n@1106 1224
n@1106 1225 // Support: IE8
n@1106 1226 // Enforce case-sensitivity of name attribute
n@1106 1227 if ( div.querySelectorAll("[name=d]").length ) {
n@1106 1228 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
n@1106 1229 }
n@1106 1230
n@1106 1231 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
n@1106 1232 // IE8 throws error here and will not see later tests
n@1106 1233 if ( !div.querySelectorAll(":enabled").length ) {
n@1106 1234 rbuggyQSA.push( ":enabled", ":disabled" );
n@1106 1235 }
n@1106 1236
n@1106 1237 // Opera 10-11 does not throw on post-comma invalid pseudos
n@1106 1238 div.querySelectorAll("*,:x");
n@1106 1239 rbuggyQSA.push(",.*:");
n@1106 1240 });
n@1106 1241 }
n@1106 1242
n@1106 1243 if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
n@1106 1244 docElem.webkitMatchesSelector ||
n@1106 1245 docElem.mozMatchesSelector ||
n@1106 1246 docElem.oMatchesSelector ||
n@1106 1247 docElem.msMatchesSelector) )) ) {
n@1106 1248
n@1106 1249 assert(function( div ) {
n@1106 1250 // Check to see if it's possible to do matchesSelector
n@1106 1251 // on a disconnected node (IE 9)
n@1106 1252 support.disconnectedMatch = matches.call( div, "div" );
n@1106 1253
n@1106 1254 // This should fail with an exception
n@1106 1255 // Gecko does not error, returns false instead
n@1106 1256 matches.call( div, "[s!='']:x" );
n@1106 1257 rbuggyMatches.push( "!=", pseudos );
n@1106 1258 });
n@1106 1259 }
n@1106 1260
n@1106 1261 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
n@1106 1262 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
n@1106 1263
n@1106 1264 /* Contains
n@1106 1265 ---------------------------------------------------------------------- */
n@1106 1266 hasCompare = rnative.test( docElem.compareDocumentPosition );
n@1106 1267
n@1106 1268 // Element contains another
n@1106 1269 // Purposefully does not implement inclusive descendent
n@1106 1270 // As in, an element does not contain itself
n@1106 1271 contains = hasCompare || rnative.test( docElem.contains ) ?
n@1106 1272 function( a, b ) {
n@1106 1273 var adown = a.nodeType === 9 ? a.documentElement : a,
n@1106 1274 bup = b && b.parentNode;
n@1106 1275 return a === bup || !!( bup && bup.nodeType === 1 && (
n@1106 1276 adown.contains ?
n@1106 1277 adown.contains( bup ) :
n@1106 1278 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
n@1106 1279 ));
n@1106 1280 } :
n@1106 1281 function( a, b ) {
n@1106 1282 if ( b ) {
n@1106 1283 while ( (b = b.parentNode) ) {
n@1106 1284 if ( b === a ) {
n@1106 1285 return true;
n@1106 1286 }
n@1106 1287 }
n@1106 1288 }
n@1106 1289 return false;
n@1106 1290 };
n@1106 1291
n@1106 1292 /* Sorting
n@1106 1293 ---------------------------------------------------------------------- */
n@1106 1294
n@1106 1295 // Document order sorting
n@1106 1296 sortOrder = hasCompare ?
n@1106 1297 function( a, b ) {
n@1106 1298
n@1106 1299 // Flag for duplicate removal
n@1106 1300 if ( a === b ) {
n@1106 1301 hasDuplicate = true;
n@1106 1302 return 0;
n@1106 1303 }
n@1106 1304
n@1106 1305 // Sort on method existence if only one input has compareDocumentPosition
n@1106 1306 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
n@1106 1307 if ( compare ) {
n@1106 1308 return compare;
n@1106 1309 }
n@1106 1310
n@1106 1311 // Calculate position if both inputs belong to the same document
n@1106 1312 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
n@1106 1313 a.compareDocumentPosition( b ) :
n@1106 1314
n@1106 1315 // Otherwise we know they are disconnected
n@1106 1316 1;
n@1106 1317
n@1106 1318 // Disconnected nodes
n@1106 1319 if ( compare & 1 ||
n@1106 1320 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
n@1106 1321
n@1106 1322 // Choose the first element that is related to our preferred document
n@1106 1323 if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
n@1106 1324 return -1;
n@1106 1325 }
n@1106 1326 if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
n@1106 1327 return 1;
n@1106 1328 }
n@1106 1329
n@1106 1330 // Maintain original order
n@1106 1331 return sortInput ?
n@1106 1332 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
n@1106 1333 0;
n@1106 1334 }
n@1106 1335
n@1106 1336 return compare & 4 ? -1 : 1;
n@1106 1337 } :
n@1106 1338 function( a, b ) {
n@1106 1339 // Exit early if the nodes are identical
n@1106 1340 if ( a === b ) {
n@1106 1341 hasDuplicate = true;
n@1106 1342 return 0;
n@1106 1343 }
n@1106 1344
n@1106 1345 var cur,
n@1106 1346 i = 0,
n@1106 1347 aup = a.parentNode,
n@1106 1348 bup = b.parentNode,
n@1106 1349 ap = [ a ],
n@1106 1350 bp = [ b ];
n@1106 1351
n@1106 1352 // Parentless nodes are either documents or disconnected
n@1106 1353 if ( !aup || !bup ) {
n@1106 1354 return a === doc ? -1 :
n@1106 1355 b === doc ? 1 :
n@1106 1356 aup ? -1 :
n@1106 1357 bup ? 1 :
n@1106 1358 sortInput ?
n@1106 1359 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
n@1106 1360 0;
n@1106 1361
n@1106 1362 // If the nodes are siblings, we can do a quick check
n@1106 1363 } else if ( aup === bup ) {
n@1106 1364 return siblingCheck( a, b );
n@1106 1365 }
n@1106 1366
n@1106 1367 // Otherwise we need full lists of their ancestors for comparison
n@1106 1368 cur = a;
n@1106 1369 while ( (cur = cur.parentNode) ) {
n@1106 1370 ap.unshift( cur );
n@1106 1371 }
n@1106 1372 cur = b;
n@1106 1373 while ( (cur = cur.parentNode) ) {
n@1106 1374 bp.unshift( cur );
n@1106 1375 }
n@1106 1376
n@1106 1377 // Walk down the tree looking for a discrepancy
n@1106 1378 while ( ap[i] === bp[i] ) {
n@1106 1379 i++;
n@1106 1380 }
n@1106 1381
n@1106 1382 return i ?
n@1106 1383 // Do a sibling check if the nodes have a common ancestor
n@1106 1384 siblingCheck( ap[i], bp[i] ) :
n@1106 1385
n@1106 1386 // Otherwise nodes in our document sort first
n@1106 1387 ap[i] === preferredDoc ? -1 :
n@1106 1388 bp[i] === preferredDoc ? 1 :
n@1106 1389 0;
n@1106 1390 };
n@1106 1391
n@1106 1392 return doc;
n@1106 1393 };
n@1106 1394
n@1106 1395 Sizzle.matches = function( expr, elements ) {
n@1106 1396 return Sizzle( expr, null, null, elements );
n@1106 1397 };
n@1106 1398
n@1106 1399 Sizzle.matchesSelector = function( elem, expr ) {
n@1106 1400 // Set document vars if needed
n@1106 1401 if ( ( elem.ownerDocument || elem ) !== document ) {
n@1106 1402 setDocument( elem );
n@1106 1403 }
n@1106 1404
n@1106 1405 // Make sure that attribute selectors are quoted
n@1106 1406 expr = expr.replace( rattributeQuotes, "='$1']" );
n@1106 1407
n@1106 1408 if ( support.matchesSelector && documentIsHTML &&
n@1106 1409 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
n@1106 1410 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
n@1106 1411
n@1106 1412 try {
n@1106 1413 var ret = matches.call( elem, expr );
n@1106 1414
n@1106 1415 // IE 9's matchesSelector returns false on disconnected nodes
n@1106 1416 if ( ret || support.disconnectedMatch ||
n@1106 1417 // As well, disconnected nodes are said to be in a document
n@1106 1418 // fragment in IE 9
n@1106 1419 elem.document && elem.document.nodeType !== 11 ) {
n@1106 1420 return ret;
n@1106 1421 }
n@1106 1422 } catch (e) {}
n@1106 1423 }
n@1106 1424
n@1106 1425 return Sizzle( expr, document, null, [ elem ] ).length > 0;
n@1106 1426 };
n@1106 1427
n@1106 1428 Sizzle.contains = function( context, elem ) {
n@1106 1429 // Set document vars if needed
n@1106 1430 if ( ( context.ownerDocument || context ) !== document ) {
n@1106 1431 setDocument( context );
n@1106 1432 }
n@1106 1433 return contains( context, elem );
n@1106 1434 };
n@1106 1435
n@1106 1436 Sizzle.attr = function( elem, name ) {
n@1106 1437 // Set document vars if needed
n@1106 1438 if ( ( elem.ownerDocument || elem ) !== document ) {
n@1106 1439 setDocument( elem );
n@1106 1440 }
n@1106 1441
n@1106 1442 var fn = Expr.attrHandle[ name.toLowerCase() ],
n@1106 1443 // Don't get fooled by Object.prototype properties (jQuery #13807)
n@1106 1444 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
n@1106 1445 fn( elem, name, !documentIsHTML ) :
n@1106 1446 undefined;
n@1106 1447
n@1106 1448 return val !== undefined ?
n@1106 1449 val :
n@1106 1450 support.attributes || !documentIsHTML ?
n@1106 1451 elem.getAttribute( name ) :
n@1106 1452 (val = elem.getAttributeNode(name)) && val.specified ?
n@1106 1453 val.value :
n@1106 1454 null;
n@1106 1455 };
n@1106 1456
n@1106 1457 Sizzle.error = function( msg ) {
n@1106 1458 throw new Error( "Syntax error, unrecognized expression: " + msg );
n@1106 1459 };
n@1106 1460
n@1106 1461 /**
n@1106 1462 * Document sorting and removing duplicates
n@1106 1463 * @param {ArrayLike} results
n@1106 1464 */
n@1106 1465 Sizzle.uniqueSort = function( results ) {
n@1106 1466 var elem,
n@1106 1467 duplicates = [],
n@1106 1468 j = 0,
n@1106 1469 i = 0;
n@1106 1470
n@1106 1471 // Unless we *know* we can detect duplicates, assume their presence
n@1106 1472 hasDuplicate = !support.detectDuplicates;
n@1106 1473 sortInput = !support.sortStable && results.slice( 0 );
n@1106 1474 results.sort( sortOrder );
n@1106 1475
n@1106 1476 if ( hasDuplicate ) {
n@1106 1477 while ( (elem = results[i++]) ) {
n@1106 1478 if ( elem === results[ i ] ) {
n@1106 1479 j = duplicates.push( i );
n@1106 1480 }
n@1106 1481 }
n@1106 1482 while ( j-- ) {
n@1106 1483 results.splice( duplicates[ j ], 1 );
n@1106 1484 }
n@1106 1485 }
n@1106 1486
n@1106 1487 // Clear input after sorting to release objects
n@1106 1488 // See https://github.com/jquery/sizzle/pull/225
n@1106 1489 sortInput = null;
n@1106 1490
n@1106 1491 return results;
n@1106 1492 };
n@1106 1493
n@1106 1494 /**
n@1106 1495 * Utility function for retrieving the text value of an array of DOM nodes
n@1106 1496 * @param {Array|Element} elem
n@1106 1497 */
n@1106 1498 getText = Sizzle.getText = function( elem ) {
n@1106 1499 var node,
n@1106 1500 ret = "",
n@1106 1501 i = 0,
n@1106 1502 nodeType = elem.nodeType;
n@1106 1503
n@1106 1504 if ( !nodeType ) {
n@1106 1505 // If no nodeType, this is expected to be an array
n@1106 1506 while ( (node = elem[i++]) ) {
n@1106 1507 // Do not traverse comment nodes
n@1106 1508 ret += getText( node );
n@1106 1509 }
n@1106 1510 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
n@1106 1511 // Use textContent for elements
n@1106 1512 // innerText usage removed for consistency of new lines (jQuery #11153)
n@1106 1513 if ( typeof elem.textContent === "string" ) {
n@1106 1514 return elem.textContent;
n@1106 1515 } else {
n@1106 1516 // Traverse its children
n@1106 1517 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
n@1106 1518 ret += getText( elem );
n@1106 1519 }
n@1106 1520 }
n@1106 1521 } else if ( nodeType === 3 || nodeType === 4 ) {
n@1106 1522 return elem.nodeValue;
n@1106 1523 }
n@1106 1524 // Do not include comment or processing instruction nodes
n@1106 1525
n@1106 1526 return ret;
n@1106 1527 };
n@1106 1528
n@1106 1529 Expr = Sizzle.selectors = {
n@1106 1530
n@1106 1531 // Can be adjusted by the user
n@1106 1532 cacheLength: 50,
n@1106 1533
n@1106 1534 createPseudo: markFunction,
n@1106 1535
n@1106 1536 match: matchExpr,
n@1106 1537
n@1106 1538 attrHandle: {},
n@1106 1539
n@1106 1540 find: {},
n@1106 1541
n@1106 1542 relative: {
n@1106 1543 ">": { dir: "parentNode", first: true },
n@1106 1544 " ": { dir: "parentNode" },
n@1106 1545 "+": { dir: "previousSibling", first: true },
n@1106 1546 "~": { dir: "previousSibling" }
n@1106 1547 },
n@1106 1548
n@1106 1549 preFilter: {
n@1106 1550 "ATTR": function( match ) {
n@1106 1551 match[1] = match[1].replace( runescape, funescape );
n@1106 1552
n@1106 1553 // Move the given value to match[3] whether quoted or unquoted
n@1106 1554 match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
n@1106 1555
n@1106 1556 if ( match[2] === "~=" ) {
n@1106 1557 match[3] = " " + match[3] + " ";
n@1106 1558 }
n@1106 1559
n@1106 1560 return match.slice( 0, 4 );
n@1106 1561 },
n@1106 1562
n@1106 1563 "CHILD": function( match ) {
n@1106 1564 /* matches from matchExpr["CHILD"]
n@1106 1565 1 type (only|nth|...)
n@1106 1566 2 what (child|of-type)
n@1106 1567 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
n@1106 1568 4 xn-component of xn+y argument ([+-]?\d*n|)
n@1106 1569 5 sign of xn-component
n@1106 1570 6 x of xn-component
n@1106 1571 7 sign of y-component
n@1106 1572 8 y of y-component
n@1106 1573 */
n@1106 1574 match[1] = match[1].toLowerCase();
n@1106 1575
n@1106 1576 if ( match[1].slice( 0, 3 ) === "nth" ) {
n@1106 1577 // nth-* requires argument
n@1106 1578 if ( !match[3] ) {
n@1106 1579 Sizzle.error( match[0] );
n@1106 1580 }
n@1106 1581
n@1106 1582 // numeric x and y parameters for Expr.filter.CHILD
n@1106 1583 // remember that false/true cast respectively to 0/1
n@1106 1584 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
n@1106 1585 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
n@1106 1586
n@1106 1587 // other types prohibit arguments
n@1106 1588 } else if ( match[3] ) {
n@1106 1589 Sizzle.error( match[0] );
n@1106 1590 }
n@1106 1591
n@1106 1592 return match;
n@1106 1593 },
n@1106 1594
n@1106 1595 "PSEUDO": function( match ) {
n@1106 1596 var excess,
n@1106 1597 unquoted = !match[6] && match[2];
n@1106 1598
n@1106 1599 if ( matchExpr["CHILD"].test( match[0] ) ) {
n@1106 1600 return null;
n@1106 1601 }
n@1106 1602
n@1106 1603 // Accept quoted arguments as-is
n@1106 1604 if ( match[3] ) {
n@1106 1605 match[2] = match[4] || match[5] || "";
n@1106 1606
n@1106 1607 // Strip excess characters from unquoted arguments
n@1106 1608 } else if ( unquoted && rpseudo.test( unquoted ) &&
n@1106 1609 // Get excess from tokenize (recursively)
n@1106 1610 (excess = tokenize( unquoted, true )) &&
n@1106 1611 // advance to the next closing parenthesis
n@1106 1612 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
n@1106 1613
n@1106 1614 // excess is a negative index
n@1106 1615 match[0] = match[0].slice( 0, excess );
n@1106 1616 match[2] = unquoted.slice( 0, excess );
n@1106 1617 }
n@1106 1618
n@1106 1619 // Return only captures needed by the pseudo filter method (type and argument)
n@1106 1620 return match.slice( 0, 3 );
n@1106 1621 }
n@1106 1622 },
n@1106 1623
n@1106 1624 filter: {
n@1106 1625
n@1106 1626 "TAG": function( nodeNameSelector ) {
n@1106 1627 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
n@1106 1628 return nodeNameSelector === "*" ?
n@1106 1629 function() { return true; } :
n@1106 1630 function( elem ) {
n@1106 1631 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
n@1106 1632 };
n@1106 1633 },
n@1106 1634
n@1106 1635 "CLASS": function( className ) {
n@1106 1636 var pattern = classCache[ className + " " ];
n@1106 1637
n@1106 1638 return pattern ||
n@1106 1639 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
n@1106 1640 classCache( className, function( elem ) {
n@1106 1641 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
n@1106 1642 });
n@1106 1643 },
n@1106 1644
n@1106 1645 "ATTR": function( name, operator, check ) {
n@1106 1646 return function( elem ) {
n@1106 1647 var result = Sizzle.attr( elem, name );
n@1106 1648
n@1106 1649 if ( result == null ) {
n@1106 1650 return operator === "!=";
n@1106 1651 }
n@1106 1652 if ( !operator ) {
n@1106 1653 return true;
n@1106 1654 }
n@1106 1655
n@1106 1656 result += "";
n@1106 1657
n@1106 1658 return operator === "=" ? result === check :
n@1106 1659 operator === "!=" ? result !== check :
n@1106 1660 operator === "^=" ? check && result.indexOf( check ) === 0 :
n@1106 1661 operator === "*=" ? check && result.indexOf( check ) > -1 :
n@1106 1662 operator === "$=" ? check && result.slice( -check.length ) === check :
n@1106 1663 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
n@1106 1664 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
n@1106 1665 false;
n@1106 1666 };
n@1106 1667 },
n@1106 1668
n@1106 1669 "CHILD": function( type, what, argument, first, last ) {
n@1106 1670 var simple = type.slice( 0, 3 ) !== "nth",
n@1106 1671 forward = type.slice( -4 ) !== "last",
n@1106 1672 ofType = what === "of-type";
n@1106 1673
n@1106 1674 return first === 1 && last === 0 ?
n@1106 1675
n@1106 1676 // Shortcut for :nth-*(n)
n@1106 1677 function( elem ) {
n@1106 1678 return !!elem.parentNode;
n@1106 1679 } :
n@1106 1680
n@1106 1681 function( elem, context, xml ) {
n@1106 1682 var cache, outerCache, node, diff, nodeIndex, start,
n@1106 1683 dir = simple !== forward ? "nextSibling" : "previousSibling",
n@1106 1684 parent = elem.parentNode,
n@1106 1685 name = ofType && elem.nodeName.toLowerCase(),
n@1106 1686 useCache = !xml && !ofType;
n@1106 1687
n@1106 1688 if ( parent ) {
n@1106 1689
n@1106 1690 // :(first|last|only)-(child|of-type)
n@1106 1691 if ( simple ) {
n@1106 1692 while ( dir ) {
n@1106 1693 node = elem;
n@1106 1694 while ( (node = node[ dir ]) ) {
n@1106 1695 if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
n@1106 1696 return false;
n@1106 1697 }
n@1106 1698 }
n@1106 1699 // Reverse direction for :only-* (if we haven't yet done so)
n@1106 1700 start = dir = type === "only" && !start && "nextSibling";
n@1106 1701 }
n@1106 1702 return true;
n@1106 1703 }
n@1106 1704
n@1106 1705 start = [ forward ? parent.firstChild : parent.lastChild ];
n@1106 1706
n@1106 1707 // non-xml :nth-child(...) stores cache data on `parent`
n@1106 1708 if ( forward && useCache ) {
n@1106 1709 // Seek `elem` from a previously-cached index
n@1106 1710 outerCache = parent[ expando ] || (parent[ expando ] = {});
n@1106 1711 cache = outerCache[ type ] || [];
n@1106 1712 nodeIndex = cache[0] === dirruns && cache[1];
n@1106 1713 diff = cache[0] === dirruns && cache[2];
n@1106 1714 node = nodeIndex && parent.childNodes[ nodeIndex ];
n@1106 1715
n@1106 1716 while ( (node = ++nodeIndex && node && node[ dir ] ||
n@1106 1717
n@1106 1718 // Fallback to seeking `elem` from the start
n@1106 1719 (diff = nodeIndex = 0) || start.pop()) ) {
n@1106 1720
n@1106 1721 // When found, cache indexes on `parent` and break
n@1106 1722 if ( node.nodeType === 1 && ++diff && node === elem ) {
n@1106 1723 outerCache[ type ] = [ dirruns, nodeIndex, diff ];
n@1106 1724 break;
n@1106 1725 }
n@1106 1726 }
n@1106 1727
n@1106 1728 // Use previously-cached element index if available
n@1106 1729 } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
n@1106 1730 diff = cache[1];
n@1106 1731
n@1106 1732 // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
n@1106 1733 } else {
n@1106 1734 // Use the same loop as above to seek `elem` from the start
n@1106 1735 while ( (node = ++nodeIndex && node && node[ dir ] ||
n@1106 1736 (diff = nodeIndex = 0) || start.pop()) ) {
n@1106 1737
n@1106 1738 if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
n@1106 1739 // Cache the index of each encountered element
n@1106 1740 if ( useCache ) {
n@1106 1741 (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
n@1106 1742 }
n@1106 1743
n@1106 1744 if ( node === elem ) {
n@1106 1745 break;
n@1106 1746 }
n@1106 1747 }
n@1106 1748 }
n@1106 1749 }
n@1106 1750
n@1106 1751 // Incorporate the offset, then check against cycle size
n@1106 1752 diff -= last;
n@1106 1753 return diff === first || ( diff % first === 0 && diff / first >= 0 );
n@1106 1754 }
n@1106 1755 };
n@1106 1756 },
n@1106 1757
n@1106 1758 "PSEUDO": function( pseudo, argument ) {
n@1106 1759 // pseudo-class names are case-insensitive
n@1106 1760 // http://www.w3.org/TR/selectors/#pseudo-classes
n@1106 1761 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
n@1106 1762 // Remember that setFilters inherits from pseudos
n@1106 1763 var args,
n@1106 1764 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
n@1106 1765 Sizzle.error( "unsupported pseudo: " + pseudo );
n@1106 1766
n@1106 1767 // The user may use createPseudo to indicate that
n@1106 1768 // arguments are needed to create the filter function
n@1106 1769 // just as Sizzle does
n@1106 1770 if ( fn[ expando ] ) {
n@1106 1771 return fn( argument );
n@1106 1772 }
n@1106 1773
n@1106 1774 // But maintain support for old signatures
n@1106 1775 if ( fn.length > 1 ) {
n@1106 1776 args = [ pseudo, pseudo, "", argument ];
n@1106 1777 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
n@1106 1778 markFunction(function( seed, matches ) {
n@1106 1779 var idx,
n@1106 1780 matched = fn( seed, argument ),
n@1106 1781 i = matched.length;
n@1106 1782 while ( i-- ) {
n@1106 1783 idx = indexOf( seed, matched[i] );
n@1106 1784 seed[ idx ] = !( matches[ idx ] = matched[i] );
n@1106 1785 }
n@1106 1786 }) :
n@1106 1787 function( elem ) {
n@1106 1788 return fn( elem, 0, args );
n@1106 1789 };
n@1106 1790 }
n@1106 1791
n@1106 1792 return fn;
n@1106 1793 }
n@1106 1794 },
n@1106 1795
n@1106 1796 pseudos: {
n@1106 1797 // Potentially complex pseudos
n@1106 1798 "not": markFunction(function( selector ) {
n@1106 1799 // Trim the selector passed to compile
n@1106 1800 // to avoid treating leading and trailing
n@1106 1801 // spaces as combinators
n@1106 1802 var input = [],
n@1106 1803 results = [],
n@1106 1804 matcher = compile( selector.replace( rtrim, "$1" ) );
n@1106 1805
n@1106 1806 return matcher[ expando ] ?
n@1106 1807 markFunction(function( seed, matches, context, xml ) {
n@1106 1808 var elem,
n@1106 1809 unmatched = matcher( seed, null, xml, [] ),
n@1106 1810 i = seed.length;
n@1106 1811
n@1106 1812 // Match elements unmatched by `matcher`
n@1106 1813 while ( i-- ) {
n@1106 1814 if ( (elem = unmatched[i]) ) {
n@1106 1815 seed[i] = !(matches[i] = elem);
n@1106 1816 }
n@1106 1817 }
n@1106 1818 }) :
n@1106 1819 function( elem, context, xml ) {
n@1106 1820 input[0] = elem;
n@1106 1821 matcher( input, null, xml, results );
n@1106 1822 // Don't keep the element (issue #299)
n@1106 1823 input[0] = null;
n@1106 1824 return !results.pop();
n@1106 1825 };
n@1106 1826 }),
n@1106 1827
n@1106 1828 "has": markFunction(function( selector ) {
n@1106 1829 return function( elem ) {
n@1106 1830 return Sizzle( selector, elem ).length > 0;
n@1106 1831 };
n@1106 1832 }),
n@1106 1833
n@1106 1834 "contains": markFunction(function( text ) {
n@1106 1835 text = text.replace( runescape, funescape );
n@1106 1836 return function( elem ) {
n@1106 1837 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
n@1106 1838 };
n@1106 1839 }),
n@1106 1840
n@1106 1841 // "Whether an element is represented by a :lang() selector
n@1106 1842 // is based solely on the element's language value
n@1106 1843 // being equal to the identifier C,
n@1106 1844 // or beginning with the identifier C immediately followed by "-".
n@1106 1845 // The matching of C against the element's language value is performed case-insensitively.
n@1106 1846 // The identifier C does not have to be a valid language name."
n@1106 1847 // http://www.w3.org/TR/selectors/#lang-pseudo
n@1106 1848 "lang": markFunction( function( lang ) {
n@1106 1849 // lang value must be a valid identifier
n@1106 1850 if ( !ridentifier.test(lang || "") ) {
n@1106 1851 Sizzle.error( "unsupported lang: " + lang );
n@1106 1852 }
n@1106 1853 lang = lang.replace( runescape, funescape ).toLowerCase();
n@1106 1854 return function( elem ) {
n@1106 1855 var elemLang;
n@1106 1856 do {
n@1106 1857 if ( (elemLang = documentIsHTML ?
n@1106 1858 elem.lang :
n@1106 1859 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
n@1106 1860
n@1106 1861 elemLang = elemLang.toLowerCase();
n@1106 1862 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
n@1106 1863 }
n@1106 1864 } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
n@1106 1865 return false;
n@1106 1866 };
n@1106 1867 }),
n@1106 1868
n@1106 1869 // Miscellaneous
n@1106 1870 "target": function( elem ) {
n@1106 1871 var hash = window.location && window.location.hash;
n@1106 1872 return hash && hash.slice( 1 ) === elem.id;
n@1106 1873 },
n@1106 1874
n@1106 1875 "root": function( elem ) {
n@1106 1876 return elem === docElem;
n@1106 1877 },
n@1106 1878
n@1106 1879 "focus": function( elem ) {
n@1106 1880 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
n@1106 1881 },
n@1106 1882
n@1106 1883 // Boolean properties
n@1106 1884 "enabled": function( elem ) {
n@1106 1885 return elem.disabled === false;
n@1106 1886 },
n@1106 1887
n@1106 1888 "disabled": function( elem ) {
n@1106 1889 return elem.disabled === true;
n@1106 1890 },
n@1106 1891
n@1106 1892 "checked": function( elem ) {
n@1106 1893 // In CSS3, :checked should return both checked and selected elements
n@1106 1894 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
n@1106 1895 var nodeName = elem.nodeName.toLowerCase();
n@1106 1896 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
n@1106 1897 },
n@1106 1898
n@1106 1899 "selected": function( elem ) {
n@1106 1900 // Accessing this property makes selected-by-default
n@1106 1901 // options in Safari work properly
n@1106 1902 if ( elem.parentNode ) {
n@1106 1903 elem.parentNode.selectedIndex;
n@1106 1904 }
n@1106 1905
n@1106 1906 return elem.selected === true;
n@1106 1907 },
n@1106 1908
n@1106 1909 // Contents
n@1106 1910 "empty": function( elem ) {
n@1106 1911 // http://www.w3.org/TR/selectors/#empty-pseudo
n@1106 1912 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
n@1106 1913 // but not by others (comment: 8; processing instruction: 7; etc.)
n@1106 1914 // nodeType < 6 works because attributes (2) do not appear as children
n@1106 1915 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
n@1106 1916 if ( elem.nodeType < 6 ) {
n@1106 1917 return false;
n@1106 1918 }
n@1106 1919 }
n@1106 1920 return true;
n@1106 1921 },
n@1106 1922
n@1106 1923 "parent": function( elem ) {
n@1106 1924 return !Expr.pseudos["empty"]( elem );
n@1106 1925 },
n@1106 1926
n@1106 1927 // Element/input types
n@1106 1928 "header": function( elem ) {
n@1106 1929 return rheader.test( elem.nodeName );
n@1106 1930 },
n@1106 1931
n@1106 1932 "input": function( elem ) {
n@1106 1933 return rinputs.test( elem.nodeName );
n@1106 1934 },
n@1106 1935
n@1106 1936 "button": function( elem ) {
n@1106 1937 var name = elem.nodeName.toLowerCase();
n@1106 1938 return name === "input" && elem.type === "button" || name === "button";
n@1106 1939 },
n@1106 1940
n@1106 1941 "text": function( elem ) {
n@1106 1942 var attr;
n@1106 1943 return elem.nodeName.toLowerCase() === "input" &&
n@1106 1944 elem.type === "text" &&
n@1106 1945
n@1106 1946 // Support: IE<8
n@1106 1947 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
n@1106 1948 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
n@1106 1949 },
n@1106 1950
n@1106 1951 // Position-in-collection
n@1106 1952 "first": createPositionalPseudo(function() {
n@1106 1953 return [ 0 ];
n@1106 1954 }),
n@1106 1955
n@1106 1956 "last": createPositionalPseudo(function( matchIndexes, length ) {
n@1106 1957 return [ length - 1 ];
n@1106 1958 }),
n@1106 1959
n@1106 1960 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
n@1106 1961 return [ argument < 0 ? argument + length : argument ];
n@1106 1962 }),
n@1106 1963
n@1106 1964 "even": createPositionalPseudo(function( matchIndexes, length ) {
n@1106 1965 var i = 0;
n@1106 1966 for ( ; i < length; i += 2 ) {
n@1106 1967 matchIndexes.push( i );
n@1106 1968 }
n@1106 1969 return matchIndexes;
n@1106 1970 }),
n@1106 1971
n@1106 1972 "odd": createPositionalPseudo(function( matchIndexes, length ) {
n@1106 1973 var i = 1;
n@1106 1974 for ( ; i < length; i += 2 ) {
n@1106 1975 matchIndexes.push( i );
n@1106 1976 }
n@1106 1977 return matchIndexes;
n@1106 1978 }),
n@1106 1979
n@1106 1980 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
n@1106 1981 var i = argument < 0 ? argument + length : argument;
n@1106 1982 for ( ; --i >= 0; ) {
n@1106 1983 matchIndexes.push( i );
n@1106 1984 }
n@1106 1985 return matchIndexes;
n@1106 1986 }),
n@1106 1987
n@1106 1988 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
n@1106 1989 var i = argument < 0 ? argument + length : argument;
n@1106 1990 for ( ; ++i < length; ) {
n@1106 1991 matchIndexes.push( i );
n@1106 1992 }
n@1106 1993 return matchIndexes;
n@1106 1994 })
n@1106 1995 }
n@1106 1996 };
n@1106 1997
n@1106 1998 Expr.pseudos["nth"] = Expr.pseudos["eq"];
n@1106 1999
n@1106 2000 // Add button/input type pseudos
n@1106 2001 for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
n@1106 2002 Expr.pseudos[ i ] = createInputPseudo( i );
n@1106 2003 }
n@1106 2004 for ( i in { submit: true, reset: true } ) {
n@1106 2005 Expr.pseudos[ i ] = createButtonPseudo( i );
n@1106 2006 }
n@1106 2007
n@1106 2008 // Easy API for creating new setFilters
n@1106 2009 function setFilters() {}
n@1106 2010 setFilters.prototype = Expr.filters = Expr.pseudos;
n@1106 2011 Expr.setFilters = new setFilters();
n@1106 2012
n@1106 2013 tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
n@1106 2014 var matched, match, tokens, type,
n@1106 2015 soFar, groups, preFilters,
n@1106 2016 cached = tokenCache[ selector + " " ];
n@1106 2017
n@1106 2018 if ( cached ) {
n@1106 2019 return parseOnly ? 0 : cached.slice( 0 );
n@1106 2020 }
n@1106 2021
n@1106 2022 soFar = selector;
n@1106 2023 groups = [];
n@1106 2024 preFilters = Expr.preFilter;
n@1106 2025
n@1106 2026 while ( soFar ) {
n@1106 2027
n@1106 2028 // Comma and first run
n@1106 2029 if ( !matched || (match = rcomma.exec( soFar )) ) {
n@1106 2030 if ( match ) {
n@1106 2031 // Don't consume trailing commas as valid
n@1106 2032 soFar = soFar.slice( match[0].length ) || soFar;
n@1106 2033 }
n@1106 2034 groups.push( (tokens = []) );
n@1106 2035 }
n@1106 2036
n@1106 2037 matched = false;
n@1106 2038
n@1106 2039 // Combinators
n@1106 2040 if ( (match = rcombinators.exec( soFar )) ) {
n@1106 2041 matched = match.shift();
n@1106 2042 tokens.push({
n@1106 2043 value: matched,
n@1106 2044 // Cast descendant combinators to space
n@1106 2045 type: match[0].replace( rtrim, " " )
n@1106 2046 });
n@1106 2047 soFar = soFar.slice( matched.length );
n@1106 2048 }
n@1106 2049
n@1106 2050 // Filters
n@1106 2051 for ( type in Expr.filter ) {
n@1106 2052 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
n@1106 2053 (match = preFilters[ type ]( match ))) ) {
n@1106 2054 matched = match.shift();
n@1106 2055 tokens.push({
n@1106 2056 value: matched,
n@1106 2057 type: type,
n@1106 2058 matches: match
n@1106 2059 });
n@1106 2060 soFar = soFar.slice( matched.length );
n@1106 2061 }
n@1106 2062 }
n@1106 2063
n@1106 2064 if ( !matched ) {
n@1106 2065 break;
n@1106 2066 }
n@1106 2067 }
n@1106 2068
n@1106 2069 // Return the length of the invalid excess
n@1106 2070 // if we're just parsing
n@1106 2071 // Otherwise, throw an error or return tokens
n@1106 2072 return parseOnly ?
n@1106 2073 soFar.length :
n@1106 2074 soFar ?
n@1106 2075 Sizzle.error( selector ) :
n@1106 2076 // Cache the tokens
n@1106 2077 tokenCache( selector, groups ).slice( 0 );
n@1106 2078 };
n@1106 2079
n@1106 2080 function toSelector( tokens ) {
n@1106 2081 var i = 0,
n@1106 2082 len = tokens.length,
n@1106 2083 selector = "";
n@1106 2084 for ( ; i < len; i++ ) {
n@1106 2085 selector += tokens[i].value;
n@1106 2086 }
n@1106 2087 return selector;
n@1106 2088 }
n@1106 2089
n@1106 2090 function addCombinator( matcher, combinator, base ) {
n@1106 2091 var dir = combinator.dir,
n@1106 2092 checkNonElements = base && dir === "parentNode",
n@1106 2093 doneName = done++;
n@1106 2094
n@1106 2095 return combinator.first ?
n@1106 2096 // Check against closest ancestor/preceding element
n@1106 2097 function( elem, context, xml ) {
n@1106 2098 while ( (elem = elem[ dir ]) ) {
n@1106 2099 if ( elem.nodeType === 1 || checkNonElements ) {
n@1106 2100 return matcher( elem, context, xml );
n@1106 2101 }
n@1106 2102 }
n@1106 2103 } :
n@1106 2104
n@1106 2105 // Check against all ancestor/preceding elements
n@1106 2106 function( elem, context, xml ) {
n@1106 2107 var oldCache, outerCache,
n@1106 2108 newCache = [ dirruns, doneName ];
n@1106 2109
n@1106 2110 // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
n@1106 2111 if ( xml ) {
n@1106 2112 while ( (elem = elem[ dir ]) ) {
n@1106 2113 if ( elem.nodeType === 1 || checkNonElements ) {
n@1106 2114 if ( matcher( elem, context, xml ) ) {
n@1106 2115 return true;
n@1106 2116 }
n@1106 2117 }
n@1106 2118 }
n@1106 2119 } else {
n@1106 2120 while ( (elem = elem[ dir ]) ) {
n@1106 2121 if ( elem.nodeType === 1 || checkNonElements ) {
n@1106 2122 outerCache = elem[ expando ] || (elem[ expando ] = {});
n@1106 2123 if ( (oldCache = outerCache[ dir ]) &&
n@1106 2124 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
n@1106 2125
n@1106 2126 // Assign to newCache so results back-propagate to previous elements
n@1106 2127 return (newCache[ 2 ] = oldCache[ 2 ]);
n@1106 2128 } else {
n@1106 2129 // Reuse newcache so results back-propagate to previous elements
n@1106 2130 outerCache[ dir ] = newCache;
n@1106 2131
n@1106 2132 // A match means we're done; a fail means we have to keep checking
n@1106 2133 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
n@1106 2134 return true;
n@1106 2135 }
n@1106 2136 }
n@1106 2137 }
n@1106 2138 }
n@1106 2139 }
n@1106 2140 };
n@1106 2141 }
n@1106 2142
n@1106 2143 function elementMatcher( matchers ) {
n@1106 2144 return matchers.length > 1 ?
n@1106 2145 function( elem, context, xml ) {
n@1106 2146 var i = matchers.length;
n@1106 2147 while ( i-- ) {
n@1106 2148 if ( !matchers[i]( elem, context, xml ) ) {
n@1106 2149 return false;
n@1106 2150 }
n@1106 2151 }
n@1106 2152 return true;
n@1106 2153 } :
n@1106 2154 matchers[0];
n@1106 2155 }
n@1106 2156
n@1106 2157 function multipleContexts( selector, contexts, results ) {
n@1106 2158 var i = 0,
n@1106 2159 len = contexts.length;
n@1106 2160 for ( ; i < len; i++ ) {
n@1106 2161 Sizzle( selector, contexts[i], results );
n@1106 2162 }
n@1106 2163 return results;
n@1106 2164 }
n@1106 2165
n@1106 2166 function condense( unmatched, map, filter, context, xml ) {
n@1106 2167 var elem,
n@1106 2168 newUnmatched = [],
n@1106 2169 i = 0,
n@1106 2170 len = unmatched.length,
n@1106 2171 mapped = map != null;
n@1106 2172
n@1106 2173 for ( ; i < len; i++ ) {
n@1106 2174 if ( (elem = unmatched[i]) ) {
n@1106 2175 if ( !filter || filter( elem, context, xml ) ) {
n@1106 2176 newUnmatched.push( elem );
n@1106 2177 if ( mapped ) {
n@1106 2178 map.push( i );
n@1106 2179 }
n@1106 2180 }
n@1106 2181 }
n@1106 2182 }
n@1106 2183
n@1106 2184 return newUnmatched;
n@1106 2185 }
n@1106 2186
n@1106 2187 function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
n@1106 2188 if ( postFilter && !postFilter[ expando ] ) {
n@1106 2189 postFilter = setMatcher( postFilter );
n@1106 2190 }
n@1106 2191 if ( postFinder && !postFinder[ expando ] ) {
n@1106 2192 postFinder = setMatcher( postFinder, postSelector );
n@1106 2193 }
n@1106 2194 return markFunction(function( seed, results, context, xml ) {
n@1106 2195 var temp, i, elem,
n@1106 2196 preMap = [],
n@1106 2197 postMap = [],
n@1106 2198 preexisting = results.length,
n@1106 2199
n@1106 2200 // Get initial elements from seed or context
n@1106 2201 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
n@1106 2202
n@1106 2203 // Prefilter to get matcher input, preserving a map for seed-results synchronization
n@1106 2204 matcherIn = preFilter && ( seed || !selector ) ?
n@1106 2205 condense( elems, preMap, preFilter, context, xml ) :
n@1106 2206 elems,
n@1106 2207
n@1106 2208 matcherOut = matcher ?
n@1106 2209 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
n@1106 2210 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
n@1106 2211
n@1106 2212 // ...intermediate processing is necessary
n@1106 2213 [] :
n@1106 2214
n@1106 2215 // ...otherwise use results directly
n@1106 2216 results :
n@1106 2217 matcherIn;
n@1106 2218
n@1106 2219 // Find primary matches
n@1106 2220 if ( matcher ) {
n@1106 2221 matcher( matcherIn, matcherOut, context, xml );
n@1106 2222 }
n@1106 2223
n@1106 2224 // Apply postFilter
n@1106 2225 if ( postFilter ) {
n@1106 2226 temp = condense( matcherOut, postMap );
n@1106 2227 postFilter( temp, [], context, xml );
n@1106 2228
n@1106 2229 // Un-match failing elements by moving them back to matcherIn
n@1106 2230 i = temp.length;
n@1106 2231 while ( i-- ) {
n@1106 2232 if ( (elem = temp[i]) ) {
n@1106 2233 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
n@1106 2234 }
n@1106 2235 }
n@1106 2236 }
n@1106 2237
n@1106 2238 if ( seed ) {
n@1106 2239 if ( postFinder || preFilter ) {
n@1106 2240 if ( postFinder ) {
n@1106 2241 // Get the final matcherOut by condensing this intermediate into postFinder contexts
n@1106 2242 temp = [];
n@1106 2243 i = matcherOut.length;
n@1106 2244 while ( i-- ) {
n@1106 2245 if ( (elem = matcherOut[i]) ) {
n@1106 2246 // Restore matcherIn since elem is not yet a final match
n@1106 2247 temp.push( (matcherIn[i] = elem) );
n@1106 2248 }
n@1106 2249 }
n@1106 2250 postFinder( null, (matcherOut = []), temp, xml );
n@1106 2251 }
n@1106 2252
n@1106 2253 // Move matched elements from seed to results to keep them synchronized
n@1106 2254 i = matcherOut.length;
n@1106 2255 while ( i-- ) {
n@1106 2256 if ( (elem = matcherOut[i]) &&
n@1106 2257 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
n@1106 2258
n@1106 2259 seed[temp] = !(results[temp] = elem);
n@1106 2260 }
n@1106 2261 }
n@1106 2262 }
n@1106 2263
n@1106 2264 // Add elements to results, through postFinder if defined
n@1106 2265 } else {
n@1106 2266 matcherOut = condense(
n@1106 2267 matcherOut === results ?
n@1106 2268 matcherOut.splice( preexisting, matcherOut.length ) :
n@1106 2269 matcherOut
n@1106 2270 );
n@1106 2271 if ( postFinder ) {
n@1106 2272 postFinder( null, results, matcherOut, xml );
n@1106 2273 } else {
n@1106 2274 push.apply( results, matcherOut );
n@1106 2275 }
n@1106 2276 }
n@1106 2277 });
n@1106 2278 }
n@1106 2279
n@1106 2280 function matcherFromTokens( tokens ) {
n@1106 2281 var checkContext, matcher, j,
n@1106 2282 len = tokens.length,
n@1106 2283 leadingRelative = Expr.relative[ tokens[0].type ],
n@1106 2284 implicitRelative = leadingRelative || Expr.relative[" "],
n@1106 2285 i = leadingRelative ? 1 : 0,
n@1106 2286
n@1106 2287 // The foundational matcher ensures that elements are reachable from top-level context(s)
n@1106 2288 matchContext = addCombinator( function( elem ) {
n@1106 2289 return elem === checkContext;
n@1106 2290 }, implicitRelative, true ),
n@1106 2291 matchAnyContext = addCombinator( function( elem ) {
n@1106 2292 return indexOf( checkContext, elem ) > -1;
n@1106 2293 }, implicitRelative, true ),
n@1106 2294 matchers = [ function( elem, context, xml ) {
n@1106 2295 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
n@1106 2296 (checkContext = context).nodeType ?
n@1106 2297 matchContext( elem, context, xml ) :
n@1106 2298 matchAnyContext( elem, context, xml ) );
n@1106 2299 // Avoid hanging onto element (issue #299)
n@1106 2300 checkContext = null;
n@1106 2301 return ret;
n@1106 2302 } ];
n@1106 2303
n@1106 2304 for ( ; i < len; i++ ) {
n@1106 2305 if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
n@1106 2306 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
n@1106 2307 } else {
n@1106 2308 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
n@1106 2309
n@1106 2310 // Return special upon seeing a positional matcher
n@1106 2311 if ( matcher[ expando ] ) {
n@1106 2312 // Find the next relative operator (if any) for proper handling
n@1106 2313 j = ++i;
n@1106 2314 for ( ; j < len; j++ ) {
n@1106 2315 if ( Expr.relative[ tokens[j].type ] ) {
n@1106 2316 break;
n@1106 2317 }
n@1106 2318 }
n@1106 2319 return setMatcher(
n@1106 2320 i > 1 && elementMatcher( matchers ),
n@1106 2321 i > 1 && toSelector(
n@1106 2322 // If the preceding token was a descendant combinator, insert an implicit any-element `*`
n@1106 2323 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
n@1106 2324 ).replace( rtrim, "$1" ),
n@1106 2325 matcher,
n@1106 2326 i < j && matcherFromTokens( tokens.slice( i, j ) ),
n@1106 2327 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
n@1106 2328 j < len && toSelector( tokens )
n@1106 2329 );
n@1106 2330 }
n@1106 2331 matchers.push( matcher );
n@1106 2332 }
n@1106 2333 }
n@1106 2334
n@1106 2335 return elementMatcher( matchers );
n@1106 2336 }
n@1106 2337
n@1106 2338 function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
n@1106 2339 var bySet = setMatchers.length > 0,
n@1106 2340 byElement = elementMatchers.length > 0,
n@1106 2341 superMatcher = function( seed, context, xml, results, outermost ) {
n@1106 2342 var elem, j, matcher,
n@1106 2343 matchedCount = 0,
n@1106 2344 i = "0",
n@1106 2345 unmatched = seed && [],
n@1106 2346 setMatched = [],
n@1106 2347 contextBackup = outermostContext,
n@1106 2348 // We must always have either seed elements or outermost context
n@1106 2349 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
n@1106 2350 // Use integer dirruns iff this is the outermost matcher
n@1106 2351 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
n@1106 2352 len = elems.length;
n@1106 2353
n@1106 2354 if ( outermost ) {
n@1106 2355 outermostContext = context !== document && context;
n@1106 2356 }
n@1106 2357
n@1106 2358 // Add elements passing elementMatchers directly to results
n@1106 2359 // Keep `i` a string if there are no elements so `matchedCount` will be "00" below
n@1106 2360 // Support: IE<9, Safari
n@1106 2361 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
n@1106 2362 for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
n@1106 2363 if ( byElement && elem ) {
n@1106 2364 j = 0;
n@1106 2365 while ( (matcher = elementMatchers[j++]) ) {
n@1106 2366 if ( matcher( elem, context, xml ) ) {
n@1106 2367 results.push( elem );
n@1106 2368 break;
n@1106 2369 }
n@1106 2370 }
n@1106 2371 if ( outermost ) {
n@1106 2372 dirruns = dirrunsUnique;
n@1106 2373 }
n@1106 2374 }
n@1106 2375
n@1106 2376 // Track unmatched elements for set filters
n@1106 2377 if ( bySet ) {
n@1106 2378 // They will have gone through all possible matchers
n@1106 2379 if ( (elem = !matcher && elem) ) {
n@1106 2380 matchedCount--;
n@1106 2381 }
n@1106 2382
n@1106 2383 // Lengthen the array for every element, matched or not
n@1106 2384 if ( seed ) {
n@1106 2385 unmatched.push( elem );
n@1106 2386 }
n@1106 2387 }
n@1106 2388 }
n@1106 2389
n@1106 2390 // Apply set filters to unmatched elements
n@1106 2391 matchedCount += i;
n@1106 2392 if ( bySet && i !== matchedCount ) {
n@1106 2393 j = 0;
n@1106 2394 while ( (matcher = setMatchers[j++]) ) {
n@1106 2395 matcher( unmatched, setMatched, context, xml );
n@1106 2396 }
n@1106 2397
n@1106 2398 if ( seed ) {
n@1106 2399 // Reintegrate element matches to eliminate the need for sorting
n@1106 2400 if ( matchedCount > 0 ) {
n@1106 2401 while ( i-- ) {
n@1106 2402 if ( !(unmatched[i] || setMatched[i]) ) {
n@1106 2403 setMatched[i] = pop.call( results );
n@1106 2404 }
n@1106 2405 }
n@1106 2406 }
n@1106 2407
n@1106 2408 // Discard index placeholder values to get only actual matches
n@1106 2409 setMatched = condense( setMatched );
n@1106 2410 }
n@1106 2411
n@1106 2412 // Add matches to results
n@1106 2413 push.apply( results, setMatched );
n@1106 2414
n@1106 2415 // Seedless set matches succeeding multiple successful matchers stipulate sorting
n@1106 2416 if ( outermost && !seed && setMatched.length > 0 &&
n@1106 2417 ( matchedCount + setMatchers.length ) > 1 ) {
n@1106 2418
n@1106 2419 Sizzle.uniqueSort( results );
n@1106 2420 }
n@1106 2421 }
n@1106 2422
n@1106 2423 // Override manipulation of globals by nested matchers
n@1106 2424 if ( outermost ) {
n@1106 2425 dirruns = dirrunsUnique;
n@1106 2426 outermostContext = contextBackup;
n@1106 2427 }
n@1106 2428
n@1106 2429 return unmatched;
n@1106 2430 };
n@1106 2431
n@1106 2432 return bySet ?
n@1106 2433 markFunction( superMatcher ) :
n@1106 2434 superMatcher;
n@1106 2435 }
n@1106 2436
n@1106 2437 compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
n@1106 2438 var i,
n@1106 2439 setMatchers = [],
n@1106 2440 elementMatchers = [],
n@1106 2441 cached = compilerCache[ selector + " " ];
n@1106 2442
n@1106 2443 if ( !cached ) {
n@1106 2444 // Generate a function of recursive functions that can be used to check each element
n@1106 2445 if ( !match ) {
n@1106 2446 match = tokenize( selector );
n@1106 2447 }
n@1106 2448 i = match.length;
n@1106 2449 while ( i-- ) {
n@1106 2450 cached = matcherFromTokens( match[i] );
n@1106 2451 if ( cached[ expando ] ) {
n@1106 2452 setMatchers.push( cached );
n@1106 2453 } else {
n@1106 2454 elementMatchers.push( cached );
n@1106 2455 }
n@1106 2456 }
n@1106 2457
n@1106 2458 // Cache the compiled function
n@1106 2459 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
n@1106 2460
n@1106 2461 // Save selector and tokenization
n@1106 2462 cached.selector = selector;
n@1106 2463 }
n@1106 2464 return cached;
n@1106 2465 };
n@1106 2466
n@1106 2467 /**
n@1106 2468 * A low-level selection function that works with Sizzle's compiled
n@1106 2469 * selector functions
n@1106 2470 * @param {String|Function} selector A selector or a pre-compiled
n@1106 2471 * selector function built with Sizzle.compile
n@1106 2472 * @param {Element} context
n@1106 2473 * @param {Array} [results]
n@1106 2474 * @param {Array} [seed] A set of elements to match against
n@1106 2475 */
n@1106 2476 select = Sizzle.select = function( selector, context, results, seed ) {
n@1106 2477 var i, tokens, token, type, find,
n@1106 2478 compiled = typeof selector === "function" && selector,
n@1106 2479 match = !seed && tokenize( (selector = compiled.selector || selector) );
n@1106 2480
n@1106 2481 results = results || [];
n@1106 2482
n@1106 2483 // Try to minimize operations if there is no seed and only one group
n@1106 2484 if ( match.length === 1 ) {
n@1106 2485
n@1106 2486 // Take a shortcut and set the context if the root selector is an ID
n@1106 2487 tokens = match[0] = match[0].slice( 0 );
n@1106 2488 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
n@1106 2489 support.getById && context.nodeType === 9 && documentIsHTML &&
n@1106 2490 Expr.relative[ tokens[1].type ] ) {
n@1106 2491
n@1106 2492 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
n@1106 2493 if ( !context ) {
n@1106 2494 return results;
n@1106 2495
n@1106 2496 // Precompiled matchers will still verify ancestry, so step up a level
n@1106 2497 } else if ( compiled ) {
n@1106 2498 context = context.parentNode;
n@1106 2499 }
n@1106 2500
n@1106 2501 selector = selector.slice( tokens.shift().value.length );
n@1106 2502 }
n@1106 2503
n@1106 2504 // Fetch a seed set for right-to-left matching
n@1106 2505 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
n@1106 2506 while ( i-- ) {
n@1106 2507 token = tokens[i];
n@1106 2508
n@1106 2509 // Abort if we hit a combinator
n@1106 2510 if ( Expr.relative[ (type = token.type) ] ) {
n@1106 2511 break;
n@1106 2512 }
n@1106 2513 if ( (find = Expr.find[ type ]) ) {
n@1106 2514 // Search, expanding context for leading sibling combinators
n@1106 2515 if ( (seed = find(
n@1106 2516 token.matches[0].replace( runescape, funescape ),
n@1106 2517 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
n@1106 2518 )) ) {
n@1106 2519
n@1106 2520 // If seed is empty or no tokens remain, we can return early
n@1106 2521 tokens.splice( i, 1 );
n@1106 2522 selector = seed.length && toSelector( tokens );
n@1106 2523 if ( !selector ) {
n@1106 2524 push.apply( results, seed );
n@1106 2525 return results;
n@1106 2526 }
n@1106 2527
n@1106 2528 break;
n@1106 2529 }
n@1106 2530 }
n@1106 2531 }
n@1106 2532 }
n@1106 2533
n@1106 2534 // Compile and execute a filtering function if one is not provided
n@1106 2535 // Provide `match` to avoid retokenization if we modified the selector above
n@1106 2536 ( compiled || compile( selector, match ) )(
n@1106 2537 seed,
n@1106 2538 context,
n@1106 2539 !documentIsHTML,
n@1106 2540 results,
n@1106 2541 rsibling.test( selector ) && testContext( context.parentNode ) || context
n@1106 2542 );
n@1106 2543 return results;
n@1106 2544 };
n@1106 2545
n@1106 2546 // One-time assignments
n@1106 2547
n@1106 2548 // Sort stability
n@1106 2549 support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
n@1106 2550
n@1106 2551 // Support: Chrome 14-35+
n@1106 2552 // Always assume duplicates if they aren't passed to the comparison function
n@1106 2553 support.detectDuplicates = !!hasDuplicate;
n@1106 2554
n@1106 2555 // Initialize against the default document
n@1106 2556 setDocument();
n@1106 2557
n@1106 2558 // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
n@1106 2559 // Detached nodes confoundingly follow *each other*
n@1106 2560 support.sortDetached = assert(function( div1 ) {
n@1106 2561 // Should return 1, but returns 4 (following)
n@1106 2562 return div1.compareDocumentPosition( document.createElement("div") ) & 1;
n@1106 2563 });
n@1106 2564
n@1106 2565 // Support: IE<8
n@1106 2566 // Prevent attribute/property "interpolation"
n@1106 2567 // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
n@1106 2568 if ( !assert(function( div ) {
n@1106 2569 div.innerHTML = "<a href='#'></a>";
n@1106 2570 return div.firstChild.getAttribute("href") === "#" ;
n@1106 2571 }) ) {
n@1106 2572 addHandle( "type|href|height|width", function( elem, name, isXML ) {
n@1106 2573 if ( !isXML ) {
n@1106 2574 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
n@1106 2575 }
n@1106 2576 });
n@1106 2577 }
n@1106 2578
n@1106 2579 // Support: IE<9
n@1106 2580 // Use defaultValue in place of getAttribute("value")
n@1106 2581 if ( !support.attributes || !assert(function( div ) {
n@1106 2582 div.innerHTML = "<input/>";
n@1106 2583 div.firstChild.setAttribute( "value", "" );
n@1106 2584 return div.firstChild.getAttribute( "value" ) === "";
n@1106 2585 }) ) {
n@1106 2586 addHandle( "value", function( elem, name, isXML ) {
n@1106 2587 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
n@1106 2588 return elem.defaultValue;
n@1106 2589 }
n@1106 2590 });
n@1106 2591 }
n@1106 2592
n@1106 2593 // Support: IE<9
n@1106 2594 // Use getAttributeNode to fetch booleans when getAttribute lies
n@1106 2595 if ( !assert(function( div ) {
n@1106 2596 return div.getAttribute("disabled") == null;
n@1106 2597 }) ) {
n@1106 2598 addHandle( booleans, function( elem, name, isXML ) {
n@1106 2599 var val;
n@1106 2600 if ( !isXML ) {
n@1106 2601 return elem[ name ] === true ? name.toLowerCase() :
n@1106 2602 (val = elem.getAttributeNode( name )) && val.specified ?
n@1106 2603 val.value :
n@1106 2604 null;
n@1106 2605 }
n@1106 2606 });
n@1106 2607 }
n@1106 2608
n@1106 2609 return Sizzle;
n@1106 2610
n@1106 2611 })( window );
n@1106 2612
n@1106 2613
n@1106 2614
n@1106 2615 jQuery.find = Sizzle;
n@1106 2616 jQuery.expr = Sizzle.selectors;
n@1106 2617 jQuery.expr[":"] = jQuery.expr.pseudos;
n@1106 2618 jQuery.unique = Sizzle.uniqueSort;
n@1106 2619 jQuery.text = Sizzle.getText;
n@1106 2620 jQuery.isXMLDoc = Sizzle.isXML;
n@1106 2621 jQuery.contains = Sizzle.contains;
n@1106 2622
n@1106 2623
n@1106 2624
n@1106 2625 var rneedsContext = jQuery.expr.match.needsContext;
n@1106 2626
n@1106 2627 var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
n@1106 2628
n@1106 2629
n@1106 2630
n@1106 2631 var risSimple = /^.[^:#\[\.,]*$/;
n@1106 2632
n@1106 2633 // Implement the identical functionality for filter and not
n@1106 2634 function winnow( elements, qualifier, not ) {
n@1106 2635 if ( jQuery.isFunction( qualifier ) ) {
n@1106 2636 return jQuery.grep( elements, function( elem, i ) {
n@1106 2637 /* jshint -W018 */
n@1106 2638 return !!qualifier.call( elem, i, elem ) !== not;
n@1106 2639 });
n@1106 2640
n@1106 2641 }
n@1106 2642
n@1106 2643 if ( qualifier.nodeType ) {
n@1106 2644 return jQuery.grep( elements, function( elem ) {
n@1106 2645 return ( elem === qualifier ) !== not;
n@1106 2646 });
n@1106 2647
n@1106 2648 }
n@1106 2649
n@1106 2650 if ( typeof qualifier === "string" ) {
n@1106 2651 if ( risSimple.test( qualifier ) ) {
n@1106 2652 return jQuery.filter( qualifier, elements, not );
n@1106 2653 }
n@1106 2654
n@1106 2655 qualifier = jQuery.filter( qualifier, elements );
n@1106 2656 }
n@1106 2657
n@1106 2658 return jQuery.grep( elements, function( elem ) {
n@1106 2659 return ( indexOf.call( qualifier, elem ) >= 0 ) !== not;
n@1106 2660 });
n@1106 2661 }
n@1106 2662
n@1106 2663 jQuery.filter = function( expr, elems, not ) {
n@1106 2664 var elem = elems[ 0 ];
n@1106 2665
n@1106 2666 if ( not ) {
n@1106 2667 expr = ":not(" + expr + ")";
n@1106 2668 }
n@1106 2669
n@1106 2670 return elems.length === 1 && elem.nodeType === 1 ?
n@1106 2671 jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
n@1106 2672 jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
n@1106 2673 return elem.nodeType === 1;
n@1106 2674 }));
n@1106 2675 };
n@1106 2676
n@1106 2677 jQuery.fn.extend({
n@1106 2678 find: function( selector ) {
n@1106 2679 var i,
n@1106 2680 len = this.length,
n@1106 2681 ret = [],
n@1106 2682 self = this;
n@1106 2683
n@1106 2684 if ( typeof selector !== "string" ) {
n@1106 2685 return this.pushStack( jQuery( selector ).filter(function() {
n@1106 2686 for ( i = 0; i < len; i++ ) {
n@1106 2687 if ( jQuery.contains( self[ i ], this ) ) {
n@1106 2688 return true;
n@1106 2689 }
n@1106 2690 }
n@1106 2691 }) );
n@1106 2692 }
n@1106 2693
n@1106 2694 for ( i = 0; i < len; i++ ) {
n@1106 2695 jQuery.find( selector, self[ i ], ret );
n@1106 2696 }
n@1106 2697
n@1106 2698 // Needed because $( selector, context ) becomes $( context ).find( selector )
n@1106 2699 ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
n@1106 2700 ret.selector = this.selector ? this.selector + " " + selector : selector;
n@1106 2701 return ret;
n@1106 2702 },
n@1106 2703 filter: function( selector ) {
n@1106 2704 return this.pushStack( winnow(this, selector || [], false) );
n@1106 2705 },
n@1106 2706 not: function( selector ) {
n@1106 2707 return this.pushStack( winnow(this, selector || [], true) );
n@1106 2708 },
n@1106 2709 is: function( selector ) {
n@1106 2710 return !!winnow(
n@1106 2711 this,
n@1106 2712
n@1106 2713 // If this is a positional/relative selector, check membership in the returned set
n@1106 2714 // so $("p:first").is("p:last") won't return true for a doc with two "p".
n@1106 2715 typeof selector === "string" && rneedsContext.test( selector ) ?
n@1106 2716 jQuery( selector ) :
n@1106 2717 selector || [],
n@1106 2718 false
n@1106 2719 ).length;
n@1106 2720 }
n@1106 2721 });
n@1106 2722
n@1106 2723
n@1106 2724 // Initialize a jQuery object
n@1106 2725
n@1106 2726
n@1106 2727 // A central reference to the root jQuery(document)
n@1106 2728 var rootjQuery,
n@1106 2729
n@1106 2730 // A simple way to check for HTML strings
n@1106 2731 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
n@1106 2732 // Strict HTML recognition (#11290: must start with <)
n@1106 2733 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
n@1106 2734
n@1106 2735 init = jQuery.fn.init = function( selector, context ) {
n@1106 2736 var match, elem;
n@1106 2737
n@1106 2738 // HANDLE: $(""), $(null), $(undefined), $(false)
n@1106 2739 if ( !selector ) {
n@1106 2740 return this;
n@1106 2741 }
n@1106 2742
n@1106 2743 // Handle HTML strings
n@1106 2744 if ( typeof selector === "string" ) {
n@1106 2745 if ( selector[0] === "<" && selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) {
n@1106 2746 // Assume that strings that start and end with <> are HTML and skip the regex check
n@1106 2747 match = [ null, selector, null ];
n@1106 2748
n@1106 2749 } else {
n@1106 2750 match = rquickExpr.exec( selector );
n@1106 2751 }
n@1106 2752
n@1106 2753 // Match html or make sure no context is specified for #id
n@1106 2754 if ( match && (match[1] || !context) ) {
n@1106 2755
n@1106 2756 // HANDLE: $(html) -> $(array)
n@1106 2757 if ( match[1] ) {
n@1106 2758 context = context instanceof jQuery ? context[0] : context;
n@1106 2759
n@1106 2760 // Option to run scripts is true for back-compat
n@1106 2761 // Intentionally let the error be thrown if parseHTML is not present
n@1106 2762 jQuery.merge( this, jQuery.parseHTML(
n@1106 2763 match[1],
n@1106 2764 context && context.nodeType ? context.ownerDocument || context : document,
n@1106 2765 true
n@1106 2766 ) );
n@1106 2767
n@1106 2768 // HANDLE: $(html, props)
n@1106 2769 if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
n@1106 2770 for ( match in context ) {
n@1106 2771 // Properties of context are called as methods if possible
n@1106 2772 if ( jQuery.isFunction( this[ match ] ) ) {
n@1106 2773 this[ match ]( context[ match ] );
n@1106 2774
n@1106 2775 // ...and otherwise set as attributes
n@1106 2776 } else {
n@1106 2777 this.attr( match, context[ match ] );
n@1106 2778 }
n@1106 2779 }
n@1106 2780 }
n@1106 2781
n@1106 2782 return this;
n@1106 2783
n@1106 2784 // HANDLE: $(#id)
n@1106 2785 } else {
n@1106 2786 elem = document.getElementById( match[2] );
n@1106 2787
n@1106 2788 // Support: Blackberry 4.6
n@1106 2789 // gEBID returns nodes no longer in the document (#6963)
n@1106 2790 if ( elem && elem.parentNode ) {
n@1106 2791 // Inject the element directly into the jQuery object
n@1106 2792 this.length = 1;
n@1106 2793 this[0] = elem;
n@1106 2794 }
n@1106 2795
n@1106 2796 this.context = document;
n@1106 2797 this.selector = selector;
n@1106 2798 return this;
n@1106 2799 }
n@1106 2800
n@1106 2801 // HANDLE: $(expr, $(...))
n@1106 2802 } else if ( !context || context.jquery ) {
n@1106 2803 return ( context || rootjQuery ).find( selector );
n@1106 2804
n@1106 2805 // HANDLE: $(expr, context)
n@1106 2806 // (which is just equivalent to: $(context).find(expr)
n@1106 2807 } else {
n@1106 2808 return this.constructor( context ).find( selector );
n@1106 2809 }
n@1106 2810
n@1106 2811 // HANDLE: $(DOMElement)
n@1106 2812 } else if ( selector.nodeType ) {
n@1106 2813 this.context = this[0] = selector;
n@1106 2814 this.length = 1;
n@1106 2815 return this;
n@1106 2816
n@1106 2817 // HANDLE: $(function)
n@1106 2818 // Shortcut for document ready
n@1106 2819 } else if ( jQuery.isFunction( selector ) ) {
n@1106 2820 return typeof rootjQuery.ready !== "undefined" ?
n@1106 2821 rootjQuery.ready( selector ) :
n@1106 2822 // Execute immediately if ready is not present
n@1106 2823 selector( jQuery );
n@1106 2824 }
n@1106 2825
n@1106 2826 if ( selector.selector !== undefined ) {
n@1106 2827 this.selector = selector.selector;
n@1106 2828 this.context = selector.context;
n@1106 2829 }
n@1106 2830
n@1106 2831 return jQuery.makeArray( selector, this );
n@1106 2832 };
n@1106 2833
n@1106 2834 // Give the init function the jQuery prototype for later instantiation
n@1106 2835 init.prototype = jQuery.fn;
n@1106 2836
n@1106 2837 // Initialize central reference
n@1106 2838 rootjQuery = jQuery( document );
n@1106 2839
n@1106 2840
n@1106 2841 var rparentsprev = /^(?:parents|prev(?:Until|All))/,
n@1106 2842 // Methods guaranteed to produce a unique set when starting from a unique set
n@1106 2843 guaranteedUnique = {
n@1106 2844 children: true,
n@1106 2845 contents: true,
n@1106 2846 next: true,
n@1106 2847 prev: true
n@1106 2848 };
n@1106 2849
n@1106 2850 jQuery.extend({
n@1106 2851 dir: function( elem, dir, until ) {
n@1106 2852 var matched = [],
n@1106 2853 truncate = until !== undefined;
n@1106 2854
n@1106 2855 while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) {
n@1106 2856 if ( elem.nodeType === 1 ) {
n@1106 2857 if ( truncate && jQuery( elem ).is( until ) ) {
n@1106 2858 break;
n@1106 2859 }
n@1106 2860 matched.push( elem );
n@1106 2861 }
n@1106 2862 }
n@1106 2863 return matched;
n@1106 2864 },
n@1106 2865
n@1106 2866 sibling: function( n, elem ) {
n@1106 2867 var matched = [];
n@1106 2868
n@1106 2869 for ( ; n; n = n.nextSibling ) {
n@1106 2870 if ( n.nodeType === 1 && n !== elem ) {
n@1106 2871 matched.push( n );
n@1106 2872 }
n@1106 2873 }
n@1106 2874
n@1106 2875 return matched;
n@1106 2876 }
n@1106 2877 });
n@1106 2878
n@1106 2879 jQuery.fn.extend({
n@1106 2880 has: function( target ) {
n@1106 2881 var targets = jQuery( target, this ),
n@1106 2882 l = targets.length;
n@1106 2883
n@1106 2884 return this.filter(function() {
n@1106 2885 var i = 0;
n@1106 2886 for ( ; i < l; i++ ) {
n@1106 2887 if ( jQuery.contains( this, targets[i] ) ) {
n@1106 2888 return true;
n@1106 2889 }
n@1106 2890 }
n@1106 2891 });
n@1106 2892 },
n@1106 2893
n@1106 2894 closest: function( selectors, context ) {
n@1106 2895 var cur,
n@1106 2896 i = 0,
n@1106 2897 l = this.length,
n@1106 2898 matched = [],
n@1106 2899 pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
n@1106 2900 jQuery( selectors, context || this.context ) :
n@1106 2901 0;
n@1106 2902
n@1106 2903 for ( ; i < l; i++ ) {
n@1106 2904 for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
n@1106 2905 // Always skip document fragments
n@1106 2906 if ( cur.nodeType < 11 && (pos ?
n@1106 2907 pos.index(cur) > -1 :
n@1106 2908
n@1106 2909 // Don't pass non-elements to Sizzle
n@1106 2910 cur.nodeType === 1 &&
n@1106 2911 jQuery.find.matchesSelector(cur, selectors)) ) {
n@1106 2912
n@1106 2913 matched.push( cur );
n@1106 2914 break;
n@1106 2915 }
n@1106 2916 }
n@1106 2917 }
n@1106 2918
n@1106 2919 return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched );
n@1106 2920 },
n@1106 2921
n@1106 2922 // Determine the position of an element within the set
n@1106 2923 index: function( elem ) {
n@1106 2924
n@1106 2925 // No argument, return index in parent
n@1106 2926 if ( !elem ) {
n@1106 2927 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
n@1106 2928 }
n@1106 2929
n@1106 2930 // Index in selector
n@1106 2931 if ( typeof elem === "string" ) {
n@1106 2932 return indexOf.call( jQuery( elem ), this[ 0 ] );
n@1106 2933 }
n@1106 2934
n@1106 2935 // Locate the position of the desired element
n@1106 2936 return indexOf.call( this,
n@1106 2937
n@1106 2938 // If it receives a jQuery object, the first element is used
n@1106 2939 elem.jquery ? elem[ 0 ] : elem
n@1106 2940 );
n@1106 2941 },
n@1106 2942
n@1106 2943 add: function( selector, context ) {
n@1106 2944 return this.pushStack(
n@1106 2945 jQuery.unique(
n@1106 2946 jQuery.merge( this.get(), jQuery( selector, context ) )
n@1106 2947 )
n@1106 2948 );
n@1106 2949 },
n@1106 2950
n@1106 2951 addBack: function( selector ) {
n@1106 2952 return this.add( selector == null ?
n@1106 2953 this.prevObject : this.prevObject.filter(selector)
n@1106 2954 );
n@1106 2955 }
n@1106 2956 });
n@1106 2957
n@1106 2958 function sibling( cur, dir ) {
n@1106 2959 while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {}
n@1106 2960 return cur;
n@1106 2961 }
n@1106 2962
n@1106 2963 jQuery.each({
n@1106 2964 parent: function( elem ) {
n@1106 2965 var parent = elem.parentNode;
n@1106 2966 return parent && parent.nodeType !== 11 ? parent : null;
n@1106 2967 },
n@1106 2968 parents: function( elem ) {
n@1106 2969 return jQuery.dir( elem, "parentNode" );
n@1106 2970 },
n@1106 2971 parentsUntil: function( elem, i, until ) {
n@1106 2972 return jQuery.dir( elem, "parentNode", until );
n@1106 2973 },
n@1106 2974 next: function( elem ) {
n@1106 2975 return sibling( elem, "nextSibling" );
n@1106 2976 },
n@1106 2977 prev: function( elem ) {
n@1106 2978 return sibling( elem, "previousSibling" );
n@1106 2979 },
n@1106 2980 nextAll: function( elem ) {
n@1106 2981 return jQuery.dir( elem, "nextSibling" );
n@1106 2982 },
n@1106 2983 prevAll: function( elem ) {
n@1106 2984 return jQuery.dir( elem, "previousSibling" );
n@1106 2985 },
n@1106 2986 nextUntil: function( elem, i, until ) {
n@1106 2987 return jQuery.dir( elem, "nextSibling", until );
n@1106 2988 },
n@1106 2989 prevUntil: function( elem, i, until ) {
n@1106 2990 return jQuery.dir( elem, "previousSibling", until );
n@1106 2991 },
n@1106 2992 siblings: function( elem ) {
n@1106 2993 return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
n@1106 2994 },
n@1106 2995 children: function( elem ) {
n@1106 2996 return jQuery.sibling( elem.firstChild );
n@1106 2997 },
n@1106 2998 contents: function( elem ) {
n@1106 2999 return elem.contentDocument || jQuery.merge( [], elem.childNodes );
n@1106 3000 }
n@1106 3001 }, function( name, fn ) {
n@1106 3002 jQuery.fn[ name ] = function( until, selector ) {
n@1106 3003 var matched = jQuery.map( this, fn, until );
n@1106 3004
n@1106 3005 if ( name.slice( -5 ) !== "Until" ) {
n@1106 3006 selector = until;
n@1106 3007 }
n@1106 3008
n@1106 3009 if ( selector && typeof selector === "string" ) {
n@1106 3010 matched = jQuery.filter( selector, matched );
n@1106 3011 }
n@1106 3012
n@1106 3013 if ( this.length > 1 ) {
n@1106 3014 // Remove duplicates
n@1106 3015 if ( !guaranteedUnique[ name ] ) {
n@1106 3016 jQuery.unique( matched );
n@1106 3017 }
n@1106 3018
n@1106 3019 // Reverse order for parents* and prev-derivatives
n@1106 3020 if ( rparentsprev.test( name ) ) {
n@1106 3021 matched.reverse();
n@1106 3022 }
n@1106 3023 }
n@1106 3024
n@1106 3025 return this.pushStack( matched );
n@1106 3026 };
n@1106 3027 });
n@1106 3028 var rnotwhite = (/\S+/g);
n@1106 3029
n@1106 3030
n@1106 3031
n@1106 3032 // String to Object options format cache
n@1106 3033 var optionsCache = {};
n@1106 3034
n@1106 3035 // Convert String-formatted options into Object-formatted ones and store in cache
n@1106 3036 function createOptions( options ) {
n@1106 3037 var object = optionsCache[ options ] = {};
n@1106 3038 jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
n@1106 3039 object[ flag ] = true;
n@1106 3040 });
n@1106 3041 return object;
n@1106 3042 }
n@1106 3043
n@1106 3044 /*
n@1106 3045 * Create a callback list using the following parameters:
n@1106 3046 *
n@1106 3047 * options: an optional list of space-separated options that will change how
n@1106 3048 * the callback list behaves or a more traditional option object
n@1106 3049 *
n@1106 3050 * By default a callback list will act like an event callback list and can be
n@1106 3051 * "fired" multiple times.
n@1106 3052 *
n@1106 3053 * Possible options:
n@1106 3054 *
n@1106 3055 * once: will ensure the callback list can only be fired once (like a Deferred)
n@1106 3056 *
n@1106 3057 * memory: will keep track of previous values and will call any callback added
n@1106 3058 * after the list has been fired right away with the latest "memorized"
n@1106 3059 * values (like a Deferred)
n@1106 3060 *
n@1106 3061 * unique: will ensure a callback can only be added once (no duplicate in the list)
n@1106 3062 *
n@1106 3063 * stopOnFalse: interrupt callings when a callback returns false
n@1106 3064 *
n@1106 3065 */
n@1106 3066 jQuery.Callbacks = function( options ) {
n@1106 3067
n@1106 3068 // Convert options from String-formatted to Object-formatted if needed
n@1106 3069 // (we check in cache first)
n@1106 3070 options = typeof options === "string" ?
n@1106 3071 ( optionsCache[ options ] || createOptions( options ) ) :
n@1106 3072 jQuery.extend( {}, options );
n@1106 3073
n@1106 3074 var // Last fire value (for non-forgettable lists)
n@1106 3075 memory,
n@1106 3076 // Flag to know if list was already fired
n@1106 3077 fired,
n@1106 3078 // Flag to know if list is currently firing
n@1106 3079 firing,
n@1106 3080 // First callback to fire (used internally by add and fireWith)
n@1106 3081 firingStart,
n@1106 3082 // End of the loop when firing
n@1106 3083 firingLength,
n@1106 3084 // Index of currently firing callback (modified by remove if needed)
n@1106 3085 firingIndex,
n@1106 3086 // Actual callback list
n@1106 3087 list = [],
n@1106 3088 // Stack of fire calls for repeatable lists
n@1106 3089 stack = !options.once && [],
n@1106 3090 // Fire callbacks
n@1106 3091 fire = function( data ) {
n@1106 3092 memory = options.memory && data;
n@1106 3093 fired = true;
n@1106 3094 firingIndex = firingStart || 0;
n@1106 3095 firingStart = 0;
n@1106 3096 firingLength = list.length;
n@1106 3097 firing = true;
n@1106 3098 for ( ; list && firingIndex < firingLength; firingIndex++ ) {
n@1106 3099 if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
n@1106 3100 memory = false; // To prevent further calls using add
n@1106 3101 break;
n@1106 3102 }
n@1106 3103 }
n@1106 3104 firing = false;
n@1106 3105 if ( list ) {
n@1106 3106 if ( stack ) {
n@1106 3107 if ( stack.length ) {
n@1106 3108 fire( stack.shift() );
n@1106 3109 }
n@1106 3110 } else if ( memory ) {
n@1106 3111 list = [];
n@1106 3112 } else {
n@1106 3113 self.disable();
n@1106 3114 }
n@1106 3115 }
n@1106 3116 },
n@1106 3117 // Actual Callbacks object
n@1106 3118 self = {
n@1106 3119 // Add a callback or a collection of callbacks to the list
n@1106 3120 add: function() {
n@1106 3121 if ( list ) {
n@1106 3122 // First, we save the current length
n@1106 3123 var start = list.length;
n@1106 3124 (function add( args ) {
n@1106 3125 jQuery.each( args, function( _, arg ) {
n@1106 3126 var type = jQuery.type( arg );
n@1106 3127 if ( type === "function" ) {
n@1106 3128 if ( !options.unique || !self.has( arg ) ) {
n@1106 3129 list.push( arg );
n@1106 3130 }
n@1106 3131 } else if ( arg && arg.length && type !== "string" ) {
n@1106 3132 // Inspect recursively
n@1106 3133 add( arg );
n@1106 3134 }
n@1106 3135 });
n@1106 3136 })( arguments );
n@1106 3137 // Do we need to add the callbacks to the
n@1106 3138 // current firing batch?
n@1106 3139 if ( firing ) {
n@1106 3140 firingLength = list.length;
n@1106 3141 // With memory, if we're not firing then
n@1106 3142 // we should call right away
n@1106 3143 } else if ( memory ) {
n@1106 3144 firingStart = start;
n@1106 3145 fire( memory );
n@1106 3146 }
n@1106 3147 }
n@1106 3148 return this;
n@1106 3149 },
n@1106 3150 // Remove a callback from the list
n@1106 3151 remove: function() {
n@1106 3152 if ( list ) {
n@1106 3153 jQuery.each( arguments, function( _, arg ) {
n@1106 3154 var index;
n@1106 3155 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
n@1106 3156 list.splice( index, 1 );
n@1106 3157 // Handle firing indexes
n@1106 3158 if ( firing ) {
n@1106 3159 if ( index <= firingLength ) {
n@1106 3160 firingLength--;
n@1106 3161 }
n@1106 3162 if ( index <= firingIndex ) {
n@1106 3163 firingIndex--;
n@1106 3164 }
n@1106 3165 }
n@1106 3166 }
n@1106 3167 });
n@1106 3168 }
n@1106 3169 return this;
n@1106 3170 },
n@1106 3171 // Check if a given callback is in the list.
n@1106 3172 // If no argument is given, return whether or not list has callbacks attached.
n@1106 3173 has: function( fn ) {
n@1106 3174 return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
n@1106 3175 },
n@1106 3176 // Remove all callbacks from the list
n@1106 3177 empty: function() {
n@1106 3178 list = [];
n@1106 3179 firingLength = 0;
n@1106 3180 return this;
n@1106 3181 },
n@1106 3182 // Have the list do nothing anymore
n@1106 3183 disable: function() {
n@1106 3184 list = stack = memory = undefined;
n@1106 3185 return this;
n@1106 3186 },
n@1106 3187 // Is it disabled?
n@1106 3188 disabled: function() {
n@1106 3189 return !list;
n@1106 3190 },
n@1106 3191 // Lock the list in its current state
n@1106 3192 lock: function() {
n@1106 3193 stack = undefined;
n@1106 3194 if ( !memory ) {
n@1106 3195 self.disable();
n@1106 3196 }
n@1106 3197 return this;
n@1106 3198 },
n@1106 3199 // Is it locked?
n@1106 3200 locked: function() {
n@1106 3201 return !stack;
n@1106 3202 },
n@1106 3203 // Call all callbacks with the given context and arguments
n@1106 3204 fireWith: function( context, args ) {
n@1106 3205 if ( list && ( !fired || stack ) ) {
n@1106 3206 args = args || [];
n@1106 3207 args = [ context, args.slice ? args.slice() : args ];
n@1106 3208 if ( firing ) {
n@1106 3209 stack.push( args );
n@1106 3210 } else {
n@1106 3211 fire( args );
n@1106 3212 }
n@1106 3213 }
n@1106 3214 return this;
n@1106 3215 },
n@1106 3216 // Call all the callbacks with the given arguments
n@1106 3217 fire: function() {
n@1106 3218 self.fireWith( this, arguments );
n@1106 3219 return this;
n@1106 3220 },
n@1106 3221 // To know if the callbacks have already been called at least once
n@1106 3222 fired: function() {
n@1106 3223 return !!fired;
n@1106 3224 }
n@1106 3225 };
n@1106 3226
n@1106 3227 return self;
n@1106 3228 };
n@1106 3229
n@1106 3230
n@1106 3231 jQuery.extend({
n@1106 3232
n@1106 3233 Deferred: function( func ) {
n@1106 3234 var tuples = [
n@1106 3235 // action, add listener, listener list, final state
n@1106 3236 [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
n@1106 3237 [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
n@1106 3238 [ "notify", "progress", jQuery.Callbacks("memory") ]
n@1106 3239 ],
n@1106 3240 state = "pending",
n@1106 3241 promise = {
n@1106 3242 state: function() {
n@1106 3243 return state;
n@1106 3244 },
n@1106 3245 always: function() {
n@1106 3246 deferred.done( arguments ).fail( arguments );
n@1106 3247 return this;
n@1106 3248 },
n@1106 3249 then: function( /* fnDone, fnFail, fnProgress */ ) {
n@1106 3250 var fns = arguments;
n@1106 3251 return jQuery.Deferred(function( newDefer ) {
n@1106 3252 jQuery.each( tuples, function( i, tuple ) {
n@1106 3253 var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
n@1106 3254 // deferred[ done | fail | progress ] for forwarding actions to newDefer
n@1106 3255 deferred[ tuple[1] ](function() {
n@1106 3256 var returned = fn && fn.apply( this, arguments );
n@1106 3257 if ( returned && jQuery.isFunction( returned.promise ) ) {
n@1106 3258 returned.promise()
n@1106 3259 .done( newDefer.resolve )
n@1106 3260 .fail( newDefer.reject )
n@1106 3261 .progress( newDefer.notify );
n@1106 3262 } else {
n@1106 3263 newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
n@1106 3264 }
n@1106 3265 });
n@1106 3266 });
n@1106 3267 fns = null;
n@1106 3268 }).promise();
n@1106 3269 },
n@1106 3270 // Get a promise for this deferred
n@1106 3271 // If obj is provided, the promise aspect is added to the object
n@1106 3272 promise: function( obj ) {
n@1106 3273 return obj != null ? jQuery.extend( obj, promise ) : promise;
n@1106 3274 }
n@1106 3275 },
n@1106 3276 deferred = {};
n@1106 3277
n@1106 3278 // Keep pipe for back-compat
n@1106 3279 promise.pipe = promise.then;
n@1106 3280
n@1106 3281 // Add list-specific methods
n@1106 3282 jQuery.each( tuples, function( i, tuple ) {
n@1106 3283 var list = tuple[ 2 ],
n@1106 3284 stateString = tuple[ 3 ];
n@1106 3285
n@1106 3286 // promise[ done | fail | progress ] = list.add
n@1106 3287 promise[ tuple[1] ] = list.add;
n@1106 3288
n@1106 3289 // Handle state
n@1106 3290 if ( stateString ) {
n@1106 3291 list.add(function() {
n@1106 3292 // state = [ resolved | rejected ]
n@1106 3293 state = stateString;
n@1106 3294
n@1106 3295 // [ reject_list | resolve_list ].disable; progress_list.lock
n@1106 3296 }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
n@1106 3297 }
n@1106 3298
n@1106 3299 // deferred[ resolve | reject | notify ]
n@1106 3300 deferred[ tuple[0] ] = function() {
n@1106 3301 deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
n@1106 3302 return this;
n@1106 3303 };
n@1106 3304 deferred[ tuple[0] + "With" ] = list.fireWith;
n@1106 3305 });
n@1106 3306
n@1106 3307 // Make the deferred a promise
n@1106 3308 promise.promise( deferred );
n@1106 3309
n@1106 3310 // Call given func if any
n@1106 3311 if ( func ) {
n@1106 3312 func.call( deferred, deferred );
n@1106 3313 }
n@1106 3314
n@1106 3315 // All done!
n@1106 3316 return deferred;
n@1106 3317 },
n@1106 3318
n@1106 3319 // Deferred helper
n@1106 3320 when: function( subordinate /* , ..., subordinateN */ ) {
n@1106 3321 var i = 0,
n@1106 3322 resolveValues = slice.call( arguments ),
n@1106 3323 length = resolveValues.length,
n@1106 3324
n@1106 3325 // the count of uncompleted subordinates
n@1106 3326 remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
n@1106 3327
n@1106 3328 // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
n@1106 3329 deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
n@1106 3330
n@1106 3331 // Update function for both resolve and progress values
n@1106 3332 updateFunc = function( i, contexts, values ) {
n@1106 3333 return function( value ) {
n@1106 3334 contexts[ i ] = this;
n@1106 3335 values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
n@1106 3336 if ( values === progressValues ) {
n@1106 3337 deferred.notifyWith( contexts, values );
n@1106 3338 } else if ( !( --remaining ) ) {
n@1106 3339 deferred.resolveWith( contexts, values );
n@1106 3340 }
n@1106 3341 };
n@1106 3342 },
n@1106 3343
n@1106 3344 progressValues, progressContexts, resolveContexts;
n@1106 3345
n@1106 3346 // Add listeners to Deferred subordinates; treat others as resolved
n@1106 3347 if ( length > 1 ) {
n@1106 3348 progressValues = new Array( length );
n@1106 3349 progressContexts = new Array( length );
n@1106 3350 resolveContexts = new Array( length );
n@1106 3351 for ( ; i < length; i++ ) {
n@1106 3352 if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
n@1106 3353 resolveValues[ i ].promise()
n@1106 3354 .done( updateFunc( i, resolveContexts, resolveValues ) )
n@1106 3355 .fail( deferred.reject )
n@1106 3356 .progress( updateFunc( i, progressContexts, progressValues ) );
n@1106 3357 } else {
n@1106 3358 --remaining;
n@1106 3359 }
n@1106 3360 }
n@1106 3361 }
n@1106 3362
n@1106 3363 // If we're not waiting on anything, resolve the master
n@1106 3364 if ( !remaining ) {
n@1106 3365 deferred.resolveWith( resolveContexts, resolveValues );
n@1106 3366 }
n@1106 3367
n@1106 3368 return deferred.promise();
n@1106 3369 }
n@1106 3370 });
n@1106 3371
n@1106 3372
n@1106 3373 // The deferred used on DOM ready
n@1106 3374 var readyList;
n@1106 3375
n@1106 3376 jQuery.fn.ready = function( fn ) {
n@1106 3377 // Add the callback
n@1106 3378 jQuery.ready.promise().done( fn );
n@1106 3379
n@1106 3380 return this;
n@1106 3381 };
n@1106 3382
n@1106 3383 jQuery.extend({
n@1106 3384 // Is the DOM ready to be used? Set to true once it occurs.
n@1106 3385 isReady: false,
n@1106 3386
n@1106 3387 // A counter to track how many items to wait for before
n@1106 3388 // the ready event fires. See #6781
n@1106 3389 readyWait: 1,
n@1106 3390
n@1106 3391 // Hold (or release) the ready event
n@1106 3392 holdReady: function( hold ) {
n@1106 3393 if ( hold ) {
n@1106 3394 jQuery.readyWait++;
n@1106 3395 } else {
n@1106 3396 jQuery.ready( true );
n@1106 3397 }
n@1106 3398 },
n@1106 3399
n@1106 3400 // Handle when the DOM is ready
n@1106 3401 ready: function( wait ) {
n@1106 3402
n@1106 3403 // Abort if there are pending holds or we're already ready
n@1106 3404 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
n@1106 3405 return;
n@1106 3406 }
n@1106 3407
n@1106 3408 // Remember that the DOM is ready
n@1106 3409 jQuery.isReady = true;
n@1106 3410
n@1106 3411 // If a normal DOM Ready event fired, decrement, and wait if need be
n@1106 3412 if ( wait !== true && --jQuery.readyWait > 0 ) {
n@1106 3413 return;
n@1106 3414 }
n@1106 3415
n@1106 3416 // If there are functions bound, to execute
n@1106 3417 readyList.resolveWith( document, [ jQuery ] );
n@1106 3418
n@1106 3419 // Trigger any bound ready events
n@1106 3420 if ( jQuery.fn.triggerHandler ) {
n@1106 3421 jQuery( document ).triggerHandler( "ready" );
n@1106 3422 jQuery( document ).off( "ready" );
n@1106 3423 }
n@1106 3424 }
n@1106 3425 });
n@1106 3426
n@1106 3427 /**
n@1106 3428 * The ready event handler and self cleanup method
n@1106 3429 */
n@1106 3430 function completed() {
n@1106 3431 document.removeEventListener( "DOMContentLoaded", completed, false );
n@1106 3432 window.removeEventListener( "load", completed, false );
n@1106 3433 jQuery.ready();
n@1106 3434 }
n@1106 3435
n@1106 3436 jQuery.ready.promise = function( obj ) {
n@1106 3437 if ( !readyList ) {
n@1106 3438
n@1106 3439 readyList = jQuery.Deferred();
n@1106 3440
n@1106 3441 // Catch cases where $(document).ready() is called after the browser event has already occurred.
n@1106 3442 // We once tried to use readyState "interactive" here, but it caused issues like the one
n@1106 3443 // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
n@1106 3444 if ( document.readyState === "complete" ) {
n@1106 3445 // Handle it asynchronously to allow scripts the opportunity to delay ready
n@1106 3446 setTimeout( jQuery.ready );
n@1106 3447
n@1106 3448 } else {
n@1106 3449
n@1106 3450 // Use the handy event callback
n@1106 3451 document.addEventListener( "DOMContentLoaded", completed, false );
n@1106 3452
n@1106 3453 // A fallback to window.onload, that will always work
n@1106 3454 window.addEventListener( "load", completed, false );
n@1106 3455 }
n@1106 3456 }
n@1106 3457 return readyList.promise( obj );
n@1106 3458 };
n@1106 3459
n@1106 3460 // Kick off the DOM ready check even if the user does not
n@1106 3461 jQuery.ready.promise();
n@1106 3462
n@1106 3463
n@1106 3464
n@1106 3465
n@1106 3466 // Multifunctional method to get and set values of a collection
n@1106 3467 // The value/s can optionally be executed if it's a function
n@1106 3468 var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
n@1106 3469 var i = 0,
n@1106 3470 len = elems.length,
n@1106 3471 bulk = key == null;
n@1106 3472
n@1106 3473 // Sets many values
n@1106 3474 if ( jQuery.type( key ) === "object" ) {
n@1106 3475 chainable = true;
n@1106 3476 for ( i in key ) {
n@1106 3477 jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
n@1106 3478 }
n@1106 3479
n@1106 3480 // Sets one value
n@1106 3481 } else if ( value !== undefined ) {
n@1106 3482 chainable = true;
n@1106 3483
n@1106 3484 if ( !jQuery.isFunction( value ) ) {
n@1106 3485 raw = true;
n@1106 3486 }
n@1106 3487
n@1106 3488 if ( bulk ) {
n@1106 3489 // Bulk operations run against the entire set
n@1106 3490 if ( raw ) {
n@1106 3491 fn.call( elems, value );
n@1106 3492 fn = null;
n@1106 3493
n@1106 3494 // ...except when executing function values
n@1106 3495 } else {
n@1106 3496 bulk = fn;
n@1106 3497 fn = function( elem, key, value ) {
n@1106 3498 return bulk.call( jQuery( elem ), value );
n@1106 3499 };
n@1106 3500 }
n@1106 3501 }
n@1106 3502
n@1106 3503 if ( fn ) {
n@1106 3504 for ( ; i < len; i++ ) {
n@1106 3505 fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
n@1106 3506 }
n@1106 3507 }
n@1106 3508 }
n@1106 3509
n@1106 3510 return chainable ?
n@1106 3511 elems :
n@1106 3512
n@1106 3513 // Gets
n@1106 3514 bulk ?
n@1106 3515 fn.call( elems ) :
n@1106 3516 len ? fn( elems[0], key ) : emptyGet;
n@1106 3517 };
n@1106 3518
n@1106 3519
n@1106 3520 /**
n@1106 3521 * Determines whether an object can have data
n@1106 3522 */
n@1106 3523 jQuery.acceptData = function( owner ) {
n@1106 3524 // Accepts only:
n@1106 3525 // - Node
n@1106 3526 // - Node.ELEMENT_NODE
n@1106 3527 // - Node.DOCUMENT_NODE
n@1106 3528 // - Object
n@1106 3529 // - Any
n@1106 3530 /* jshint -W018 */
n@1106 3531 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
n@1106 3532 };
n@1106 3533
n@1106 3534
n@1106 3535 function Data() {
n@1106 3536 // Support: Android<4,
n@1106 3537 // Old WebKit does not have Object.preventExtensions/freeze method,
n@1106 3538 // return new empty object instead with no [[set]] accessor
n@1106 3539 Object.defineProperty( this.cache = {}, 0, {
n@1106 3540 get: function() {
n@1106 3541 return {};
n@1106 3542 }
n@1106 3543 });
n@1106 3544
n@1106 3545 this.expando = jQuery.expando + Data.uid++;
n@1106 3546 }
n@1106 3547
n@1106 3548 Data.uid = 1;
n@1106 3549 Data.accepts = jQuery.acceptData;
n@1106 3550
n@1106 3551 Data.prototype = {
n@1106 3552 key: function( owner ) {
n@1106 3553 // We can accept data for non-element nodes in modern browsers,
n@1106 3554 // but we should not, see #8335.
n@1106 3555 // Always return the key for a frozen object.
n@1106 3556 if ( !Data.accepts( owner ) ) {
n@1106 3557 return 0;
n@1106 3558 }
n@1106 3559
n@1106 3560 var descriptor = {},
n@1106 3561 // Check if the owner object already has a cache key
n@1106 3562 unlock = owner[ this.expando ];
n@1106 3563
n@1106 3564 // If not, create one
n@1106 3565 if ( !unlock ) {
n@1106 3566 unlock = Data.uid++;
n@1106 3567
n@1106 3568 // Secure it in a non-enumerable, non-writable property
n@1106 3569 try {
n@1106 3570 descriptor[ this.expando ] = { value: unlock };
n@1106 3571 Object.defineProperties( owner, descriptor );
n@1106 3572
n@1106 3573 // Support: Android<4
n@1106 3574 // Fallback to a less secure definition
n@1106 3575 } catch ( e ) {
n@1106 3576 descriptor[ this.expando ] = unlock;
n@1106 3577 jQuery.extend( owner, descriptor );
n@1106 3578 }
n@1106 3579 }
n@1106 3580
n@1106 3581 // Ensure the cache object
n@1106 3582 if ( !this.cache[ unlock ] ) {
n@1106 3583 this.cache[ unlock ] = {};
n@1106 3584 }
n@1106 3585
n@1106 3586 return unlock;
n@1106 3587 },
n@1106 3588 set: function( owner, data, value ) {
n@1106 3589 var prop,
n@1106 3590 // There may be an unlock assigned to this node,
n@1106 3591 // if there is no entry for this "owner", create one inline
n@1106 3592 // and set the unlock as though an owner entry had always existed
n@1106 3593 unlock = this.key( owner ),
n@1106 3594 cache = this.cache[ unlock ];
n@1106 3595
n@1106 3596 // Handle: [ owner, key, value ] args
n@1106 3597 if ( typeof data === "string" ) {
n@1106 3598 cache[ data ] = value;
n@1106 3599
n@1106 3600 // Handle: [ owner, { properties } ] args
n@1106 3601 } else {
n@1106 3602 // Fresh assignments by object are shallow copied
n@1106 3603 if ( jQuery.isEmptyObject( cache ) ) {
n@1106 3604 jQuery.extend( this.cache[ unlock ], data );
n@1106 3605 // Otherwise, copy the properties one-by-one to the cache object
n@1106 3606 } else {
n@1106 3607 for ( prop in data ) {
n@1106 3608 cache[ prop ] = data[ prop ];
n@1106 3609 }
n@1106 3610 }
n@1106 3611 }
n@1106 3612 return cache;
n@1106 3613 },
n@1106 3614 get: function( owner, key ) {
n@1106 3615 // Either a valid cache is found, or will be created.
n@1106 3616 // New caches will be created and the unlock returned,
n@1106 3617 // allowing direct access to the newly created
n@1106 3618 // empty data object. A valid owner object must be provided.
n@1106 3619 var cache = this.cache[ this.key( owner ) ];
n@1106 3620
n@1106 3621 return key === undefined ?
n@1106 3622 cache : cache[ key ];
n@1106 3623 },
n@1106 3624 access: function( owner, key, value ) {
n@1106 3625 var stored;
n@1106 3626 // In cases where either:
n@1106 3627 //
n@1106 3628 // 1. No key was specified
n@1106 3629 // 2. A string key was specified, but no value provided
n@1106 3630 //
n@1106 3631 // Take the "read" path and allow the get method to determine
n@1106 3632 // which value to return, respectively either:
n@1106 3633 //
n@1106 3634 // 1. The entire cache object
n@1106 3635 // 2. The data stored at the key
n@1106 3636 //
n@1106 3637 if ( key === undefined ||
n@1106 3638 ((key && typeof key === "string") && value === undefined) ) {
n@1106 3639
n@1106 3640 stored = this.get( owner, key );
n@1106 3641
n@1106 3642 return stored !== undefined ?
n@1106 3643 stored : this.get( owner, jQuery.camelCase(key) );
n@1106 3644 }
n@1106 3645
n@1106 3646 // [*]When the key is not a string, or both a key and value
n@1106 3647 // are specified, set or extend (existing objects) with either:
n@1106 3648 //
n@1106 3649 // 1. An object of properties
n@1106 3650 // 2. A key and value
n@1106 3651 //
n@1106 3652 this.set( owner, key, value );
n@1106 3653
n@1106 3654 // Since the "set" path can have two possible entry points
n@1106 3655 // return the expected data based on which path was taken[*]
n@1106 3656 return value !== undefined ? value : key;
n@1106 3657 },
n@1106 3658 remove: function( owner, key ) {
n@1106 3659 var i, name, camel,
n@1106 3660 unlock = this.key( owner ),
n@1106 3661 cache = this.cache[ unlock ];
n@1106 3662
n@1106 3663 if ( key === undefined ) {
n@1106 3664 this.cache[ unlock ] = {};
n@1106 3665
n@1106 3666 } else {
n@1106 3667 // Support array or space separated string of keys
n@1106 3668 if ( jQuery.isArray( key ) ) {
n@1106 3669 // If "name" is an array of keys...
n@1106 3670 // When data is initially created, via ("key", "val") signature,
n@1106 3671 // keys will be converted to camelCase.
n@1106 3672 // Since there is no way to tell _how_ a key was added, remove
n@1106 3673 // both plain key and camelCase key. #12786
n@1106 3674 // This will only penalize the array argument path.
n@1106 3675 name = key.concat( key.map( jQuery.camelCase ) );
n@1106 3676 } else {
n@1106 3677 camel = jQuery.camelCase( key );
n@1106 3678 // Try the string as a key before any manipulation
n@1106 3679 if ( key in cache ) {
n@1106 3680 name = [ key, camel ];
n@1106 3681 } else {
n@1106 3682 // If a key with the spaces exists, use it.
n@1106 3683 // Otherwise, create an array by matching non-whitespace
n@1106 3684 name = camel;
n@1106 3685 name = name in cache ?
n@1106 3686 [ name ] : ( name.match( rnotwhite ) || [] );
n@1106 3687 }
n@1106 3688 }
n@1106 3689
n@1106 3690 i = name.length;
n@1106 3691 while ( i-- ) {
n@1106 3692 delete cache[ name[ i ] ];
n@1106 3693 }
n@1106 3694 }
n@1106 3695 },
n@1106 3696 hasData: function( owner ) {
n@1106 3697 return !jQuery.isEmptyObject(
n@1106 3698 this.cache[ owner[ this.expando ] ] || {}
n@1106 3699 );
n@1106 3700 },
n@1106 3701 discard: function( owner ) {
n@1106 3702 if ( owner[ this.expando ] ) {
n@1106 3703 delete this.cache[ owner[ this.expando ] ];
n@1106 3704 }
n@1106 3705 }
n@1106 3706 };
n@1106 3707 var data_priv = new Data();
n@1106 3708
n@1106 3709 var data_user = new Data();
n@1106 3710
n@1106 3711
n@1106 3712
n@1106 3713 // Implementation Summary
n@1106 3714 //
n@1106 3715 // 1. Enforce API surface and semantic compatibility with 1.9.x branch
n@1106 3716 // 2. Improve the module's maintainability by reducing the storage
n@1106 3717 // paths to a single mechanism.
n@1106 3718 // 3. Use the same single mechanism to support "private" and "user" data.
n@1106 3719 // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
n@1106 3720 // 5. Avoid exposing implementation details on user objects (eg. expando properties)
n@1106 3721 // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
n@1106 3722
n@1106 3723 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
n@1106 3724 rmultiDash = /([A-Z])/g;
n@1106 3725
n@1106 3726 function dataAttr( elem, key, data ) {
n@1106 3727 var name;
n@1106 3728
n@1106 3729 // If nothing was found internally, try to fetch any
n@1106 3730 // data from the HTML5 data-* attribute
n@1106 3731 if ( data === undefined && elem.nodeType === 1 ) {
n@1106 3732 name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
n@1106 3733 data = elem.getAttribute( name );
n@1106 3734
n@1106 3735 if ( typeof data === "string" ) {
n@1106 3736 try {
n@1106 3737 data = data === "true" ? true :
n@1106 3738 data === "false" ? false :
n@1106 3739 data === "null" ? null :
n@1106 3740 // Only convert to a number if it doesn't change the string
n@1106 3741 +data + "" === data ? +data :
n@1106 3742 rbrace.test( data ) ? jQuery.parseJSON( data ) :
n@1106 3743 data;
n@1106 3744 } catch( e ) {}
n@1106 3745
n@1106 3746 // Make sure we set the data so it isn't changed later
n@1106 3747 data_user.set( elem, key, data );
n@1106 3748 } else {
n@1106 3749 data = undefined;
n@1106 3750 }
n@1106 3751 }
n@1106 3752 return data;
n@1106 3753 }
n@1106 3754
n@1106 3755 jQuery.extend({
n@1106 3756 hasData: function( elem ) {
n@1106 3757 return data_user.hasData( elem ) || data_priv.hasData( elem );
n@1106 3758 },
n@1106 3759
n@1106 3760 data: function( elem, name, data ) {
n@1106 3761 return data_user.access( elem, name, data );
n@1106 3762 },
n@1106 3763
n@1106 3764 removeData: function( elem, name ) {
n@1106 3765 data_user.remove( elem, name );
n@1106 3766 },
n@1106 3767
n@1106 3768 // TODO: Now that all calls to _data and _removeData have been replaced
n@1106 3769 // with direct calls to data_priv methods, these can be deprecated.
n@1106 3770 _data: function( elem, name, data ) {
n@1106 3771 return data_priv.access( elem, name, data );
n@1106 3772 },
n@1106 3773
n@1106 3774 _removeData: function( elem, name ) {
n@1106 3775 data_priv.remove( elem, name );
n@1106 3776 }
n@1106 3777 });
n@1106 3778
n@1106 3779 jQuery.fn.extend({
n@1106 3780 data: function( key, value ) {
n@1106 3781 var i, name, data,
n@1106 3782 elem = this[ 0 ],
n@1106 3783 attrs = elem && elem.attributes;
n@1106 3784
n@1106 3785 // Gets all values
n@1106 3786 if ( key === undefined ) {
n@1106 3787 if ( this.length ) {
n@1106 3788 data = data_user.get( elem );
n@1106 3789
n@1106 3790 if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) {
n@1106 3791 i = attrs.length;
n@1106 3792 while ( i-- ) {
n@1106 3793
n@1106 3794 // Support: IE11+
n@1106 3795 // The attrs elements can be null (#14894)
n@1106 3796 if ( attrs[ i ] ) {
n@1106 3797 name = attrs[ i ].name;
n@1106 3798 if ( name.indexOf( "data-" ) === 0 ) {
n@1106 3799 name = jQuery.camelCase( name.slice(5) );
n@1106 3800 dataAttr( elem, name, data[ name ] );
n@1106 3801 }
n@1106 3802 }
n@1106 3803 }
n@1106 3804 data_priv.set( elem, "hasDataAttrs", true );
n@1106 3805 }
n@1106 3806 }
n@1106 3807
n@1106 3808 return data;
n@1106 3809 }
n@1106 3810
n@1106 3811 // Sets multiple values
n@1106 3812 if ( typeof key === "object" ) {
n@1106 3813 return this.each(function() {
n@1106 3814 data_user.set( this, key );
n@1106 3815 });
n@1106 3816 }
n@1106 3817
n@1106 3818 return access( this, function( value ) {
n@1106 3819 var data,
n@1106 3820 camelKey = jQuery.camelCase( key );
n@1106 3821
n@1106 3822 // The calling jQuery object (element matches) is not empty
n@1106 3823 // (and therefore has an element appears at this[ 0 ]) and the
n@1106 3824 // `value` parameter was not undefined. An empty jQuery object
n@1106 3825 // will result in `undefined` for elem = this[ 0 ] which will
n@1106 3826 // throw an exception if an attempt to read a data cache is made.
n@1106 3827 if ( elem && value === undefined ) {
n@1106 3828 // Attempt to get data from the cache
n@1106 3829 // with the key as-is
n@1106 3830 data = data_user.get( elem, key );
n@1106 3831 if ( data !== undefined ) {
n@1106 3832 return data;
n@1106 3833 }
n@1106 3834
n@1106 3835 // Attempt to get data from the cache
n@1106 3836 // with the key camelized
n@1106 3837 data = data_user.get( elem, camelKey );
n@1106 3838 if ( data !== undefined ) {
n@1106 3839 return data;
n@1106 3840 }
n@1106 3841
n@1106 3842 // Attempt to "discover" the data in
n@1106 3843 // HTML5 custom data-* attrs
n@1106 3844 data = dataAttr( elem, camelKey, undefined );
n@1106 3845 if ( data !== undefined ) {
n@1106 3846 return data;
n@1106 3847 }
n@1106 3848
n@1106 3849 // We tried really hard, but the data doesn't exist.
n@1106 3850 return;
n@1106 3851 }
n@1106 3852
n@1106 3853 // Set the data...
n@1106 3854 this.each(function() {
n@1106 3855 // First, attempt to store a copy or reference of any
n@1106 3856 // data that might've been store with a camelCased key.
n@1106 3857 var data = data_user.get( this, camelKey );
n@1106 3858
n@1106 3859 // For HTML5 data-* attribute interop, we have to
n@1106 3860 // store property names with dashes in a camelCase form.
n@1106 3861 // This might not apply to all properties...*
n@1106 3862 data_user.set( this, camelKey, value );
n@1106 3863
n@1106 3864 // *... In the case of properties that might _actually_
n@1106 3865 // have dashes, we need to also store a copy of that
n@1106 3866 // unchanged property.
n@1106 3867 if ( key.indexOf("-") !== -1 && data !== undefined ) {
n@1106 3868 data_user.set( this, key, value );
n@1106 3869 }
n@1106 3870 });
n@1106 3871 }, null, value, arguments.length > 1, null, true );
n@1106 3872 },
n@1106 3873
n@1106 3874 removeData: function( key ) {
n@1106 3875 return this.each(function() {
n@1106 3876 data_user.remove( this, key );
n@1106 3877 });
n@1106 3878 }
n@1106 3879 });
n@1106 3880
n@1106 3881
n@1106 3882 jQuery.extend({
n@1106 3883 queue: function( elem, type, data ) {
n@1106 3884 var queue;
n@1106 3885
n@1106 3886 if ( elem ) {
n@1106 3887 type = ( type || "fx" ) + "queue";
n@1106 3888 queue = data_priv.get( elem, type );
n@1106 3889
n@1106 3890 // Speed up dequeue by getting out quickly if this is just a lookup
n@1106 3891 if ( data ) {
n@1106 3892 if ( !queue || jQuery.isArray( data ) ) {
n@1106 3893 queue = data_priv.access( elem, type, jQuery.makeArray(data) );
n@1106 3894 } else {
n@1106 3895 queue.push( data );
n@1106 3896 }
n@1106 3897 }
n@1106 3898 return queue || [];
n@1106 3899 }
n@1106 3900 },
n@1106 3901
n@1106 3902 dequeue: function( elem, type ) {
n@1106 3903 type = type || "fx";
n@1106 3904
n@1106 3905 var queue = jQuery.queue( elem, type ),
n@1106 3906 startLength = queue.length,
n@1106 3907 fn = queue.shift(),
n@1106 3908 hooks = jQuery._queueHooks( elem, type ),
n@1106 3909 next = function() {
n@1106 3910 jQuery.dequeue( elem, type );
n@1106 3911 };
n@1106 3912
n@1106 3913 // If the fx queue is dequeued, always remove the progress sentinel
n@1106 3914 if ( fn === "inprogress" ) {
n@1106 3915 fn = queue.shift();
n@1106 3916 startLength--;
n@1106 3917 }
n@1106 3918
n@1106 3919 if ( fn ) {
n@1106 3920
n@1106 3921 // Add a progress sentinel to prevent the fx queue from being
n@1106 3922 // automatically dequeued
n@1106 3923 if ( type === "fx" ) {
n@1106 3924 queue.unshift( "inprogress" );
n@1106 3925 }
n@1106 3926
n@1106 3927 // Clear up the last queue stop function
n@1106 3928 delete hooks.stop;
n@1106 3929 fn.call( elem, next, hooks );
n@1106 3930 }
n@1106 3931
n@1106 3932 if ( !startLength && hooks ) {
n@1106 3933 hooks.empty.fire();
n@1106 3934 }
n@1106 3935 },
n@1106 3936
n@1106 3937 // Not public - generate a queueHooks object, or return the current one
n@1106 3938 _queueHooks: function( elem, type ) {
n@1106 3939 var key = type + "queueHooks";
n@1106 3940 return data_priv.get( elem, key ) || data_priv.access( elem, key, {
n@1106 3941 empty: jQuery.Callbacks("once memory").add(function() {
n@1106 3942 data_priv.remove( elem, [ type + "queue", key ] );
n@1106 3943 })
n@1106 3944 });
n@1106 3945 }
n@1106 3946 });
n@1106 3947
n@1106 3948 jQuery.fn.extend({
n@1106 3949 queue: function( type, data ) {
n@1106 3950 var setter = 2;
n@1106 3951
n@1106 3952 if ( typeof type !== "string" ) {
n@1106 3953 data = type;
n@1106 3954 type = "fx";
n@1106 3955 setter--;
n@1106 3956 }
n@1106 3957
n@1106 3958 if ( arguments.length < setter ) {
n@1106 3959 return jQuery.queue( this[0], type );
n@1106 3960 }
n@1106 3961
n@1106 3962 return data === undefined ?
n@1106 3963 this :
n@1106 3964 this.each(function() {
n@1106 3965 var queue = jQuery.queue( this, type, data );
n@1106 3966
n@1106 3967 // Ensure a hooks for this queue
n@1106 3968 jQuery._queueHooks( this, type );
n@1106 3969
n@1106 3970 if ( type === "fx" && queue[0] !== "inprogress" ) {
n@1106 3971 jQuery.dequeue( this, type );
n@1106 3972 }
n@1106 3973 });
n@1106 3974 },
n@1106 3975 dequeue: function( type ) {
n@1106 3976 return this.each(function() {
n@1106 3977 jQuery.dequeue( this, type );
n@1106 3978 });
n@1106 3979 },
n@1106 3980 clearQueue: function( type ) {
n@1106 3981 return this.queue( type || "fx", [] );
n@1106 3982 },
n@1106 3983 // Get a promise resolved when queues of a certain type
n@1106 3984 // are emptied (fx is the type by default)
n@1106 3985 promise: function( type, obj ) {
n@1106 3986 var tmp,
n@1106 3987 count = 1,
n@1106 3988 defer = jQuery.Deferred(),
n@1106 3989 elements = this,
n@1106 3990 i = this.length,
n@1106 3991 resolve = function() {
n@1106 3992 if ( !( --count ) ) {
n@1106 3993 defer.resolveWith( elements, [ elements ] );
n@1106 3994 }
n@1106 3995 };
n@1106 3996
n@1106 3997 if ( typeof type !== "string" ) {
n@1106 3998 obj = type;
n@1106 3999 type = undefined;
n@1106 4000 }
n@1106 4001 type = type || "fx";
n@1106 4002
n@1106 4003 while ( i-- ) {
n@1106 4004 tmp = data_priv.get( elements[ i ], type + "queueHooks" );
n@1106 4005 if ( tmp && tmp.empty ) {
n@1106 4006 count++;
n@1106 4007 tmp.empty.add( resolve );
n@1106 4008 }
n@1106 4009 }
n@1106 4010 resolve();
n@1106 4011 return defer.promise( obj );
n@1106 4012 }
n@1106 4013 });
n@1106 4014 var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;
n@1106 4015
n@1106 4016 var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
n@1106 4017
n@1106 4018 var isHidden = function( elem, el ) {
n@1106 4019 // isHidden might be called from jQuery#filter function;
n@1106 4020 // in that case, element will be second argument
n@1106 4021 elem = el || elem;
n@1106 4022 return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
n@1106 4023 };
n@1106 4024
n@1106 4025 var rcheckableType = (/^(?:checkbox|radio)$/i);
n@1106 4026
n@1106 4027
n@1106 4028
n@1106 4029 (function() {
n@1106 4030 var fragment = document.createDocumentFragment(),
n@1106 4031 div = fragment.appendChild( document.createElement( "div" ) ),
n@1106 4032 input = document.createElement( "input" );
n@1106 4033
n@1106 4034 // Support: Safari<=5.1
n@1106 4035 // Check state lost if the name is set (#11217)
n@1106 4036 // Support: Windows Web Apps (WWA)
n@1106 4037 // `name` and `type` must use .setAttribute for WWA (#14901)
n@1106 4038 input.setAttribute( "type", "radio" );
n@1106 4039 input.setAttribute( "checked", "checked" );
n@1106 4040 input.setAttribute( "name", "t" );
n@1106 4041
n@1106 4042 div.appendChild( input );
n@1106 4043
n@1106 4044 // Support: Safari<=5.1, Android<4.2
n@1106 4045 // Older WebKit doesn't clone checked state correctly in fragments
n@1106 4046 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
n@1106 4047
n@1106 4048 // Support: IE<=11+
n@1106 4049 // Make sure textarea (and checkbox) defaultValue is properly cloned
n@1106 4050 div.innerHTML = "<textarea>x</textarea>";
n@1106 4051 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
n@1106 4052 })();
n@1106 4053 var strundefined = typeof undefined;
n@1106 4054
n@1106 4055
n@1106 4056
n@1106 4057 support.focusinBubbles = "onfocusin" in window;
n@1106 4058
n@1106 4059
n@1106 4060 var
n@1106 4061 rkeyEvent = /^key/,
n@1106 4062 rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/,
n@1106 4063 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
n@1106 4064 rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
n@1106 4065
n@1106 4066 function returnTrue() {
n@1106 4067 return true;
n@1106 4068 }
n@1106 4069
n@1106 4070 function returnFalse() {
n@1106 4071 return false;
n@1106 4072 }
n@1106 4073
n@1106 4074 function safeActiveElement() {
n@1106 4075 try {
n@1106 4076 return document.activeElement;
n@1106 4077 } catch ( err ) { }
n@1106 4078 }
n@1106 4079
n@1106 4080 /*
n@1106 4081 * Helper functions for managing events -- not part of the public interface.
n@1106 4082 * Props to Dean Edwards' addEvent library for many of the ideas.
n@1106 4083 */
n@1106 4084 jQuery.event = {
n@1106 4085
n@1106 4086 global: {},
n@1106 4087
n@1106 4088 add: function( elem, types, handler, data, selector ) {
n@1106 4089
n@1106 4090 var handleObjIn, eventHandle, tmp,
n@1106 4091 events, t, handleObj,
n@1106 4092 special, handlers, type, namespaces, origType,
n@1106 4093 elemData = data_priv.get( elem );
n@1106 4094
n@1106 4095 // Don't attach events to noData or text/comment nodes (but allow plain objects)
n@1106 4096 if ( !elemData ) {
n@1106 4097 return;
n@1106 4098 }
n@1106 4099
n@1106 4100 // Caller can pass in an object of custom data in lieu of the handler
n@1106 4101 if ( handler.handler ) {
n@1106 4102 handleObjIn = handler;
n@1106 4103 handler = handleObjIn.handler;
n@1106 4104 selector = handleObjIn.selector;
n@1106 4105 }
n@1106 4106
n@1106 4107 // Make sure that the handler has a unique ID, used to find/remove it later
n@1106 4108 if ( !handler.guid ) {
n@1106 4109 handler.guid = jQuery.guid++;
n@1106 4110 }
n@1106 4111
n@1106 4112 // Init the element's event structure and main handler, if this is the first
n@1106 4113 if ( !(events = elemData.events) ) {
n@1106 4114 events = elemData.events = {};
n@1106 4115 }
n@1106 4116 if ( !(eventHandle = elemData.handle) ) {
n@1106 4117 eventHandle = elemData.handle = function( e ) {
n@1106 4118 // Discard the second event of a jQuery.event.trigger() and
n@1106 4119 // when an event is called after a page has unloaded
n@1106 4120 return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ?
n@1106 4121 jQuery.event.dispatch.apply( elem, arguments ) : undefined;
n@1106 4122 };
n@1106 4123 }
n@1106 4124
n@1106 4125 // Handle multiple events separated by a space
n@1106 4126 types = ( types || "" ).match( rnotwhite ) || [ "" ];
n@1106 4127 t = types.length;
n@1106 4128 while ( t-- ) {
n@1106 4129 tmp = rtypenamespace.exec( types[t] ) || [];
n@1106 4130 type = origType = tmp[1];
n@1106 4131 namespaces = ( tmp[2] || "" ).split( "." ).sort();
n@1106 4132
n@1106 4133 // There *must* be a type, no attaching namespace-only handlers
n@1106 4134 if ( !type ) {
n@1106 4135 continue;
n@1106 4136 }
n@1106 4137
n@1106 4138 // If event changes its type, use the special event handlers for the changed type
n@1106 4139 special = jQuery.event.special[ type ] || {};
n@1106 4140
n@1106 4141 // If selector defined, determine special event api type, otherwise given type
n@1106 4142 type = ( selector ? special.delegateType : special.bindType ) || type;
n@1106 4143
n@1106 4144 // Update special based on newly reset type
n@1106 4145 special = jQuery.event.special[ type ] || {};
n@1106 4146
n@1106 4147 // handleObj is passed to all event handlers
n@1106 4148 handleObj = jQuery.extend({
n@1106 4149 type: type,
n@1106 4150 origType: origType,
n@1106 4151 data: data,
n@1106 4152 handler: handler,
n@1106 4153 guid: handler.guid,
n@1106 4154 selector: selector,
n@1106 4155 needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
n@1106 4156 namespace: namespaces.join(".")
n@1106 4157 }, handleObjIn );
n@1106 4158
n@1106 4159 // Init the event handler queue if we're the first
n@1106 4160 if ( !(handlers = events[ type ]) ) {
n@1106 4161 handlers = events[ type ] = [];
n@1106 4162 handlers.delegateCount = 0;
n@1106 4163
n@1106 4164 // Only use addEventListener if the special events handler returns false
n@1106 4165 if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
n@1106 4166 if ( elem.addEventListener ) {
n@1106 4167 elem.addEventListener( type, eventHandle, false );
n@1106 4168 }
n@1106 4169 }
n@1106 4170 }
n@1106 4171
n@1106 4172 if ( special.add ) {
n@1106 4173 special.add.call( elem, handleObj );
n@1106 4174
n@1106 4175 if ( !handleObj.handler.guid ) {
n@1106 4176 handleObj.handler.guid = handler.guid;
n@1106 4177 }
n@1106 4178 }
n@1106 4179
n@1106 4180 // Add to the element's handler list, delegates in front
n@1106 4181 if ( selector ) {
n@1106 4182 handlers.splice( handlers.delegateCount++, 0, handleObj );
n@1106 4183 } else {
n@1106 4184 handlers.push( handleObj );
n@1106 4185 }
n@1106 4186
n@1106 4187 // Keep track of which events have ever been used, for event optimization
n@1106 4188 jQuery.event.global[ type ] = true;
n@1106 4189 }
n@1106 4190
n@1106 4191 },
n@1106 4192
n@1106 4193 // Detach an event or set of events from an element
n@1106 4194 remove: function( elem, types, handler, selector, mappedTypes ) {
n@1106 4195
n@1106 4196 var j, origCount, tmp,
n@1106 4197 events, t, handleObj,
n@1106 4198 special, handlers, type, namespaces, origType,
n@1106 4199 elemData = data_priv.hasData( elem ) && data_priv.get( elem );
n@1106 4200
n@1106 4201 if ( !elemData || !(events = elemData.events) ) {
n@1106 4202 return;
n@1106 4203 }
n@1106 4204
n@1106 4205 // Once for each type.namespace in types; type may be omitted
n@1106 4206 types = ( types || "" ).match( rnotwhite ) || [ "" ];
n@1106 4207 t = types.length;
n@1106 4208 while ( t-- ) {
n@1106 4209 tmp = rtypenamespace.exec( types[t] ) || [];
n@1106 4210 type = origType = tmp[1];
n@1106 4211 namespaces = ( tmp[2] || "" ).split( "." ).sort();
n@1106 4212
n@1106 4213 // Unbind all events (on this namespace, if provided) for the element
n@1106 4214 if ( !type ) {
n@1106 4215 for ( type in events ) {
n@1106 4216 jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
n@1106 4217 }
n@1106 4218 continue;
n@1106 4219 }
n@1106 4220
n@1106 4221 special = jQuery.event.special[ type ] || {};
n@1106 4222 type = ( selector ? special.delegateType : special.bindType ) || type;
n@1106 4223 handlers = events[ type ] || [];
n@1106 4224 tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
n@1106 4225
n@1106 4226 // Remove matching events
n@1106 4227 origCount = j = handlers.length;
n@1106 4228 while ( j-- ) {
n@1106 4229 handleObj = handlers[ j ];
n@1106 4230
n@1106 4231 if ( ( mappedTypes || origType === handleObj.origType ) &&
n@1106 4232 ( !handler || handler.guid === handleObj.guid ) &&
n@1106 4233 ( !tmp || tmp.test( handleObj.namespace ) ) &&
n@1106 4234 ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
n@1106 4235 handlers.splice( j, 1 );
n@1106 4236
n@1106 4237 if ( handleObj.selector ) {
n@1106 4238 handlers.delegateCount--;
n@1106 4239 }
n@1106 4240 if ( special.remove ) {
n@1106 4241 special.remove.call( elem, handleObj );
n@1106 4242 }
n@1106 4243 }
n@1106 4244 }
n@1106 4245
n@1106 4246 // Remove generic event handler if we removed something and no more handlers exist
n@1106 4247 // (avoids potential for endless recursion during removal of special event handlers)
n@1106 4248 if ( origCount && !handlers.length ) {
n@1106 4249 if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
n@1106 4250 jQuery.removeEvent( elem, type, elemData.handle );
n@1106 4251 }
n@1106 4252
n@1106 4253 delete events[ type ];
n@1106 4254 }
n@1106 4255 }
n@1106 4256
n@1106 4257 // Remove the expando if it's no longer used
n@1106 4258 if ( jQuery.isEmptyObject( events ) ) {
n@1106 4259 delete elemData.handle;
n@1106 4260 data_priv.remove( elem, "events" );
n@1106 4261 }
n@1106 4262 },
n@1106 4263
n@1106 4264 trigger: function( event, data, elem, onlyHandlers ) {
n@1106 4265
n@1106 4266 var i, cur, tmp, bubbleType, ontype, handle, special,
n@1106 4267 eventPath = [ elem || document ],
n@1106 4268 type = hasOwn.call( event, "type" ) ? event.type : event,
n@1106 4269 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
n@1106 4270
n@1106 4271 cur = tmp = elem = elem || document;
n@1106 4272
n@1106 4273 // Don't do events on text and comment nodes
n@1106 4274 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
n@1106 4275 return;
n@1106 4276 }
n@1106 4277
n@1106 4278 // focus/blur morphs to focusin/out; ensure we're not firing them right now
n@1106 4279 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
n@1106 4280 return;
n@1106 4281 }
n@1106 4282
n@1106 4283 if ( type.indexOf(".") >= 0 ) {
n@1106 4284 // Namespaced trigger; create a regexp to match event type in handle()
n@1106 4285 namespaces = type.split(".");
n@1106 4286 type = namespaces.shift();
n@1106 4287 namespaces.sort();
n@1106 4288 }
n@1106 4289 ontype = type.indexOf(":") < 0 && "on" + type;
n@1106 4290
n@1106 4291 // Caller can pass in a jQuery.Event object, Object, or just an event type string
n@1106 4292 event = event[ jQuery.expando ] ?
n@1106 4293 event :
n@1106 4294 new jQuery.Event( type, typeof event === "object" && event );
n@1106 4295
n@1106 4296 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
n@1106 4297 event.isTrigger = onlyHandlers ? 2 : 3;
n@1106 4298 event.namespace = namespaces.join(".");
n@1106 4299 event.namespace_re = event.namespace ?
n@1106 4300 new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
n@1106 4301 null;
n@1106 4302
n@1106 4303 // Clean up the event in case it is being reused
n@1106 4304 event.result = undefined;
n@1106 4305 if ( !event.target ) {
n@1106 4306 event.target = elem;
n@1106 4307 }
n@1106 4308
n@1106 4309 // Clone any incoming data and prepend the event, creating the handler arg list
n@1106 4310 data = data == null ?
n@1106 4311 [ event ] :
n@1106 4312 jQuery.makeArray( data, [ event ] );
n@1106 4313
n@1106 4314 // Allow special events to draw outside the lines
n@1106 4315 special = jQuery.event.special[ type ] || {};
n@1106 4316 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
n@1106 4317 return;
n@1106 4318 }
n@1106 4319
n@1106 4320 // Determine event propagation path in advance, per W3C events spec (#9951)
n@1106 4321 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
n@1106 4322 if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
n@1106 4323
n@1106 4324 bubbleType = special.delegateType || type;
n@1106 4325 if ( !rfocusMorph.test( bubbleType + type ) ) {
n@1106 4326 cur = cur.parentNode;
n@1106 4327 }
n@1106 4328 for ( ; cur; cur = cur.parentNode ) {
n@1106 4329 eventPath.push( cur );
n@1106 4330 tmp = cur;
n@1106 4331 }
n@1106 4332
n@1106 4333 // Only add window if we got to document (e.g., not plain obj or detached DOM)
n@1106 4334 if ( tmp === (elem.ownerDocument || document) ) {
n@1106 4335 eventPath.push( tmp.defaultView || tmp.parentWindow || window );
n@1106 4336 }
n@1106 4337 }
n@1106 4338
n@1106 4339 // Fire handlers on the event path
n@1106 4340 i = 0;
n@1106 4341 while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
n@1106 4342
n@1106 4343 event.type = i > 1 ?
n@1106 4344 bubbleType :
n@1106 4345 special.bindType || type;
n@1106 4346
n@1106 4347 // jQuery handler
n@1106 4348 handle = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( cur, "handle" );
n@1106 4349 if ( handle ) {
n@1106 4350 handle.apply( cur, data );
n@1106 4351 }
n@1106 4352
n@1106 4353 // Native handler
n@1106 4354 handle = ontype && cur[ ontype ];
n@1106 4355 if ( handle && handle.apply && jQuery.acceptData( cur ) ) {
n@1106 4356 event.result = handle.apply( cur, data );
n@1106 4357 if ( event.result === false ) {
n@1106 4358 event.preventDefault();
n@1106 4359 }
n@1106 4360 }
n@1106 4361 }
n@1106 4362 event.type = type;
n@1106 4363
n@1106 4364 // If nobody prevented the default action, do it now
n@1106 4365 if ( !onlyHandlers && !event.isDefaultPrevented() ) {
n@1106 4366
n@1106 4367 if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&
n@1106 4368 jQuery.acceptData( elem ) ) {
n@1106 4369
n@1106 4370 // Call a native DOM method on the target with the same name name as the event.
n@1106 4371 // Don't do default actions on window, that's where global variables be (#6170)
n@1106 4372 if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
n@1106 4373
n@1106 4374 // Don't re-trigger an onFOO event when we call its FOO() method
n@1106 4375 tmp = elem[ ontype ];
n@1106 4376
n@1106 4377 if ( tmp ) {
n@1106 4378 elem[ ontype ] = null;
n@1106 4379 }
n@1106 4380
n@1106 4381 // Prevent re-triggering of the same event, since we already bubbled it above
n@1106 4382 jQuery.event.triggered = type;
n@1106 4383 elem[ type ]();
n@1106 4384 jQuery.event.triggered = undefined;
n@1106 4385
n@1106 4386 if ( tmp ) {
n@1106 4387 elem[ ontype ] = tmp;
n@1106 4388 }
n@1106 4389 }
n@1106 4390 }
n@1106 4391 }
n@1106 4392
n@1106 4393 return event.result;
n@1106 4394 },
n@1106 4395
n@1106 4396 dispatch: function( event ) {
n@1106 4397
n@1106 4398 // Make a writable jQuery.Event from the native event object
n@1106 4399 event = jQuery.event.fix( event );
n@1106 4400
n@1106 4401 var i, j, ret, matched, handleObj,
n@1106 4402 handlerQueue = [],
n@1106 4403 args = slice.call( arguments ),
n@1106 4404 handlers = ( data_priv.get( this, "events" ) || {} )[ event.type ] || [],
n@1106 4405 special = jQuery.event.special[ event.type ] || {};
n@1106 4406
n@1106 4407 // Use the fix-ed jQuery.Event rather than the (read-only) native event
n@1106 4408 args[0] = event;
n@1106 4409 event.delegateTarget = this;
n@1106 4410
n@1106 4411 // Call the preDispatch hook for the mapped type, and let it bail if desired
n@1106 4412 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
n@1106 4413 return;
n@1106 4414 }
n@1106 4415
n@1106 4416 // Determine handlers
n@1106 4417 handlerQueue = jQuery.event.handlers.call( this, event, handlers );
n@1106 4418
n@1106 4419 // Run delegates first; they may want to stop propagation beneath us
n@1106 4420 i = 0;
n@1106 4421 while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
n@1106 4422 event.currentTarget = matched.elem;
n@1106 4423
n@1106 4424 j = 0;
n@1106 4425 while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
n@1106 4426
n@1106 4427 // Triggered event must either 1) have no namespace, or 2) have namespace(s)
n@1106 4428 // a subset or equal to those in the bound event (both can have no namespace).
n@1106 4429 if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
n@1106 4430
n@1106 4431 event.handleObj = handleObj;
n@1106 4432 event.data = handleObj.data;
n@1106 4433
n@1106 4434 ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
n@1106 4435 .apply( matched.elem, args );
n@1106 4436
n@1106 4437 if ( ret !== undefined ) {
n@1106 4438 if ( (event.result = ret) === false ) {
n@1106 4439 event.preventDefault();
n@1106 4440 event.stopPropagation();
n@1106 4441 }
n@1106 4442 }
n@1106 4443 }
n@1106 4444 }
n@1106 4445 }
n@1106 4446
n@1106 4447 // Call the postDispatch hook for the mapped type
n@1106 4448 if ( special.postDispatch ) {
n@1106 4449 special.postDispatch.call( this, event );
n@1106 4450 }
n@1106 4451
n@1106 4452 return event.result;
n@1106 4453 },
n@1106 4454
n@1106 4455 handlers: function( event, handlers ) {
n@1106 4456 var i, matches, sel, handleObj,
n@1106 4457 handlerQueue = [],
n@1106 4458 delegateCount = handlers.delegateCount,
n@1106 4459 cur = event.target;
n@1106 4460
n@1106 4461 // Find delegate handlers
n@1106 4462 // Black-hole SVG <use> instance trees (#13180)
n@1106 4463 // Avoid non-left-click bubbling in Firefox (#3861)
n@1106 4464 if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
n@1106 4465
n@1106 4466 for ( ; cur !== this; cur = cur.parentNode || this ) {
n@1106 4467
n@1106 4468 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
n@1106 4469 if ( cur.disabled !== true || event.type !== "click" ) {
n@1106 4470 matches = [];
n@1106 4471 for ( i = 0; i < delegateCount; i++ ) {
n@1106 4472 handleObj = handlers[ i ];
n@1106 4473
n@1106 4474 // Don't conflict with Object.prototype properties (#13203)
n@1106 4475 sel = handleObj.selector + " ";
n@1106 4476
n@1106 4477 if ( matches[ sel ] === undefined ) {
n@1106 4478 matches[ sel ] = handleObj.needsContext ?
n@1106 4479 jQuery( sel, this ).index( cur ) >= 0 :
n@1106 4480 jQuery.find( sel, this, null, [ cur ] ).length;
n@1106 4481 }
n@1106 4482 if ( matches[ sel ] ) {
n@1106 4483 matches.push( handleObj );
n@1106 4484 }
n@1106 4485 }
n@1106 4486 if ( matches.length ) {
n@1106 4487 handlerQueue.push({ elem: cur, handlers: matches });
n@1106 4488 }
n@1106 4489 }
n@1106 4490 }
n@1106 4491 }
n@1106 4492
n@1106 4493 // Add the remaining (directly-bound) handlers
n@1106 4494 if ( delegateCount < handlers.length ) {
n@1106 4495 handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
n@1106 4496 }
n@1106 4497
n@1106 4498 return handlerQueue;
n@1106 4499 },
n@1106 4500
n@1106 4501 // Includes some event props shared by KeyEvent and MouseEvent
n@1106 4502 props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
n@1106 4503
n@1106 4504 fixHooks: {},
n@1106 4505
n@1106 4506 keyHooks: {
n@1106 4507 props: "char charCode key keyCode".split(" "),
n@1106 4508 filter: function( event, original ) {
n@1106 4509
n@1106 4510 // Add which for key events
n@1106 4511 if ( event.which == null ) {
n@1106 4512 event.which = original.charCode != null ? original.charCode : original.keyCode;
n@1106 4513 }
n@1106 4514
n@1106 4515 return event;
n@1106 4516 }
n@1106 4517 },
n@1106 4518
n@1106 4519 mouseHooks: {
n@1106 4520 props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
n@1106 4521 filter: function( event, original ) {
n@1106 4522 var eventDoc, doc, body,
n@1106 4523 button = original.button;
n@1106 4524
n@1106 4525 // Calculate pageX/Y if missing and clientX/Y available
n@1106 4526 if ( event.pageX == null && original.clientX != null ) {
n@1106 4527 eventDoc = event.target.ownerDocument || document;
n@1106 4528 doc = eventDoc.documentElement;
n@1106 4529 body = eventDoc.body;
n@1106 4530
n@1106 4531 event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
n@1106 4532 event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
n@1106 4533 }
n@1106 4534
n@1106 4535 // Add which for click: 1 === left; 2 === middle; 3 === right
n@1106 4536 // Note: button is not normalized, so don't use it
n@1106 4537 if ( !event.which && button !== undefined ) {
n@1106 4538 event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
n@1106 4539 }
n@1106 4540
n@1106 4541 return event;
n@1106 4542 }
n@1106 4543 },
n@1106 4544
n@1106 4545 fix: function( event ) {
n@1106 4546 if ( event[ jQuery.expando ] ) {
n@1106 4547 return event;
n@1106 4548 }
n@1106 4549
n@1106 4550 // Create a writable copy of the event object and normalize some properties
n@1106 4551 var i, prop, copy,
n@1106 4552 type = event.type,
n@1106 4553 originalEvent = event,
n@1106 4554 fixHook = this.fixHooks[ type ];
n@1106 4555
n@1106 4556 if ( !fixHook ) {
n@1106 4557 this.fixHooks[ type ] = fixHook =
n@1106 4558 rmouseEvent.test( type ) ? this.mouseHooks :
n@1106 4559 rkeyEvent.test( type ) ? this.keyHooks :
n@1106 4560 {};
n@1106 4561 }
n@1106 4562 copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
n@1106 4563
n@1106 4564 event = new jQuery.Event( originalEvent );
n@1106 4565
n@1106 4566 i = copy.length;
n@1106 4567 while ( i-- ) {
n@1106 4568 prop = copy[ i ];
n@1106 4569 event[ prop ] = originalEvent[ prop ];
n@1106 4570 }
n@1106 4571
n@1106 4572 // Support: Cordova 2.5 (WebKit) (#13255)
n@1106 4573 // All events should have a target; Cordova deviceready doesn't
n@1106 4574 if ( !event.target ) {
n@1106 4575 event.target = document;
n@1106 4576 }
n@1106 4577
n@1106 4578 // Support: Safari 6.0+, Chrome<28
n@1106 4579 // Target should not be a text node (#504, #13143)
n@1106 4580 if ( event.target.nodeType === 3 ) {
n@1106 4581 event.target = event.target.parentNode;
n@1106 4582 }
n@1106 4583
n@1106 4584 return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
n@1106 4585 },
n@1106 4586
n@1106 4587 special: {
n@1106 4588 load: {
n@1106 4589 // Prevent triggered image.load events from bubbling to window.load
n@1106 4590 noBubble: true
n@1106 4591 },
n@1106 4592 focus: {
n@1106 4593 // Fire native event if possible so blur/focus sequence is correct
n@1106 4594 trigger: function() {
n@1106 4595 if ( this !== safeActiveElement() && this.focus ) {
n@1106 4596 this.focus();
n@1106 4597 return false;
n@1106 4598 }
n@1106 4599 },
n@1106 4600 delegateType: "focusin"
n@1106 4601 },
n@1106 4602 blur: {
n@1106 4603 trigger: function() {
n@1106 4604 if ( this === safeActiveElement() && this.blur ) {
n@1106 4605 this.blur();
n@1106 4606 return false;
n@1106 4607 }
n@1106 4608 },
n@1106 4609 delegateType: "focusout"
n@1106 4610 },
n@1106 4611 click: {
n@1106 4612 // For checkbox, fire native event so checked state will be right
n@1106 4613 trigger: function() {
n@1106 4614 if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
n@1106 4615 this.click();
n@1106 4616 return false;
n@1106 4617 }
n@1106 4618 },
n@1106 4619
n@1106 4620 // For cross-browser consistency, don't fire native .click() on links
n@1106 4621 _default: function( event ) {
n@1106 4622 return jQuery.nodeName( event.target, "a" );
n@1106 4623 }
n@1106 4624 },
n@1106 4625
n@1106 4626 beforeunload: {
n@1106 4627 postDispatch: function( event ) {
n@1106 4628
n@1106 4629 // Support: Firefox 20+
n@1106 4630 // Firefox doesn't alert if the returnValue field is not set.
n@1106 4631 if ( event.result !== undefined && event.originalEvent ) {
n@1106 4632 event.originalEvent.returnValue = event.result;
n@1106 4633 }
n@1106 4634 }
n@1106 4635 }
n@1106 4636 },
n@1106 4637
n@1106 4638 simulate: function( type, elem, event, bubble ) {
n@1106 4639 // Piggyback on a donor event to simulate a different one.
n@1106 4640 // Fake originalEvent to avoid donor's stopPropagation, but if the
n@1106 4641 // simulated event prevents default then we do the same on the donor.
n@1106 4642 var e = jQuery.extend(
n@1106 4643 new jQuery.Event(),
n@1106 4644 event,
n@1106 4645 {
n@1106 4646 type: type,
n@1106 4647 isSimulated: true,
n@1106 4648 originalEvent: {}
n@1106 4649 }
n@1106 4650 );
n@1106 4651 if ( bubble ) {
n@1106 4652 jQuery.event.trigger( e, null, elem );
n@1106 4653 } else {
n@1106 4654 jQuery.event.dispatch.call( elem, e );
n@1106 4655 }
n@1106 4656 if ( e.isDefaultPrevented() ) {
n@1106 4657 event.preventDefault();
n@1106 4658 }
n@1106 4659 }
n@1106 4660 };
n@1106 4661
n@1106 4662 jQuery.removeEvent = function( elem, type, handle ) {
n@1106 4663 if ( elem.removeEventListener ) {
n@1106 4664 elem.removeEventListener( type, handle, false );
n@1106 4665 }
n@1106 4666 };
n@1106 4667
n@1106 4668 jQuery.Event = function( src, props ) {
n@1106 4669 // Allow instantiation without the 'new' keyword
n@1106 4670 if ( !(this instanceof jQuery.Event) ) {
n@1106 4671 return new jQuery.Event( src, props );
n@1106 4672 }
n@1106 4673
n@1106 4674 // Event object
n@1106 4675 if ( src && src.type ) {
n@1106 4676 this.originalEvent = src;
n@1106 4677 this.type = src.type;
n@1106 4678
n@1106 4679 // Events bubbling up the document may have been marked as prevented
n@1106 4680 // by a handler lower down the tree; reflect the correct value.
n@1106 4681 this.isDefaultPrevented = src.defaultPrevented ||
n@1106 4682 src.defaultPrevented === undefined &&
n@1106 4683 // Support: Android<4.0
n@1106 4684 src.returnValue === false ?
n@1106 4685 returnTrue :
n@1106 4686 returnFalse;
n@1106 4687
n@1106 4688 // Event type
n@1106 4689 } else {
n@1106 4690 this.type = src;
n@1106 4691 }
n@1106 4692
n@1106 4693 // Put explicitly provided properties onto the event object
n@1106 4694 if ( props ) {
n@1106 4695 jQuery.extend( this, props );
n@1106 4696 }
n@1106 4697
n@1106 4698 // Create a timestamp if incoming event doesn't have one
n@1106 4699 this.timeStamp = src && src.timeStamp || jQuery.now();
n@1106 4700
n@1106 4701 // Mark it as fixed
n@1106 4702 this[ jQuery.expando ] = true;
n@1106 4703 };
n@1106 4704
n@1106 4705 // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
n@1106 4706 // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
n@1106 4707 jQuery.Event.prototype = {
n@1106 4708 isDefaultPrevented: returnFalse,
n@1106 4709 isPropagationStopped: returnFalse,
n@1106 4710 isImmediatePropagationStopped: returnFalse,
n@1106 4711
n@1106 4712 preventDefault: function() {
n@1106 4713 var e = this.originalEvent;
n@1106 4714
n@1106 4715 this.isDefaultPrevented = returnTrue;
n@1106 4716
n@1106 4717 if ( e && e.preventDefault ) {
n@1106 4718 e.preventDefault();
n@1106 4719 }
n@1106 4720 },
n@1106 4721 stopPropagation: function() {
n@1106 4722 var e = this.originalEvent;
n@1106 4723
n@1106 4724 this.isPropagationStopped = returnTrue;
n@1106 4725
n@1106 4726 if ( e && e.stopPropagation ) {
n@1106 4727 e.stopPropagation();
n@1106 4728 }
n@1106 4729 },
n@1106 4730 stopImmediatePropagation: function() {
n@1106 4731 var e = this.originalEvent;
n@1106 4732
n@1106 4733 this.isImmediatePropagationStopped = returnTrue;
n@1106 4734
n@1106 4735 if ( e && e.stopImmediatePropagation ) {
n@1106 4736 e.stopImmediatePropagation();
n@1106 4737 }
n@1106 4738
n@1106 4739 this.stopPropagation();
n@1106 4740 }
n@1106 4741 };
n@1106 4742
n@1106 4743 // Create mouseenter/leave events using mouseover/out and event-time checks
n@1106 4744 // Support: Chrome 15+
n@1106 4745 jQuery.each({
n@1106 4746 mouseenter: "mouseover",
n@1106 4747 mouseleave: "mouseout",
n@1106 4748 pointerenter: "pointerover",
n@1106 4749 pointerleave: "pointerout"
n@1106 4750 }, function( orig, fix ) {
n@1106 4751 jQuery.event.special[ orig ] = {
n@1106 4752 delegateType: fix,
n@1106 4753 bindType: fix,
n@1106 4754
n@1106 4755 handle: function( event ) {
n@1106 4756 var ret,
n@1106 4757 target = this,
n@1106 4758 related = event.relatedTarget,
n@1106 4759 handleObj = event.handleObj;
n@1106 4760
n@1106 4761 // For mousenter/leave call the handler if related is outside the target.
n@1106 4762 // NB: No relatedTarget if the mouse left/entered the browser window
n@1106 4763 if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
n@1106 4764 event.type = handleObj.origType;
n@1106 4765 ret = handleObj.handler.apply( this, arguments );
n@1106 4766 event.type = fix;
n@1106 4767 }
n@1106 4768 return ret;
n@1106 4769 }
n@1106 4770 };
n@1106 4771 });
n@1106 4772
n@1106 4773 // Support: Firefox, Chrome, Safari
n@1106 4774 // Create "bubbling" focus and blur events
n@1106 4775 if ( !support.focusinBubbles ) {
n@1106 4776 jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
n@1106 4777
n@1106 4778 // Attach a single capturing handler on the document while someone wants focusin/focusout
n@1106 4779 var handler = function( event ) {
n@1106 4780 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
n@1106 4781 };
n@1106 4782
n@1106 4783 jQuery.event.special[ fix ] = {
n@1106 4784 setup: function() {
n@1106 4785 var doc = this.ownerDocument || this,
n@1106 4786 attaches = data_priv.access( doc, fix );
n@1106 4787
n@1106 4788 if ( !attaches ) {
n@1106 4789 doc.addEventListener( orig, handler, true );
n@1106 4790 }
n@1106 4791 data_priv.access( doc, fix, ( attaches || 0 ) + 1 );
n@1106 4792 },
n@1106 4793 teardown: function() {
n@1106 4794 var doc = this.ownerDocument || this,
n@1106 4795 attaches = data_priv.access( doc, fix ) - 1;
n@1106 4796
n@1106 4797 if ( !attaches ) {
n@1106 4798 doc.removeEventListener( orig, handler, true );
n@1106 4799 data_priv.remove( doc, fix );
n@1106 4800
n@1106 4801 } else {
n@1106 4802 data_priv.access( doc, fix, attaches );
n@1106 4803 }
n@1106 4804 }
n@1106 4805 };
n@1106 4806 });
n@1106 4807 }
n@1106 4808
n@1106 4809 jQuery.fn.extend({
n@1106 4810
n@1106 4811 on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
n@1106 4812 var origFn, type;
n@1106 4813
n@1106 4814 // Types can be a map of types/handlers
n@1106 4815 if ( typeof types === "object" ) {
n@1106 4816 // ( types-Object, selector, data )
n@1106 4817 if ( typeof selector !== "string" ) {
n@1106 4818 // ( types-Object, data )
n@1106 4819 data = data || selector;
n@1106 4820 selector = undefined;
n@1106 4821 }
n@1106 4822 for ( type in types ) {
n@1106 4823 this.on( type, selector, data, types[ type ], one );
n@1106 4824 }
n@1106 4825 return this;
n@1106 4826 }
n@1106 4827
n@1106 4828 if ( data == null && fn == null ) {
n@1106 4829 // ( types, fn )
n@1106 4830 fn = selector;
n@1106 4831 data = selector = undefined;
n@1106 4832 } else if ( fn == null ) {
n@1106 4833 if ( typeof selector === "string" ) {
n@1106 4834 // ( types, selector, fn )
n@1106 4835 fn = data;
n@1106 4836 data = undefined;
n@1106 4837 } else {
n@1106 4838 // ( types, data, fn )
n@1106 4839 fn = data;
n@1106 4840 data = selector;
n@1106 4841 selector = undefined;
n@1106 4842 }
n@1106 4843 }
n@1106 4844 if ( fn === false ) {
n@1106 4845 fn = returnFalse;
n@1106 4846 } else if ( !fn ) {
n@1106 4847 return this;
n@1106 4848 }
n@1106 4849
n@1106 4850 if ( one === 1 ) {
n@1106 4851 origFn = fn;
n@1106 4852 fn = function( event ) {
n@1106 4853 // Can use an empty set, since event contains the info
n@1106 4854 jQuery().off( event );
n@1106 4855 return origFn.apply( this, arguments );
n@1106 4856 };
n@1106 4857 // Use same guid so caller can remove using origFn
n@1106 4858 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
n@1106 4859 }
n@1106 4860 return this.each( function() {
n@1106 4861 jQuery.event.add( this, types, fn, data, selector );
n@1106 4862 });
n@1106 4863 },
n@1106 4864 one: function( types, selector, data, fn ) {
n@1106 4865 return this.on( types, selector, data, fn, 1 );
n@1106 4866 },
n@1106 4867 off: function( types, selector, fn ) {
n@1106 4868 var handleObj, type;
n@1106 4869 if ( types && types.preventDefault && types.handleObj ) {
n@1106 4870 // ( event ) dispatched jQuery.Event
n@1106 4871 handleObj = types.handleObj;
n@1106 4872 jQuery( types.delegateTarget ).off(
n@1106 4873 handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
n@1106 4874 handleObj.selector,
n@1106 4875 handleObj.handler
n@1106 4876 );
n@1106 4877 return this;
n@1106 4878 }
n@1106 4879 if ( typeof types === "object" ) {
n@1106 4880 // ( types-object [, selector] )
n@1106 4881 for ( type in types ) {
n@1106 4882 this.off( type, selector, types[ type ] );
n@1106 4883 }
n@1106 4884 return this;
n@1106 4885 }
n@1106 4886 if ( selector === false || typeof selector === "function" ) {
n@1106 4887 // ( types [, fn] )
n@1106 4888 fn = selector;
n@1106 4889 selector = undefined;
n@1106 4890 }
n@1106 4891 if ( fn === false ) {
n@1106 4892 fn = returnFalse;
n@1106 4893 }
n@1106 4894 return this.each(function() {
n@1106 4895 jQuery.event.remove( this, types, fn, selector );
n@1106 4896 });
n@1106 4897 },
n@1106 4898
n@1106 4899 trigger: function( type, data ) {
n@1106 4900 return this.each(function() {
n@1106 4901 jQuery.event.trigger( type, data, this );
n@1106 4902 });
n@1106 4903 },
n@1106 4904 triggerHandler: function( type, data ) {
n@1106 4905 var elem = this[0];
n@1106 4906 if ( elem ) {
n@1106 4907 return jQuery.event.trigger( type, data, elem, true );
n@1106 4908 }
n@1106 4909 }
n@1106 4910 });
n@1106 4911
n@1106 4912
n@1106 4913 var
n@1106 4914 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
n@1106 4915 rtagName = /<([\w:]+)/,
n@1106 4916 rhtml = /<|&#?\w+;/,
n@1106 4917 rnoInnerhtml = /<(?:script|style|link)/i,
n@1106 4918 // checked="checked" or checked
n@1106 4919 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
n@1106 4920 rscriptType = /^$|\/(?:java|ecma)script/i,
n@1106 4921 rscriptTypeMasked = /^true\/(.*)/,
n@1106 4922 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
n@1106 4923
n@1106 4924 // We have to close these tags to support XHTML (#13200)
n@1106 4925 wrapMap = {
n@1106 4926
n@1106 4927 // Support: IE9
n@1106 4928 option: [ 1, "<select multiple='multiple'>", "</select>" ],
n@1106 4929
n@1106 4930 thead: [ 1, "<table>", "</table>" ],
n@1106 4931 col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
n@1106 4932 tr: [ 2, "<table><tbody>", "</tbody></table>" ],
n@1106 4933 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
n@1106 4934
n@1106 4935 _default: [ 0, "", "" ]
n@1106 4936 };
n@1106 4937
n@1106 4938 // Support: IE9
n@1106 4939 wrapMap.optgroup = wrapMap.option;
n@1106 4940
n@1106 4941 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
n@1106 4942 wrapMap.th = wrapMap.td;
n@1106 4943
n@1106 4944 // Support: 1.x compatibility
n@1106 4945 // Manipulating tables requires a tbody
n@1106 4946 function manipulationTarget( elem, content ) {
n@1106 4947 return jQuery.nodeName( elem, "table" ) &&
n@1106 4948 jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
n@1106 4949
n@1106 4950 elem.getElementsByTagName("tbody")[0] ||
n@1106 4951 elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
n@1106 4952 elem;
n@1106 4953 }
n@1106 4954
n@1106 4955 // Replace/restore the type attribute of script elements for safe DOM manipulation
n@1106 4956 function disableScript( elem ) {
n@1106 4957 elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
n@1106 4958 return elem;
n@1106 4959 }
n@1106 4960 function restoreScript( elem ) {
n@1106 4961 var match = rscriptTypeMasked.exec( elem.type );
n@1106 4962
n@1106 4963 if ( match ) {
n@1106 4964 elem.type = match[ 1 ];
n@1106 4965 } else {
n@1106 4966 elem.removeAttribute("type");
n@1106 4967 }
n@1106 4968
n@1106 4969 return elem;
n@1106 4970 }
n@1106 4971
n@1106 4972 // Mark scripts as having already been evaluated
n@1106 4973 function setGlobalEval( elems, refElements ) {
n@1106 4974 var i = 0,
n@1106 4975 l = elems.length;
n@1106 4976
n@1106 4977 for ( ; i < l; i++ ) {
n@1106 4978 data_priv.set(
n@1106 4979 elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" )
n@1106 4980 );
n@1106 4981 }
n@1106 4982 }
n@1106 4983
n@1106 4984 function cloneCopyEvent( src, dest ) {
n@1106 4985 var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
n@1106 4986
n@1106 4987 if ( dest.nodeType !== 1 ) {
n@1106 4988 return;
n@1106 4989 }
n@1106 4990
n@1106 4991 // 1. Copy private data: events, handlers, etc.
n@1106 4992 if ( data_priv.hasData( src ) ) {
n@1106 4993 pdataOld = data_priv.access( src );
n@1106 4994 pdataCur = data_priv.set( dest, pdataOld );
n@1106 4995 events = pdataOld.events;
n@1106 4996
n@1106 4997 if ( events ) {
n@1106 4998 delete pdataCur.handle;
n@1106 4999 pdataCur.events = {};
n@1106 5000
n@1106 5001 for ( type in events ) {
n@1106 5002 for ( i = 0, l = events[ type ].length; i < l; i++ ) {
n@1106 5003 jQuery.event.add( dest, type, events[ type ][ i ] );
n@1106 5004 }
n@1106 5005 }
n@1106 5006 }
n@1106 5007 }
n@1106 5008
n@1106 5009 // 2. Copy user data
n@1106 5010 if ( data_user.hasData( src ) ) {
n@1106 5011 udataOld = data_user.access( src );
n@1106 5012 udataCur = jQuery.extend( {}, udataOld );
n@1106 5013
n@1106 5014 data_user.set( dest, udataCur );
n@1106 5015 }
n@1106 5016 }
n@1106 5017
n@1106 5018 function getAll( context, tag ) {
n@1106 5019 var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) :
n@1106 5020 context.querySelectorAll ? context.querySelectorAll( tag || "*" ) :
n@1106 5021 [];
n@1106 5022
n@1106 5023 return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
n@1106 5024 jQuery.merge( [ context ], ret ) :
n@1106 5025 ret;
n@1106 5026 }
n@1106 5027
n@1106 5028 // Fix IE bugs, see support tests
n@1106 5029 function fixInput( src, dest ) {
n@1106 5030 var nodeName = dest.nodeName.toLowerCase();
n@1106 5031
n@1106 5032 // Fails to persist the checked state of a cloned checkbox or radio button.
n@1106 5033 if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
n@1106 5034 dest.checked = src.checked;
n@1106 5035
n@1106 5036 // Fails to return the selected option to the default selected state when cloning options
n@1106 5037 } else if ( nodeName === "input" || nodeName === "textarea" ) {
n@1106 5038 dest.defaultValue = src.defaultValue;
n@1106 5039 }
n@1106 5040 }
n@1106 5041
n@1106 5042 jQuery.extend({
n@1106 5043 clone: function( elem, dataAndEvents, deepDataAndEvents ) {
n@1106 5044 var i, l, srcElements, destElements,
n@1106 5045 clone = elem.cloneNode( true ),
n@1106 5046 inPage = jQuery.contains( elem.ownerDocument, elem );
n@1106 5047
n@1106 5048 // Fix IE cloning issues
n@1106 5049 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
n@1106 5050 !jQuery.isXMLDoc( elem ) ) {
n@1106 5051
n@1106 5052 // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
n@1106 5053 destElements = getAll( clone );
n@1106 5054 srcElements = getAll( elem );
n@1106 5055
n@1106 5056 for ( i = 0, l = srcElements.length; i < l; i++ ) {
n@1106 5057 fixInput( srcElements[ i ], destElements[ i ] );
n@1106 5058 }
n@1106 5059 }
n@1106 5060
n@1106 5061 // Copy the events from the original to the clone
n@1106 5062 if ( dataAndEvents ) {
n@1106 5063 if ( deepDataAndEvents ) {
n@1106 5064 srcElements = srcElements || getAll( elem );
n@1106 5065 destElements = destElements || getAll( clone );
n@1106 5066
n@1106 5067 for ( i = 0, l = srcElements.length; i < l; i++ ) {
n@1106 5068 cloneCopyEvent( srcElements[ i ], destElements[ i ] );
n@1106 5069 }
n@1106 5070 } else {
n@1106 5071 cloneCopyEvent( elem, clone );
n@1106 5072 }
n@1106 5073 }
n@1106 5074
n@1106 5075 // Preserve script evaluation history
n@1106 5076 destElements = getAll( clone, "script" );
n@1106 5077 if ( destElements.length > 0 ) {
n@1106 5078 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
n@1106 5079 }
n@1106 5080
n@1106 5081 // Return the cloned set
n@1106 5082 return clone;
n@1106 5083 },
n@1106 5084
n@1106 5085 buildFragment: function( elems, context, scripts, selection ) {
n@1106 5086 var elem, tmp, tag, wrap, contains, j,
n@1106 5087 fragment = context.createDocumentFragment(),
n@1106 5088 nodes = [],
n@1106 5089 i = 0,
n@1106 5090 l = elems.length;
n@1106 5091
n@1106 5092 for ( ; i < l; i++ ) {
n@1106 5093 elem = elems[ i ];
n@1106 5094
n@1106 5095 if ( elem || elem === 0 ) {
n@1106 5096
n@1106 5097 // Add nodes directly
n@1106 5098 if ( jQuery.type( elem ) === "object" ) {
n@1106 5099 // Support: QtWebKit, PhantomJS
n@1106 5100 // push.apply(_, arraylike) throws on ancient WebKit
n@1106 5101 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
n@1106 5102
n@1106 5103 // Convert non-html into a text node
n@1106 5104 } else if ( !rhtml.test( elem ) ) {
n@1106 5105 nodes.push( context.createTextNode( elem ) );
n@1106 5106
n@1106 5107 // Convert html into DOM nodes
n@1106 5108 } else {
n@1106 5109 tmp = tmp || fragment.appendChild( context.createElement("div") );
n@1106 5110
n@1106 5111 // Deserialize a standard representation
n@1106 5112 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
n@1106 5113 wrap = wrapMap[ tag ] || wrapMap._default;
n@1106 5114 tmp.innerHTML = wrap[ 1 ] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[ 2 ];
n@1106 5115
n@1106 5116 // Descend through wrappers to the right content
n@1106 5117 j = wrap[ 0 ];
n@1106 5118 while ( j-- ) {
n@1106 5119 tmp = tmp.lastChild;
n@1106 5120 }
n@1106 5121
n@1106 5122 // Support: QtWebKit, PhantomJS
n@1106 5123 // push.apply(_, arraylike) throws on ancient WebKit
n@1106 5124 jQuery.merge( nodes, tmp.childNodes );
n@1106 5125
n@1106 5126 // Remember the top-level container
n@1106 5127 tmp = fragment.firstChild;
n@1106 5128
n@1106 5129 // Ensure the created nodes are orphaned (#12392)
n@1106 5130 tmp.textContent = "";
n@1106 5131 }
n@1106 5132 }
n@1106 5133 }
n@1106 5134
n@1106 5135 // Remove wrapper from fragment
n@1106 5136 fragment.textContent = "";
n@1106 5137
n@1106 5138 i = 0;
n@1106 5139 while ( (elem = nodes[ i++ ]) ) {
n@1106 5140
n@1106 5141 // #4087 - If origin and destination elements are the same, and this is
n@1106 5142 // that element, do not do anything
n@1106 5143 if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
n@1106 5144 continue;
n@1106 5145 }
n@1106 5146
n@1106 5147 contains = jQuery.contains( elem.ownerDocument, elem );
n@1106 5148
n@1106 5149 // Append to fragment
n@1106 5150 tmp = getAll( fragment.appendChild( elem ), "script" );
n@1106 5151
n@1106 5152 // Preserve script evaluation history
n@1106 5153 if ( contains ) {
n@1106 5154 setGlobalEval( tmp );
n@1106 5155 }
n@1106 5156
n@1106 5157 // Capture executables
n@1106 5158 if ( scripts ) {
n@1106 5159 j = 0;
n@1106 5160 while ( (elem = tmp[ j++ ]) ) {
n@1106 5161 if ( rscriptType.test( elem.type || "" ) ) {
n@1106 5162 scripts.push( elem );
n@1106 5163 }
n@1106 5164 }
n@1106 5165 }
n@1106 5166 }
n@1106 5167
n@1106 5168 return fragment;
n@1106 5169 },
n@1106 5170
n@1106 5171 cleanData: function( elems ) {
n@1106 5172 var data, elem, type, key,
n@1106 5173 special = jQuery.event.special,
n@1106 5174 i = 0;
n@1106 5175
n@1106 5176 for ( ; (elem = elems[ i ]) !== undefined; i++ ) {
n@1106 5177 if ( jQuery.acceptData( elem ) ) {
n@1106 5178 key = elem[ data_priv.expando ];
n@1106 5179
n@1106 5180 if ( key && (data = data_priv.cache[ key ]) ) {
n@1106 5181 if ( data.events ) {
n@1106 5182 for ( type in data.events ) {
n@1106 5183 if ( special[ type ] ) {
n@1106 5184 jQuery.event.remove( elem, type );
n@1106 5185
n@1106 5186 // This is a shortcut to avoid jQuery.event.remove's overhead
n@1106 5187 } else {
n@1106 5188 jQuery.removeEvent( elem, type, data.handle );
n@1106 5189 }
n@1106 5190 }
n@1106 5191 }
n@1106 5192 if ( data_priv.cache[ key ] ) {
n@1106 5193 // Discard any remaining `private` data
n@1106 5194 delete data_priv.cache[ key ];
n@1106 5195 }
n@1106 5196 }
n@1106 5197 }
n@1106 5198 // Discard any remaining `user` data
n@1106 5199 delete data_user.cache[ elem[ data_user.expando ] ];
n@1106 5200 }
n@1106 5201 }
n@1106 5202 });
n@1106 5203
n@1106 5204 jQuery.fn.extend({
n@1106 5205 text: function( value ) {
n@1106 5206 return access( this, function( value ) {
n@1106 5207 return value === undefined ?
n@1106 5208 jQuery.text( this ) :
n@1106 5209 this.empty().each(function() {
n@1106 5210 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
n@1106 5211 this.textContent = value;
n@1106 5212 }
n@1106 5213 });
n@1106 5214 }, null, value, arguments.length );
n@1106 5215 },
n@1106 5216
n@1106 5217 append: function() {
n@1106 5218 return this.domManip( arguments, function( elem ) {
n@1106 5219 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
n@1106 5220 var target = manipulationTarget( this, elem );
n@1106 5221 target.appendChild( elem );
n@1106 5222 }
n@1106 5223 });
n@1106 5224 },
n@1106 5225
n@1106 5226 prepend: function() {
n@1106 5227 return this.domManip( arguments, function( elem ) {
n@1106 5228 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
n@1106 5229 var target = manipulationTarget( this, elem );
n@1106 5230 target.insertBefore( elem, target.firstChild );
n@1106 5231 }
n@1106 5232 });
n@1106 5233 },
n@1106 5234
n@1106 5235 before: function() {
n@1106 5236 return this.domManip( arguments, function( elem ) {
n@1106 5237 if ( this.parentNode ) {
n@1106 5238 this.parentNode.insertBefore( elem, this );
n@1106 5239 }
n@1106 5240 });
n@1106 5241 },
n@1106 5242
n@1106 5243 after: function() {
n@1106 5244 return this.domManip( arguments, function( elem ) {
n@1106 5245 if ( this.parentNode ) {
n@1106 5246 this.parentNode.insertBefore( elem, this.nextSibling );
n@1106 5247 }
n@1106 5248 });
n@1106 5249 },
n@1106 5250
n@1106 5251 remove: function( selector, keepData /* Internal Use Only */ ) {
n@1106 5252 var elem,
n@1106 5253 elems = selector ? jQuery.filter( selector, this ) : this,
n@1106 5254 i = 0;
n@1106 5255
n@1106 5256 for ( ; (elem = elems[i]) != null; i++ ) {
n@1106 5257 if ( !keepData && elem.nodeType === 1 ) {
n@1106 5258 jQuery.cleanData( getAll( elem ) );
n@1106 5259 }
n@1106 5260
n@1106 5261 if ( elem.parentNode ) {
n@1106 5262 if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
n@1106 5263 setGlobalEval( getAll( elem, "script" ) );
n@1106 5264 }
n@1106 5265 elem.parentNode.removeChild( elem );
n@1106 5266 }
n@1106 5267 }
n@1106 5268
n@1106 5269 return this;
n@1106 5270 },
n@1106 5271
n@1106 5272 empty: function() {
n@1106 5273 var elem,
n@1106 5274 i = 0;
n@1106 5275
n@1106 5276 for ( ; (elem = this[i]) != null; i++ ) {
n@1106 5277 if ( elem.nodeType === 1 ) {
n@1106 5278
n@1106 5279 // Prevent memory leaks
n@1106 5280 jQuery.cleanData( getAll( elem, false ) );
n@1106 5281
n@1106 5282 // Remove any remaining nodes
n@1106 5283 elem.textContent = "";
n@1106 5284 }
n@1106 5285 }
n@1106 5286
n@1106 5287 return this;
n@1106 5288 },
n@1106 5289
n@1106 5290 clone: function( dataAndEvents, deepDataAndEvents ) {
n@1106 5291 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
n@1106 5292 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
n@1106 5293
n@1106 5294 return this.map(function() {
n@1106 5295 return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
n@1106 5296 });
n@1106 5297 },
n@1106 5298
n@1106 5299 html: function( value ) {
n@1106 5300 return access( this, function( value ) {
n@1106 5301 var elem = this[ 0 ] || {},
n@1106 5302 i = 0,
n@1106 5303 l = this.length;
n@1106 5304
n@1106 5305 if ( value === undefined && elem.nodeType === 1 ) {
n@1106 5306 return elem.innerHTML;
n@1106 5307 }
n@1106 5308
n@1106 5309 // See if we can take a shortcut and just use innerHTML
n@1106 5310 if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
n@1106 5311 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
n@1106 5312
n@1106 5313 value = value.replace( rxhtmlTag, "<$1></$2>" );
n@1106 5314
n@1106 5315 try {
n@1106 5316 for ( ; i < l; i++ ) {
n@1106 5317 elem = this[ i ] || {};
n@1106 5318
n@1106 5319 // Remove element nodes and prevent memory leaks
n@1106 5320 if ( elem.nodeType === 1 ) {
n@1106 5321 jQuery.cleanData( getAll( elem, false ) );
n@1106 5322 elem.innerHTML = value;
n@1106 5323 }
n@1106 5324 }
n@1106 5325
n@1106 5326 elem = 0;
n@1106 5327
n@1106 5328 // If using innerHTML throws an exception, use the fallback method
n@1106 5329 } catch( e ) {}
n@1106 5330 }
n@1106 5331
n@1106 5332 if ( elem ) {
n@1106 5333 this.empty().append( value );
n@1106 5334 }
n@1106 5335 }, null, value, arguments.length );
n@1106 5336 },
n@1106 5337
n@1106 5338 replaceWith: function() {
n@1106 5339 var arg = arguments[ 0 ];
n@1106 5340
n@1106 5341 // Make the changes, replacing each context element with the new content
n@1106 5342 this.domManip( arguments, function( elem ) {
n@1106 5343 arg = this.parentNode;
n@1106 5344
n@1106 5345 jQuery.cleanData( getAll( this ) );
n@1106 5346
n@1106 5347 if ( arg ) {
n@1106 5348 arg.replaceChild( elem, this );
n@1106 5349 }
n@1106 5350 });
n@1106 5351
n@1106 5352 // Force removal if there was no new content (e.g., from empty arguments)
n@1106 5353 return arg && (arg.length || arg.nodeType) ? this : this.remove();
n@1106 5354 },
n@1106 5355
n@1106 5356 detach: function( selector ) {
n@1106 5357 return this.remove( selector, true );
n@1106 5358 },
n@1106 5359
n@1106 5360 domManip: function( args, callback ) {
n@1106 5361
n@1106 5362 // Flatten any nested arrays
n@1106 5363 args = concat.apply( [], args );
n@1106 5364
n@1106 5365 var fragment, first, scripts, hasScripts, node, doc,
n@1106 5366 i = 0,
n@1106 5367 l = this.length,
n@1106 5368 set = this,
n@1106 5369 iNoClone = l - 1,
n@1106 5370 value = args[ 0 ],
n@1106 5371 isFunction = jQuery.isFunction( value );
n@1106 5372
n@1106 5373 // We can't cloneNode fragments that contain checked, in WebKit
n@1106 5374 if ( isFunction ||
n@1106 5375 ( l > 1 && typeof value === "string" &&
n@1106 5376 !support.checkClone && rchecked.test( value ) ) ) {
n@1106 5377 return this.each(function( index ) {
n@1106 5378 var self = set.eq( index );
n@1106 5379 if ( isFunction ) {
n@1106 5380 args[ 0 ] = value.call( this, index, self.html() );
n@1106 5381 }
n@1106 5382 self.domManip( args, callback );
n@1106 5383 });
n@1106 5384 }
n@1106 5385
n@1106 5386 if ( l ) {
n@1106 5387 fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
n@1106 5388 first = fragment.firstChild;
n@1106 5389
n@1106 5390 if ( fragment.childNodes.length === 1 ) {
n@1106 5391 fragment = first;
n@1106 5392 }
n@1106 5393
n@1106 5394 if ( first ) {
n@1106 5395 scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
n@1106 5396 hasScripts = scripts.length;
n@1106 5397
n@1106 5398 // Use the original fragment for the last item instead of the first because it can end up
n@1106 5399 // being emptied incorrectly in certain situations (#8070).
n@1106 5400 for ( ; i < l; i++ ) {
n@1106 5401 node = fragment;
n@1106 5402
n@1106 5403 if ( i !== iNoClone ) {
n@1106 5404 node = jQuery.clone( node, true, true );
n@1106 5405
n@1106 5406 // Keep references to cloned scripts for later restoration
n@1106 5407 if ( hasScripts ) {
n@1106 5408 // Support: QtWebKit
n@1106 5409 // jQuery.merge because push.apply(_, arraylike) throws
n@1106 5410 jQuery.merge( scripts, getAll( node, "script" ) );
n@1106 5411 }
n@1106 5412 }
n@1106 5413
n@1106 5414 callback.call( this[ i ], node, i );
n@1106 5415 }
n@1106 5416
n@1106 5417 if ( hasScripts ) {
n@1106 5418 doc = scripts[ scripts.length - 1 ].ownerDocument;
n@1106 5419
n@1106 5420 // Reenable scripts
n@1106 5421 jQuery.map( scripts, restoreScript );
n@1106 5422
n@1106 5423 // Evaluate executable scripts on first document insertion
n@1106 5424 for ( i = 0; i < hasScripts; i++ ) {
n@1106 5425 node = scripts[ i ];
n@1106 5426 if ( rscriptType.test( node.type || "" ) &&
n@1106 5427 !data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
n@1106 5428
n@1106 5429 if ( node.src ) {
n@1106 5430 // Optional AJAX dependency, but won't run scripts if not present
n@1106 5431 if ( jQuery._evalUrl ) {
n@1106 5432 jQuery._evalUrl( node.src );
n@1106 5433 }
n@1106 5434 } else {
n@1106 5435 jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) );
n@1106 5436 }
n@1106 5437 }
n@1106 5438 }
n@1106 5439 }
n@1106 5440 }
n@1106 5441 }
n@1106 5442
n@1106 5443 return this;
n@1106 5444 }
n@1106 5445 });
n@1106 5446
n@1106 5447 jQuery.each({
n@1106 5448 appendTo: "append",
n@1106 5449 prependTo: "prepend",
n@1106 5450 insertBefore: "before",
n@1106 5451 insertAfter: "after",
n@1106 5452 replaceAll: "replaceWith"
n@1106 5453 }, function( name, original ) {
n@1106 5454 jQuery.fn[ name ] = function( selector ) {
n@1106 5455 var elems,
n@1106 5456 ret = [],
n@1106 5457 insert = jQuery( selector ),
n@1106 5458 last = insert.length - 1,
n@1106 5459 i = 0;
n@1106 5460
n@1106 5461 for ( ; i <= last; i++ ) {
n@1106 5462 elems = i === last ? this : this.clone( true );
n@1106 5463 jQuery( insert[ i ] )[ original ]( elems );
n@1106 5464
n@1106 5465 // Support: QtWebKit
n@1106 5466 // .get() because push.apply(_, arraylike) throws
n@1106 5467 push.apply( ret, elems.get() );
n@1106 5468 }
n@1106 5469
n@1106 5470 return this.pushStack( ret );
n@1106 5471 };
n@1106 5472 });
n@1106 5473
n@1106 5474
n@1106 5475 var iframe,
n@1106 5476 elemdisplay = {};
n@1106 5477
n@1106 5478 /**
n@1106 5479 * Retrieve the actual display of a element
n@1106 5480 * @param {String} name nodeName of the element
n@1106 5481 * @param {Object} doc Document object
n@1106 5482 */
n@1106 5483 // Called only from within defaultDisplay
n@1106 5484 function actualDisplay( name, doc ) {
n@1106 5485 var style,
n@1106 5486 elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
n@1106 5487
n@1106 5488 // getDefaultComputedStyle might be reliably used only on attached element
n@1106 5489 display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ?
n@1106 5490
n@1106 5491 // Use of this method is a temporary fix (more like optimization) until something better comes along,
n@1106 5492 // since it was removed from specification and supported only in FF
n@1106 5493 style.display : jQuery.css( elem[ 0 ], "display" );
n@1106 5494
n@1106 5495 // We don't have any data stored on the element,
n@1106 5496 // so use "detach" method as fast way to get rid of the element
n@1106 5497 elem.detach();
n@1106 5498
n@1106 5499 return display;
n@1106 5500 }
n@1106 5501
n@1106 5502 /**
n@1106 5503 * Try to determine the default display value of an element
n@1106 5504 * @param {String} nodeName
n@1106 5505 */
n@1106 5506 function defaultDisplay( nodeName ) {
n@1106 5507 var doc = document,
n@1106 5508 display = elemdisplay[ nodeName ];
n@1106 5509
n@1106 5510 if ( !display ) {
n@1106 5511 display = actualDisplay( nodeName, doc );
n@1106 5512
n@1106 5513 // If the simple way fails, read from inside an iframe
n@1106 5514 if ( display === "none" || !display ) {
n@1106 5515
n@1106 5516 // Use the already-created iframe if possible
n@1106 5517 iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement );
n@1106 5518
n@1106 5519 // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
n@1106 5520 doc = iframe[ 0 ].contentDocument;
n@1106 5521
n@1106 5522 // Support: IE
n@1106 5523 doc.write();
n@1106 5524 doc.close();
n@1106 5525
n@1106 5526 display = actualDisplay( nodeName, doc );
n@1106 5527 iframe.detach();
n@1106 5528 }
n@1106 5529
n@1106 5530 // Store the correct default display
n@1106 5531 elemdisplay[ nodeName ] = display;
n@1106 5532 }
n@1106 5533
n@1106 5534 return display;
n@1106 5535 }
n@1106 5536 var rmargin = (/^margin/);
n@1106 5537
n@1106 5538 var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
n@1106 5539
n@1106 5540 var getStyles = function( elem ) {
n@1106 5541 // Support: IE<=11+, Firefox<=30+ (#15098, #14150)
n@1106 5542 // IE throws on elements created in popups
n@1106 5543 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
n@1106 5544 if ( elem.ownerDocument.defaultView.opener ) {
n@1106 5545 return elem.ownerDocument.defaultView.getComputedStyle( elem, null );
n@1106 5546 }
n@1106 5547
n@1106 5548 return window.getComputedStyle( elem, null );
n@1106 5549 };
n@1106 5550
n@1106 5551
n@1106 5552
n@1106 5553 function curCSS( elem, name, computed ) {
n@1106 5554 var width, minWidth, maxWidth, ret,
n@1106 5555 style = elem.style;
n@1106 5556
n@1106 5557 computed = computed || getStyles( elem );
n@1106 5558
n@1106 5559 // Support: IE9
n@1106 5560 // getPropertyValue is only needed for .css('filter') (#12537)
n@1106 5561 if ( computed ) {
n@1106 5562 ret = computed.getPropertyValue( name ) || computed[ name ];
n@1106 5563 }
n@1106 5564
n@1106 5565 if ( computed ) {
n@1106 5566
n@1106 5567 if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
n@1106 5568 ret = jQuery.style( elem, name );
n@1106 5569 }
n@1106 5570
n@1106 5571 // Support: iOS < 6
n@1106 5572 // A tribute to the "awesome hack by Dean Edwards"
n@1106 5573 // iOS < 6 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
n@1106 5574 // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
n@1106 5575 if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
n@1106 5576
n@1106 5577 // Remember the original values
n@1106 5578 width = style.width;
n@1106 5579 minWidth = style.minWidth;
n@1106 5580 maxWidth = style.maxWidth;
n@1106 5581
n@1106 5582 // Put in the new values to get a computed value out
n@1106 5583 style.minWidth = style.maxWidth = style.width = ret;
n@1106 5584 ret = computed.width;
n@1106 5585
n@1106 5586 // Revert the changed values
n@1106 5587 style.width = width;
n@1106 5588 style.minWidth = minWidth;
n@1106 5589 style.maxWidth = maxWidth;
n@1106 5590 }
n@1106 5591 }
n@1106 5592
n@1106 5593 return ret !== undefined ?
n@1106 5594 // Support: IE
n@1106 5595 // IE returns zIndex value as an integer.
n@1106 5596 ret + "" :
n@1106 5597 ret;
n@1106 5598 }
n@1106 5599
n@1106 5600
n@1106 5601 function addGetHookIf( conditionFn, hookFn ) {
n@1106 5602 // Define the hook, we'll check on the first run if it's really needed.
n@1106 5603 return {
n@1106 5604 get: function() {
n@1106 5605 if ( conditionFn() ) {
n@1106 5606 // Hook not needed (or it's not possible to use it due
n@1106 5607 // to missing dependency), remove it.
n@1106 5608 delete this.get;
n@1106 5609 return;
n@1106 5610 }
n@1106 5611
n@1106 5612 // Hook needed; redefine it so that the support test is not executed again.
n@1106 5613 return (this.get = hookFn).apply( this, arguments );
n@1106 5614 }
n@1106 5615 };
n@1106 5616 }
n@1106 5617
n@1106 5618
n@1106 5619 (function() {
n@1106 5620 var pixelPositionVal, boxSizingReliableVal,
n@1106 5621 docElem = document.documentElement,
n@1106 5622 container = document.createElement( "div" ),
n@1106 5623 div = document.createElement( "div" );
n@1106 5624
n@1106 5625 if ( !div.style ) {
n@1106 5626 return;
n@1106 5627 }
n@1106 5628
n@1106 5629 // Support: IE9-11+
n@1106 5630 // Style of cloned element affects source element cloned (#8908)
n@1106 5631 div.style.backgroundClip = "content-box";
n@1106 5632 div.cloneNode( true ).style.backgroundClip = "";
n@1106 5633 support.clearCloneStyle = div.style.backgroundClip === "content-box";
n@1106 5634
n@1106 5635 container.style.cssText = "border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;" +
n@1106 5636 "position:absolute";
n@1106 5637 container.appendChild( div );
n@1106 5638
n@1106 5639 // Executing both pixelPosition & boxSizingReliable tests require only one layout
n@1106 5640 // so they're executed at the same time to save the second computation.
n@1106 5641 function computePixelPositionAndBoxSizingReliable() {
n@1106 5642 div.style.cssText =
n@1106 5643 // Support: Firefox<29, Android 2.3
n@1106 5644 // Vendor-prefix box-sizing
n@1106 5645 "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
n@1106 5646 "box-sizing:border-box;display:block;margin-top:1%;top:1%;" +
n@1106 5647 "border:1px;padding:1px;width:4px;position:absolute";
n@1106 5648 div.innerHTML = "";
n@1106 5649 docElem.appendChild( container );
n@1106 5650
n@1106 5651 var divStyle = window.getComputedStyle( div, null );
n@1106 5652 pixelPositionVal = divStyle.top !== "1%";
n@1106 5653 boxSizingReliableVal = divStyle.width === "4px";
n@1106 5654
n@1106 5655 docElem.removeChild( container );
n@1106 5656 }
n@1106 5657
n@1106 5658 // Support: node.js jsdom
n@1106 5659 // Don't assume that getComputedStyle is a property of the global object
n@1106 5660 if ( window.getComputedStyle ) {
n@1106 5661 jQuery.extend( support, {
n@1106 5662 pixelPosition: function() {
n@1106 5663
n@1106 5664 // This test is executed only once but we still do memoizing
n@1106 5665 // since we can use the boxSizingReliable pre-computing.
n@1106 5666 // No need to check if the test was already performed, though.
n@1106 5667 computePixelPositionAndBoxSizingReliable();
n@1106 5668 return pixelPositionVal;
n@1106 5669 },
n@1106 5670 boxSizingReliable: function() {
n@1106 5671 if ( boxSizingReliableVal == null ) {
n@1106 5672 computePixelPositionAndBoxSizingReliable();
n@1106 5673 }
n@1106 5674 return boxSizingReliableVal;
n@1106 5675 },
n@1106 5676 reliableMarginRight: function() {
n@1106 5677
n@1106 5678 // Support: Android 2.3
n@1106 5679 // Check if div with explicit width and no margin-right incorrectly
n@1106 5680 // gets computed margin-right based on width of container. (#3333)
n@1106 5681 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
n@1106 5682 // This support function is only executed once so no memoizing is needed.
n@1106 5683 var ret,
n@1106 5684 marginDiv = div.appendChild( document.createElement( "div" ) );
n@1106 5685
n@1106 5686 // Reset CSS: box-sizing; display; margin; border; padding
n@1106 5687 marginDiv.style.cssText = div.style.cssText =
n@1106 5688 // Support: Firefox<29, Android 2.3
n@1106 5689 // Vendor-prefix box-sizing
n@1106 5690 "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
n@1106 5691 "box-sizing:content-box;display:block;margin:0;border:0;padding:0";
n@1106 5692 marginDiv.style.marginRight = marginDiv.style.width = "0";
n@1106 5693 div.style.width = "1px";
n@1106 5694 docElem.appendChild( container );
n@1106 5695
n@1106 5696 ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight );
n@1106 5697
n@1106 5698 docElem.removeChild( container );
n@1106 5699 div.removeChild( marginDiv );
n@1106 5700
n@1106 5701 return ret;
n@1106 5702 }
n@1106 5703 });
n@1106 5704 }
n@1106 5705 })();
n@1106 5706
n@1106 5707
n@1106 5708 // A method for quickly swapping in/out CSS properties to get correct calculations.
n@1106 5709 jQuery.swap = function( elem, options, callback, args ) {
n@1106 5710 var ret, name,
n@1106 5711 old = {};
n@1106 5712
n@1106 5713 // Remember the old values, and insert the new ones
n@1106 5714 for ( name in options ) {
n@1106 5715 old[ name ] = elem.style[ name ];
n@1106 5716 elem.style[ name ] = options[ name ];
n@1106 5717 }
n@1106 5718
n@1106 5719 ret = callback.apply( elem, args || [] );
n@1106 5720
n@1106 5721 // Revert the old values
n@1106 5722 for ( name in options ) {
n@1106 5723 elem.style[ name ] = old[ name ];
n@1106 5724 }
n@1106 5725
n@1106 5726 return ret;
n@1106 5727 };
n@1106 5728
n@1106 5729
n@1106 5730 var
n@1106 5731 // Swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
n@1106 5732 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
n@1106 5733 rdisplayswap = /^(none|table(?!-c[ea]).+)/,
n@1106 5734 rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),
n@1106 5735 rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ),
n@1106 5736
n@1106 5737 cssShow = { position: "absolute", visibility: "hidden", display: "block" },
n@1106 5738 cssNormalTransform = {
n@1106 5739 letterSpacing: "0",
n@1106 5740 fontWeight: "400"
n@1106 5741 },
n@1106 5742
n@1106 5743 cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
n@1106 5744
n@1106 5745 // Return a css property mapped to a potentially vendor prefixed property
n@1106 5746 function vendorPropName( style, name ) {
n@1106 5747
n@1106 5748 // Shortcut for names that are not vendor prefixed
n@1106 5749 if ( name in style ) {
n@1106 5750 return name;
n@1106 5751 }
n@1106 5752
n@1106 5753 // Check for vendor prefixed names
n@1106 5754 var capName = name[0].toUpperCase() + name.slice(1),
n@1106 5755 origName = name,
n@1106 5756 i = cssPrefixes.length;
n@1106 5757
n@1106 5758 while ( i-- ) {
n@1106 5759 name = cssPrefixes[ i ] + capName;
n@1106 5760 if ( name in style ) {
n@1106 5761 return name;
n@1106 5762 }
n@1106 5763 }
n@1106 5764
n@1106 5765 return origName;
n@1106 5766 }
n@1106 5767
n@1106 5768 function setPositiveNumber( elem, value, subtract ) {
n@1106 5769 var matches = rnumsplit.exec( value );
n@1106 5770 return matches ?
n@1106 5771 // Guard against undefined "subtract", e.g., when used as in cssHooks
n@1106 5772 Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
n@1106 5773 value;
n@1106 5774 }
n@1106 5775
n@1106 5776 function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
n@1106 5777 var i = extra === ( isBorderBox ? "border" : "content" ) ?
n@1106 5778 // If we already have the right measurement, avoid augmentation
n@1106 5779 4 :
n@1106 5780 // Otherwise initialize for horizontal or vertical properties
n@1106 5781 name === "width" ? 1 : 0,
n@1106 5782
n@1106 5783 val = 0;
n@1106 5784
n@1106 5785 for ( ; i < 4; i += 2 ) {
n@1106 5786 // Both box models exclude margin, so add it if we want it
n@1106 5787 if ( extra === "margin" ) {
n@1106 5788 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
n@1106 5789 }
n@1106 5790
n@1106 5791 if ( isBorderBox ) {
n@1106 5792 // border-box includes padding, so remove it if we want content
n@1106 5793 if ( extra === "content" ) {
n@1106 5794 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
n@1106 5795 }
n@1106 5796
n@1106 5797 // At this point, extra isn't border nor margin, so remove border
n@1106 5798 if ( extra !== "margin" ) {
n@1106 5799 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
n@1106 5800 }
n@1106 5801 } else {
n@1106 5802 // At this point, extra isn't content, so add padding
n@1106 5803 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
n@1106 5804
n@1106 5805 // At this point, extra isn't content nor padding, so add border
n@1106 5806 if ( extra !== "padding" ) {
n@1106 5807 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
n@1106 5808 }
n@1106 5809 }
n@1106 5810 }
n@1106 5811
n@1106 5812 return val;
n@1106 5813 }
n@1106 5814
n@1106 5815 function getWidthOrHeight( elem, name, extra ) {
n@1106 5816
n@1106 5817 // Start with offset property, which is equivalent to the border-box value
n@1106 5818 var valueIsBorderBox = true,
n@1106 5819 val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
n@1106 5820 styles = getStyles( elem ),
n@1106 5821 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
n@1106 5822
n@1106 5823 // Some non-html elements return undefined for offsetWidth, so check for null/undefined
n@1106 5824 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
n@1106 5825 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
n@1106 5826 if ( val <= 0 || val == null ) {
n@1106 5827 // Fall back to computed then uncomputed css if necessary
n@1106 5828 val = curCSS( elem, name, styles );
n@1106 5829 if ( val < 0 || val == null ) {
n@1106 5830 val = elem.style[ name ];
n@1106 5831 }
n@1106 5832
n@1106 5833 // Computed unit is not pixels. Stop here and return.
n@1106 5834 if ( rnumnonpx.test(val) ) {
n@1106 5835 return val;
n@1106 5836 }
n@1106 5837
n@1106 5838 // Check for style in case a browser which returns unreliable values
n@1106 5839 // for getComputedStyle silently falls back to the reliable elem.style
n@1106 5840 valueIsBorderBox = isBorderBox &&
n@1106 5841 ( support.boxSizingReliable() || val === elem.style[ name ] );
n@1106 5842
n@1106 5843 // Normalize "", auto, and prepare for extra
n@1106 5844 val = parseFloat( val ) || 0;
n@1106 5845 }
n@1106 5846
n@1106 5847 // Use the active box-sizing model to add/subtract irrelevant styles
n@1106 5848 return ( val +
n@1106 5849 augmentWidthOrHeight(
n@1106 5850 elem,
n@1106 5851 name,
n@1106 5852 extra || ( isBorderBox ? "border" : "content" ),
n@1106 5853 valueIsBorderBox,
n@1106 5854 styles
n@1106 5855 )
n@1106 5856 ) + "px";
n@1106 5857 }
n@1106 5858
n@1106 5859 function showHide( elements, show ) {
n@1106 5860 var display, elem, hidden,
n@1106 5861 values = [],
n@1106 5862 index = 0,
n@1106 5863 length = elements.length;
n@1106 5864
n@1106 5865 for ( ; index < length; index++ ) {
n@1106 5866 elem = elements[ index ];
n@1106 5867 if ( !elem.style ) {
n@1106 5868 continue;
n@1106 5869 }
n@1106 5870
n@1106 5871 values[ index ] = data_priv.get( elem, "olddisplay" );
n@1106 5872 display = elem.style.display;
n@1106 5873 if ( show ) {
n@1106 5874 // Reset the inline display of this element to learn if it is
n@1106 5875 // being hidden by cascaded rules or not
n@1106 5876 if ( !values[ index ] && display === "none" ) {
n@1106 5877 elem.style.display = "";
n@1106 5878 }
n@1106 5879
n@1106 5880 // Set elements which have been overridden with display: none
n@1106 5881 // in a stylesheet to whatever the default browser style is
n@1106 5882 // for such an element
n@1106 5883 if ( elem.style.display === "" && isHidden( elem ) ) {
n@1106 5884 values[ index ] = data_priv.access( elem, "olddisplay", defaultDisplay(elem.nodeName) );
n@1106 5885 }
n@1106 5886 } else {
n@1106 5887 hidden = isHidden( elem );
n@1106 5888
n@1106 5889 if ( display !== "none" || !hidden ) {
n@1106 5890 data_priv.set( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
n@1106 5891 }
n@1106 5892 }
n@1106 5893 }
n@1106 5894
n@1106 5895 // Set the display of most of the elements in a second loop
n@1106 5896 // to avoid the constant reflow
n@1106 5897 for ( index = 0; index < length; index++ ) {
n@1106 5898 elem = elements[ index ];
n@1106 5899 if ( !elem.style ) {
n@1106 5900 continue;
n@1106 5901 }
n@1106 5902 if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
n@1106 5903 elem.style.display = show ? values[ index ] || "" : "none";
n@1106 5904 }
n@1106 5905 }
n@1106 5906
n@1106 5907 return elements;
n@1106 5908 }
n@1106 5909
n@1106 5910 jQuery.extend({
n@1106 5911
n@1106 5912 // Add in style property hooks for overriding the default
n@1106 5913 // behavior of getting and setting a style property
n@1106 5914 cssHooks: {
n@1106 5915 opacity: {
n@1106 5916 get: function( elem, computed ) {
n@1106 5917 if ( computed ) {
n@1106 5918
n@1106 5919 // We should always get a number back from opacity
n@1106 5920 var ret = curCSS( elem, "opacity" );
n@1106 5921 return ret === "" ? "1" : ret;
n@1106 5922 }
n@1106 5923 }
n@1106 5924 }
n@1106 5925 },
n@1106 5926
n@1106 5927 // Don't automatically add "px" to these possibly-unitless properties
n@1106 5928 cssNumber: {
n@1106 5929 "columnCount": true,
n@1106 5930 "fillOpacity": true,
n@1106 5931 "flexGrow": true,
n@1106 5932 "flexShrink": true,
n@1106 5933 "fontWeight": true,
n@1106 5934 "lineHeight": true,
n@1106 5935 "opacity": true,
n@1106 5936 "order": true,
n@1106 5937 "orphans": true,
n@1106 5938 "widows": true,
n@1106 5939 "zIndex": true,
n@1106 5940 "zoom": true
n@1106 5941 },
n@1106 5942
n@1106 5943 // Add in properties whose names you wish to fix before
n@1106 5944 // setting or getting the value
n@1106 5945 cssProps: {
n@1106 5946 "float": "cssFloat"
n@1106 5947 },
n@1106 5948
n@1106 5949 // Get and set the style property on a DOM Node
n@1106 5950 style: function( elem, name, value, extra ) {
n@1106 5951
n@1106 5952 // Don't set styles on text and comment nodes
n@1106 5953 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
n@1106 5954 return;
n@1106 5955 }
n@1106 5956
n@1106 5957 // Make sure that we're working with the right name
n@1106 5958 var ret, type, hooks,
n@1106 5959 origName = jQuery.camelCase( name ),
n@1106 5960 style = elem.style;
n@1106 5961
n@1106 5962 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
n@1106 5963
n@1106 5964 // Gets hook for the prefixed version, then unprefixed version
n@1106 5965 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
n@1106 5966
n@1106 5967 // Check if we're setting a value
n@1106 5968 if ( value !== undefined ) {
n@1106 5969 type = typeof value;
n@1106 5970
n@1106 5971 // Convert "+=" or "-=" to relative numbers (#7345)
n@1106 5972 if ( type === "string" && (ret = rrelNum.exec( value )) ) {
n@1106 5973 value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
n@1106 5974 // Fixes bug #9237
n@1106 5975 type = "number";
n@1106 5976 }
n@1106 5977
n@1106 5978 // Make sure that null and NaN values aren't set (#7116)
n@1106 5979 if ( value == null || value !== value ) {
n@1106 5980 return;
n@1106 5981 }
n@1106 5982
n@1106 5983 // If a number, add 'px' to the (except for certain CSS properties)
n@1106 5984 if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
n@1106 5985 value += "px";
n@1106 5986 }
n@1106 5987
n@1106 5988 // Support: IE9-11+
n@1106 5989 // background-* props affect original clone's values
n@1106 5990 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
n@1106 5991 style[ name ] = "inherit";
n@1106 5992 }
n@1106 5993
n@1106 5994 // If a hook was provided, use that value, otherwise just set the specified value
n@1106 5995 if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
n@1106 5996 style[ name ] = value;
n@1106 5997 }
n@1106 5998
n@1106 5999 } else {
n@1106 6000 // If a hook was provided get the non-computed value from there
n@1106 6001 if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
n@1106 6002 return ret;
n@1106 6003 }
n@1106 6004
n@1106 6005 // Otherwise just get the value from the style object
n@1106 6006 return style[ name ];
n@1106 6007 }
n@1106 6008 },
n@1106 6009
n@1106 6010 css: function( elem, name, extra, styles ) {
n@1106 6011 var val, num, hooks,
n@1106 6012 origName = jQuery.camelCase( name );
n@1106 6013
n@1106 6014 // Make sure that we're working with the right name
n@1106 6015 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
n@1106 6016
n@1106 6017 // Try prefixed name followed by the unprefixed name
n@1106 6018 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
n@1106 6019
n@1106 6020 // If a hook was provided get the computed value from there
n@1106 6021 if ( hooks && "get" in hooks ) {
n@1106 6022 val = hooks.get( elem, true, extra );
n@1106 6023 }
n@1106 6024
n@1106 6025 // Otherwise, if a way to get the computed value exists, use that
n@1106 6026 if ( val === undefined ) {
n@1106 6027 val = curCSS( elem, name, styles );
n@1106 6028 }
n@1106 6029
n@1106 6030 // Convert "normal" to computed value
n@1106 6031 if ( val === "normal" && name in cssNormalTransform ) {
n@1106 6032 val = cssNormalTransform[ name ];
n@1106 6033 }
n@1106 6034
n@1106 6035 // Make numeric if forced or a qualifier was provided and val looks numeric
n@1106 6036 if ( extra === "" || extra ) {
n@1106 6037 num = parseFloat( val );
n@1106 6038 return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
n@1106 6039 }
n@1106 6040 return val;
n@1106 6041 }
n@1106 6042 });
n@1106 6043
n@1106 6044 jQuery.each([ "height", "width" ], function( i, name ) {
n@1106 6045 jQuery.cssHooks[ name ] = {
n@1106 6046 get: function( elem, computed, extra ) {
n@1106 6047 if ( computed ) {
n@1106 6048
n@1106 6049 // Certain elements can have dimension info if we invisibly show them
n@1106 6050 // but it must have a current display style that would benefit
n@1106 6051 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ?
n@1106 6052 jQuery.swap( elem, cssShow, function() {
n@1106 6053 return getWidthOrHeight( elem, name, extra );
n@1106 6054 }) :
n@1106 6055 getWidthOrHeight( elem, name, extra );
n@1106 6056 }
n@1106 6057 },
n@1106 6058
n@1106 6059 set: function( elem, value, extra ) {
n@1106 6060 var styles = extra && getStyles( elem );
n@1106 6061 return setPositiveNumber( elem, value, extra ?
n@1106 6062 augmentWidthOrHeight(
n@1106 6063 elem,
n@1106 6064 name,
n@1106 6065 extra,
n@1106 6066 jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
n@1106 6067 styles
n@1106 6068 ) : 0
n@1106 6069 );
n@1106 6070 }
n@1106 6071 };
n@1106 6072 });
n@1106 6073
n@1106 6074 // Support: Android 2.3
n@1106 6075 jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
n@1106 6076 function( elem, computed ) {
n@1106 6077 if ( computed ) {
n@1106 6078 return jQuery.swap( elem, { "display": "inline-block" },
n@1106 6079 curCSS, [ elem, "marginRight" ] );
n@1106 6080 }
n@1106 6081 }
n@1106 6082 );
n@1106 6083
n@1106 6084 // These hooks are used by animate to expand properties
n@1106 6085 jQuery.each({
n@1106 6086 margin: "",
n@1106 6087 padding: "",
n@1106 6088 border: "Width"
n@1106 6089 }, function( prefix, suffix ) {
n@1106 6090 jQuery.cssHooks[ prefix + suffix ] = {
n@1106 6091 expand: function( value ) {
n@1106 6092 var i = 0,
n@1106 6093 expanded = {},
n@1106 6094
n@1106 6095 // Assumes a single number if not a string
n@1106 6096 parts = typeof value === "string" ? value.split(" ") : [ value ];
n@1106 6097
n@1106 6098 for ( ; i < 4; i++ ) {
n@1106 6099 expanded[ prefix + cssExpand[ i ] + suffix ] =
n@1106 6100 parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
n@1106 6101 }
n@1106 6102
n@1106 6103 return expanded;
n@1106 6104 }
n@1106 6105 };
n@1106 6106
n@1106 6107 if ( !rmargin.test( prefix ) ) {
n@1106 6108 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
n@1106 6109 }
n@1106 6110 });
n@1106 6111
n@1106 6112 jQuery.fn.extend({
n@1106 6113 css: function( name, value ) {
n@1106 6114 return access( this, function( elem, name, value ) {
n@1106 6115 var styles, len,
n@1106 6116 map = {},
n@1106 6117 i = 0;
n@1106 6118
n@1106 6119 if ( jQuery.isArray( name ) ) {
n@1106 6120 styles = getStyles( elem );
n@1106 6121 len = name.length;
n@1106 6122
n@1106 6123 for ( ; i < len; i++ ) {
n@1106 6124 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
n@1106 6125 }
n@1106 6126
n@1106 6127 return map;
n@1106 6128 }
n@1106 6129
n@1106 6130 return value !== undefined ?
n@1106 6131 jQuery.style( elem, name, value ) :
n@1106 6132 jQuery.css( elem, name );
n@1106 6133 }, name, value, arguments.length > 1 );
n@1106 6134 },
n@1106 6135 show: function() {
n@1106 6136 return showHide( this, true );
n@1106 6137 },
n@1106 6138 hide: function() {
n@1106 6139 return showHide( this );
n@1106 6140 },
n@1106 6141 toggle: function( state ) {
n@1106 6142 if ( typeof state === "boolean" ) {
n@1106 6143 return state ? this.show() : this.hide();
n@1106 6144 }
n@1106 6145
n@1106 6146 return this.each(function() {
n@1106 6147 if ( isHidden( this ) ) {
n@1106 6148 jQuery( this ).show();
n@1106 6149 } else {
n@1106 6150 jQuery( this ).hide();
n@1106 6151 }
n@1106 6152 });
n@1106 6153 }
n@1106 6154 });
n@1106 6155
n@1106 6156
n@1106 6157 function Tween( elem, options, prop, end, easing ) {
n@1106 6158 return new Tween.prototype.init( elem, options, prop, end, easing );
n@1106 6159 }
n@1106 6160 jQuery.Tween = Tween;
n@1106 6161
n@1106 6162 Tween.prototype = {
n@1106 6163 constructor: Tween,
n@1106 6164 init: function( elem, options, prop, end, easing, unit ) {
n@1106 6165 this.elem = elem;
n@1106 6166 this.prop = prop;
n@1106 6167 this.easing = easing || "swing";
n@1106 6168 this.options = options;
n@1106 6169 this.start = this.now = this.cur();
n@1106 6170 this.end = end;
n@1106 6171 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
n@1106 6172 },
n@1106 6173 cur: function() {
n@1106 6174 var hooks = Tween.propHooks[ this.prop ];
n@1106 6175
n@1106 6176 return hooks && hooks.get ?
n@1106 6177 hooks.get( this ) :
n@1106 6178 Tween.propHooks._default.get( this );
n@1106 6179 },
n@1106 6180 run: function( percent ) {
n@1106 6181 var eased,
n@1106 6182 hooks = Tween.propHooks[ this.prop ];
n@1106 6183
n@1106 6184 if ( this.options.duration ) {
n@1106 6185 this.pos = eased = jQuery.easing[ this.easing ](
n@1106 6186 percent, this.options.duration * percent, 0, 1, this.options.duration
n@1106 6187 );
n@1106 6188 } else {
n@1106 6189 this.pos = eased = percent;
n@1106 6190 }
n@1106 6191 this.now = ( this.end - this.start ) * eased + this.start;
n@1106 6192
n@1106 6193 if ( this.options.step ) {
n@1106 6194 this.options.step.call( this.elem, this.now, this );
n@1106 6195 }
n@1106 6196
n@1106 6197 if ( hooks && hooks.set ) {
n@1106 6198 hooks.set( this );
n@1106 6199 } else {
n@1106 6200 Tween.propHooks._default.set( this );
n@1106 6201 }
n@1106 6202 return this;
n@1106 6203 }
n@1106 6204 };
n@1106 6205
n@1106 6206 Tween.prototype.init.prototype = Tween.prototype;
n@1106 6207
n@1106 6208 Tween.propHooks = {
n@1106 6209 _default: {
n@1106 6210 get: function( tween ) {
n@1106 6211 var result;
n@1106 6212
n@1106 6213 if ( tween.elem[ tween.prop ] != null &&
n@1106 6214 (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
n@1106 6215 return tween.elem[ tween.prop ];
n@1106 6216 }
n@1106 6217
n@1106 6218 // Passing an empty string as a 3rd parameter to .css will automatically
n@1106 6219 // attempt a parseFloat and fallback to a string if the parse fails.
n@1106 6220 // Simple values such as "10px" are parsed to Float;
n@1106 6221 // complex values such as "rotate(1rad)" are returned as-is.
n@1106 6222 result = jQuery.css( tween.elem, tween.prop, "" );
n@1106 6223 // Empty strings, null, undefined and "auto" are converted to 0.
n@1106 6224 return !result || result === "auto" ? 0 : result;
n@1106 6225 },
n@1106 6226 set: function( tween ) {
n@1106 6227 // Use step hook for back compat.
n@1106 6228 // Use cssHook if its there.
n@1106 6229 // Use .style if available and use plain properties where available.
n@1106 6230 if ( jQuery.fx.step[ tween.prop ] ) {
n@1106 6231 jQuery.fx.step[ tween.prop ]( tween );
n@1106 6232 } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
n@1106 6233 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
n@1106 6234 } else {
n@1106 6235 tween.elem[ tween.prop ] = tween.now;
n@1106 6236 }
n@1106 6237 }
n@1106 6238 }
n@1106 6239 };
n@1106 6240
n@1106 6241 // Support: IE9
n@1106 6242 // Panic based approach to setting things on disconnected nodes
n@1106 6243 Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
n@1106 6244 set: function( tween ) {
n@1106 6245 if ( tween.elem.nodeType && tween.elem.parentNode ) {
n@1106 6246 tween.elem[ tween.prop ] = tween.now;
n@1106 6247 }
n@1106 6248 }
n@1106 6249 };
n@1106 6250
n@1106 6251 jQuery.easing = {
n@1106 6252 linear: function( p ) {
n@1106 6253 return p;
n@1106 6254 },
n@1106 6255 swing: function( p ) {
n@1106 6256 return 0.5 - Math.cos( p * Math.PI ) / 2;
n@1106 6257 }
n@1106 6258 };
n@1106 6259
n@1106 6260 jQuery.fx = Tween.prototype.init;
n@1106 6261
n@1106 6262 // Back Compat <1.8 extension point
n@1106 6263 jQuery.fx.step = {};
n@1106 6264
n@1106 6265
n@1106 6266
n@1106 6267
n@1106 6268 var
n@1106 6269 fxNow, timerId,
n@1106 6270 rfxtypes = /^(?:toggle|show|hide)$/,
n@1106 6271 rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ),
n@1106 6272 rrun = /queueHooks$/,
n@1106 6273 animationPrefilters = [ defaultPrefilter ],
n@1106 6274 tweeners = {
n@1106 6275 "*": [ function( prop, value ) {
n@1106 6276 var tween = this.createTween( prop, value ),
n@1106 6277 target = tween.cur(),
n@1106 6278 parts = rfxnum.exec( value ),
n@1106 6279 unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
n@1106 6280
n@1106 6281 // Starting value computation is required for potential unit mismatches
n@1106 6282 start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) &&
n@1106 6283 rfxnum.exec( jQuery.css( tween.elem, prop ) ),
n@1106 6284 scale = 1,
n@1106 6285 maxIterations = 20;
n@1106 6286
n@1106 6287 if ( start && start[ 3 ] !== unit ) {
n@1106 6288 // Trust units reported by jQuery.css
n@1106 6289 unit = unit || start[ 3 ];
n@1106 6290
n@1106 6291 // Make sure we update the tween properties later on
n@1106 6292 parts = parts || [];
n@1106 6293
n@1106 6294 // Iteratively approximate from a nonzero starting point
n@1106 6295 start = +target || 1;
n@1106 6296
n@1106 6297 do {
n@1106 6298 // If previous iteration zeroed out, double until we get *something*.
n@1106 6299 // Use string for doubling so we don't accidentally see scale as unchanged below
n@1106 6300 scale = scale || ".5";
n@1106 6301
n@1106 6302 // Adjust and apply
n@1106 6303 start = start / scale;
n@1106 6304 jQuery.style( tween.elem, prop, start + unit );
n@1106 6305
n@1106 6306 // Update scale, tolerating zero or NaN from tween.cur(),
n@1106 6307 // break the loop if scale is unchanged or perfect, or if we've just had enough
n@1106 6308 } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
n@1106 6309 }
n@1106 6310
n@1106 6311 // Update tween properties
n@1106 6312 if ( parts ) {
n@1106 6313 start = tween.start = +start || +target || 0;
n@1106 6314 tween.unit = unit;
n@1106 6315 // If a +=/-= token was provided, we're doing a relative animation
n@1106 6316 tween.end = parts[ 1 ] ?
n@1106 6317 start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :
n@1106 6318 +parts[ 2 ];
n@1106 6319 }
n@1106 6320
n@1106 6321 return tween;
n@1106 6322 } ]
n@1106 6323 };
n@1106 6324
n@1106 6325 // Animations created synchronously will run synchronously
n@1106 6326 function createFxNow() {
n@1106 6327 setTimeout(function() {
n@1106 6328 fxNow = undefined;
n@1106 6329 });
n@1106 6330 return ( fxNow = jQuery.now() );
n@1106 6331 }
n@1106 6332
n@1106 6333 // Generate parameters to create a standard animation
n@1106 6334 function genFx( type, includeWidth ) {
n@1106 6335 var which,
n@1106 6336 i = 0,
n@1106 6337 attrs = { height: type };
n@1106 6338
n@1106 6339 // If we include width, step value is 1 to do all cssExpand values,
n@1106 6340 // otherwise step value is 2 to skip over Left and Right
n@1106 6341 includeWidth = includeWidth ? 1 : 0;
n@1106 6342 for ( ; i < 4 ; i += 2 - includeWidth ) {
n@1106 6343 which = cssExpand[ i ];
n@1106 6344 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
n@1106 6345 }
n@1106 6346
n@1106 6347 if ( includeWidth ) {
n@1106 6348 attrs.opacity = attrs.width = type;
n@1106 6349 }
n@1106 6350
n@1106 6351 return attrs;
n@1106 6352 }
n@1106 6353
n@1106 6354 function createTween( value, prop, animation ) {
n@1106 6355 var tween,
n@1106 6356 collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
n@1106 6357 index = 0,
n@1106 6358 length = collection.length;
n@1106 6359 for ( ; index < length; index++ ) {
n@1106 6360 if ( (tween = collection[ index ].call( animation, prop, value )) ) {
n@1106 6361
n@1106 6362 // We're done with this property
n@1106 6363 return tween;
n@1106 6364 }
n@1106 6365 }
n@1106 6366 }
n@1106 6367
n@1106 6368 function defaultPrefilter( elem, props, opts ) {
n@1106 6369 /* jshint validthis: true */
n@1106 6370 var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
n@1106 6371 anim = this,
n@1106 6372 orig = {},
n@1106 6373 style = elem.style,
n@1106 6374 hidden = elem.nodeType && isHidden( elem ),
n@1106 6375 dataShow = data_priv.get( elem, "fxshow" );
n@1106 6376
n@1106 6377 // Handle queue: false promises
n@1106 6378 if ( !opts.queue ) {
n@1106 6379 hooks = jQuery._queueHooks( elem, "fx" );
n@1106 6380 if ( hooks.unqueued == null ) {
n@1106 6381 hooks.unqueued = 0;
n@1106 6382 oldfire = hooks.empty.fire;
n@1106 6383 hooks.empty.fire = function() {
n@1106 6384 if ( !hooks.unqueued ) {
n@1106 6385 oldfire();
n@1106 6386 }
n@1106 6387 };
n@1106 6388 }
n@1106 6389 hooks.unqueued++;
n@1106 6390
n@1106 6391 anim.always(function() {
n@1106 6392 // Ensure the complete handler is called before this completes
n@1106 6393 anim.always(function() {
n@1106 6394 hooks.unqueued--;
n@1106 6395 if ( !jQuery.queue( elem, "fx" ).length ) {
n@1106 6396 hooks.empty.fire();
n@1106 6397 }
n@1106 6398 });
n@1106 6399 });
n@1106 6400 }
n@1106 6401
n@1106 6402 // Height/width overflow pass
n@1106 6403 if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
n@1106 6404 // Make sure that nothing sneaks out
n@1106 6405 // Record all 3 overflow attributes because IE9-10 do not
n@1106 6406 // change the overflow attribute when overflowX and
n@1106 6407 // overflowY are set to the same value
n@1106 6408 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
n@1106 6409
n@1106 6410 // Set display property to inline-block for height/width
n@1106 6411 // animations on inline elements that are having width/height animated
n@1106 6412 display = jQuery.css( elem, "display" );
n@1106 6413
n@1106 6414 // Test default display if display is currently "none"
n@1106 6415 checkDisplay = display === "none" ?
n@1106 6416 data_priv.get( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
n@1106 6417
n@1106 6418 if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
n@1106 6419 style.display = "inline-block";
n@1106 6420 }
n@1106 6421 }
n@1106 6422
n@1106 6423 if ( opts.overflow ) {
n@1106 6424 style.overflow = "hidden";
n@1106 6425 anim.always(function() {
n@1106 6426 style.overflow = opts.overflow[ 0 ];
n@1106 6427 style.overflowX = opts.overflow[ 1 ];
n@1106 6428 style.overflowY = opts.overflow[ 2 ];
n@1106 6429 });
n@1106 6430 }
n@1106 6431
n@1106 6432 // show/hide pass
n@1106 6433 for ( prop in props ) {
n@1106 6434 value = props[ prop ];
n@1106 6435 if ( rfxtypes.exec( value ) ) {
n@1106 6436 delete props[ prop ];
n@1106 6437 toggle = toggle || value === "toggle";
n@1106 6438 if ( value === ( hidden ? "hide" : "show" ) ) {
n@1106 6439
n@1106 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
n@1106 6441 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
n@1106 6442 hidden = true;
n@1106 6443 } else {
n@1106 6444 continue;
n@1106 6445 }
n@1106 6446 }
n@1106 6447 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
n@1106 6448
n@1106 6449 // Any non-fx value stops us from restoring the original display value
n@1106 6450 } else {
n@1106 6451 display = undefined;
n@1106 6452 }
n@1106 6453 }
n@1106 6454
n@1106 6455 if ( !jQuery.isEmptyObject( orig ) ) {
n@1106 6456 if ( dataShow ) {
n@1106 6457 if ( "hidden" in dataShow ) {
n@1106 6458 hidden = dataShow.hidden;
n@1106 6459 }
n@1106 6460 } else {
n@1106 6461 dataShow = data_priv.access( elem, "fxshow", {} );
n@1106 6462 }
n@1106 6463
n@1106 6464 // Store state if its toggle - enables .stop().toggle() to "reverse"
n@1106 6465 if ( toggle ) {
n@1106 6466 dataShow.hidden = !hidden;
n@1106 6467 }
n@1106 6468 if ( hidden ) {
n@1106 6469 jQuery( elem ).show();
n@1106 6470 } else {
n@1106 6471 anim.done(function() {
n@1106 6472 jQuery( elem ).hide();
n@1106 6473 });
n@1106 6474 }
n@1106 6475 anim.done(function() {
n@1106 6476 var prop;
n@1106 6477
n@1106 6478 data_priv.remove( elem, "fxshow" );
n@1106 6479 for ( prop in orig ) {
n@1106 6480 jQuery.style( elem, prop, orig[ prop ] );
n@1106 6481 }
n@1106 6482 });
n@1106 6483 for ( prop in orig ) {
n@1106 6484 tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
n@1106 6485
n@1106 6486 if ( !( prop in dataShow ) ) {
n@1106 6487 dataShow[ prop ] = tween.start;
n@1106 6488 if ( hidden ) {
n@1106 6489 tween.end = tween.start;
n@1106 6490 tween.start = prop === "width" || prop === "height" ? 1 : 0;
n@1106 6491 }
n@1106 6492 }
n@1106 6493 }
n@1106 6494
n@1106 6495 // If this is a noop like .hide().hide(), restore an overwritten display value
n@1106 6496 } else if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" ) {
n@1106 6497 style.display = display;
n@1106 6498 }
n@1106 6499 }
n@1106 6500
n@1106 6501 function propFilter( props, specialEasing ) {
n@1106 6502 var index, name, easing, value, hooks;
n@1106 6503
n@1106 6504 // camelCase, specialEasing and expand cssHook pass
n@1106 6505 for ( index in props ) {
n@1106 6506 name = jQuery.camelCase( index );
n@1106 6507 easing = specialEasing[ name ];
n@1106 6508 value = props[ index ];
n@1106 6509 if ( jQuery.isArray( value ) ) {
n@1106 6510 easing = value[ 1 ];
n@1106 6511 value = props[ index ] = value[ 0 ];
n@1106 6512 }
n@1106 6513
n@1106 6514 if ( index !== name ) {
n@1106 6515 props[ name ] = value;
n@1106 6516 delete props[ index ];
n@1106 6517 }
n@1106 6518
n@1106 6519 hooks = jQuery.cssHooks[ name ];
n@1106 6520 if ( hooks && "expand" in hooks ) {
n@1106 6521 value = hooks.expand( value );
n@1106 6522 delete props[ name ];
n@1106 6523
n@1106 6524 // Not quite $.extend, this won't overwrite existing keys.
n@1106 6525 // Reusing 'index' because we have the correct "name"
n@1106 6526 for ( index in value ) {
n@1106 6527 if ( !( index in props ) ) {
n@1106 6528 props[ index ] = value[ index ];
n@1106 6529 specialEasing[ index ] = easing;
n@1106 6530 }
n@1106 6531 }
n@1106 6532 } else {
n@1106 6533 specialEasing[ name ] = easing;
n@1106 6534 }
n@1106 6535 }
n@1106 6536 }
n@1106 6537
n@1106 6538 function Animation( elem, properties, options ) {
n@1106 6539 var result,
n@1106 6540 stopped,
n@1106 6541 index = 0,
n@1106 6542 length = animationPrefilters.length,
n@1106 6543 deferred = jQuery.Deferred().always( function() {
n@1106 6544 // Don't match elem in the :animated selector
n@1106 6545 delete tick.elem;
n@1106 6546 }),
n@1106 6547 tick = function() {
n@1106 6548 if ( stopped ) {
n@1106 6549 return false;
n@1106 6550 }
n@1106 6551 var currentTime = fxNow || createFxNow(),
n@1106 6552 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
n@1106 6553 // Support: Android 2.3
n@1106 6554 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
n@1106 6555 temp = remaining / animation.duration || 0,
n@1106 6556 percent = 1 - temp,
n@1106 6557 index = 0,
n@1106 6558 length = animation.tweens.length;
n@1106 6559
n@1106 6560 for ( ; index < length ; index++ ) {
n@1106 6561 animation.tweens[ index ].run( percent );
n@1106 6562 }
n@1106 6563
n@1106 6564 deferred.notifyWith( elem, [ animation, percent, remaining ]);
n@1106 6565
n@1106 6566 if ( percent < 1 && length ) {
n@1106 6567 return remaining;
n@1106 6568 } else {
n@1106 6569 deferred.resolveWith( elem, [ animation ] );
n@1106 6570 return false;
n@1106 6571 }
n@1106 6572 },
n@1106 6573 animation = deferred.promise({
n@1106 6574 elem: elem,
n@1106 6575 props: jQuery.extend( {}, properties ),
n@1106 6576 opts: jQuery.extend( true, { specialEasing: {} }, options ),
n@1106 6577 originalProperties: properties,
n@1106 6578 originalOptions: options,
n@1106 6579 startTime: fxNow || createFxNow(),
n@1106 6580 duration: options.duration,
n@1106 6581 tweens: [],
n@1106 6582 createTween: function( prop, end ) {
n@1106 6583 var tween = jQuery.Tween( elem, animation.opts, prop, end,
n@1106 6584 animation.opts.specialEasing[ prop ] || animation.opts.easing );
n@1106 6585 animation.tweens.push( tween );
n@1106 6586 return tween;
n@1106 6587 },
n@1106 6588 stop: function( gotoEnd ) {
n@1106 6589 var index = 0,
n@1106 6590 // If we are going to the end, we want to run all the tweens
n@1106 6591 // otherwise we skip this part
n@1106 6592 length = gotoEnd ? animation.tweens.length : 0;
n@1106 6593 if ( stopped ) {
n@1106 6594 return this;
n@1106 6595 }
n@1106 6596 stopped = true;
n@1106 6597 for ( ; index < length ; index++ ) {
n@1106 6598 animation.tweens[ index ].run( 1 );
n@1106 6599 }
n@1106 6600
n@1106 6601 // Resolve when we played the last frame; otherwise, reject
n@1106 6602 if ( gotoEnd ) {
n@1106 6603 deferred.resolveWith( elem, [ animation, gotoEnd ] );
n@1106 6604 } else {
n@1106 6605 deferred.rejectWith( elem, [ animation, gotoEnd ] );
n@1106 6606 }
n@1106 6607 return this;
n@1106 6608 }
n@1106 6609 }),
n@1106 6610 props = animation.props;
n@1106 6611
n@1106 6612 propFilter( props, animation.opts.specialEasing );
n@1106 6613
n@1106 6614 for ( ; index < length ; index++ ) {
n@1106 6615 result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
n@1106 6616 if ( result ) {
n@1106 6617 return result;
n@1106 6618 }
n@1106 6619 }
n@1106 6620
n@1106 6621 jQuery.map( props, createTween, animation );
n@1106 6622
n@1106 6623 if ( jQuery.isFunction( animation.opts.start ) ) {
n@1106 6624 animation.opts.start.call( elem, animation );
n@1106 6625 }
n@1106 6626
n@1106 6627 jQuery.fx.timer(
n@1106 6628 jQuery.extend( tick, {
n@1106 6629 elem: elem,
n@1106 6630 anim: animation,
n@1106 6631 queue: animation.opts.queue
n@1106 6632 })
n@1106 6633 );
n@1106 6634
n@1106 6635 // attach callbacks from options
n@1106 6636 return animation.progress( animation.opts.progress )
n@1106 6637 .done( animation.opts.done, animation.opts.complete )
n@1106 6638 .fail( animation.opts.fail )
n@1106 6639 .always( animation.opts.always );
n@1106 6640 }
n@1106 6641
n@1106 6642 jQuery.Animation = jQuery.extend( Animation, {
n@1106 6643
n@1106 6644 tweener: function( props, callback ) {
n@1106 6645 if ( jQuery.isFunction( props ) ) {
n@1106 6646 callback = props;
n@1106 6647 props = [ "*" ];
n@1106 6648 } else {
n@1106 6649 props = props.split(" ");
n@1106 6650 }
n@1106 6651
n@1106 6652 var prop,
n@1106 6653 index = 0,
n@1106 6654 length = props.length;
n@1106 6655
n@1106 6656 for ( ; index < length ; index++ ) {
n@1106 6657 prop = props[ index ];
n@1106 6658 tweeners[ prop ] = tweeners[ prop ] || [];
n@1106 6659 tweeners[ prop ].unshift( callback );
n@1106 6660 }
n@1106 6661 },
n@1106 6662
n@1106 6663 prefilter: function( callback, prepend ) {
n@1106 6664 if ( prepend ) {
n@1106 6665 animationPrefilters.unshift( callback );
n@1106 6666 } else {
n@1106 6667 animationPrefilters.push( callback );
n@1106 6668 }
n@1106 6669 }
n@1106 6670 });
n@1106 6671
n@1106 6672 jQuery.speed = function( speed, easing, fn ) {
n@1106 6673 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
n@1106 6674 complete: fn || !fn && easing ||
n@1106 6675 jQuery.isFunction( speed ) && speed,
n@1106 6676 duration: speed,
n@1106 6677 easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
n@1106 6678 };
n@1106 6679
n@1106 6680 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
n@1106 6681 opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
n@1106 6682
n@1106 6683 // Normalize opt.queue - true/undefined/null -> "fx"
n@1106 6684 if ( opt.queue == null || opt.queue === true ) {
n@1106 6685 opt.queue = "fx";
n@1106 6686 }
n@1106 6687
n@1106 6688 // Queueing
n@1106 6689 opt.old = opt.complete;
n@1106 6690
n@1106 6691 opt.complete = function() {
n@1106 6692 if ( jQuery.isFunction( opt.old ) ) {
n@1106 6693 opt.old.call( this );
n@1106 6694 }
n@1106 6695
n@1106 6696 if ( opt.queue ) {
n@1106 6697 jQuery.dequeue( this, opt.queue );
n@1106 6698 }
n@1106 6699 };
n@1106 6700
n@1106 6701 return opt;
n@1106 6702 };
n@1106 6703
n@1106 6704 jQuery.fn.extend({
n@1106 6705 fadeTo: function( speed, to, easing, callback ) {
n@1106 6706
n@1106 6707 // Show any hidden elements after setting opacity to 0
n@1106 6708 return this.filter( isHidden ).css( "opacity", 0 ).show()
n@1106 6709
n@1106 6710 // Animate to the value specified
n@1106 6711 .end().animate({ opacity: to }, speed, easing, callback );
n@1106 6712 },
n@1106 6713 animate: function( prop, speed, easing, callback ) {
n@1106 6714 var empty = jQuery.isEmptyObject( prop ),
n@1106 6715 optall = jQuery.speed( speed, easing, callback ),
n@1106 6716 doAnimation = function() {
n@1106 6717 // Operate on a copy of prop so per-property easing won't be lost
n@1106 6718 var anim = Animation( this, jQuery.extend( {}, prop ), optall );
n@1106 6719
n@1106 6720 // Empty animations, or finishing resolves immediately
n@1106 6721 if ( empty || data_priv.get( this, "finish" ) ) {
n@1106 6722 anim.stop( true );
n@1106 6723 }
n@1106 6724 };
n@1106 6725 doAnimation.finish = doAnimation;
n@1106 6726
n@1106 6727 return empty || optall.queue === false ?
n@1106 6728 this.each( doAnimation ) :
n@1106 6729 this.queue( optall.queue, doAnimation );
n@1106 6730 },
n@1106 6731 stop: function( type, clearQueue, gotoEnd ) {
n@1106 6732 var stopQueue = function( hooks ) {
n@1106 6733 var stop = hooks.stop;
n@1106 6734 delete hooks.stop;
n@1106 6735 stop( gotoEnd );
n@1106 6736 };
n@1106 6737
n@1106 6738 if ( typeof type !== "string" ) {
n@1106 6739 gotoEnd = clearQueue;
n@1106 6740 clearQueue = type;
n@1106 6741 type = undefined;
n@1106 6742 }
n@1106 6743 if ( clearQueue && type !== false ) {
n@1106 6744 this.queue( type || "fx", [] );
n@1106 6745 }
n@1106 6746
n@1106 6747 return this.each(function() {
n@1106 6748 var dequeue = true,
n@1106 6749 index = type != null && type + "queueHooks",
n@1106 6750 timers = jQuery.timers,
n@1106 6751 data = data_priv.get( this );
n@1106 6752
n@1106 6753 if ( index ) {
n@1106 6754 if ( data[ index ] && data[ index ].stop ) {
n@1106 6755 stopQueue( data[ index ] );
n@1106 6756 }
n@1106 6757 } else {
n@1106 6758 for ( index in data ) {
n@1106 6759 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
n@1106 6760 stopQueue( data[ index ] );
n@1106 6761 }
n@1106 6762 }
n@1106 6763 }
n@1106 6764
n@1106 6765 for ( index = timers.length; index--; ) {
n@1106 6766 if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
n@1106 6767 timers[ index ].anim.stop( gotoEnd );
n@1106 6768 dequeue = false;
n@1106 6769 timers.splice( index, 1 );
n@1106 6770 }
n@1106 6771 }
n@1106 6772
n@1106 6773 // Start the next in the queue if the last step wasn't forced.
n@1106 6774 // Timers currently will call their complete callbacks, which
n@1106 6775 // will dequeue but only if they were gotoEnd.
n@1106 6776 if ( dequeue || !gotoEnd ) {
n@1106 6777 jQuery.dequeue( this, type );
n@1106 6778 }
n@1106 6779 });
n@1106 6780 },
n@1106 6781 finish: function( type ) {
n@1106 6782 if ( type !== false ) {
n@1106 6783 type = type || "fx";
n@1106 6784 }
n@1106 6785 return this.each(function() {
n@1106 6786 var index,
n@1106 6787 data = data_priv.get( this ),
n@1106 6788 queue = data[ type + "queue" ],
n@1106 6789 hooks = data[ type + "queueHooks" ],
n@1106 6790 timers = jQuery.timers,
n@1106 6791 length = queue ? queue.length : 0;
n@1106 6792
n@1106 6793 // Enable finishing flag on private data
n@1106 6794 data.finish = true;
n@1106 6795
n@1106 6796 // Empty the queue first
n@1106 6797 jQuery.queue( this, type, [] );
n@1106 6798
n@1106 6799 if ( hooks && hooks.stop ) {
n@1106 6800 hooks.stop.call( this, true );
n@1106 6801 }
n@1106 6802
n@1106 6803 // Look for any active animations, and finish them
n@1106 6804 for ( index = timers.length; index--; ) {
n@1106 6805 if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
n@1106 6806 timers[ index ].anim.stop( true );
n@1106 6807 timers.splice( index, 1 );
n@1106 6808 }
n@1106 6809 }
n@1106 6810
n@1106 6811 // Look for any animations in the old queue and finish them
n@1106 6812 for ( index = 0; index < length; index++ ) {
n@1106 6813 if ( queue[ index ] && queue[ index ].finish ) {
n@1106 6814 queue[ index ].finish.call( this );
n@1106 6815 }
n@1106 6816 }
n@1106 6817
n@1106 6818 // Turn off finishing flag
n@1106 6819 delete data.finish;
n@1106 6820 });
n@1106 6821 }
n@1106 6822 });
n@1106 6823
n@1106 6824 jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
n@1106 6825 var cssFn = jQuery.fn[ name ];
n@1106 6826 jQuery.fn[ name ] = function( speed, easing, callback ) {
n@1106 6827 return speed == null || typeof speed === "boolean" ?
n@1106 6828 cssFn.apply( this, arguments ) :
n@1106 6829 this.animate( genFx( name, true ), speed, easing, callback );
n@1106 6830 };
n@1106 6831 });
n@1106 6832
n@1106 6833 // Generate shortcuts for custom animations
n@1106 6834 jQuery.each({
n@1106 6835 slideDown: genFx("show"),
n@1106 6836 slideUp: genFx("hide"),
n@1106 6837 slideToggle: genFx("toggle"),
n@1106 6838 fadeIn: { opacity: "show" },
n@1106 6839 fadeOut: { opacity: "hide" },
n@1106 6840 fadeToggle: { opacity: "toggle" }
n@1106 6841 }, function( name, props ) {
n@1106 6842 jQuery.fn[ name ] = function( speed, easing, callback ) {
n@1106 6843 return this.animate( props, speed, easing, callback );
n@1106 6844 };
n@1106 6845 });
n@1106 6846
n@1106 6847 jQuery.timers = [];
n@1106 6848 jQuery.fx.tick = function() {
n@1106 6849 var timer,
n@1106 6850 i = 0,
n@1106 6851 timers = jQuery.timers;
n@1106 6852
n@1106 6853 fxNow = jQuery.now();
n@1106 6854
n@1106 6855 for ( ; i < timers.length; i++ ) {
n@1106 6856 timer = timers[ i ];
n@1106 6857 // Checks the timer has not already been removed
n@1106 6858 if ( !timer() && timers[ i ] === timer ) {
n@1106 6859 timers.splice( i--, 1 );
n@1106 6860 }
n@1106 6861 }
n@1106 6862
n@1106 6863 if ( !timers.length ) {
n@1106 6864 jQuery.fx.stop();
n@1106 6865 }
n@1106 6866 fxNow = undefined;
n@1106 6867 };
n@1106 6868
n@1106 6869 jQuery.fx.timer = function( timer ) {
n@1106 6870 jQuery.timers.push( timer );
n@1106 6871 if ( timer() ) {
n@1106 6872 jQuery.fx.start();
n@1106 6873 } else {
n@1106 6874 jQuery.timers.pop();
n@1106 6875 }
n@1106 6876 };
n@1106 6877
n@1106 6878 jQuery.fx.interval = 13;
n@1106 6879
n@1106 6880 jQuery.fx.start = function() {
n@1106 6881 if ( !timerId ) {
n@1106 6882 timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
n@1106 6883 }
n@1106 6884 };
n@1106 6885
n@1106 6886 jQuery.fx.stop = function() {
n@1106 6887 clearInterval( timerId );
n@1106 6888 timerId = null;
n@1106 6889 };
n@1106 6890
n@1106 6891 jQuery.fx.speeds = {
n@1106 6892 slow: 600,
n@1106 6893 fast: 200,
n@1106 6894 // Default speed
n@1106 6895 _default: 400
n@1106 6896 };
n@1106 6897
n@1106 6898
n@1106 6899 // Based off of the plugin by Clint Helfers, with permission.
n@1106 6900 // http://blindsignals.com/index.php/2009/07/jquery-delay/
n@1106 6901 jQuery.fn.delay = function( time, type ) {
n@1106 6902 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
n@1106 6903 type = type || "fx";
n@1106 6904
n@1106 6905 return this.queue( type, function( next, hooks ) {
n@1106 6906 var timeout = setTimeout( next, time );
n@1106 6907 hooks.stop = function() {
n@1106 6908 clearTimeout( timeout );
n@1106 6909 };
n@1106 6910 });
n@1106 6911 };
n@1106 6912
n@1106 6913
n@1106 6914 (function() {
n@1106 6915 var input = document.createElement( "input" ),
n@1106 6916 select = document.createElement( "select" ),
n@1106 6917 opt = select.appendChild( document.createElement( "option" ) );
n@1106 6918
n@1106 6919 input.type = "checkbox";
n@1106 6920
n@1106 6921 // Support: iOS<=5.1, Android<=4.2+
n@1106 6922 // Default value for a checkbox should be "on"
n@1106 6923 support.checkOn = input.value !== "";
n@1106 6924
n@1106 6925 // Support: IE<=11+
n@1106 6926 // Must access selectedIndex to make default options select
n@1106 6927 support.optSelected = opt.selected;
n@1106 6928
n@1106 6929 // Support: Android<=2.3
n@1106 6930 // Options inside disabled selects are incorrectly marked as disabled
n@1106 6931 select.disabled = true;
n@1106 6932 support.optDisabled = !opt.disabled;
n@1106 6933
n@1106 6934 // Support: IE<=11+
n@1106 6935 // An input loses its value after becoming a radio
n@1106 6936 input = document.createElement( "input" );
n@1106 6937 input.value = "t";
n@1106 6938 input.type = "radio";
n@1106 6939 support.radioValue = input.value === "t";
n@1106 6940 })();
n@1106 6941
n@1106 6942
n@1106 6943 var nodeHook, boolHook,
n@1106 6944 attrHandle = jQuery.expr.attrHandle;
n@1106 6945
n@1106 6946 jQuery.fn.extend({
n@1106 6947 attr: function( name, value ) {
n@1106 6948 return access( this, jQuery.attr, name, value, arguments.length > 1 );
n@1106 6949 },
n@1106 6950
n@1106 6951 removeAttr: function( name ) {
n@1106 6952 return this.each(function() {
n@1106 6953 jQuery.removeAttr( this, name );
n@1106 6954 });
n@1106 6955 }
n@1106 6956 });
n@1106 6957
n@1106 6958 jQuery.extend({
n@1106 6959 attr: function( elem, name, value ) {
n@1106 6960 var hooks, ret,
n@1106 6961 nType = elem.nodeType;
n@1106 6962
n@1106 6963 // don't get/set attributes on text, comment and attribute nodes
n@1106 6964 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
n@1106 6965 return;
n@1106 6966 }
n@1106 6967
n@1106 6968 // Fallback to prop when attributes are not supported
n@1106 6969 if ( typeof elem.getAttribute === strundefined ) {
n@1106 6970 return jQuery.prop( elem, name, value );
n@1106 6971 }
n@1106 6972
n@1106 6973 // All attributes are lowercase
n@1106 6974 // Grab necessary hook if one is defined
n@1106 6975 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
n@1106 6976 name = name.toLowerCase();
n@1106 6977 hooks = jQuery.attrHooks[ name ] ||
n@1106 6978 ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
n@1106 6979 }
n@1106 6980
n@1106 6981 if ( value !== undefined ) {
n@1106 6982
n@1106 6983 if ( value === null ) {
n@1106 6984 jQuery.removeAttr( elem, name );
n@1106 6985
n@1106 6986 } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
n@1106 6987 return ret;
n@1106 6988
n@1106 6989 } else {
n@1106 6990 elem.setAttribute( name, value + "" );
n@1106 6991 return value;
n@1106 6992 }
n@1106 6993
n@1106 6994 } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
n@1106 6995 return ret;
n@1106 6996
n@1106 6997 } else {
n@1106 6998 ret = jQuery.find.attr( elem, name );
n@1106 6999
n@1106 7000 // Non-existent attributes return null, we normalize to undefined
n@1106 7001 return ret == null ?
n@1106 7002 undefined :
n@1106 7003 ret;
n@1106 7004 }
n@1106 7005 },
n@1106 7006
n@1106 7007 removeAttr: function( elem, value ) {
n@1106 7008 var name, propName,
n@1106 7009 i = 0,
n@1106 7010 attrNames = value && value.match( rnotwhite );
n@1106 7011
n@1106 7012 if ( attrNames && elem.nodeType === 1 ) {
n@1106 7013 while ( (name = attrNames[i++]) ) {
n@1106 7014 propName = jQuery.propFix[ name ] || name;
n@1106 7015
n@1106 7016 // Boolean attributes get special treatment (#10870)
n@1106 7017 if ( jQuery.expr.match.bool.test( name ) ) {
n@1106 7018 // Set corresponding property to false
n@1106 7019 elem[ propName ] = false;
n@1106 7020 }
n@1106 7021
n@1106 7022 elem.removeAttribute( name );
n@1106 7023 }
n@1106 7024 }
n@1106 7025 },
n@1106 7026
n@1106 7027 attrHooks: {
n@1106 7028 type: {
n@1106 7029 set: function( elem, value ) {
n@1106 7030 if ( !support.radioValue && value === "radio" &&
n@1106 7031 jQuery.nodeName( elem, "input" ) ) {
n@1106 7032 var val = elem.value;
n@1106 7033 elem.setAttribute( "type", value );
n@1106 7034 if ( val ) {
n@1106 7035 elem.value = val;
n@1106 7036 }
n@1106 7037 return value;
n@1106 7038 }
n@1106 7039 }
n@1106 7040 }
n@1106 7041 }
n@1106 7042 });
n@1106 7043
n@1106 7044 // Hooks for boolean attributes
n@1106 7045 boolHook = {
n@1106 7046 set: function( elem, value, name ) {
n@1106 7047 if ( value === false ) {
n@1106 7048 // Remove boolean attributes when set to false
n@1106 7049 jQuery.removeAttr( elem, name );
n@1106 7050 } else {
n@1106 7051 elem.setAttribute( name, name );
n@1106 7052 }
n@1106 7053 return name;
n@1106 7054 }
n@1106 7055 };
n@1106 7056 jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
n@1106 7057 var getter = attrHandle[ name ] || jQuery.find.attr;
n@1106 7058
n@1106 7059 attrHandle[ name ] = function( elem, name, isXML ) {
n@1106 7060 var ret, handle;
n@1106 7061 if ( !isXML ) {
n@1106 7062 // Avoid an infinite loop by temporarily removing this function from the getter
n@1106 7063 handle = attrHandle[ name ];
n@1106 7064 attrHandle[ name ] = ret;
n@1106 7065 ret = getter( elem, name, isXML ) != null ?
n@1106 7066 name.toLowerCase() :
n@1106 7067 null;
n@1106 7068 attrHandle[ name ] = handle;
n@1106 7069 }
n@1106 7070 return ret;
n@1106 7071 };
n@1106 7072 });
n@1106 7073
n@1106 7074
n@1106 7075
n@1106 7076
n@1106 7077 var rfocusable = /^(?:input|select|textarea|button)$/i;
n@1106 7078
n@1106 7079 jQuery.fn.extend({
n@1106 7080 prop: function( name, value ) {
n@1106 7081 return access( this, jQuery.prop, name, value, arguments.length > 1 );
n@1106 7082 },
n@1106 7083
n@1106 7084 removeProp: function( name ) {
n@1106 7085 return this.each(function() {
n@1106 7086 delete this[ jQuery.propFix[ name ] || name ];
n@1106 7087 });
n@1106 7088 }
n@1106 7089 });
n@1106 7090
n@1106 7091 jQuery.extend({
n@1106 7092 propFix: {
n@1106 7093 "for": "htmlFor",
n@1106 7094 "class": "className"
n@1106 7095 },
n@1106 7096
n@1106 7097 prop: function( elem, name, value ) {
n@1106 7098 var ret, hooks, notxml,
n@1106 7099 nType = elem.nodeType;
n@1106 7100
n@1106 7101 // Don't get/set properties on text, comment and attribute nodes
n@1106 7102 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
n@1106 7103 return;
n@1106 7104 }
n@1106 7105
n@1106 7106 notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
n@1106 7107
n@1106 7108 if ( notxml ) {
n@1106 7109 // Fix name and attach hooks
n@1106 7110 name = jQuery.propFix[ name ] || name;
n@1106 7111 hooks = jQuery.propHooks[ name ];
n@1106 7112 }
n@1106 7113
n@1106 7114 if ( value !== undefined ) {
n@1106 7115 return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
n@1106 7116 ret :
n@1106 7117 ( elem[ name ] = value );
n@1106 7118
n@1106 7119 } else {
n@1106 7120 return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
n@1106 7121 ret :
n@1106 7122 elem[ name ];
n@1106 7123 }
n@1106 7124 },
n@1106 7125
n@1106 7126 propHooks: {
n@1106 7127 tabIndex: {
n@1106 7128 get: function( elem ) {
n@1106 7129 return elem.hasAttribute( "tabindex" ) || rfocusable.test( elem.nodeName ) || elem.href ?
n@1106 7130 elem.tabIndex :
n@1106 7131 -1;
n@1106 7132 }
n@1106 7133 }
n@1106 7134 }
n@1106 7135 });
n@1106 7136
n@1106 7137 if ( !support.optSelected ) {
n@1106 7138 jQuery.propHooks.selected = {
n@1106 7139 get: function( elem ) {
n@1106 7140 var parent = elem.parentNode;
n@1106 7141 if ( parent && parent.parentNode ) {
n@1106 7142 parent.parentNode.selectedIndex;
n@1106 7143 }
n@1106 7144 return null;
n@1106 7145 }
n@1106 7146 };
n@1106 7147 }
n@1106 7148
n@1106 7149 jQuery.each([
n@1106 7150 "tabIndex",
n@1106 7151 "readOnly",
n@1106 7152 "maxLength",
n@1106 7153 "cellSpacing",
n@1106 7154 "cellPadding",
n@1106 7155 "rowSpan",
n@1106 7156 "colSpan",
n@1106 7157 "useMap",
n@1106 7158 "frameBorder",
n@1106 7159 "contentEditable"
n@1106 7160 ], function() {
n@1106 7161 jQuery.propFix[ this.toLowerCase() ] = this;
n@1106 7162 });
n@1106 7163
n@1106 7164
n@1106 7165
n@1106 7166
n@1106 7167 var rclass = /[\t\r\n\f]/g;
n@1106 7168
n@1106 7169 jQuery.fn.extend({
n@1106 7170 addClass: function( value ) {
n@1106 7171 var classes, elem, cur, clazz, j, finalValue,
n@1106 7172 proceed = typeof value === "string" && value,
n@1106 7173 i = 0,
n@1106 7174 len = this.length;
n@1106 7175
n@1106 7176 if ( jQuery.isFunction( value ) ) {
n@1106 7177 return this.each(function( j ) {
n@1106 7178 jQuery( this ).addClass( value.call( this, j, this.className ) );
n@1106 7179 });
n@1106 7180 }
n@1106 7181
n@1106 7182 if ( proceed ) {
n@1106 7183 // The disjunction here is for better compressibility (see removeClass)
n@1106 7184 classes = ( value || "" ).match( rnotwhite ) || [];
n@1106 7185
n@1106 7186 for ( ; i < len; i++ ) {
n@1106 7187 elem = this[ i ];
n@1106 7188 cur = elem.nodeType === 1 && ( elem.className ?
n@1106 7189 ( " " + elem.className + " " ).replace( rclass, " " ) :
n@1106 7190 " "
n@1106 7191 );
n@1106 7192
n@1106 7193 if ( cur ) {
n@1106 7194 j = 0;
n@1106 7195 while ( (clazz = classes[j++]) ) {
n@1106 7196 if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
n@1106 7197 cur += clazz + " ";
n@1106 7198 }
n@1106 7199 }
n@1106 7200
n@1106 7201 // only assign if different to avoid unneeded rendering.
n@1106 7202 finalValue = jQuery.trim( cur );
n@1106 7203 if ( elem.className !== finalValue ) {
n@1106 7204 elem.className = finalValue;
n@1106 7205 }
n@1106 7206 }
n@1106 7207 }
n@1106 7208 }
n@1106 7209
n@1106 7210 return this;
n@1106 7211 },
n@1106 7212
n@1106 7213 removeClass: function( value ) {
n@1106 7214 var classes, elem, cur, clazz, j, finalValue,
n@1106 7215 proceed = arguments.length === 0 || typeof value === "string" && value,
n@1106 7216 i = 0,
n@1106 7217 len = this.length;
n@1106 7218
n@1106 7219 if ( jQuery.isFunction( value ) ) {
n@1106 7220 return this.each(function( j ) {
n@1106 7221 jQuery( this ).removeClass( value.call( this, j, this.className ) );
n@1106 7222 });
n@1106 7223 }
n@1106 7224 if ( proceed ) {
n@1106 7225 classes = ( value || "" ).match( rnotwhite ) || [];
n@1106 7226
n@1106 7227 for ( ; i < len; i++ ) {
n@1106 7228 elem = this[ i ];
n@1106 7229 // This expression is here for better compressibility (see addClass)
n@1106 7230 cur = elem.nodeType === 1 && ( elem.className ?
n@1106 7231 ( " " + elem.className + " " ).replace( rclass, " " ) :
n@1106 7232 ""
n@1106 7233 );
n@1106 7234
n@1106 7235 if ( cur ) {
n@1106 7236 j = 0;
n@1106 7237 while ( (clazz = classes[j++]) ) {
n@1106 7238 // Remove *all* instances
n@1106 7239 while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
n@1106 7240 cur = cur.replace( " " + clazz + " ", " " );
n@1106 7241 }
n@1106 7242 }
n@1106 7243
n@1106 7244 // Only assign if different to avoid unneeded rendering.
n@1106 7245 finalValue = value ? jQuery.trim( cur ) : "";
n@1106 7246 if ( elem.className !== finalValue ) {
n@1106 7247 elem.className = finalValue;
n@1106 7248 }
n@1106 7249 }
n@1106 7250 }
n@1106 7251 }
n@1106 7252
n@1106 7253 return this;
n@1106 7254 },
n@1106 7255
n@1106 7256 toggleClass: function( value, stateVal ) {
n@1106 7257 var type = typeof value;
n@1106 7258
n@1106 7259 if ( typeof stateVal === "boolean" && type === "string" ) {
n@1106 7260 return stateVal ? this.addClass( value ) : this.removeClass( value );
n@1106 7261 }
n@1106 7262
n@1106 7263 if ( jQuery.isFunction( value ) ) {
n@1106 7264 return this.each(function( i ) {
n@1106 7265 jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
n@1106 7266 });
n@1106 7267 }
n@1106 7268
n@1106 7269 return this.each(function() {
n@1106 7270 if ( type === "string" ) {
n@1106 7271 // Toggle individual class names
n@1106 7272 var className,
n@1106 7273 i = 0,
n@1106 7274 self = jQuery( this ),
n@1106 7275 classNames = value.match( rnotwhite ) || [];
n@1106 7276
n@1106 7277 while ( (className = classNames[ i++ ]) ) {
n@1106 7278 // Check each className given, space separated list
n@1106 7279 if ( self.hasClass( className ) ) {
n@1106 7280 self.removeClass( className );
n@1106 7281 } else {
n@1106 7282 self.addClass( className );
n@1106 7283 }
n@1106 7284 }
n@1106 7285
n@1106 7286 // Toggle whole class name
n@1106 7287 } else if ( type === strundefined || type === "boolean" ) {
n@1106 7288 if ( this.className ) {
n@1106 7289 // store className if set
n@1106 7290 data_priv.set( this, "__className__", this.className );
n@1106 7291 }
n@1106 7292
n@1106 7293 // If the element has a class name or if we're passed `false`,
n@1106 7294 // then remove the whole classname (if there was one, the above saved it).
n@1106 7295 // Otherwise bring back whatever was previously saved (if anything),
n@1106 7296 // falling back to the empty string if nothing was stored.
n@1106 7297 this.className = this.className || value === false ? "" : data_priv.get( this, "__className__" ) || "";
n@1106 7298 }
n@1106 7299 });
n@1106 7300 },
n@1106 7301
n@1106 7302 hasClass: function( selector ) {
n@1106 7303 var className = " " + selector + " ",
n@1106 7304 i = 0,
n@1106 7305 l = this.length;
n@1106 7306 for ( ; i < l; i++ ) {
n@1106 7307 if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
n@1106 7308 return true;
n@1106 7309 }
n@1106 7310 }
n@1106 7311
n@1106 7312 return false;
n@1106 7313 }
n@1106 7314 });
n@1106 7315
n@1106 7316
n@1106 7317
n@1106 7318
n@1106 7319 var rreturn = /\r/g;
n@1106 7320
n@1106 7321 jQuery.fn.extend({
n@1106 7322 val: function( value ) {
n@1106 7323 var hooks, ret, isFunction,
n@1106 7324 elem = this[0];
n@1106 7325
n@1106 7326 if ( !arguments.length ) {
n@1106 7327 if ( elem ) {
n@1106 7328 hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
n@1106 7329
n@1106 7330 if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
n@1106 7331 return ret;
n@1106 7332 }
n@1106 7333
n@1106 7334 ret = elem.value;
n@1106 7335
n@1106 7336 return typeof ret === "string" ?
n@1106 7337 // Handle most common string cases
n@1106 7338 ret.replace(rreturn, "") :
n@1106 7339 // Handle cases where value is null/undef or number
n@1106 7340 ret == null ? "" : ret;
n@1106 7341 }
n@1106 7342
n@1106 7343 return;
n@1106 7344 }
n@1106 7345
n@1106 7346 isFunction = jQuery.isFunction( value );
n@1106 7347
n@1106 7348 return this.each(function( i ) {
n@1106 7349 var val;
n@1106 7350
n@1106 7351 if ( this.nodeType !== 1 ) {
n@1106 7352 return;
n@1106 7353 }
n@1106 7354
n@1106 7355 if ( isFunction ) {
n@1106 7356 val = value.call( this, i, jQuery( this ).val() );
n@1106 7357 } else {
n@1106 7358 val = value;
n@1106 7359 }
n@1106 7360
n@1106 7361 // Treat null/undefined as ""; convert numbers to string
n@1106 7362 if ( val == null ) {
n@1106 7363 val = "";
n@1106 7364
n@1106 7365 } else if ( typeof val === "number" ) {
n@1106 7366 val += "";
n@1106 7367
n@1106 7368 } else if ( jQuery.isArray( val ) ) {
n@1106 7369 val = jQuery.map( val, function( value ) {
n@1106 7370 return value == null ? "" : value + "";
n@1106 7371 });
n@1106 7372 }
n@1106 7373
n@1106 7374 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
n@1106 7375
n@1106 7376 // If set returns undefined, fall back to normal setting
n@1106 7377 if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
n@1106 7378 this.value = val;
n@1106 7379 }
n@1106 7380 });
n@1106 7381 }
n@1106 7382 });
n@1106 7383
n@1106 7384 jQuery.extend({
n@1106 7385 valHooks: {
n@1106 7386 option: {
n@1106 7387 get: function( elem ) {
n@1106 7388 var val = jQuery.find.attr( elem, "value" );
n@1106 7389 return val != null ?
n@1106 7390 val :
n@1106 7391 // Support: IE10-11+
n@1106 7392 // option.text throws exceptions (#14686, #14858)
n@1106 7393 jQuery.trim( jQuery.text( elem ) );
n@1106 7394 }
n@1106 7395 },
n@1106 7396 select: {
n@1106 7397 get: function( elem ) {
n@1106 7398 var value, option,
n@1106 7399 options = elem.options,
n@1106 7400 index = elem.selectedIndex,
n@1106 7401 one = elem.type === "select-one" || index < 0,
n@1106 7402 values = one ? null : [],
n@1106 7403 max = one ? index + 1 : options.length,
n@1106 7404 i = index < 0 ?
n@1106 7405 max :
n@1106 7406 one ? index : 0;
n@1106 7407
n@1106 7408 // Loop through all the selected options
n@1106 7409 for ( ; i < max; i++ ) {
n@1106 7410 option = options[ i ];
n@1106 7411
n@1106 7412 // IE6-9 doesn't update selected after form reset (#2551)
n@1106 7413 if ( ( option.selected || i === index ) &&
n@1106 7414 // Don't return options that are disabled or in a disabled optgroup
n@1106 7415 ( support.optDisabled ? !option.disabled : option.getAttribute( "disabled" ) === null ) &&
n@1106 7416 ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
n@1106 7417
n@1106 7418 // Get the specific value for the option
n@1106 7419 value = jQuery( option ).val();
n@1106 7420
n@1106 7421 // We don't need an array for one selects
n@1106 7422 if ( one ) {
n@1106 7423 return value;
n@1106 7424 }
n@1106 7425
n@1106 7426 // Multi-Selects return an array
n@1106 7427 values.push( value );
n@1106 7428 }
n@1106 7429 }
n@1106 7430
n@1106 7431 return values;
n@1106 7432 },
n@1106 7433
n@1106 7434 set: function( elem, value ) {
n@1106 7435 var optionSet, option,
n@1106 7436 options = elem.options,
n@1106 7437 values = jQuery.makeArray( value ),
n@1106 7438 i = options.length;
n@1106 7439
n@1106 7440 while ( i-- ) {
n@1106 7441 option = options[ i ];
n@1106 7442 if ( (option.selected = jQuery.inArray( option.value, values ) >= 0) ) {
n@1106 7443 optionSet = true;
n@1106 7444 }
n@1106 7445 }
n@1106 7446
n@1106 7447 // Force browsers to behave consistently when non-matching value is set
n@1106 7448 if ( !optionSet ) {
n@1106 7449 elem.selectedIndex = -1;
n@1106 7450 }
n@1106 7451 return values;
n@1106 7452 }
n@1106 7453 }
n@1106 7454 }
n@1106 7455 });
n@1106 7456
n@1106 7457 // Radios and checkboxes getter/setter
n@1106 7458 jQuery.each([ "radio", "checkbox" ], function() {
n@1106 7459 jQuery.valHooks[ this ] = {
n@1106 7460 set: function( elem, value ) {
n@1106 7461 if ( jQuery.isArray( value ) ) {
n@1106 7462 return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
n@1106 7463 }
n@1106 7464 }
n@1106 7465 };
n@1106 7466 if ( !support.checkOn ) {
n@1106 7467 jQuery.valHooks[ this ].get = function( elem ) {
n@1106 7468 return elem.getAttribute("value") === null ? "on" : elem.value;
n@1106 7469 };
n@1106 7470 }
n@1106 7471 });
n@1106 7472
n@1106 7473
n@1106 7474
n@1106 7475
n@1106 7476 // Return jQuery for attributes-only inclusion
n@1106 7477
n@1106 7478
n@1106 7479 jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
n@1106 7480 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
n@1106 7481 "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
n@1106 7482
n@1106 7483 // Handle event binding
n@1106 7484 jQuery.fn[ name ] = function( data, fn ) {
n@1106 7485 return arguments.length > 0 ?
n@1106 7486 this.on( name, null, data, fn ) :
n@1106 7487 this.trigger( name );
n@1106 7488 };
n@1106 7489 });
n@1106 7490
n@1106 7491 jQuery.fn.extend({
n@1106 7492 hover: function( fnOver, fnOut ) {
n@1106 7493 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
n@1106 7494 },
n@1106 7495
n@1106 7496 bind: function( types, data, fn ) {
n@1106 7497 return this.on( types, null, data, fn );
n@1106 7498 },
n@1106 7499 unbind: function( types, fn ) {
n@1106 7500 return this.off( types, null, fn );
n@1106 7501 },
n@1106 7502
n@1106 7503 delegate: function( selector, types, data, fn ) {
n@1106 7504 return this.on( types, selector, data, fn );
n@1106 7505 },
n@1106 7506 undelegate: function( selector, types, fn ) {
n@1106 7507 // ( namespace ) or ( selector, types [, fn] )
n@1106 7508 return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
n@1106 7509 }
n@1106 7510 });
n@1106 7511
n@1106 7512
n@1106 7513 var nonce = jQuery.now();
n@1106 7514
n@1106 7515 var rquery = (/\?/);
n@1106 7516
n@1106 7517
n@1106 7518
n@1106 7519 // Support: Android 2.3
n@1106 7520 // Workaround failure to string-cast null input
n@1106 7521 jQuery.parseJSON = function( data ) {
n@1106 7522 return JSON.parse( data + "" );
n@1106 7523 };
n@1106 7524
n@1106 7525
n@1106 7526 // Cross-browser xml parsing
n@1106 7527 jQuery.parseXML = function( data ) {
n@1106 7528 var xml, tmp;
n@1106 7529 if ( !data || typeof data !== "string" ) {
n@1106 7530 return null;
n@1106 7531 }
n@1106 7532
n@1106 7533 // Support: IE9
n@1106 7534 try {
n@1106 7535 tmp = new DOMParser();
n@1106 7536 xml = tmp.parseFromString( data, "text/xml" );
n@1106 7537 } catch ( e ) {
n@1106 7538 xml = undefined;
n@1106 7539 }
n@1106 7540
n@1106 7541 if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
n@1106 7542 jQuery.error( "Invalid XML: " + data );
n@1106 7543 }
n@1106 7544 return xml;
n@1106 7545 };
n@1106 7546
n@1106 7547
n@1106 7548 var
n@1106 7549 rhash = /#.*$/,
n@1106 7550 rts = /([?&])_=[^&]*/,
n@1106 7551 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
n@1106 7552 // #7653, #8125, #8152: local protocol detection
n@1106 7553 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
n@1106 7554 rnoContent = /^(?:GET|HEAD)$/,
n@1106 7555 rprotocol = /^\/\//,
n@1106 7556 rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
n@1106 7557
n@1106 7558 /* Prefilters
n@1106 7559 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
n@1106 7560 * 2) These are called:
n@1106 7561 * - BEFORE asking for a transport
n@1106 7562 * - AFTER param serialization (s.data is a string if s.processData is true)
n@1106 7563 * 3) key is the dataType
n@1106 7564 * 4) the catchall symbol "*" can be used
n@1106 7565 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
n@1106 7566 */
n@1106 7567 prefilters = {},
n@1106 7568
n@1106 7569 /* Transports bindings
n@1106 7570 * 1) key is the dataType
n@1106 7571 * 2) the catchall symbol "*" can be used
n@1106 7572 * 3) selection will start with transport dataType and THEN go to "*" if needed
n@1106 7573 */
n@1106 7574 transports = {},
n@1106 7575
n@1106 7576 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
n@1106 7577 allTypes = "*/".concat( "*" ),
n@1106 7578
n@1106 7579 // Document location
n@1106 7580 ajaxLocation = window.location.href,
n@1106 7581
n@1106 7582 // Segment location into parts
n@1106 7583 ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
n@1106 7584
n@1106 7585 // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
n@1106 7586 function addToPrefiltersOrTransports( structure ) {
n@1106 7587
n@1106 7588 // dataTypeExpression is optional and defaults to "*"
n@1106 7589 return function( dataTypeExpression, func ) {
n@1106 7590
n@1106 7591 if ( typeof dataTypeExpression !== "string" ) {
n@1106 7592 func = dataTypeExpression;
n@1106 7593 dataTypeExpression = "*";
n@1106 7594 }
n@1106 7595
n@1106 7596 var dataType,
n@1106 7597 i = 0,
n@1106 7598 dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
n@1106 7599
n@1106 7600 if ( jQuery.isFunction( func ) ) {
n@1106 7601 // For each dataType in the dataTypeExpression
n@1106 7602 while ( (dataType = dataTypes[i++]) ) {
n@1106 7603 // Prepend if requested
n@1106 7604 if ( dataType[0] === "+" ) {
n@1106 7605 dataType = dataType.slice( 1 ) || "*";
n@1106 7606 (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
n@1106 7607
n@1106 7608 // Otherwise append
n@1106 7609 } else {
n@1106 7610 (structure[ dataType ] = structure[ dataType ] || []).push( func );
n@1106 7611 }
n@1106 7612 }
n@1106 7613 }
n@1106 7614 };
n@1106 7615 }
n@1106 7616
n@1106 7617 // Base inspection function for prefilters and transports
n@1106 7618 function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
n@1106 7619
n@1106 7620 var inspected = {},
n@1106 7621 seekingTransport = ( structure === transports );
n@1106 7622
n@1106 7623 function inspect( dataType ) {
n@1106 7624 var selected;
n@1106 7625 inspected[ dataType ] = true;
n@1106 7626 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
n@1106 7627 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
n@1106 7628 if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
n@1106 7629 options.dataTypes.unshift( dataTypeOrTransport );
n@1106 7630 inspect( dataTypeOrTransport );
n@1106 7631 return false;
n@1106 7632 } else if ( seekingTransport ) {
n@1106 7633 return !( selected = dataTypeOrTransport );
n@1106 7634 }
n@1106 7635 });
n@1106 7636 return selected;
n@1106 7637 }
n@1106 7638
n@1106 7639 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
n@1106 7640 }
n@1106 7641
n@1106 7642 // A special extend for ajax options
n@1106 7643 // that takes "flat" options (not to be deep extended)
n@1106 7644 // Fixes #9887
n@1106 7645 function ajaxExtend( target, src ) {
n@1106 7646 var key, deep,
n@1106 7647 flatOptions = jQuery.ajaxSettings.flatOptions || {};
n@1106 7648
n@1106 7649 for ( key in src ) {
n@1106 7650 if ( src[ key ] !== undefined ) {
n@1106 7651 ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
n@1106 7652 }
n@1106 7653 }
n@1106 7654 if ( deep ) {
n@1106 7655 jQuery.extend( true, target, deep );
n@1106 7656 }
n@1106 7657
n@1106 7658 return target;
n@1106 7659 }
n@1106 7660
n@1106 7661 /* Handles responses to an ajax request:
n@1106 7662 * - finds the right dataType (mediates between content-type and expected dataType)
n@1106 7663 * - returns the corresponding response
n@1106 7664 */
n@1106 7665 function ajaxHandleResponses( s, jqXHR, responses ) {
n@1106 7666
n@1106 7667 var ct, type, finalDataType, firstDataType,
n@1106 7668 contents = s.contents,
n@1106 7669 dataTypes = s.dataTypes;
n@1106 7670
n@1106 7671 // Remove auto dataType and get content-type in the process
n@1106 7672 while ( dataTypes[ 0 ] === "*" ) {
n@1106 7673 dataTypes.shift();
n@1106 7674 if ( ct === undefined ) {
n@1106 7675 ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
n@1106 7676 }
n@1106 7677 }
n@1106 7678
n@1106 7679 // Check if we're dealing with a known content-type
n@1106 7680 if ( ct ) {
n@1106 7681 for ( type in contents ) {
n@1106 7682 if ( contents[ type ] && contents[ type ].test( ct ) ) {
n@1106 7683 dataTypes.unshift( type );
n@1106 7684 break;
n@1106 7685 }
n@1106 7686 }
n@1106 7687 }
n@1106 7688
n@1106 7689 // Check to see if we have a response for the expected dataType
n@1106 7690 if ( dataTypes[ 0 ] in responses ) {
n@1106 7691 finalDataType = dataTypes[ 0 ];
n@1106 7692 } else {
n@1106 7693 // Try convertible dataTypes
n@1106 7694 for ( type in responses ) {
n@1106 7695 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
n@1106 7696 finalDataType = type;
n@1106 7697 break;
n@1106 7698 }
n@1106 7699 if ( !firstDataType ) {
n@1106 7700 firstDataType = type;
n@1106 7701 }
n@1106 7702 }
n@1106 7703 // Or just use first one
n@1106 7704 finalDataType = finalDataType || firstDataType;
n@1106 7705 }
n@1106 7706
n@1106 7707 // If we found a dataType
n@1106 7708 // We add the dataType to the list if needed
n@1106 7709 // and return the corresponding response
n@1106 7710 if ( finalDataType ) {
n@1106 7711 if ( finalDataType !== dataTypes[ 0 ] ) {
n@1106 7712 dataTypes.unshift( finalDataType );
n@1106 7713 }
n@1106 7714 return responses[ finalDataType ];
n@1106 7715 }
n@1106 7716 }
n@1106 7717
n@1106 7718 /* Chain conversions given the request and the original response
n@1106 7719 * Also sets the responseXXX fields on the jqXHR instance
n@1106 7720 */
n@1106 7721 function ajaxConvert( s, response, jqXHR, isSuccess ) {
n@1106 7722 var conv2, current, conv, tmp, prev,
n@1106 7723 converters = {},
n@1106 7724 // Work with a copy of dataTypes in case we need to modify it for conversion
n@1106 7725 dataTypes = s.dataTypes.slice();
n@1106 7726
n@1106 7727 // Create converters map with lowercased keys
n@1106 7728 if ( dataTypes[ 1 ] ) {
n@1106 7729 for ( conv in s.converters ) {
n@1106 7730 converters[ conv.toLowerCase() ] = s.converters[ conv ];
n@1106 7731 }
n@1106 7732 }
n@1106 7733
n@1106 7734 current = dataTypes.shift();
n@1106 7735
n@1106 7736 // Convert to each sequential dataType
n@1106 7737 while ( current ) {
n@1106 7738
n@1106 7739 if ( s.responseFields[ current ] ) {
n@1106 7740 jqXHR[ s.responseFields[ current ] ] = response;
n@1106 7741 }
n@1106 7742
n@1106 7743 // Apply the dataFilter if provided
n@1106 7744 if ( !prev && isSuccess && s.dataFilter ) {
n@1106 7745 response = s.dataFilter( response, s.dataType );
n@1106 7746 }
n@1106 7747
n@1106 7748 prev = current;
n@1106 7749 current = dataTypes.shift();
n@1106 7750
n@1106 7751 if ( current ) {
n@1106 7752
n@1106 7753 // There's only work to do if current dataType is non-auto
n@1106 7754 if ( current === "*" ) {
n@1106 7755
n@1106 7756 current = prev;
n@1106 7757
n@1106 7758 // Convert response if prev dataType is non-auto and differs from current
n@1106 7759 } else if ( prev !== "*" && prev !== current ) {
n@1106 7760
n@1106 7761 // Seek a direct converter
n@1106 7762 conv = converters[ prev + " " + current ] || converters[ "* " + current ];
n@1106 7763
n@1106 7764 // If none found, seek a pair
n@1106 7765 if ( !conv ) {
n@1106 7766 for ( conv2 in converters ) {
n@1106 7767
n@1106 7768 // If conv2 outputs current
n@1106 7769 tmp = conv2.split( " " );
n@1106 7770 if ( tmp[ 1 ] === current ) {
n@1106 7771
n@1106 7772 // If prev can be converted to accepted input
n@1106 7773 conv = converters[ prev + " " + tmp[ 0 ] ] ||
n@1106 7774 converters[ "* " + tmp[ 0 ] ];
n@1106 7775 if ( conv ) {
n@1106 7776 // Condense equivalence converters
n@1106 7777 if ( conv === true ) {
n@1106 7778 conv = converters[ conv2 ];
n@1106 7779
n@1106 7780 // Otherwise, insert the intermediate dataType
n@1106 7781 } else if ( converters[ conv2 ] !== true ) {
n@1106 7782 current = tmp[ 0 ];
n@1106 7783 dataTypes.unshift( tmp[ 1 ] );
n@1106 7784 }
n@1106 7785 break;
n@1106 7786 }
n@1106 7787 }
n@1106 7788 }
n@1106 7789 }
n@1106 7790
n@1106 7791 // Apply converter (if not an equivalence)
n@1106 7792 if ( conv !== true ) {
n@1106 7793
n@1106 7794 // Unless errors are allowed to bubble, catch and return them
n@1106 7795 if ( conv && s[ "throws" ] ) {
n@1106 7796 response = conv( response );
n@1106 7797 } else {
n@1106 7798 try {
n@1106 7799 response = conv( response );
n@1106 7800 } catch ( e ) {
n@1106 7801 return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
n@1106 7802 }
n@1106 7803 }
n@1106 7804 }
n@1106 7805 }
n@1106 7806 }
n@1106 7807 }
n@1106 7808
n@1106 7809 return { state: "success", data: response };
n@1106 7810 }
n@1106 7811
n@1106 7812 jQuery.extend({
n@1106 7813
n@1106 7814 // Counter for holding the number of active queries
n@1106 7815 active: 0,
n@1106 7816
n@1106 7817 // Last-Modified header cache for next request
n@1106 7818 lastModified: {},
n@1106 7819 etag: {},
n@1106 7820
n@1106 7821 ajaxSettings: {
n@1106 7822 url: ajaxLocation,
n@1106 7823 type: "GET",
n@1106 7824 isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
n@1106 7825 global: true,
n@1106 7826 processData: true,
n@1106 7827 async: true,
n@1106 7828 contentType: "application/x-www-form-urlencoded; charset=UTF-8",
n@1106 7829 /*
n@1106 7830 timeout: 0,
n@1106 7831 data: null,
n@1106 7832 dataType: null,
n@1106 7833 username: null,
n@1106 7834 password: null,
n@1106 7835 cache: null,
n@1106 7836 throws: false,
n@1106 7837 traditional: false,
n@1106 7838 headers: {},
n@1106 7839 */
n@1106 7840
n@1106 7841 accepts: {
n@1106 7842 "*": allTypes,
n@1106 7843 text: "text/plain",
n@1106 7844 html: "text/html",
n@1106 7845 xml: "application/xml, text/xml",
n@1106 7846 json: "application/json, text/javascript"
n@1106 7847 },
n@1106 7848
n@1106 7849 contents: {
n@1106 7850 xml: /xml/,
n@1106 7851 html: /html/,
n@1106 7852 json: /json/
n@1106 7853 },
n@1106 7854
n@1106 7855 responseFields: {
n@1106 7856 xml: "responseXML",
n@1106 7857 text: "responseText",
n@1106 7858 json: "responseJSON"
n@1106 7859 },
n@1106 7860
n@1106 7861 // Data converters
n@1106 7862 // Keys separate source (or catchall "*") and destination types with a single space
n@1106 7863 converters: {
n@1106 7864
n@1106 7865 // Convert anything to text
n@1106 7866 "* text": String,
n@1106 7867
n@1106 7868 // Text to html (true = no transformation)
n@1106 7869 "text html": true,
n@1106 7870
n@1106 7871 // Evaluate text as a json expression
n@1106 7872 "text json": jQuery.parseJSON,
n@1106 7873
n@1106 7874 // Parse text as xml
n@1106 7875 "text xml": jQuery.parseXML
n@1106 7876 },
n@1106 7877
n@1106 7878 // For options that shouldn't be deep extended:
n@1106 7879 // you can add your own custom options here if
n@1106 7880 // and when you create one that shouldn't be
n@1106 7881 // deep extended (see ajaxExtend)
n@1106 7882 flatOptions: {
n@1106 7883 url: true,
n@1106 7884 context: true
n@1106 7885 }
n@1106 7886 },
n@1106 7887
n@1106 7888 // Creates a full fledged settings object into target
n@1106 7889 // with both ajaxSettings and settings fields.
n@1106 7890 // If target is omitted, writes into ajaxSettings.
n@1106 7891 ajaxSetup: function( target, settings ) {
n@1106 7892 return settings ?
n@1106 7893
n@1106 7894 // Building a settings object
n@1106 7895 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
n@1106 7896
n@1106 7897 // Extending ajaxSettings
n@1106 7898 ajaxExtend( jQuery.ajaxSettings, target );
n@1106 7899 },
n@1106 7900
n@1106 7901 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
n@1106 7902 ajaxTransport: addToPrefiltersOrTransports( transports ),
n@1106 7903
n@1106 7904 // Main method
n@1106 7905 ajax: function( url, options ) {
n@1106 7906
n@1106 7907 // If url is an object, simulate pre-1.5 signature
n@1106 7908 if ( typeof url === "object" ) {
n@1106 7909 options = url;
n@1106 7910 url = undefined;
n@1106 7911 }
n@1106 7912
n@1106 7913 // Force options to be an object
n@1106 7914 options = options || {};
n@1106 7915
n@1106 7916 var transport,
n@1106 7917 // URL without anti-cache param
n@1106 7918 cacheURL,
n@1106 7919 // Response headers
n@1106 7920 responseHeadersString,
n@1106 7921 responseHeaders,
n@1106 7922 // timeout handle
n@1106 7923 timeoutTimer,
n@1106 7924 // Cross-domain detection vars
n@1106 7925 parts,
n@1106 7926 // To know if global events are to be dispatched
n@1106 7927 fireGlobals,
n@1106 7928 // Loop variable
n@1106 7929 i,
n@1106 7930 // Create the final options object
n@1106 7931 s = jQuery.ajaxSetup( {}, options ),
n@1106 7932 // Callbacks context
n@1106 7933 callbackContext = s.context || s,
n@1106 7934 // Context for global events is callbackContext if it is a DOM node or jQuery collection
n@1106 7935 globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
n@1106 7936 jQuery( callbackContext ) :
n@1106 7937 jQuery.event,
n@1106 7938 // Deferreds
n@1106 7939 deferred = jQuery.Deferred(),
n@1106 7940 completeDeferred = jQuery.Callbacks("once memory"),
n@1106 7941 // Status-dependent callbacks
n@1106 7942 statusCode = s.statusCode || {},
n@1106 7943 // Headers (they are sent all at once)
n@1106 7944 requestHeaders = {},
n@1106 7945 requestHeadersNames = {},
n@1106 7946 // The jqXHR state
n@1106 7947 state = 0,
n@1106 7948 // Default abort message
n@1106 7949 strAbort = "canceled",
n@1106 7950 // Fake xhr
n@1106 7951 jqXHR = {
n@1106 7952 readyState: 0,
n@1106 7953
n@1106 7954 // Builds headers hashtable if needed
n@1106 7955 getResponseHeader: function( key ) {
n@1106 7956 var match;
n@1106 7957 if ( state === 2 ) {
n@1106 7958 if ( !responseHeaders ) {
n@1106 7959 responseHeaders = {};
n@1106 7960 while ( (match = rheaders.exec( responseHeadersString )) ) {
n@1106 7961 responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
n@1106 7962 }
n@1106 7963 }
n@1106 7964 match = responseHeaders[ key.toLowerCase() ];
n@1106 7965 }
n@1106 7966 return match == null ? null : match;
n@1106 7967 },
n@1106 7968
n@1106 7969 // Raw string
n@1106 7970 getAllResponseHeaders: function() {
n@1106 7971 return state === 2 ? responseHeadersString : null;
n@1106 7972 },
n@1106 7973
n@1106 7974 // Caches the header
n@1106 7975 setRequestHeader: function( name, value ) {
n@1106 7976 var lname = name.toLowerCase();
n@1106 7977 if ( !state ) {
n@1106 7978 name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
n@1106 7979 requestHeaders[ name ] = value;
n@1106 7980 }
n@1106 7981 return this;
n@1106 7982 },
n@1106 7983
n@1106 7984 // Overrides response content-type header
n@1106 7985 overrideMimeType: function( type ) {
n@1106 7986 if ( !state ) {
n@1106 7987 s.mimeType = type;
n@1106 7988 }
n@1106 7989 return this;
n@1106 7990 },
n@1106 7991
n@1106 7992 // Status-dependent callbacks
n@1106 7993 statusCode: function( map ) {
n@1106 7994 var code;
n@1106 7995 if ( map ) {
n@1106 7996 if ( state < 2 ) {
n@1106 7997 for ( code in map ) {
n@1106 7998 // Lazy-add the new callback in a way that preserves old ones
n@1106 7999 statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
n@1106 8000 }
n@1106 8001 } else {
n@1106 8002 // Execute the appropriate callbacks
n@1106 8003 jqXHR.always( map[ jqXHR.status ] );
n@1106 8004 }
n@1106 8005 }
n@1106 8006 return this;
n@1106 8007 },
n@1106 8008
n@1106 8009 // Cancel the request
n@1106 8010 abort: function( statusText ) {
n@1106 8011 var finalText = statusText || strAbort;
n@1106 8012 if ( transport ) {
n@1106 8013 transport.abort( finalText );
n@1106 8014 }
n@1106 8015 done( 0, finalText );
n@1106 8016 return this;
n@1106 8017 }
n@1106 8018 };
n@1106 8019
n@1106 8020 // Attach deferreds
n@1106 8021 deferred.promise( jqXHR ).complete = completeDeferred.add;
n@1106 8022 jqXHR.success = jqXHR.done;
n@1106 8023 jqXHR.error = jqXHR.fail;
n@1106 8024
n@1106 8025 // Remove hash character (#7531: and string promotion)
n@1106 8026 // Add protocol if not provided (prefilters might expect it)
n@1106 8027 // Handle falsy url in the settings object (#10093: consistency with old signature)
n@1106 8028 // We also use the url parameter if available
n@1106 8029 s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" )
n@1106 8030 .replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
n@1106 8031
n@1106 8032 // Alias method option to type as per ticket #12004
n@1106 8033 s.type = options.method || options.type || s.method || s.type;
n@1106 8034
n@1106 8035 // Extract dataTypes list
n@1106 8036 s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
n@1106 8037
n@1106 8038 // A cross-domain request is in order when we have a protocol:host:port mismatch
n@1106 8039 if ( s.crossDomain == null ) {
n@1106 8040 parts = rurl.exec( s.url.toLowerCase() );
n@1106 8041 s.crossDomain = !!( parts &&
n@1106 8042 ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
n@1106 8043 ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
n@1106 8044 ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
n@1106 8045 );
n@1106 8046 }
n@1106 8047
n@1106 8048 // Convert data if not already a string
n@1106 8049 if ( s.data && s.processData && typeof s.data !== "string" ) {
n@1106 8050 s.data = jQuery.param( s.data, s.traditional );
n@1106 8051 }
n@1106 8052
n@1106 8053 // Apply prefilters
n@1106 8054 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
n@1106 8055
n@1106 8056 // If request was aborted inside a prefilter, stop there
n@1106 8057 if ( state === 2 ) {
n@1106 8058 return jqXHR;
n@1106 8059 }
n@1106 8060
n@1106 8061 // We can fire global events as of now if asked to
n@1106 8062 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
n@1106 8063 fireGlobals = jQuery.event && s.global;
n@1106 8064
n@1106 8065 // Watch for a new set of requests
n@1106 8066 if ( fireGlobals && jQuery.active++ === 0 ) {
n@1106 8067 jQuery.event.trigger("ajaxStart");
n@1106 8068 }
n@1106 8069
n@1106 8070 // Uppercase the type
n@1106 8071 s.type = s.type.toUpperCase();
n@1106 8072
n@1106 8073 // Determine if request has content
n@1106 8074 s.hasContent = !rnoContent.test( s.type );
n@1106 8075
n@1106 8076 // Save the URL in case we're toying with the If-Modified-Since
n@1106 8077 // and/or If-None-Match header later on
n@1106 8078 cacheURL = s.url;
n@1106 8079
n@1106 8080 // More options handling for requests with no content
n@1106 8081 if ( !s.hasContent ) {
n@1106 8082
n@1106 8083 // If data is available, append data to url
n@1106 8084 if ( s.data ) {
n@1106 8085 cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
n@1106 8086 // #9682: remove data so that it's not used in an eventual retry
n@1106 8087 delete s.data;
n@1106 8088 }
n@1106 8089
n@1106 8090 // Add anti-cache in url if needed
n@1106 8091 if ( s.cache === false ) {
n@1106 8092 s.url = rts.test( cacheURL ) ?
n@1106 8093
n@1106 8094 // If there is already a '_' parameter, set its value
n@1106 8095 cacheURL.replace( rts, "$1_=" + nonce++ ) :
n@1106 8096
n@1106 8097 // Otherwise add one to the end
n@1106 8098 cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
n@1106 8099 }
n@1106 8100 }
n@1106 8101
n@1106 8102 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
n@1106 8103 if ( s.ifModified ) {
n@1106 8104 if ( jQuery.lastModified[ cacheURL ] ) {
n@1106 8105 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
n@1106 8106 }
n@1106 8107 if ( jQuery.etag[ cacheURL ] ) {
n@1106 8108 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
n@1106 8109 }
n@1106 8110 }
n@1106 8111
n@1106 8112 // Set the correct header, if data is being sent
n@1106 8113 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
n@1106 8114 jqXHR.setRequestHeader( "Content-Type", s.contentType );
n@1106 8115 }
n@1106 8116
n@1106 8117 // Set the Accepts header for the server, depending on the dataType
n@1106 8118 jqXHR.setRequestHeader(
n@1106 8119 "Accept",
n@1106 8120 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
n@1106 8121 s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
n@1106 8122 s.accepts[ "*" ]
n@1106 8123 );
n@1106 8124
n@1106 8125 // Check for headers option
n@1106 8126 for ( i in s.headers ) {
n@1106 8127 jqXHR.setRequestHeader( i, s.headers[ i ] );
n@1106 8128 }
n@1106 8129
n@1106 8130 // Allow custom headers/mimetypes and early abort
n@1106 8131 if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
n@1106 8132 // Abort if not done already and return
n@1106 8133 return jqXHR.abort();
n@1106 8134 }
n@1106 8135
n@1106 8136 // Aborting is no longer a cancellation
n@1106 8137 strAbort = "abort";
n@1106 8138
n@1106 8139 // Install callbacks on deferreds
n@1106 8140 for ( i in { success: 1, error: 1, complete: 1 } ) {
n@1106 8141 jqXHR[ i ]( s[ i ] );
n@1106 8142 }
n@1106 8143
n@1106 8144 // Get transport
n@1106 8145 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
n@1106 8146
n@1106 8147 // If no transport, we auto-abort
n@1106 8148 if ( !transport ) {
n@1106 8149 done( -1, "No Transport" );
n@1106 8150 } else {
n@1106 8151 jqXHR.readyState = 1;
n@1106 8152
n@1106 8153 // Send global event
n@1106 8154 if ( fireGlobals ) {
n@1106 8155 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
n@1106 8156 }
n@1106 8157 // Timeout
n@1106 8158 if ( s.async && s.timeout > 0 ) {
n@1106 8159 timeoutTimer = setTimeout(function() {
n@1106 8160 jqXHR.abort("timeout");
n@1106 8161 }, s.timeout );
n@1106 8162 }
n@1106 8163
n@1106 8164 try {
n@1106 8165 state = 1;
n@1106 8166 transport.send( requestHeaders, done );
n@1106 8167 } catch ( e ) {
n@1106 8168 // Propagate exception as error if not done
n@1106 8169 if ( state < 2 ) {
n@1106 8170 done( -1, e );
n@1106 8171 // Simply rethrow otherwise
n@1106 8172 } else {
n@1106 8173 throw e;
n@1106 8174 }
n@1106 8175 }
n@1106 8176 }
n@1106 8177
n@1106 8178 // Callback for when everything is done
n@1106 8179 function done( status, nativeStatusText, responses, headers ) {
n@1106 8180 var isSuccess, success, error, response, modified,
n@1106 8181 statusText = nativeStatusText;
n@1106 8182
n@1106 8183 // Called once
n@1106 8184 if ( state === 2 ) {
n@1106 8185 return;
n@1106 8186 }
n@1106 8187
n@1106 8188 // State is "done" now
n@1106 8189 state = 2;
n@1106 8190
n@1106 8191 // Clear timeout if it exists
n@1106 8192 if ( timeoutTimer ) {
n@1106 8193 clearTimeout( timeoutTimer );
n@1106 8194 }
n@1106 8195
n@1106 8196 // Dereference transport for early garbage collection
n@1106 8197 // (no matter how long the jqXHR object will be used)
n@1106 8198 transport = undefined;
n@1106 8199
n@1106 8200 // Cache response headers
n@1106 8201 responseHeadersString = headers || "";
n@1106 8202
n@1106 8203 // Set readyState
n@1106 8204 jqXHR.readyState = status > 0 ? 4 : 0;
n@1106 8205
n@1106 8206 // Determine if successful
n@1106 8207 isSuccess = status >= 200 && status < 300 || status === 304;
n@1106 8208
n@1106 8209 // Get response data
n@1106 8210 if ( responses ) {
n@1106 8211 response = ajaxHandleResponses( s, jqXHR, responses );
n@1106 8212 }
n@1106 8213
n@1106 8214 // Convert no matter what (that way responseXXX fields are always set)
n@1106 8215 response = ajaxConvert( s, response, jqXHR, isSuccess );
n@1106 8216
n@1106 8217 // If successful, handle type chaining
n@1106 8218 if ( isSuccess ) {
n@1106 8219
n@1106 8220 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
n@1106 8221 if ( s.ifModified ) {
n@1106 8222 modified = jqXHR.getResponseHeader("Last-Modified");
n@1106 8223 if ( modified ) {
n@1106 8224 jQuery.lastModified[ cacheURL ] = modified;
n@1106 8225 }
n@1106 8226 modified = jqXHR.getResponseHeader("etag");
n@1106 8227 if ( modified ) {
n@1106 8228 jQuery.etag[ cacheURL ] = modified;
n@1106 8229 }
n@1106 8230 }
n@1106 8231
n@1106 8232 // if no content
n@1106 8233 if ( status === 204 || s.type === "HEAD" ) {
n@1106 8234 statusText = "nocontent";
n@1106 8235
n@1106 8236 // if not modified
n@1106 8237 } else if ( status === 304 ) {
n@1106 8238 statusText = "notmodified";
n@1106 8239
n@1106 8240 // If we have data, let's convert it
n@1106 8241 } else {
n@1106 8242 statusText = response.state;
n@1106 8243 success = response.data;
n@1106 8244 error = response.error;
n@1106 8245 isSuccess = !error;
n@1106 8246 }
n@1106 8247 } else {
n@1106 8248 // Extract error from statusText and normalize for non-aborts
n@1106 8249 error = statusText;
n@1106 8250 if ( status || !statusText ) {
n@1106 8251 statusText = "error";
n@1106 8252 if ( status < 0 ) {
n@1106 8253 status = 0;
n@1106 8254 }
n@1106 8255 }
n@1106 8256 }
n@1106 8257
n@1106 8258 // Set data for the fake xhr object
n@1106 8259 jqXHR.status = status;
n@1106 8260 jqXHR.statusText = ( nativeStatusText || statusText ) + "";
n@1106 8261
n@1106 8262 // Success/Error
n@1106 8263 if ( isSuccess ) {
n@1106 8264 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
n@1106 8265 } else {
n@1106 8266 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
n@1106 8267 }
n@1106 8268
n@1106 8269 // Status-dependent callbacks
n@1106 8270 jqXHR.statusCode( statusCode );
n@1106 8271 statusCode = undefined;
n@1106 8272
n@1106 8273 if ( fireGlobals ) {
n@1106 8274 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
n@1106 8275 [ jqXHR, s, isSuccess ? success : error ] );
n@1106 8276 }
n@1106 8277
n@1106 8278 // Complete
n@1106 8279 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
n@1106 8280
n@1106 8281 if ( fireGlobals ) {
n@1106 8282 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
n@1106 8283 // Handle the global AJAX counter
n@1106 8284 if ( !( --jQuery.active ) ) {
n@1106 8285 jQuery.event.trigger("ajaxStop");
n@1106 8286 }
n@1106 8287 }
n@1106 8288 }
n@1106 8289
n@1106 8290 return jqXHR;
n@1106 8291 },
n@1106 8292
n@1106 8293 getJSON: function( url, data, callback ) {
n@1106 8294 return jQuery.get( url, data, callback, "json" );
n@1106 8295 },
n@1106 8296
n@1106 8297 getScript: function( url, callback ) {
n@1106 8298 return jQuery.get( url, undefined, callback, "script" );
n@1106 8299 }
n@1106 8300 });
n@1106 8301
n@1106 8302 jQuery.each( [ "get", "post" ], function( i, method ) {
n@1106 8303 jQuery[ method ] = function( url, data, callback, type ) {
n@1106 8304 // Shift arguments if data argument was omitted
n@1106 8305 if ( jQuery.isFunction( data ) ) {
n@1106 8306 type = type || callback;
n@1106 8307 callback = data;
n@1106 8308 data = undefined;
n@1106 8309 }
n@1106 8310
n@1106 8311 return jQuery.ajax({
n@1106 8312 url: url,
n@1106 8313 type: method,
n@1106 8314 dataType: type,
n@1106 8315 data: data,
n@1106 8316 success: callback
n@1106 8317 });
n@1106 8318 };
n@1106 8319 });
n@1106 8320
n@1106 8321
n@1106 8322 jQuery._evalUrl = function( url ) {
n@1106 8323 return jQuery.ajax({
n@1106 8324 url: url,
n@1106 8325 type: "GET",
n@1106 8326 dataType: "script",
n@1106 8327 async: false,
n@1106 8328 global: false,
n@1106 8329 "throws": true
n@1106 8330 });
n@1106 8331 };
n@1106 8332
n@1106 8333
n@1106 8334 jQuery.fn.extend({
n@1106 8335 wrapAll: function( html ) {
n@1106 8336 var wrap;
n@1106 8337
n@1106 8338 if ( jQuery.isFunction( html ) ) {
n@1106 8339 return this.each(function( i ) {
n@1106 8340 jQuery( this ).wrapAll( html.call(this, i) );
n@1106 8341 });
n@1106 8342 }
n@1106 8343
n@1106 8344 if ( this[ 0 ] ) {
n@1106 8345
n@1106 8346 // The elements to wrap the target around
n@1106 8347 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
n@1106 8348
n@1106 8349 if ( this[ 0 ].parentNode ) {
n@1106 8350 wrap.insertBefore( this[ 0 ] );
n@1106 8351 }
n@1106 8352
n@1106 8353 wrap.map(function() {
n@1106 8354 var elem = this;
n@1106 8355
n@1106 8356 while ( elem.firstElementChild ) {
n@1106 8357 elem = elem.firstElementChild;
n@1106 8358 }
n@1106 8359
n@1106 8360 return elem;
n@1106 8361 }).append( this );
n@1106 8362 }
n@1106 8363
n@1106 8364 return this;
n@1106 8365 },
n@1106 8366
n@1106 8367 wrapInner: function( html ) {
n@1106 8368 if ( jQuery.isFunction( html ) ) {
n@1106 8369 return this.each(function( i ) {
n@1106 8370 jQuery( this ).wrapInner( html.call(this, i) );
n@1106 8371 });
n@1106 8372 }
n@1106 8373
n@1106 8374 return this.each(function() {
n@1106 8375 var self = jQuery( this ),
n@1106 8376 contents = self.contents();
n@1106 8377
n@1106 8378 if ( contents.length ) {
n@1106 8379 contents.wrapAll( html );
n@1106 8380
n@1106 8381 } else {
n@1106 8382 self.append( html );
n@1106 8383 }
n@1106 8384 });
n@1106 8385 },
n@1106 8386
n@1106 8387 wrap: function( html ) {
n@1106 8388 var isFunction = jQuery.isFunction( html );
n@1106 8389
n@1106 8390 return this.each(function( i ) {
n@1106 8391 jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
n@1106 8392 });
n@1106 8393 },
n@1106 8394
n@1106 8395 unwrap: function() {
n@1106 8396 return this.parent().each(function() {
n@1106 8397 if ( !jQuery.nodeName( this, "body" ) ) {
n@1106 8398 jQuery( this ).replaceWith( this.childNodes );
n@1106 8399 }
n@1106 8400 }).end();
n@1106 8401 }
n@1106 8402 });
n@1106 8403
n@1106 8404
n@1106 8405 jQuery.expr.filters.hidden = function( elem ) {
n@1106 8406 // Support: Opera <= 12.12
n@1106 8407 // Opera reports offsetWidths and offsetHeights less than zero on some elements
n@1106 8408 return elem.offsetWidth <= 0 && elem.offsetHeight <= 0;
n@1106 8409 };
n@1106 8410 jQuery.expr.filters.visible = function( elem ) {
n@1106 8411 return !jQuery.expr.filters.hidden( elem );
n@1106 8412 };
n@1106 8413
n@1106 8414
n@1106 8415
n@1106 8416
n@1106 8417 var r20 = /%20/g,
n@1106 8418 rbracket = /\[\]$/,
n@1106 8419 rCRLF = /\r?\n/g,
n@1106 8420 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
n@1106 8421 rsubmittable = /^(?:input|select|textarea|keygen)/i;
n@1106 8422
n@1106 8423 function buildParams( prefix, obj, traditional, add ) {
n@1106 8424 var name;
n@1106 8425
n@1106 8426 if ( jQuery.isArray( obj ) ) {
n@1106 8427 // Serialize array item.
n@1106 8428 jQuery.each( obj, function( i, v ) {
n@1106 8429 if ( traditional || rbracket.test( prefix ) ) {
n@1106 8430 // Treat each array item as a scalar.
n@1106 8431 add( prefix, v );
n@1106 8432
n@1106 8433 } else {
n@1106 8434 // Item is non-scalar (array or object), encode its numeric index.
n@1106 8435 buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
n@1106 8436 }
n@1106 8437 });
n@1106 8438
n@1106 8439 } else if ( !traditional && jQuery.type( obj ) === "object" ) {
n@1106 8440 // Serialize object item.
n@1106 8441 for ( name in obj ) {
n@1106 8442 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
n@1106 8443 }
n@1106 8444
n@1106 8445 } else {
n@1106 8446 // Serialize scalar item.
n@1106 8447 add( prefix, obj );
n@1106 8448 }
n@1106 8449 }
n@1106 8450
n@1106 8451 // Serialize an array of form elements or a set of
n@1106 8452 // key/values into a query string
n@1106 8453 jQuery.param = function( a, traditional ) {
n@1106 8454 var prefix,
n@1106 8455 s = [],
n@1106 8456 add = function( key, value ) {
n@1106 8457 // If value is a function, invoke it and return its value
n@1106 8458 value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
n@1106 8459 s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
n@1106 8460 };
n@1106 8461
n@1106 8462 // Set traditional to true for jQuery <= 1.3.2 behavior.
n@1106 8463 if ( traditional === undefined ) {
n@1106 8464 traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
n@1106 8465 }
n@1106 8466
n@1106 8467 // If an array was passed in, assume that it is an array of form elements.
n@1106 8468 if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
n@1106 8469 // Serialize the form elements
n@1106 8470 jQuery.each( a, function() {
n@1106 8471 add( this.name, this.value );
n@1106 8472 });
n@1106 8473
n@1106 8474 } else {
n@1106 8475 // If traditional, encode the "old" way (the way 1.3.2 or older
n@1106 8476 // did it), otherwise encode params recursively.
n@1106 8477 for ( prefix in a ) {
n@1106 8478 buildParams( prefix, a[ prefix ], traditional, add );
n@1106 8479 }
n@1106 8480 }
n@1106 8481
n@1106 8482 // Return the resulting serialization
n@1106 8483 return s.join( "&" ).replace( r20, "+" );
n@1106 8484 };
n@1106 8485
n@1106 8486 jQuery.fn.extend({
n@1106 8487 serialize: function() {
n@1106 8488 return jQuery.param( this.serializeArray() );
n@1106 8489 },
n@1106 8490 serializeArray: function() {
n@1106 8491 return this.map(function() {
n@1106 8492 // Can add propHook for "elements" to filter or add form elements
n@1106 8493 var elements = jQuery.prop( this, "elements" );
n@1106 8494 return elements ? jQuery.makeArray( elements ) : this;
n@1106 8495 })
n@1106 8496 .filter(function() {
n@1106 8497 var type = this.type;
n@1106 8498
n@1106 8499 // Use .is( ":disabled" ) so that fieldset[disabled] works
n@1106 8500 return this.name && !jQuery( this ).is( ":disabled" ) &&
n@1106 8501 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
n@1106 8502 ( this.checked || !rcheckableType.test( type ) );
n@1106 8503 })
n@1106 8504 .map(function( i, elem ) {
n@1106 8505 var val = jQuery( this ).val();
n@1106 8506
n@1106 8507 return val == null ?
n@1106 8508 null :
n@1106 8509 jQuery.isArray( val ) ?
n@1106 8510 jQuery.map( val, function( val ) {
n@1106 8511 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
n@1106 8512 }) :
n@1106 8513 { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
n@1106 8514 }).get();
n@1106 8515 }
n@1106 8516 });
n@1106 8517
n@1106 8518
n@1106 8519 jQuery.ajaxSettings.xhr = function() {
n@1106 8520 try {
n@1106 8521 return new XMLHttpRequest();
n@1106 8522 } catch( e ) {}
n@1106 8523 };
n@1106 8524
n@1106 8525 var xhrId = 0,
n@1106 8526 xhrCallbacks = {},
n@1106 8527 xhrSuccessStatus = {
n@1106 8528 // file protocol always yields status code 0, assume 200
n@1106 8529 0: 200,
n@1106 8530 // Support: IE9
n@1106 8531 // #1450: sometimes IE returns 1223 when it should be 204
n@1106 8532 1223: 204
n@1106 8533 },
n@1106 8534 xhrSupported = jQuery.ajaxSettings.xhr();
n@1106 8535
n@1106 8536 // Support: IE9
n@1106 8537 // Open requests must be manually aborted on unload (#5280)
n@1106 8538 // See https://support.microsoft.com/kb/2856746 for more info
n@1106 8539 if ( window.attachEvent ) {
n@1106 8540 window.attachEvent( "onunload", function() {
n@1106 8541 for ( var key in xhrCallbacks ) {
n@1106 8542 xhrCallbacks[ key ]();
n@1106 8543 }
n@1106 8544 });
n@1106 8545 }
n@1106 8546
n@1106 8547 support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
n@1106 8548 support.ajax = xhrSupported = !!xhrSupported;
n@1106 8549
n@1106 8550 jQuery.ajaxTransport(function( options ) {
n@1106 8551 var callback;
n@1106 8552
n@1106 8553 // Cross domain only allowed if supported through XMLHttpRequest
n@1106 8554 if ( support.cors || xhrSupported && !options.crossDomain ) {
n@1106 8555 return {
n@1106 8556 send: function( headers, complete ) {
n@1106 8557 var i,
n@1106 8558 xhr = options.xhr(),
n@1106 8559 id = ++xhrId;
n@1106 8560
n@1106 8561 xhr.open( options.type, options.url, options.async, options.username, options.password );
n@1106 8562
n@1106 8563 // Apply custom fields if provided
n@1106 8564 if ( options.xhrFields ) {
n@1106 8565 for ( i in options.xhrFields ) {
n@1106 8566 xhr[ i ] = options.xhrFields[ i ];
n@1106 8567 }
n@1106 8568 }
n@1106 8569
n@1106 8570 // Override mime type if needed
n@1106 8571 if ( options.mimeType && xhr.overrideMimeType ) {
n@1106 8572 xhr.overrideMimeType( options.mimeType );
n@1106 8573 }
n@1106 8574
n@1106 8575 // X-Requested-With header
n@1106 8576 // For cross-domain requests, seeing as conditions for a preflight are
n@1106 8577 // akin to a jigsaw puzzle, we simply never set it to be sure.
n@1106 8578 // (it can always be set on a per-request basis or even using ajaxSetup)
n@1106 8579 // For same-domain requests, won't change header if already provided.
n@1106 8580 if ( !options.crossDomain && !headers["X-Requested-With"] ) {
n@1106 8581 headers["X-Requested-With"] = "XMLHttpRequest";
n@1106 8582 }
n@1106 8583
n@1106 8584 // Set headers
n@1106 8585 for ( i in headers ) {
n@1106 8586 xhr.setRequestHeader( i, headers[ i ] );
n@1106 8587 }
n@1106 8588
n@1106 8589 // Callback
n@1106 8590 callback = function( type ) {
n@1106 8591 return function() {
n@1106 8592 if ( callback ) {
n@1106 8593 delete xhrCallbacks[ id ];
n@1106 8594 callback = xhr.onload = xhr.onerror = null;
n@1106 8595
n@1106 8596 if ( type === "abort" ) {
n@1106 8597 xhr.abort();
n@1106 8598 } else if ( type === "error" ) {
n@1106 8599 complete(
n@1106 8600 // file: protocol always yields status 0; see #8605, #14207
n@1106 8601 xhr.status,
n@1106 8602 xhr.statusText
n@1106 8603 );
n@1106 8604 } else {
n@1106 8605 complete(
n@1106 8606 xhrSuccessStatus[ xhr.status ] || xhr.status,
n@1106 8607 xhr.statusText,
n@1106 8608 // Support: IE9
n@1106 8609 // Accessing binary-data responseText throws an exception
n@1106 8610 // (#11426)
n@1106 8611 typeof xhr.responseText === "string" ? {
n@1106 8612 text: xhr.responseText
n@1106 8613 } : undefined,
n@1106 8614 xhr.getAllResponseHeaders()
n@1106 8615 );
n@1106 8616 }
n@1106 8617 }
n@1106 8618 };
n@1106 8619 };
n@1106 8620
n@1106 8621 // Listen to events
n@1106 8622 xhr.onload = callback();
n@1106 8623 xhr.onerror = callback("error");
n@1106 8624
n@1106 8625 // Create the abort callback
n@1106 8626 callback = xhrCallbacks[ id ] = callback("abort");
n@1106 8627
n@1106 8628 try {
n@1106 8629 // Do send the request (this may raise an exception)
n@1106 8630 xhr.send( options.hasContent && options.data || null );
n@1106 8631 } catch ( e ) {
n@1106 8632 // #14683: Only rethrow if this hasn't been notified as an error yet
n@1106 8633 if ( callback ) {
n@1106 8634 throw e;
n@1106 8635 }
n@1106 8636 }
n@1106 8637 },
n@1106 8638
n@1106 8639 abort: function() {
n@1106 8640 if ( callback ) {
n@1106 8641 callback();
n@1106 8642 }
n@1106 8643 }
n@1106 8644 };
n@1106 8645 }
n@1106 8646 });
n@1106 8647
n@1106 8648
n@1106 8649
n@1106 8650
n@1106 8651 // Install script dataType
n@1106 8652 jQuery.ajaxSetup({
n@1106 8653 accepts: {
n@1106 8654 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
n@1106 8655 },
n@1106 8656 contents: {
n@1106 8657 script: /(?:java|ecma)script/
n@1106 8658 },
n@1106 8659 converters: {
n@1106 8660 "text script": function( text ) {
n@1106 8661 jQuery.globalEval( text );
n@1106 8662 return text;
n@1106 8663 }
n@1106 8664 }
n@1106 8665 });
n@1106 8666
n@1106 8667 // Handle cache's special case and crossDomain
n@1106 8668 jQuery.ajaxPrefilter( "script", function( s ) {
n@1106 8669 if ( s.cache === undefined ) {
n@1106 8670 s.cache = false;
n@1106 8671 }
n@1106 8672 if ( s.crossDomain ) {
n@1106 8673 s.type = "GET";
n@1106 8674 }
n@1106 8675 });
n@1106 8676
n@1106 8677 // Bind script tag hack transport
n@1106 8678 jQuery.ajaxTransport( "script", function( s ) {
n@1106 8679 // This transport only deals with cross domain requests
n@1106 8680 if ( s.crossDomain ) {
n@1106 8681 var script, callback;
n@1106 8682 return {
n@1106 8683 send: function( _, complete ) {
n@1106 8684 script = jQuery("<script>").prop({
n@1106 8685 async: true,
n@1106 8686 charset: s.scriptCharset,
n@1106 8687 src: s.url
n@1106 8688 }).on(
n@1106 8689 "load error",
n@1106 8690 callback = function( evt ) {
n@1106 8691 script.remove();
n@1106 8692 callback = null;
n@1106 8693 if ( evt ) {
n@1106 8694 complete( evt.type === "error" ? 404 : 200, evt.type );
n@1106 8695 }
n@1106 8696 }
n@1106 8697 );
n@1106 8698 document.head.appendChild( script[ 0 ] );
n@1106 8699 },
n@1106 8700 abort: function() {
n@1106 8701 if ( callback ) {
n@1106 8702 callback();
n@1106 8703 }
n@1106 8704 }
n@1106 8705 };
n@1106 8706 }
n@1106 8707 });
n@1106 8708
n@1106 8709
n@1106 8710
n@1106 8711
n@1106 8712 var oldCallbacks = [],
n@1106 8713 rjsonp = /(=)\?(?=&|$)|\?\?/;
n@1106 8714
n@1106 8715 // Default jsonp settings
n@1106 8716 jQuery.ajaxSetup({
n@1106 8717 jsonp: "callback",
n@1106 8718 jsonpCallback: function() {
n@1106 8719 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
n@1106 8720 this[ callback ] = true;
n@1106 8721 return callback;
n@1106 8722 }
n@1106 8723 });
n@1106 8724
n@1106 8725 // Detect, normalize options and install callbacks for jsonp requests
n@1106 8726 jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
n@1106 8727
n@1106 8728 var callbackName, overwritten, responseContainer,
n@1106 8729 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
n@1106 8730 "url" :
n@1106 8731 typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
n@1106 8732 );
n@1106 8733
n@1106 8734 // Handle iff the expected data type is "jsonp" or we have a parameter to set
n@1106 8735 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
n@1106 8736
n@1106 8737 // Get callback name, remembering preexisting value associated with it
n@1106 8738 callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
n@1106 8739 s.jsonpCallback() :
n@1106 8740 s.jsonpCallback;
n@1106 8741
n@1106 8742 // Insert callback into url or form data
n@1106 8743 if ( jsonProp ) {
n@1106 8744 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
n@1106 8745 } else if ( s.jsonp !== false ) {
n@1106 8746 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
n@1106 8747 }
n@1106 8748
n@1106 8749 // Use data converter to retrieve json after script execution
n@1106 8750 s.converters["script json"] = function() {
n@1106 8751 if ( !responseContainer ) {
n@1106 8752 jQuery.error( callbackName + " was not called" );
n@1106 8753 }
n@1106 8754 return responseContainer[ 0 ];
n@1106 8755 };
n@1106 8756
n@1106 8757 // force json dataType
n@1106 8758 s.dataTypes[ 0 ] = "json";
n@1106 8759
n@1106 8760 // Install callback
n@1106 8761 overwritten = window[ callbackName ];
n@1106 8762 window[ callbackName ] = function() {
n@1106 8763 responseContainer = arguments;
n@1106 8764 };
n@1106 8765
n@1106 8766 // Clean-up function (fires after converters)
n@1106 8767 jqXHR.always(function() {
n@1106 8768 // Restore preexisting value
n@1106 8769 window[ callbackName ] = overwritten;
n@1106 8770
n@1106 8771 // Save back as free
n@1106 8772 if ( s[ callbackName ] ) {
n@1106 8773 // make sure that re-using the options doesn't screw things around
n@1106 8774 s.jsonpCallback = originalSettings.jsonpCallback;
n@1106 8775
n@1106 8776 // save the callback name for future use
n@1106 8777 oldCallbacks.push( callbackName );
n@1106 8778 }
n@1106 8779
n@1106 8780 // Call if it was a function and we have a response
n@1106 8781 if ( responseContainer && jQuery.isFunction( overwritten ) ) {
n@1106 8782 overwritten( responseContainer[ 0 ] );
n@1106 8783 }
n@1106 8784
n@1106 8785 responseContainer = overwritten = undefined;
n@1106 8786 });
n@1106 8787
n@1106 8788 // Delegate to script
n@1106 8789 return "script";
n@1106 8790 }
n@1106 8791 });
n@1106 8792
n@1106 8793
n@1106 8794
n@1106 8795
n@1106 8796 // data: string of html
n@1106 8797 // context (optional): If specified, the fragment will be created in this context, defaults to document
n@1106 8798 // keepScripts (optional): If true, will include scripts passed in the html string
n@1106 8799 jQuery.parseHTML = function( data, context, keepScripts ) {
n@1106 8800 if ( !data || typeof data !== "string" ) {
n@1106 8801 return null;
n@1106 8802 }
n@1106 8803 if ( typeof context === "boolean" ) {
n@1106 8804 keepScripts = context;
n@1106 8805 context = false;
n@1106 8806 }
n@1106 8807 context = context || document;
n@1106 8808
n@1106 8809 var parsed = rsingleTag.exec( data ),
n@1106 8810 scripts = !keepScripts && [];
n@1106 8811
n@1106 8812 // Single tag
n@1106 8813 if ( parsed ) {
n@1106 8814 return [ context.createElement( parsed[1] ) ];
n@1106 8815 }
n@1106 8816
n@1106 8817 parsed = jQuery.buildFragment( [ data ], context, scripts );
n@1106 8818
n@1106 8819 if ( scripts && scripts.length ) {
n@1106 8820 jQuery( scripts ).remove();
n@1106 8821 }
n@1106 8822
n@1106 8823 return jQuery.merge( [], parsed.childNodes );
n@1106 8824 };
n@1106 8825
n@1106 8826
n@1106 8827 // Keep a copy of the old load method
n@1106 8828 var _load = jQuery.fn.load;
n@1106 8829
n@1106 8830 /**
n@1106 8831 * Load a url into a page
n@1106 8832 */
n@1106 8833 jQuery.fn.load = function( url, params, callback ) {
n@1106 8834 if ( typeof url !== "string" && _load ) {
n@1106 8835 return _load.apply( this, arguments );
n@1106 8836 }
n@1106 8837
n@1106 8838 var selector, type, response,
n@1106 8839 self = this,
n@1106 8840 off = url.indexOf(" ");
n@1106 8841
n@1106 8842 if ( off >= 0 ) {
n@1106 8843 selector = jQuery.trim( url.slice( off ) );
n@1106 8844 url = url.slice( 0, off );
n@1106 8845 }
n@1106 8846
n@1106 8847 // If it's a function
n@1106 8848 if ( jQuery.isFunction( params ) ) {
n@1106 8849
n@1106 8850 // We assume that it's the callback
n@1106 8851 callback = params;
n@1106 8852 params = undefined;
n@1106 8853
n@1106 8854 // Otherwise, build a param string
n@1106 8855 } else if ( params && typeof params === "object" ) {
n@1106 8856 type = "POST";
n@1106 8857 }
n@1106 8858
n@1106 8859 // If we have elements to modify, make the request
n@1106 8860 if ( self.length > 0 ) {
n@1106 8861 jQuery.ajax({
n@1106 8862 url: url,
n@1106 8863
n@1106 8864 // if "type" variable is undefined, then "GET" method will be used
n@1106 8865 type: type,
n@1106 8866 dataType: "html",
n@1106 8867 data: params
n@1106 8868 }).done(function( responseText ) {
n@1106 8869
n@1106 8870 // Save response for use in complete callback
n@1106 8871 response = arguments;
n@1106 8872
n@1106 8873 self.html( selector ?
n@1106 8874
n@1106 8875 // If a selector was specified, locate the right elements in a dummy div
n@1106 8876 // Exclude scripts to avoid IE 'Permission Denied' errors
n@1106 8877 jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
n@1106 8878
n@1106 8879 // Otherwise use the full result
n@1106 8880 responseText );
n@1106 8881
n@1106 8882 }).complete( callback && function( jqXHR, status ) {
n@1106 8883 self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
n@1106 8884 });
n@1106 8885 }
n@1106 8886
n@1106 8887 return this;
n@1106 8888 };
n@1106 8889
n@1106 8890
n@1106 8891
n@1106 8892
n@1106 8893 // Attach a bunch of functions for handling common AJAX events
n@1106 8894 jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) {
n@1106 8895 jQuery.fn[ type ] = function( fn ) {
n@1106 8896 return this.on( type, fn );
n@1106 8897 };
n@1106 8898 });
n@1106 8899
n@1106 8900
n@1106 8901
n@1106 8902
n@1106 8903 jQuery.expr.filters.animated = function( elem ) {
n@1106 8904 return jQuery.grep(jQuery.timers, function( fn ) {
n@1106 8905 return elem === fn.elem;
n@1106 8906 }).length;
n@1106 8907 };
n@1106 8908
n@1106 8909
n@1106 8910
n@1106 8911
n@1106 8912 var docElem = window.document.documentElement;
n@1106 8913
n@1106 8914 /**
n@1106 8915 * Gets a window from an element
n@1106 8916 */
n@1106 8917 function getWindow( elem ) {
n@1106 8918 return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
n@1106 8919 }
n@1106 8920
n@1106 8921 jQuery.offset = {
n@1106 8922 setOffset: function( elem, options, i ) {
n@1106 8923 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
n@1106 8924 position = jQuery.css( elem, "position" ),
n@1106 8925 curElem = jQuery( elem ),
n@1106 8926 props = {};
n@1106 8927
n@1106 8928 // Set position first, in-case top/left are set even on static elem
n@1106 8929 if ( position === "static" ) {
n@1106 8930 elem.style.position = "relative";
n@1106 8931 }
n@1106 8932
n@1106 8933 curOffset = curElem.offset();
n@1106 8934 curCSSTop = jQuery.css( elem, "top" );
n@1106 8935 curCSSLeft = jQuery.css( elem, "left" );
n@1106 8936 calculatePosition = ( position === "absolute" || position === "fixed" ) &&
n@1106 8937 ( curCSSTop + curCSSLeft ).indexOf("auto") > -1;
n@1106 8938
n@1106 8939 // Need to be able to calculate position if either
n@1106 8940 // top or left is auto and position is either absolute or fixed
n@1106 8941 if ( calculatePosition ) {
n@1106 8942 curPosition = curElem.position();
n@1106 8943 curTop = curPosition.top;
n@1106 8944 curLeft = curPosition.left;
n@1106 8945
n@1106 8946 } else {
n@1106 8947 curTop = parseFloat( curCSSTop ) || 0;
n@1106 8948 curLeft = parseFloat( curCSSLeft ) || 0;
n@1106 8949 }
n@1106 8950
n@1106 8951 if ( jQuery.isFunction( options ) ) {
n@1106 8952 options = options.call( elem, i, curOffset );
n@1106 8953 }
n@1106 8954
n@1106 8955 if ( options.top != null ) {
n@1106 8956 props.top = ( options.top - curOffset.top ) + curTop;
n@1106 8957 }
n@1106 8958 if ( options.left != null ) {
n@1106 8959 props.left = ( options.left - curOffset.left ) + curLeft;
n@1106 8960 }
n@1106 8961
n@1106 8962 if ( "using" in options ) {
n@1106 8963 options.using.call( elem, props );
n@1106 8964
n@1106 8965 } else {
n@1106 8966 curElem.css( props );
n@1106 8967 }
n@1106 8968 }
n@1106 8969 };
n@1106 8970
n@1106 8971 jQuery.fn.extend({
n@1106 8972 offset: function( options ) {
n@1106 8973 if ( arguments.length ) {
n@1106 8974 return options === undefined ?
n@1106 8975 this :
n@1106 8976 this.each(function( i ) {
n@1106 8977 jQuery.offset.setOffset( this, options, i );
n@1106 8978 });
n@1106 8979 }
n@1106 8980
n@1106 8981 var docElem, win,
n@1106 8982 elem = this[ 0 ],
n@1106 8983 box = { top: 0, left: 0 },
n@1106 8984 doc = elem && elem.ownerDocument;
n@1106 8985
n@1106 8986 if ( !doc ) {
n@1106 8987 return;
n@1106 8988 }
n@1106 8989
n@1106 8990 docElem = doc.documentElement;
n@1106 8991
n@1106 8992 // Make sure it's not a disconnected DOM node
n@1106 8993 if ( !jQuery.contains( docElem, elem ) ) {
n@1106 8994 return box;
n@1106 8995 }
n@1106 8996
n@1106 8997 // Support: BlackBerry 5, iOS 3 (original iPhone)
n@1106 8998 // If we don't have gBCR, just use 0,0 rather than error
n@1106 8999 if ( typeof elem.getBoundingClientRect !== strundefined ) {
n@1106 9000 box = elem.getBoundingClientRect();
n@1106 9001 }
n@1106 9002 win = getWindow( doc );
n@1106 9003 return {
n@1106 9004 top: box.top + win.pageYOffset - docElem.clientTop,
n@1106 9005 left: box.left + win.pageXOffset - docElem.clientLeft
n@1106 9006 };
n@1106 9007 },
n@1106 9008
n@1106 9009 position: function() {
n@1106 9010 if ( !this[ 0 ] ) {
n@1106 9011 return;
n@1106 9012 }
n@1106 9013
n@1106 9014 var offsetParent, offset,
n@1106 9015 elem = this[ 0 ],
n@1106 9016 parentOffset = { top: 0, left: 0 };
n@1106 9017
n@1106 9018 // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent
n@1106 9019 if ( jQuery.css( elem, "position" ) === "fixed" ) {
n@1106 9020 // Assume getBoundingClientRect is there when computed position is fixed
n@1106 9021 offset = elem.getBoundingClientRect();
n@1106 9022
n@1106 9023 } else {
n@1106 9024 // Get *real* offsetParent
n@1106 9025 offsetParent = this.offsetParent();
n@1106 9026
n@1106 9027 // Get correct offsets
n@1106 9028 offset = this.offset();
n@1106 9029 if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
n@1106 9030 parentOffset = offsetParent.offset();
n@1106 9031 }
n@1106 9032
n@1106 9033 // Add offsetParent borders
n@1106 9034 parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
n@1106 9035 parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
n@1106 9036 }
n@1106 9037
n@1106 9038 // Subtract parent offsets and element margins
n@1106 9039 return {
n@1106 9040 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
n@1106 9041 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
n@1106 9042 };
n@1106 9043 },
n@1106 9044
n@1106 9045 offsetParent: function() {
n@1106 9046 return this.map(function() {
n@1106 9047 var offsetParent = this.offsetParent || docElem;
n@1106 9048
n@1106 9049 while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) {
n@1106 9050 offsetParent = offsetParent.offsetParent;
n@1106 9051 }
n@1106 9052
n@1106 9053 return offsetParent || docElem;
n@1106 9054 });
n@1106 9055 }
n@1106 9056 });
n@1106 9057
n@1106 9058 // Create scrollLeft and scrollTop methods
n@1106 9059 jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
n@1106 9060 var top = "pageYOffset" === prop;
n@1106 9061
n@1106 9062 jQuery.fn[ method ] = function( val ) {
n@1106 9063 return access( this, function( elem, method, val ) {
n@1106 9064 var win = getWindow( elem );
n@1106 9065
n@1106 9066 if ( val === undefined ) {
n@1106 9067 return win ? win[ prop ] : elem[ method ];
n@1106 9068 }
n@1106 9069
n@1106 9070 if ( win ) {
n@1106 9071 win.scrollTo(
n@1106 9072 !top ? val : window.pageXOffset,
n@1106 9073 top ? val : window.pageYOffset
n@1106 9074 );
n@1106 9075
n@1106 9076 } else {
n@1106 9077 elem[ method ] = val;
n@1106 9078 }
n@1106 9079 }, method, val, arguments.length, null );
n@1106 9080 };
n@1106 9081 });
n@1106 9082
n@1106 9083 // Support: Safari<7+, Chrome<37+
n@1106 9084 // Add the top/left cssHooks using jQuery.fn.position
n@1106 9085 // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
n@1106 9086 // Blink bug: https://code.google.com/p/chromium/issues/detail?id=229280
n@1106 9087 // getComputedStyle returns percent when specified for top/left/bottom/right;
n@1106 9088 // rather than make the css module depend on the offset module, just check for it here
n@1106 9089 jQuery.each( [ "top", "left" ], function( i, prop ) {
n@1106 9090 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
n@1106 9091 function( elem, computed ) {
n@1106 9092 if ( computed ) {
n@1106 9093 computed = curCSS( elem, prop );
n@1106 9094 // If curCSS returns percentage, fallback to offset
n@1106 9095 return rnumnonpx.test( computed ) ?
n@1106 9096 jQuery( elem ).position()[ prop ] + "px" :
n@1106 9097 computed;
n@1106 9098 }
n@1106 9099 }
n@1106 9100 );
n@1106 9101 });
n@1106 9102
n@1106 9103
n@1106 9104 // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
n@1106 9105 jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
n@1106 9106 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
n@1106 9107 // Margin is only for outerHeight, outerWidth
n@1106 9108 jQuery.fn[ funcName ] = function( margin, value ) {
n@1106 9109 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
n@1106 9110 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
n@1106 9111
n@1106 9112 return access( this, function( elem, type, value ) {
n@1106 9113 var doc;
n@1106 9114
n@1106 9115 if ( jQuery.isWindow( elem ) ) {
n@1106 9116 // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
n@1106 9117 // isn't a whole lot we can do. See pull request at this URL for discussion:
n@1106 9118 // https://github.com/jquery/jquery/pull/764
n@1106 9119 return elem.document.documentElement[ "client" + name ];
n@1106 9120 }
n@1106 9121
n@1106 9122 // Get document width or height
n@1106 9123 if ( elem.nodeType === 9 ) {
n@1106 9124 doc = elem.documentElement;
n@1106 9125
n@1106 9126 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
n@1106 9127 // whichever is greatest
n@1106 9128 return Math.max(
n@1106 9129 elem.body[ "scroll" + name ], doc[ "scroll" + name ],
n@1106 9130 elem.body[ "offset" + name ], doc[ "offset" + name ],
n@1106 9131 doc[ "client" + name ]
n@1106 9132 );
n@1106 9133 }
n@1106 9134
n@1106 9135 return value === undefined ?
n@1106 9136 // Get width or height on the element, requesting but not forcing parseFloat
n@1106 9137 jQuery.css( elem, type, extra ) :
n@1106 9138
n@1106 9139 // Set width or height on the element
n@1106 9140 jQuery.style( elem, type, value, extra );
n@1106 9141 }, type, chainable ? margin : undefined, chainable, null );
n@1106 9142 };
n@1106 9143 });
n@1106 9144 });
n@1106 9145
n@1106 9146
n@1106 9147 // The number of elements contained in the matched element set
n@1106 9148 jQuery.fn.size = function() {
n@1106 9149 return this.length;
n@1106 9150 };
n@1106 9151
n@1106 9152 jQuery.fn.andSelf = jQuery.fn.addBack;
n@1106 9153
n@1106 9154
n@1106 9155
n@1106 9156
n@1106 9157 // Register as a named AMD module, since jQuery can be concatenated with other
n@1106 9158 // files that may use define, but not via a proper concatenation script that
n@1106 9159 // understands anonymous AMD modules. A named AMD is safest and most robust
n@1106 9160 // way to register. Lowercase jquery is used because AMD module names are
n@1106 9161 // derived from file names, and jQuery is normally delivered in a lowercase
n@1106 9162 // file name. Do this after creating the global so that if an AMD module wants
n@1106 9163 // to call noConflict to hide this version of jQuery, it will work.
n@1106 9164
n@1106 9165 // Note that for maximum portability, libraries that are not jQuery should
n@1106 9166 // declare themselves as anonymous modules, and avoid setting a global if an
n@1106 9167 // AMD loader is present. jQuery is a special case. For more information, see
n@1106 9168 // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
n@1106 9169
n@1106 9170 if ( typeof define === "function" && define.amd ) {
n@1106 9171 define( "jquery", [], function() {
n@1106 9172 return jQuery;
n@1106 9173 });
n@1106 9174 }
n@1106 9175
n@1106 9176
n@1106 9177
n@1106 9178
n@1106 9179 var
n@1106 9180 // Map over jQuery in case of overwrite
n@1106 9181 _jQuery = window.jQuery,
n@1106 9182
n@1106 9183 // Map over the $ in case of overwrite
n@1106 9184 _$ = window.$;
n@1106 9185
n@1106 9186 jQuery.noConflict = function( deep ) {
n@1106 9187 if ( window.$ === jQuery ) {
n@1106 9188 window.$ = _$;
n@1106 9189 }
n@1106 9190
n@1106 9191 if ( deep && window.jQuery === jQuery ) {
n@1106 9192 window.jQuery = _jQuery;
n@1106 9193 }
n@1106 9194
n@1106 9195 return jQuery;
n@1106 9196 };
n@1106 9197
n@1106 9198 // Expose jQuery and $ identifiers, even in AMD
n@1106 9199 // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
n@1106 9200 // and CommonJS for browser emulators (#13566)
n@1106 9201 if ( typeof noGlobal === strundefined ) {
n@1106 9202 window.jQuery = window.$ = jQuery;
n@1106 9203 }
n@1106 9204
n@1106 9205
n@1106 9206
n@1106 9207
n@1106 9208 return jQuery;
n@1106 9209
n@1106 9210 }));