annotate jquery-2.1.4.js @ 1034:34adad703811

SMC2015Paper: Added section to lightly compare BeaqleJS and WAET in introduction where BeaqleJS is mentioned. Removed feature 'drag playhead' as unlikley to be implemented.
author Nicholas Jillings <nicholas.jillings@eecs.qmul.ac.uk>
date Wed, 17 Jun 2015 15:27:11 +0100
parents c40ce9c67b6b
children
rev   line source
n@893 1 /*!
n@893 2 * jQuery JavaScript Library v2.1.4
n@893 3 * http://jquery.com/
n@893 4 *
n@893 5 * Includes Sizzle.js
n@893 6 * http://sizzlejs.com/
n@893 7 *
n@893 8 * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
n@893 9 * Released under the MIT license
n@893 10 * http://jquery.org/license
n@893 11 *
n@893 12 * Date: 2015-04-28T16:01Z
n@893 13 */
n@893 14
n@893 15 (function( global, factory ) {
n@893 16
n@893 17 if ( typeof module === "object" && typeof module.exports === "object" ) {
n@893 18 // For CommonJS and CommonJS-like environments where a proper `window`
n@893 19 // is present, execute the factory and get jQuery.
n@893 20 // For environments that do not have a `window` with a `document`
n@893 21 // (such as Node.js), expose a factory as module.exports.
n@893 22 // This accentuates the need for the creation of a real `window`.
n@893 23 // e.g. var jQuery = require("jquery")(window);
n@893 24 // See ticket #14549 for more info.
n@893 25 module.exports = global.document ?
n@893 26 factory( global, true ) :
n@893 27 function( w ) {
n@893 28 if ( !w.document ) {
n@893 29 throw new Error( "jQuery requires a window with a document" );
n@893 30 }
n@893 31 return factory( w );
n@893 32 };
n@893 33 } else {
n@893 34 factory( global );
n@893 35 }
n@893 36
n@893 37 // Pass this if window is not defined yet
n@893 38 }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
n@893 39
n@893 40 // Support: Firefox 18+
n@893 41 // Can't be in strict mode, several libs including ASP.NET trace
n@893 42 // the stack via arguments.caller.callee and Firefox dies if
n@893 43 // you try to trace through "use strict" call chains. (#13335)
n@893 44 //
n@893 45
n@893 46 var arr = [];
n@893 47
n@893 48 var slice = arr.slice;
n@893 49
n@893 50 var concat = arr.concat;
n@893 51
n@893 52 var push = arr.push;
n@893 53
n@893 54 var indexOf = arr.indexOf;
n@893 55
n@893 56 var class2type = {};
n@893 57
n@893 58 var toString = class2type.toString;
n@893 59
n@893 60 var hasOwn = class2type.hasOwnProperty;
n@893 61
n@893 62 var support = {};
n@893 63
n@893 64
n@893 65
n@893 66 var
n@893 67 // Use the correct document accordingly with window argument (sandbox)
n@893 68 document = window.document,
n@893 69
n@893 70 version = "2.1.4",
n@893 71
n@893 72 // Define a local copy of jQuery
n@893 73 jQuery = function( selector, context ) {
n@893 74 // The jQuery object is actually just the init constructor 'enhanced'
n@893 75 // Need init if jQuery is called (just allow error to be thrown if not included)
n@893 76 return new jQuery.fn.init( selector, context );
n@893 77 },
n@893 78
n@893 79 // Support: Android<4.1
n@893 80 // Make sure we trim BOM and NBSP
n@893 81 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
n@893 82
n@893 83 // Matches dashed string for camelizing
n@893 84 rmsPrefix = /^-ms-/,
n@893 85 rdashAlpha = /-([\da-z])/gi,
n@893 86
n@893 87 // Used by jQuery.camelCase as callback to replace()
n@893 88 fcamelCase = function( all, letter ) {
n@893 89 return letter.toUpperCase();
n@893 90 };
n@893 91
n@893 92 jQuery.fn = jQuery.prototype = {
n@893 93 // The current version of jQuery being used
n@893 94 jquery: version,
n@893 95
n@893 96 constructor: jQuery,
n@893 97
n@893 98 // Start with an empty selector
n@893 99 selector: "",
n@893 100
n@893 101 // The default length of a jQuery object is 0
n@893 102 length: 0,
n@893 103
n@893 104 toArray: function() {
n@893 105 return slice.call( this );
n@893 106 },
n@893 107
n@893 108 // Get the Nth element in the matched element set OR
n@893 109 // Get the whole matched element set as a clean array
n@893 110 get: function( num ) {
n@893 111 return num != null ?
n@893 112
n@893 113 // Return just the one element from the set
n@893 114 ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
n@893 115
n@893 116 // Return all the elements in a clean array
n@893 117 slice.call( this );
n@893 118 },
n@893 119
n@893 120 // Take an array of elements and push it onto the stack
n@893 121 // (returning the new matched element set)
n@893 122 pushStack: function( elems ) {
n@893 123
n@893 124 // Build a new jQuery matched element set
n@893 125 var ret = jQuery.merge( this.constructor(), elems );
n@893 126
n@893 127 // Add the old object onto the stack (as a reference)
n@893 128 ret.prevObject = this;
n@893 129 ret.context = this.context;
n@893 130
n@893 131 // Return the newly-formed element set
n@893 132 return ret;
n@893 133 },
n@893 134
n@893 135 // Execute a callback for every element in the matched set.
n@893 136 // (You can seed the arguments with an array of args, but this is
n@893 137 // only used internally.)
n@893 138 each: function( callback, args ) {
n@893 139 return jQuery.each( this, callback, args );
n@893 140 },
n@893 141
n@893 142 map: function( callback ) {
n@893 143 return this.pushStack( jQuery.map(this, function( elem, i ) {
n@893 144 return callback.call( elem, i, elem );
n@893 145 }));
n@893 146 },
n@893 147
n@893 148 slice: function() {
n@893 149 return this.pushStack( slice.apply( this, arguments ) );
n@893 150 },
n@893 151
n@893 152 first: function() {
n@893 153 return this.eq( 0 );
n@893 154 },
n@893 155
n@893 156 last: function() {
n@893 157 return this.eq( -1 );
n@893 158 },
n@893 159
n@893 160 eq: function( i ) {
n@893 161 var len = this.length,
n@893 162 j = +i + ( i < 0 ? len : 0 );
n@893 163 return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
n@893 164 },
n@893 165
n@893 166 end: function() {
n@893 167 return this.prevObject || this.constructor(null);
n@893 168 },
n@893 169
n@893 170 // For internal use only.
n@893 171 // Behaves like an Array's method, not like a jQuery method.
n@893 172 push: push,
n@893 173 sort: arr.sort,
n@893 174 splice: arr.splice
n@893 175 };
n@893 176
n@893 177 jQuery.extend = jQuery.fn.extend = function() {
n@893 178 var options, name, src, copy, copyIsArray, clone,
n@893 179 target = arguments[0] || {},
n@893 180 i = 1,
n@893 181 length = arguments.length,
n@893 182 deep = false;
n@893 183
n@893 184 // Handle a deep copy situation
n@893 185 if ( typeof target === "boolean" ) {
n@893 186 deep = target;
n@893 187
n@893 188 // Skip the boolean and the target
n@893 189 target = arguments[ i ] || {};
n@893 190 i++;
n@893 191 }
n@893 192
n@893 193 // Handle case when target is a string or something (possible in deep copy)
n@893 194 if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
n@893 195 target = {};
n@893 196 }
n@893 197
n@893 198 // Extend jQuery itself if only one argument is passed
n@893 199 if ( i === length ) {
n@893 200 target = this;
n@893 201 i--;
n@893 202 }
n@893 203
n@893 204 for ( ; i < length; i++ ) {
n@893 205 // Only deal with non-null/undefined values
n@893 206 if ( (options = arguments[ i ]) != null ) {
n@893 207 // Extend the base object
n@893 208 for ( name in options ) {
n@893 209 src = target[ name ];
n@893 210 copy = options[ name ];
n@893 211
n@893 212 // Prevent never-ending loop
n@893 213 if ( target === copy ) {
n@893 214 continue;
n@893 215 }
n@893 216
n@893 217 // Recurse if we're merging plain objects or arrays
n@893 218 if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
n@893 219 if ( copyIsArray ) {
n@893 220 copyIsArray = false;
n@893 221 clone = src && jQuery.isArray(src) ? src : [];
n@893 222
n@893 223 } else {
n@893 224 clone = src && jQuery.isPlainObject(src) ? src : {};
n@893 225 }
n@893 226
n@893 227 // Never move original objects, clone them
n@893 228 target[ name ] = jQuery.extend( deep, clone, copy );
n@893 229
n@893 230 // Don't bring in undefined values
n@893 231 } else if ( copy !== undefined ) {
n@893 232 target[ name ] = copy;
n@893 233 }
n@893 234 }
n@893 235 }
n@893 236 }
n@893 237
n@893 238 // Return the modified object
n@893 239 return target;
n@893 240 };
n@893 241
n@893 242 jQuery.extend({
n@893 243 // Unique for each copy of jQuery on the page
n@893 244 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
n@893 245
n@893 246 // Assume jQuery is ready without the ready module
n@893 247 isReady: true,
n@893 248
n@893 249 error: function( msg ) {
n@893 250 throw new Error( msg );
n@893 251 },
n@893 252
n@893 253 noop: function() {},
n@893 254
n@893 255 isFunction: function( obj ) {
n@893 256 return jQuery.type(obj) === "function";
n@893 257 },
n@893 258
n@893 259 isArray: Array.isArray,
n@893 260
n@893 261 isWindow: function( obj ) {
n@893 262 return obj != null && obj === obj.window;
n@893 263 },
n@893 264
n@893 265 isNumeric: function( obj ) {
n@893 266 // parseFloat NaNs numeric-cast false positives (null|true|false|"")
n@893 267 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
n@893 268 // subtraction forces infinities to NaN
n@893 269 // adding 1 corrects loss of precision from parseFloat (#15100)
n@893 270 return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0;
n@893 271 },
n@893 272
n@893 273 isPlainObject: function( obj ) {
n@893 274 // Not plain objects:
n@893 275 // - Any object or value whose internal [[Class]] property is not "[object Object]"
n@893 276 // - DOM nodes
n@893 277 // - window
n@893 278 if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
n@893 279 return false;
n@893 280 }
n@893 281
n@893 282 if ( obj.constructor &&
n@893 283 !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
n@893 284 return false;
n@893 285 }
n@893 286
n@893 287 // If the function hasn't returned already, we're confident that
n@893 288 // |obj| is a plain object, created by {} or constructed with new Object
n@893 289 return true;
n@893 290 },
n@893 291
n@893 292 isEmptyObject: function( obj ) {
n@893 293 var name;
n@893 294 for ( name in obj ) {
n@893 295 return false;
n@893 296 }
n@893 297 return true;
n@893 298 },
n@893 299
n@893 300 type: function( obj ) {
n@893 301 if ( obj == null ) {
n@893 302 return obj + "";
n@893 303 }
n@893 304 // Support: Android<4.0, iOS<6 (functionish RegExp)
n@893 305 return typeof obj === "object" || typeof obj === "function" ?
n@893 306 class2type[ toString.call(obj) ] || "object" :
n@893 307 typeof obj;
n@893 308 },
n@893 309
n@893 310 // Evaluates a script in a global context
n@893 311 globalEval: function( code ) {
n@893 312 var script,
n@893 313 indirect = eval;
n@893 314
n@893 315 code = jQuery.trim( code );
n@893 316
n@893 317 if ( code ) {
n@893 318 // If the code includes a valid, prologue position
n@893 319 // strict mode pragma, execute code by injecting a
n@893 320 // script tag into the document.
n@893 321 if ( code.indexOf("use strict") === 1 ) {
n@893 322 script = document.createElement("script");
n@893 323 script.text = code;
n@893 324 document.head.appendChild( script ).parentNode.removeChild( script );
n@893 325 } else {
n@893 326 // Otherwise, avoid the DOM node creation, insertion
n@893 327 // and removal by using an indirect global eval
n@893 328 indirect( code );
n@893 329 }
n@893 330 }
n@893 331 },
n@893 332
n@893 333 // Convert dashed to camelCase; used by the css and data modules
n@893 334 // Support: IE9-11+
n@893 335 // Microsoft forgot to hump their vendor prefix (#9572)
n@893 336 camelCase: function( string ) {
n@893 337 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
n@893 338 },
n@893 339
n@893 340 nodeName: function( elem, name ) {
n@893 341 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
n@893 342 },
n@893 343
n@893 344 // args is for internal usage only
n@893 345 each: function( obj, callback, args ) {
n@893 346 var value,
n@893 347 i = 0,
n@893 348 length = obj.length,
n@893 349 isArray = isArraylike( obj );
n@893 350
n@893 351 if ( args ) {
n@893 352 if ( isArray ) {
n@893 353 for ( ; i < length; i++ ) {
n@893 354 value = callback.apply( obj[ i ], args );
n@893 355
n@893 356 if ( value === false ) {
n@893 357 break;
n@893 358 }
n@893 359 }
n@893 360 } else {
n@893 361 for ( i in obj ) {
n@893 362 value = callback.apply( obj[ i ], args );
n@893 363
n@893 364 if ( value === false ) {
n@893 365 break;
n@893 366 }
n@893 367 }
n@893 368 }
n@893 369
n@893 370 // A special, fast, case for the most common use of each
n@893 371 } else {
n@893 372 if ( isArray ) {
n@893 373 for ( ; i < length; i++ ) {
n@893 374 value = callback.call( obj[ i ], i, obj[ i ] );
n@893 375
n@893 376 if ( value === false ) {
n@893 377 break;
n@893 378 }
n@893 379 }
n@893 380 } else {
n@893 381 for ( i in obj ) {
n@893 382 value = callback.call( obj[ i ], i, obj[ i ] );
n@893 383
n@893 384 if ( value === false ) {
n@893 385 break;
n@893 386 }
n@893 387 }
n@893 388 }
n@893 389 }
n@893 390
n@893 391 return obj;
n@893 392 },
n@893 393
n@893 394 // Support: Android<4.1
n@893 395 trim: function( text ) {
n@893 396 return text == null ?
n@893 397 "" :
n@893 398 ( text + "" ).replace( rtrim, "" );
n@893 399 },
n@893 400
n@893 401 // results is for internal usage only
n@893 402 makeArray: function( arr, results ) {
n@893 403 var ret = results || [];
n@893 404
n@893 405 if ( arr != null ) {
n@893 406 if ( isArraylike( Object(arr) ) ) {
n@893 407 jQuery.merge( ret,
n@893 408 typeof arr === "string" ?
n@893 409 [ arr ] : arr
n@893 410 );
n@893 411 } else {
n@893 412 push.call( ret, arr );
n@893 413 }
n@893 414 }
n@893 415
n@893 416 return ret;
n@893 417 },
n@893 418
n@893 419 inArray: function( elem, arr, i ) {
n@893 420 return arr == null ? -1 : indexOf.call( arr, elem, i );
n@893 421 },
n@893 422
n@893 423 merge: function( first, second ) {
n@893 424 var len = +second.length,
n@893 425 j = 0,
n@893 426 i = first.length;
n@893 427
n@893 428 for ( ; j < len; j++ ) {
n@893 429 first[ i++ ] = second[ j ];
n@893 430 }
n@893 431
n@893 432 first.length = i;
n@893 433
n@893 434 return first;
n@893 435 },
n@893 436
n@893 437 grep: function( elems, callback, invert ) {
n@893 438 var callbackInverse,
n@893 439 matches = [],
n@893 440 i = 0,
n@893 441 length = elems.length,
n@893 442 callbackExpect = !invert;
n@893 443
n@893 444 // Go through the array, only saving the items
n@893 445 // that pass the validator function
n@893 446 for ( ; i < length; i++ ) {
n@893 447 callbackInverse = !callback( elems[ i ], i );
n@893 448 if ( callbackInverse !== callbackExpect ) {
n@893 449 matches.push( elems[ i ] );
n@893 450 }
n@893 451 }
n@893 452
n@893 453 return matches;
n@893 454 },
n@893 455
n@893 456 // arg is for internal usage only
n@893 457 map: function( elems, callback, arg ) {
n@893 458 var value,
n@893 459 i = 0,
n@893 460 length = elems.length,
n@893 461 isArray = isArraylike( elems ),
n@893 462 ret = [];
n@893 463
n@893 464 // Go through the array, translating each of the items to their new values
n@893 465 if ( isArray ) {
n@893 466 for ( ; i < length; i++ ) {
n@893 467 value = callback( elems[ i ], i, arg );
n@893 468
n@893 469 if ( value != null ) {
n@893 470 ret.push( value );
n@893 471 }
n@893 472 }
n@893 473
n@893 474 // Go through every key on the object,
n@893 475 } else {
n@893 476 for ( i in elems ) {
n@893 477 value = callback( elems[ i ], i, arg );
n@893 478
n@893 479 if ( value != null ) {
n@893 480 ret.push( value );
n@893 481 }
n@893 482 }
n@893 483 }
n@893 484
n@893 485 // Flatten any nested arrays
n@893 486 return concat.apply( [], ret );
n@893 487 },
n@893 488
n@893 489 // A global GUID counter for objects
n@893 490 guid: 1,
n@893 491
n@893 492 // Bind a function to a context, optionally partially applying any
n@893 493 // arguments.
n@893 494 proxy: function( fn, context ) {
n@893 495 var tmp, args, proxy;
n@893 496
n@893 497 if ( typeof context === "string" ) {
n@893 498 tmp = fn[ context ];
n@893 499 context = fn;
n@893 500 fn = tmp;
n@893 501 }
n@893 502
n@893 503 // Quick check to determine if target is callable, in the spec
n@893 504 // this throws a TypeError, but we will just return undefined.
n@893 505 if ( !jQuery.isFunction( fn ) ) {
n@893 506 return undefined;
n@893 507 }
n@893 508
n@893 509 // Simulated bind
n@893 510 args = slice.call( arguments, 2 );
n@893 511 proxy = function() {
n@893 512 return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
n@893 513 };
n@893 514
n@893 515 // Set the guid of unique handler to the same of original handler, so it can be removed
n@893 516 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
n@893 517
n@893 518 return proxy;
n@893 519 },
n@893 520
n@893 521 now: Date.now,
n@893 522
n@893 523 // jQuery.support is not used in Core but other projects attach their
n@893 524 // properties to it so it needs to exist.
n@893 525 support: support
n@893 526 });
n@893 527
n@893 528 // Populate the class2type map
n@893 529 jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
n@893 530 class2type[ "[object " + name + "]" ] = name.toLowerCase();
n@893 531 });
n@893 532
n@893 533 function isArraylike( obj ) {
n@893 534
n@893 535 // Support: iOS 8.2 (not reproducible in simulator)
n@893 536 // `in` check used to prevent JIT error (gh-2145)
n@893 537 // hasOwn isn't used here due to false negatives
n@893 538 // regarding Nodelist length in IE
n@893 539 var length = "length" in obj && obj.length,
n@893 540 type = jQuery.type( obj );
n@893 541
n@893 542 if ( type === "function" || jQuery.isWindow( obj ) ) {
n@893 543 return false;
n@893 544 }
n@893 545
n@893 546 if ( obj.nodeType === 1 && length ) {
n@893 547 return true;
n@893 548 }
n@893 549
n@893 550 return type === "array" || length === 0 ||
n@893 551 typeof length === "number" && length > 0 && ( length - 1 ) in obj;
n@893 552 }
n@893 553 var Sizzle =
n@893 554 /*!
n@893 555 * Sizzle CSS Selector Engine v2.2.0-pre
n@893 556 * http://sizzlejs.com/
n@893 557 *
n@893 558 * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors
n@893 559 * Released under the MIT license
n@893 560 * http://jquery.org/license
n@893 561 *
n@893 562 * Date: 2014-12-16
n@893 563 */
n@893 564 (function( window ) {
n@893 565
n@893 566 var i,
n@893 567 support,
n@893 568 Expr,
n@893 569 getText,
n@893 570 isXML,
n@893 571 tokenize,
n@893 572 compile,
n@893 573 select,
n@893 574 outermostContext,
n@893 575 sortInput,
n@893 576 hasDuplicate,
n@893 577
n@893 578 // Local document vars
n@893 579 setDocument,
n@893 580 document,
n@893 581 docElem,
n@893 582 documentIsHTML,
n@893 583 rbuggyQSA,
n@893 584 rbuggyMatches,
n@893 585 matches,
n@893 586 contains,
n@893 587
n@893 588 // Instance-specific data
n@893 589 expando = "sizzle" + 1 * new Date(),
n@893 590 preferredDoc = window.document,
n@893 591 dirruns = 0,
n@893 592 done = 0,
n@893 593 classCache = createCache(),
n@893 594 tokenCache = createCache(),
n@893 595 compilerCache = createCache(),
n@893 596 sortOrder = function( a, b ) {
n@893 597 if ( a === b ) {
n@893 598 hasDuplicate = true;
n@893 599 }
n@893 600 return 0;
n@893 601 },
n@893 602
n@893 603 // General-purpose constants
n@893 604 MAX_NEGATIVE = 1 << 31,
n@893 605
n@893 606 // Instance methods
n@893 607 hasOwn = ({}).hasOwnProperty,
n@893 608 arr = [],
n@893 609 pop = arr.pop,
n@893 610 push_native = arr.push,
n@893 611 push = arr.push,
n@893 612 slice = arr.slice,
n@893 613 // Use a stripped-down indexOf as it's faster than native
n@893 614 // http://jsperf.com/thor-indexof-vs-for/5
n@893 615 indexOf = function( list, elem ) {
n@893 616 var i = 0,
n@893 617 len = list.length;
n@893 618 for ( ; i < len; i++ ) {
n@893 619 if ( list[i] === elem ) {
n@893 620 return i;
n@893 621 }
n@893 622 }
n@893 623 return -1;
n@893 624 },
n@893 625
n@893 626 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
n@893 627
n@893 628 // Regular expressions
n@893 629
n@893 630 // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
n@893 631 whitespace = "[\\x20\\t\\r\\n\\f]",
n@893 632 // http://www.w3.org/TR/css3-syntax/#characters
n@893 633 characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
n@893 634
n@893 635 // Loosely modeled on CSS identifier characters
n@893 636 // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
n@893 637 // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
n@893 638 identifier = characterEncoding.replace( "w", "w#" ),
n@893 639
n@893 640 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
n@893 641 attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace +
n@893 642 // Operator (capture 2)
n@893 643 "*([*^$|!~]?=)" + whitespace +
n@893 644 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
n@893 645 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
n@893 646 "*\\]",
n@893 647
n@893 648 pseudos = ":(" + characterEncoding + ")(?:\\((" +
n@893 649 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
n@893 650 // 1. quoted (capture 3; capture 4 or capture 5)
n@893 651 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
n@893 652 // 2. simple (capture 6)
n@893 653 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
n@893 654 // 3. anything else (capture 2)
n@893 655 ".*" +
n@893 656 ")\\)|)",
n@893 657
n@893 658 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
n@893 659 rwhitespace = new RegExp( whitespace + "+", "g" ),
n@893 660 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
n@893 661
n@893 662 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
n@893 663 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
n@893 664
n@893 665 rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
n@893 666
n@893 667 rpseudo = new RegExp( pseudos ),
n@893 668 ridentifier = new RegExp( "^" + identifier + "$" ),
n@893 669
n@893 670 matchExpr = {
n@893 671 "ID": new RegExp( "^#(" + characterEncoding + ")" ),
n@893 672 "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
n@893 673 "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
n@893 674 "ATTR": new RegExp( "^" + attributes ),
n@893 675 "PSEUDO": new RegExp( "^" + pseudos ),
n@893 676 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
n@893 677 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
n@893 678 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
n@893 679 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
n@893 680 // For use in libraries implementing .is()
n@893 681 // We use this for POS matching in `select`
n@893 682 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
n@893 683 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
n@893 684 },
n@893 685
n@893 686 rinputs = /^(?:input|select|textarea|button)$/i,
n@893 687 rheader = /^h\d$/i,
n@893 688
n@893 689 rnative = /^[^{]+\{\s*\[native \w/,
n@893 690
n@893 691 // Easily-parseable/retrievable ID or TAG or CLASS selectors
n@893 692 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
n@893 693
n@893 694 rsibling = /[+~]/,
n@893 695 rescape = /'|\\/g,
n@893 696
n@893 697 // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
n@893 698 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
n@893 699 funescape = function( _, escaped, escapedWhitespace ) {
n@893 700 var high = "0x" + escaped - 0x10000;
n@893 701 // NaN means non-codepoint
n@893 702 // Support: Firefox<24
n@893 703 // Workaround erroneous numeric interpretation of +"0x"
n@893 704 return high !== high || escapedWhitespace ?
n@893 705 escaped :
n@893 706 high < 0 ?
n@893 707 // BMP codepoint
n@893 708 String.fromCharCode( high + 0x10000 ) :
n@893 709 // Supplemental Plane codepoint (surrogate pair)
n@893 710 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
n@893 711 },
n@893 712
n@893 713 // Used for iframes
n@893 714 // See setDocument()
n@893 715 // Removing the function wrapper causes a "Permission Denied"
n@893 716 // error in IE
n@893 717 unloadHandler = function() {
n@893 718 setDocument();
n@893 719 };
n@893 720
n@893 721 // Optimize for push.apply( _, NodeList )
n@893 722 try {
n@893 723 push.apply(
n@893 724 (arr = slice.call( preferredDoc.childNodes )),
n@893 725 preferredDoc.childNodes
n@893 726 );
n@893 727 // Support: Android<4.0
n@893 728 // Detect silently failing push.apply
n@893 729 arr[ preferredDoc.childNodes.length ].nodeType;
n@893 730 } catch ( e ) {
n@893 731 push = { apply: arr.length ?
n@893 732
n@893 733 // Leverage slice if possible
n@893 734 function( target, els ) {
n@893 735 push_native.apply( target, slice.call(els) );
n@893 736 } :
n@893 737
n@893 738 // Support: IE<9
n@893 739 // Otherwise append directly
n@893 740 function( target, els ) {
n@893 741 var j = target.length,
n@893 742 i = 0;
n@893 743 // Can't trust NodeList.length
n@893 744 while ( (target[j++] = els[i++]) ) {}
n@893 745 target.length = j - 1;
n@893 746 }
n@893 747 };
n@893 748 }
n@893 749
n@893 750 function Sizzle( selector, context, results, seed ) {
n@893 751 var match, elem, m, nodeType,
n@893 752 // QSA vars
n@893 753 i, groups, old, nid, newContext, newSelector;
n@893 754
n@893 755 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
n@893 756 setDocument( context );
n@893 757 }
n@893 758
n@893 759 context = context || document;
n@893 760 results = results || [];
n@893 761 nodeType = context.nodeType;
n@893 762
n@893 763 if ( typeof selector !== "string" || !selector ||
n@893 764 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
n@893 765
n@893 766 return results;
n@893 767 }
n@893 768
n@893 769 if ( !seed && documentIsHTML ) {
n@893 770
n@893 771 // Try to shortcut find operations when possible (e.g., not under DocumentFragment)
n@893 772 if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
n@893 773 // Speed-up: Sizzle("#ID")
n@893 774 if ( (m = match[1]) ) {
n@893 775 if ( nodeType === 9 ) {
n@893 776 elem = context.getElementById( m );
n@893 777 // Check parentNode to catch when Blackberry 4.6 returns
n@893 778 // nodes that are no longer in the document (jQuery #6963)
n@893 779 if ( elem && elem.parentNode ) {
n@893 780 // Handle the case where IE, Opera, and Webkit return items
n@893 781 // by name instead of ID
n@893 782 if ( elem.id === m ) {
n@893 783 results.push( elem );
n@893 784 return results;
n@893 785 }
n@893 786 } else {
n@893 787 return results;
n@893 788 }
n@893 789 } else {
n@893 790 // Context is not a document
n@893 791 if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
n@893 792 contains( context, elem ) && elem.id === m ) {
n@893 793 results.push( elem );
n@893 794 return results;
n@893 795 }
n@893 796 }
n@893 797
n@893 798 // Speed-up: Sizzle("TAG")
n@893 799 } else if ( match[2] ) {
n@893 800 push.apply( results, context.getElementsByTagName( selector ) );
n@893 801 return results;
n@893 802
n@893 803 // Speed-up: Sizzle(".CLASS")
n@893 804 } else if ( (m = match[3]) && support.getElementsByClassName ) {
n@893 805 push.apply( results, context.getElementsByClassName( m ) );
n@893 806 return results;
n@893 807 }
n@893 808 }
n@893 809
n@893 810 // QSA path
n@893 811 if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
n@893 812 nid = old = expando;
n@893 813 newContext = context;
n@893 814 newSelector = nodeType !== 1 && selector;
n@893 815
n@893 816 // qSA works strangely on Element-rooted queries
n@893 817 // We can work around this by specifying an extra ID on the root
n@893 818 // and working up from there (Thanks to Andrew Dupont for the technique)
n@893 819 // IE 8 doesn't work on object elements
n@893 820 if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
n@893 821 groups = tokenize( selector );
n@893 822
n@893 823 if ( (old = context.getAttribute("id")) ) {
n@893 824 nid = old.replace( rescape, "\\$&" );
n@893 825 } else {
n@893 826 context.setAttribute( "id", nid );
n@893 827 }
n@893 828 nid = "[id='" + nid + "'] ";
n@893 829
n@893 830 i = groups.length;
n@893 831 while ( i-- ) {
n@893 832 groups[i] = nid + toSelector( groups[i] );
n@893 833 }
n@893 834 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context;
n@893 835 newSelector = groups.join(",");
n@893 836 }
n@893 837
n@893 838 if ( newSelector ) {
n@893 839 try {
n@893 840 push.apply( results,
n@893 841 newContext.querySelectorAll( newSelector )
n@893 842 );
n@893 843 return results;
n@893 844 } catch(qsaError) {
n@893 845 } finally {
n@893 846 if ( !old ) {
n@893 847 context.removeAttribute("id");
n@893 848 }
n@893 849 }
n@893 850 }
n@893 851 }
n@893 852 }
n@893 853
n@893 854 // All others
n@893 855 return select( selector.replace( rtrim, "$1" ), context, results, seed );
n@893 856 }
n@893 857
n@893 858 /**
n@893 859 * Create key-value caches of limited size
n@893 860 * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
n@893 861 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
n@893 862 * deleting the oldest entry
n@893 863 */
n@893 864 function createCache() {
n@893 865 var keys = [];
n@893 866
n@893 867 function cache( key, value ) {
n@893 868 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
n@893 869 if ( keys.push( key + " " ) > Expr.cacheLength ) {
n@893 870 // Only keep the most recent entries
n@893 871 delete cache[ keys.shift() ];
n@893 872 }
n@893 873 return (cache[ key + " " ] = value);
n@893 874 }
n@893 875 return cache;
n@893 876 }
n@893 877
n@893 878 /**
n@893 879 * Mark a function for special use by Sizzle
n@893 880 * @param {Function} fn The function to mark
n@893 881 */
n@893 882 function markFunction( fn ) {
n@893 883 fn[ expando ] = true;
n@893 884 return fn;
n@893 885 }
n@893 886
n@893 887 /**
n@893 888 * Support testing using an element
n@893 889 * @param {Function} fn Passed the created div and expects a boolean result
n@893 890 */
n@893 891 function assert( fn ) {
n@893 892 var div = document.createElement("div");
n@893 893
n@893 894 try {
n@893 895 return !!fn( div );
n@893 896 } catch (e) {
n@893 897 return false;
n@893 898 } finally {
n@893 899 // Remove from its parent by default
n@893 900 if ( div.parentNode ) {
n@893 901 div.parentNode.removeChild( div );
n@893 902 }
n@893 903 // release memory in IE
n@893 904 div = null;
n@893 905 }
n@893 906 }
n@893 907
n@893 908 /**
n@893 909 * Adds the same handler for all of the specified attrs
n@893 910 * @param {String} attrs Pipe-separated list of attributes
n@893 911 * @param {Function} handler The method that will be applied
n@893 912 */
n@893 913 function addHandle( attrs, handler ) {
n@893 914 var arr = attrs.split("|"),
n@893 915 i = attrs.length;
n@893 916
n@893 917 while ( i-- ) {
n@893 918 Expr.attrHandle[ arr[i] ] = handler;
n@893 919 }
n@893 920 }
n@893 921
n@893 922 /**
n@893 923 * Checks document order of two siblings
n@893 924 * @param {Element} a
n@893 925 * @param {Element} b
n@893 926 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
n@893 927 */
n@893 928 function siblingCheck( a, b ) {
n@893 929 var cur = b && a,
n@893 930 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
n@893 931 ( ~b.sourceIndex || MAX_NEGATIVE ) -
n@893 932 ( ~a.sourceIndex || MAX_NEGATIVE );
n@893 933
n@893 934 // Use IE sourceIndex if available on both nodes
n@893 935 if ( diff ) {
n@893 936 return diff;
n@893 937 }
n@893 938
n@893 939 // Check if b follows a
n@893 940 if ( cur ) {
n@893 941 while ( (cur = cur.nextSibling) ) {
n@893 942 if ( cur === b ) {
n@893 943 return -1;
n@893 944 }
n@893 945 }
n@893 946 }
n@893 947
n@893 948 return a ? 1 : -1;
n@893 949 }
n@893 950
n@893 951 /**
n@893 952 * Returns a function to use in pseudos for input types
n@893 953 * @param {String} type
n@893 954 */
n@893 955 function createInputPseudo( type ) {
n@893 956 return function( elem ) {
n@893 957 var name = elem.nodeName.toLowerCase();
n@893 958 return name === "input" && elem.type === type;
n@893 959 };
n@893 960 }
n@893 961
n@893 962 /**
n@893 963 * Returns a function to use in pseudos for buttons
n@893 964 * @param {String} type
n@893 965 */
n@893 966 function createButtonPseudo( type ) {
n@893 967 return function( elem ) {
n@893 968 var name = elem.nodeName.toLowerCase();
n@893 969 return (name === "input" || name === "button") && elem.type === type;
n@893 970 };
n@893 971 }
n@893 972
n@893 973 /**
n@893 974 * Returns a function to use in pseudos for positionals
n@893 975 * @param {Function} fn
n@893 976 */
n@893 977 function createPositionalPseudo( fn ) {
n@893 978 return markFunction(function( argument ) {
n@893 979 argument = +argument;
n@893 980 return markFunction(function( seed, matches ) {
n@893 981 var j,
n@893 982 matchIndexes = fn( [], seed.length, argument ),
n@893 983 i = matchIndexes.length;
n@893 984
n@893 985 // Match elements found at the specified indexes
n@893 986 while ( i-- ) {
n@893 987 if ( seed[ (j = matchIndexes[i]) ] ) {
n@893 988 seed[j] = !(matches[j] = seed[j]);
n@893 989 }
n@893 990 }
n@893 991 });
n@893 992 });
n@893 993 }
n@893 994
n@893 995 /**
n@893 996 * Checks a node for validity as a Sizzle context
n@893 997 * @param {Element|Object=} context
n@893 998 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
n@893 999 */
n@893 1000 function testContext( context ) {
n@893 1001 return context && typeof context.getElementsByTagName !== "undefined" && context;
n@893 1002 }
n@893 1003
n@893 1004 // Expose support vars for convenience
n@893 1005 support = Sizzle.support = {};
n@893 1006
n@893 1007 /**
n@893 1008 * Detects XML nodes
n@893 1009 * @param {Element|Object} elem An element or a document
n@893 1010 * @returns {Boolean} True iff elem is a non-HTML XML node
n@893 1011 */
n@893 1012 isXML = Sizzle.isXML = function( elem ) {
n@893 1013 // documentElement is verified for cases where it doesn't yet exist
n@893 1014 // (such as loading iframes in IE - #4833)
n@893 1015 var documentElement = elem && (elem.ownerDocument || elem).documentElement;
n@893 1016 return documentElement ? documentElement.nodeName !== "HTML" : false;
n@893 1017 };
n@893 1018
n@893 1019 /**
n@893 1020 * Sets document-related variables once based on the current document
n@893 1021 * @param {Element|Object} [doc] An element or document object to use to set the document
n@893 1022 * @returns {Object} Returns the current document
n@893 1023 */
n@893 1024 setDocument = Sizzle.setDocument = function( node ) {
n@893 1025 var hasCompare, parent,
n@893 1026 doc = node ? node.ownerDocument || node : preferredDoc;
n@893 1027
n@893 1028 // If no document and documentElement is available, return
n@893 1029 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
n@893 1030 return document;
n@893 1031 }
n@893 1032
n@893 1033 // Set our document
n@893 1034 document = doc;
n@893 1035 docElem = doc.documentElement;
n@893 1036 parent = doc.defaultView;
n@893 1037
n@893 1038 // Support: IE>8
n@893 1039 // If iframe document is assigned to "document" variable and if iframe has been reloaded,
n@893 1040 // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
n@893 1041 // IE6-8 do not support the defaultView property so parent will be undefined
n@893 1042 if ( parent && parent !== parent.top ) {
n@893 1043 // IE11 does not have attachEvent, so all must suffer
n@893 1044 if ( parent.addEventListener ) {
n@893 1045 parent.addEventListener( "unload", unloadHandler, false );
n@893 1046 } else if ( parent.attachEvent ) {
n@893 1047 parent.attachEvent( "onunload", unloadHandler );
n@893 1048 }
n@893 1049 }
n@893 1050
n@893 1051 /* Support tests
n@893 1052 ---------------------------------------------------------------------- */
n@893 1053 documentIsHTML = !isXML( doc );
n@893 1054
n@893 1055 /* Attributes
n@893 1056 ---------------------------------------------------------------------- */
n@893 1057
n@893 1058 // Support: IE<8
n@893 1059 // Verify that getAttribute really returns attributes and not properties
n@893 1060 // (excepting IE8 booleans)
n@893 1061 support.attributes = assert(function( div ) {
n@893 1062 div.className = "i";
n@893 1063 return !div.getAttribute("className");
n@893 1064 });
n@893 1065
n@893 1066 /* getElement(s)By*
n@893 1067 ---------------------------------------------------------------------- */
n@893 1068
n@893 1069 // Check if getElementsByTagName("*") returns only elements
n@893 1070 support.getElementsByTagName = assert(function( div ) {
n@893 1071 div.appendChild( doc.createComment("") );
n@893 1072 return !div.getElementsByTagName("*").length;
n@893 1073 });
n@893 1074
n@893 1075 // Support: IE<9
n@893 1076 support.getElementsByClassName = rnative.test( doc.getElementsByClassName );
n@893 1077
n@893 1078 // Support: IE<10
n@893 1079 // Check if getElementById returns elements by name
n@893 1080 // The broken getElementById methods don't pick up programatically-set names,
n@893 1081 // so use a roundabout getElementsByName test
n@893 1082 support.getById = assert(function( div ) {
n@893 1083 docElem.appendChild( div ).id = expando;
n@893 1084 return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
n@893 1085 });
n@893 1086
n@893 1087 // ID find and filter
n@893 1088 if ( support.getById ) {
n@893 1089 Expr.find["ID"] = function( id, context ) {
n@893 1090 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
n@893 1091 var m = context.getElementById( id );
n@893 1092 // Check parentNode to catch when Blackberry 4.6 returns
n@893 1093 // nodes that are no longer in the document #6963
n@893 1094 return m && m.parentNode ? [ m ] : [];
n@893 1095 }
n@893 1096 };
n@893 1097 Expr.filter["ID"] = function( id ) {
n@893 1098 var attrId = id.replace( runescape, funescape );
n@893 1099 return function( elem ) {
n@893 1100 return elem.getAttribute("id") === attrId;
n@893 1101 };
n@893 1102 };
n@893 1103 } else {
n@893 1104 // Support: IE6/7
n@893 1105 // getElementById is not reliable as a find shortcut
n@893 1106 delete Expr.find["ID"];
n@893 1107
n@893 1108 Expr.filter["ID"] = function( id ) {
n@893 1109 var attrId = id.replace( runescape, funescape );
n@893 1110 return function( elem ) {
n@893 1111 var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
n@893 1112 return node && node.value === attrId;
n@893 1113 };
n@893 1114 };
n@893 1115 }
n@893 1116
n@893 1117 // Tag
n@893 1118 Expr.find["TAG"] = support.getElementsByTagName ?
n@893 1119 function( tag, context ) {
n@893 1120 if ( typeof context.getElementsByTagName !== "undefined" ) {
n@893 1121 return context.getElementsByTagName( tag );
n@893 1122
n@893 1123 // DocumentFragment nodes don't have gEBTN
n@893 1124 } else if ( support.qsa ) {
n@893 1125 return context.querySelectorAll( tag );
n@893 1126 }
n@893 1127 } :
n@893 1128
n@893 1129 function( tag, context ) {
n@893 1130 var elem,
n@893 1131 tmp = [],
n@893 1132 i = 0,
n@893 1133 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
n@893 1134 results = context.getElementsByTagName( tag );
n@893 1135
n@893 1136 // Filter out possible comments
n@893 1137 if ( tag === "*" ) {
n@893 1138 while ( (elem = results[i++]) ) {
n@893 1139 if ( elem.nodeType === 1 ) {
n@893 1140 tmp.push( elem );
n@893 1141 }
n@893 1142 }
n@893 1143
n@893 1144 return tmp;
n@893 1145 }
n@893 1146 return results;
n@893 1147 };
n@893 1148
n@893 1149 // Class
n@893 1150 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
n@893 1151 if ( documentIsHTML ) {
n@893 1152 return context.getElementsByClassName( className );
n@893 1153 }
n@893 1154 };
n@893 1155
n@893 1156 /* QSA/matchesSelector
n@893 1157 ---------------------------------------------------------------------- */
n@893 1158
n@893 1159 // QSA and matchesSelector support
n@893 1160
n@893 1161 // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
n@893 1162 rbuggyMatches = [];
n@893 1163
n@893 1164 // qSa(:focus) reports false when true (Chrome 21)
n@893 1165 // We allow this because of a bug in IE8/9 that throws an error
n@893 1166 // whenever `document.activeElement` is accessed on an iframe
n@893 1167 // So, we allow :focus to pass through QSA all the time to avoid the IE error
n@893 1168 // See http://bugs.jquery.com/ticket/13378
n@893 1169 rbuggyQSA = [];
n@893 1170
n@893 1171 if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
n@893 1172 // Build QSA regex
n@893 1173 // Regex strategy adopted from Diego Perini
n@893 1174 assert(function( div ) {
n@893 1175 // Select is set to empty string on purpose
n@893 1176 // This is to test IE's treatment of not explicitly
n@893 1177 // setting a boolean content attribute,
n@893 1178 // since its presence should be enough
n@893 1179 // http://bugs.jquery.com/ticket/12359
n@893 1180 docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" +
n@893 1181 "<select id='" + expando + "-\f]' msallowcapture=''>" +
n@893 1182 "<option selected=''></option></select>";
n@893 1183
n@893 1184 // Support: IE8, Opera 11-12.16
n@893 1185 // Nothing should be selected when empty strings follow ^= or $= or *=
n@893 1186 // The test attribute must be unknown in Opera but "safe" for WinRT
n@893 1187 // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
n@893 1188 if ( div.querySelectorAll("[msallowcapture^='']").length ) {
n@893 1189 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
n@893 1190 }
n@893 1191
n@893 1192 // Support: IE8
n@893 1193 // Boolean attributes and "value" are not treated correctly
n@893 1194 if ( !div.querySelectorAll("[selected]").length ) {
n@893 1195 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
n@893 1196 }
n@893 1197
n@893 1198 // Support: Chrome<29, Android<4.2+, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.7+
n@893 1199 if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
n@893 1200 rbuggyQSA.push("~=");
n@893 1201 }
n@893 1202
n@893 1203 // Webkit/Opera - :checked should return selected option elements
n@893 1204 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
n@893 1205 // IE8 throws error here and will not see later tests
n@893 1206 if ( !div.querySelectorAll(":checked").length ) {
n@893 1207 rbuggyQSA.push(":checked");
n@893 1208 }
n@893 1209
n@893 1210 // Support: Safari 8+, iOS 8+
n@893 1211 // https://bugs.webkit.org/show_bug.cgi?id=136851
n@893 1212 // In-page `selector#id sibing-combinator selector` fails
n@893 1213 if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) {
n@893 1214 rbuggyQSA.push(".#.+[+~]");
n@893 1215 }
n@893 1216 });
n@893 1217
n@893 1218 assert(function( div ) {
n@893 1219 // Support: Windows 8 Native Apps
n@893 1220 // The type and name attributes are restricted during .innerHTML assignment
n@893 1221 var input = doc.createElement("input");
n@893 1222 input.setAttribute( "type", "hidden" );
n@893 1223 div.appendChild( input ).setAttribute( "name", "D" );
n@893 1224
n@893 1225 // Support: IE8
n@893 1226 // Enforce case-sensitivity of name attribute
n@893 1227 if ( div.querySelectorAll("[name=d]").length ) {
n@893 1228 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
n@893 1229 }
n@893 1230
n@893 1231 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
n@893 1232 // IE8 throws error here and will not see later tests
n@893 1233 if ( !div.querySelectorAll(":enabled").length ) {
n@893 1234 rbuggyQSA.push( ":enabled", ":disabled" );
n@893 1235 }
n@893 1236
n@893 1237 // Opera 10-11 does not throw on post-comma invalid pseudos
n@893 1238 div.querySelectorAll("*,:x");
n@893 1239 rbuggyQSA.push(",.*:");
n@893 1240 });
n@893 1241 }
n@893 1242
n@893 1243 if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
n@893 1244 docElem.webkitMatchesSelector ||
n@893 1245 docElem.mozMatchesSelector ||
n@893 1246 docElem.oMatchesSelector ||
n@893 1247 docElem.msMatchesSelector) )) ) {
n@893 1248
n@893 1249 assert(function( div ) {
n@893 1250 // Check to see if it's possible to do matchesSelector
n@893 1251 // on a disconnected node (IE 9)
n@893 1252 support.disconnectedMatch = matches.call( div, "div" );
n@893 1253
n@893 1254 // This should fail with an exception
n@893 1255 // Gecko does not error, returns false instead
n@893 1256 matches.call( div, "[s!='']:x" );
n@893 1257 rbuggyMatches.push( "!=", pseudos );
n@893 1258 });
n@893 1259 }
n@893 1260
n@893 1261 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
n@893 1262 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
n@893 1263
n@893 1264 /* Contains
n@893 1265 ---------------------------------------------------------------------- */
n@893 1266 hasCompare = rnative.test( docElem.compareDocumentPosition );
n@893 1267
n@893 1268 // Element contains another
n@893 1269 // Purposefully does not implement inclusive descendent
n@893 1270 // As in, an element does not contain itself
n@893 1271 contains = hasCompare || rnative.test( docElem.contains ) ?
n@893 1272 function( a, b ) {
n@893 1273 var adown = a.nodeType === 9 ? a.documentElement : a,
n@893 1274 bup = b && b.parentNode;
n@893 1275 return a === bup || !!( bup && bup.nodeType === 1 && (
n@893 1276 adown.contains ?
n@893 1277 adown.contains( bup ) :
n@893 1278 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
n@893 1279 ));
n@893 1280 } :
n@893 1281 function( a, b ) {
n@893 1282 if ( b ) {
n@893 1283 while ( (b = b.parentNode) ) {
n@893 1284 if ( b === a ) {
n@893 1285 return true;
n@893 1286 }
n@893 1287 }
n@893 1288 }
n@893 1289 return false;
n@893 1290 };
n@893 1291
n@893 1292 /* Sorting
n@893 1293 ---------------------------------------------------------------------- */
n@893 1294
n@893 1295 // Document order sorting
n@893 1296 sortOrder = hasCompare ?
n@893 1297 function( a, b ) {
n@893 1298
n@893 1299 // Flag for duplicate removal
n@893 1300 if ( a === b ) {
n@893 1301 hasDuplicate = true;
n@893 1302 return 0;
n@893 1303 }
n@893 1304
n@893 1305 // Sort on method existence if only one input has compareDocumentPosition
n@893 1306 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
n@893 1307 if ( compare ) {
n@893 1308 return compare;
n@893 1309 }
n@893 1310
n@893 1311 // Calculate position if both inputs belong to the same document
n@893 1312 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
n@893 1313 a.compareDocumentPosition( b ) :
n@893 1314
n@893 1315 // Otherwise we know they are disconnected
n@893 1316 1;
n@893 1317
n@893 1318 // Disconnected nodes
n@893 1319 if ( compare & 1 ||
n@893 1320 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
n@893 1321
n@893 1322 // Choose the first element that is related to our preferred document
n@893 1323 if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
n@893 1324 return -1;
n@893 1325 }
n@893 1326 if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
n@893 1327 return 1;
n@893 1328 }
n@893 1329
n@893 1330 // Maintain original order
n@893 1331 return sortInput ?
n@893 1332 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
n@893 1333 0;
n@893 1334 }
n@893 1335
n@893 1336 return compare & 4 ? -1 : 1;
n@893 1337 } :
n@893 1338 function( a, b ) {
n@893 1339 // Exit early if the nodes are identical
n@893 1340 if ( a === b ) {
n@893 1341 hasDuplicate = true;
n@893 1342 return 0;
n@893 1343 }
n@893 1344
n@893 1345 var cur,
n@893 1346 i = 0,
n@893 1347 aup = a.parentNode,
n@893 1348 bup = b.parentNode,
n@893 1349 ap = [ a ],
n@893 1350 bp = [ b ];
n@893 1351
n@893 1352 // Parentless nodes are either documents or disconnected
n@893 1353 if ( !aup || !bup ) {
n@893 1354 return a === doc ? -1 :
n@893 1355 b === doc ? 1 :
n@893 1356 aup ? -1 :
n@893 1357 bup ? 1 :
n@893 1358 sortInput ?
n@893 1359 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
n@893 1360 0;
n@893 1361
n@893 1362 // If the nodes are siblings, we can do a quick check
n@893 1363 } else if ( aup === bup ) {
n@893 1364 return siblingCheck( a, b );
n@893 1365 }
n@893 1366
n@893 1367 // Otherwise we need full lists of their ancestors for comparison
n@893 1368 cur = a;
n@893 1369 while ( (cur = cur.parentNode) ) {
n@893 1370 ap.unshift( cur );
n@893 1371 }
n@893 1372 cur = b;
n@893 1373 while ( (cur = cur.parentNode) ) {
n@893 1374 bp.unshift( cur );
n@893 1375 }
n@893 1376
n@893 1377 // Walk down the tree looking for a discrepancy
n@893 1378 while ( ap[i] === bp[i] ) {
n@893 1379 i++;
n@893 1380 }
n@893 1381
n@893 1382 return i ?
n@893 1383 // Do a sibling check if the nodes have a common ancestor
n@893 1384 siblingCheck( ap[i], bp[i] ) :
n@893 1385
n@893 1386 // Otherwise nodes in our document sort first
n@893 1387 ap[i] === preferredDoc ? -1 :
n@893 1388 bp[i] === preferredDoc ? 1 :
n@893 1389 0;
n@893 1390 };
n@893 1391
n@893 1392 return doc;
n@893 1393 };
n@893 1394
n@893 1395 Sizzle.matches = function( expr, elements ) {
n@893 1396 return Sizzle( expr, null, null, elements );
n@893 1397 };
n@893 1398
n@893 1399 Sizzle.matchesSelector = function( elem, expr ) {
n@893 1400 // Set document vars if needed
n@893 1401 if ( ( elem.ownerDocument || elem ) !== document ) {
n@893 1402 setDocument( elem );
n@893 1403 }
n@893 1404
n@893 1405 // Make sure that attribute selectors are quoted
n@893 1406 expr = expr.replace( rattributeQuotes, "='$1']" );
n@893 1407
n@893 1408 if ( support.matchesSelector && documentIsHTML &&
n@893 1409 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
n@893 1410 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
n@893 1411
n@893 1412 try {
n@893 1413 var ret = matches.call( elem, expr );
n@893 1414
n@893 1415 // IE 9's matchesSelector returns false on disconnected nodes
n@893 1416 if ( ret || support.disconnectedMatch ||
n@893 1417 // As well, disconnected nodes are said to be in a document
n@893 1418 // fragment in IE 9
n@893 1419 elem.document && elem.document.nodeType !== 11 ) {
n@893 1420 return ret;
n@893 1421 }
n@893 1422 } catch (e) {}
n@893 1423 }
n@893 1424
n@893 1425 return Sizzle( expr, document, null, [ elem ] ).length > 0;
n@893 1426 };
n@893 1427
n@893 1428 Sizzle.contains = function( context, elem ) {
n@893 1429 // Set document vars if needed
n@893 1430 if ( ( context.ownerDocument || context ) !== document ) {
n@893 1431 setDocument( context );
n@893 1432 }
n@893 1433 return contains( context, elem );
n@893 1434 };
n@893 1435
n@893 1436 Sizzle.attr = function( elem, name ) {
n@893 1437 // Set document vars if needed
n@893 1438 if ( ( elem.ownerDocument || elem ) !== document ) {
n@893 1439 setDocument( elem );
n@893 1440 }
n@893 1441
n@893 1442 var fn = Expr.attrHandle[ name.toLowerCase() ],
n@893 1443 // Don't get fooled by Object.prototype properties (jQuery #13807)
n@893 1444 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
n@893 1445 fn( elem, name, !documentIsHTML ) :
n@893 1446 undefined;
n@893 1447
n@893 1448 return val !== undefined ?
n@893 1449 val :
n@893 1450 support.attributes || !documentIsHTML ?
n@893 1451 elem.getAttribute( name ) :
n@893 1452 (val = elem.getAttributeNode(name)) && val.specified ?
n@893 1453 val.value :
n@893 1454 null;
n@893 1455 };
n@893 1456
n@893 1457 Sizzle.error = function( msg ) {
n@893 1458 throw new Error( "Syntax error, unrecognized expression: " + msg );
n@893 1459 };
n@893 1460
n@893 1461 /**
n@893 1462 * Document sorting and removing duplicates
n@893 1463 * @param {ArrayLike} results
n@893 1464 */
n@893 1465 Sizzle.uniqueSort = function( results ) {
n@893 1466 var elem,
n@893 1467 duplicates = [],
n@893 1468 j = 0,
n@893 1469 i = 0;
n@893 1470
n@893 1471 // Unless we *know* we can detect duplicates, assume their presence
n@893 1472 hasDuplicate = !support.detectDuplicates;
n@893 1473 sortInput = !support.sortStable && results.slice( 0 );
n@893 1474 results.sort( sortOrder );
n@893 1475
n@893 1476 if ( hasDuplicate ) {
n@893 1477 while ( (elem = results[i++]) ) {
n@893 1478 if ( elem === results[ i ] ) {
n@893 1479 j = duplicates.push( i );
n@893 1480 }
n@893 1481 }
n@893 1482 while ( j-- ) {
n@893 1483 results.splice( duplicates[ j ], 1 );
n@893 1484 }
n@893 1485 }
n@893 1486
n@893 1487 // Clear input after sorting to release objects
n@893 1488 // See https://github.com/jquery/sizzle/pull/225
n@893 1489 sortInput = null;
n@893 1490
n@893 1491 return results;
n@893 1492 };
n@893 1493
n@893 1494 /**
n@893 1495 * Utility function for retrieving the text value of an array of DOM nodes
n@893 1496 * @param {Array|Element} elem
n@893 1497 */
n@893 1498 getText = Sizzle.getText = function( elem ) {
n@893 1499 var node,
n@893 1500 ret = "",
n@893 1501 i = 0,
n@893 1502 nodeType = elem.nodeType;
n@893 1503
n@893 1504 if ( !nodeType ) {
n@893 1505 // If no nodeType, this is expected to be an array
n@893 1506 while ( (node = elem[i++]) ) {
n@893 1507 // Do not traverse comment nodes
n@893 1508 ret += getText( node );
n@893 1509 }
n@893 1510 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
n@893 1511 // Use textContent for elements
n@893 1512 // innerText usage removed for consistency of new lines (jQuery #11153)
n@893 1513 if ( typeof elem.textContent === "string" ) {
n@893 1514 return elem.textContent;
n@893 1515 } else {
n@893 1516 // Traverse its children
n@893 1517 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
n@893 1518 ret += getText( elem );
n@893 1519 }
n@893 1520 }
n@893 1521 } else if ( nodeType === 3 || nodeType === 4 ) {
n@893 1522 return elem.nodeValue;
n@893 1523 }
n@893 1524 // Do not include comment or processing instruction nodes
n@893 1525
n@893 1526 return ret;
n@893 1527 };
n@893 1528
n@893 1529 Expr = Sizzle.selectors = {
n@893 1530
n@893 1531 // Can be adjusted by the user
n@893 1532 cacheLength: 50,
n@893 1533
n@893 1534 createPseudo: markFunction,
n@893 1535
n@893 1536 match: matchExpr,
n@893 1537
n@893 1538 attrHandle: {},
n@893 1539
n@893 1540 find: {},
n@893 1541
n@893 1542 relative: {
n@893 1543 ">": { dir: "parentNode", first: true },
n@893 1544 " ": { dir: "parentNode" },
n@893 1545 "+": { dir: "previousSibling", first: true },
n@893 1546 "~": { dir: "previousSibling" }
n@893 1547 },
n@893 1548
n@893 1549 preFilter: {
n@893 1550 "ATTR": function( match ) {
n@893 1551 match[1] = match[1].replace( runescape, funescape );
n@893 1552
n@893 1553 // Move the given value to match[3] whether quoted or unquoted
n@893 1554 match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
n@893 1555
n@893 1556 if ( match[2] === "~=" ) {
n@893 1557 match[3] = " " + match[3] + " ";
n@893 1558 }
n@893 1559
n@893 1560 return match.slice( 0, 4 );
n@893 1561 },
n@893 1562
n@893 1563 "CHILD": function( match ) {
n@893 1564 /* matches from matchExpr["CHILD"]
n@893 1565 1 type (only|nth|...)
n@893 1566 2 what (child|of-type)
n@893 1567 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
n@893 1568 4 xn-component of xn+y argument ([+-]?\d*n|)
n@893 1569 5 sign of xn-component
n@893 1570 6 x of xn-component
n@893 1571 7 sign of y-component
n@893 1572 8 y of y-component
n@893 1573 */
n@893 1574 match[1] = match[1].toLowerCase();
n@893 1575
n@893 1576 if ( match[1].slice( 0, 3 ) === "nth" ) {
n@893 1577 // nth-* requires argument
n@893 1578 if ( !match[3] ) {
n@893 1579 Sizzle.error( match[0] );
n@893 1580 }
n@893 1581
n@893 1582 // numeric x and y parameters for Expr.filter.CHILD
n@893 1583 // remember that false/true cast respectively to 0/1
n@893 1584 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
n@893 1585 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
n@893 1586
n@893 1587 // other types prohibit arguments
n@893 1588 } else if ( match[3] ) {
n@893 1589 Sizzle.error( match[0] );
n@893 1590 }
n@893 1591
n@893 1592 return match;
n@893 1593 },
n@893 1594
n@893 1595 "PSEUDO": function( match ) {
n@893 1596 var excess,
n@893 1597 unquoted = !match[6] && match[2];
n@893 1598
n@893 1599 if ( matchExpr["CHILD"].test( match[0] ) ) {
n@893 1600 return null;
n@893 1601 }
n@893 1602
n@893 1603 // Accept quoted arguments as-is
n@893 1604 if ( match[3] ) {
n@893 1605 match[2] = match[4] || match[5] || "";
n@893 1606
n@893 1607 // Strip excess characters from unquoted arguments
n@893 1608 } else if ( unquoted && rpseudo.test( unquoted ) &&
n@893 1609 // Get excess from tokenize (recursively)
n@893 1610 (excess = tokenize( unquoted, true )) &&
n@893 1611 // advance to the next closing parenthesis
n@893 1612 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
n@893 1613
n@893 1614 // excess is a negative index
n@893 1615 match[0] = match[0].slice( 0, excess );
n@893 1616 match[2] = unquoted.slice( 0, excess );
n@893 1617 }
n@893 1618
n@893 1619 // Return only captures needed by the pseudo filter method (type and argument)
n@893 1620 return match.slice( 0, 3 );
n@893 1621 }
n@893 1622 },
n@893 1623
n@893 1624 filter: {
n@893 1625
n@893 1626 "TAG": function( nodeNameSelector ) {
n@893 1627 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
n@893 1628 return nodeNameSelector === "*" ?
n@893 1629 function() { return true; } :
n@893 1630 function( elem ) {
n@893 1631 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
n@893 1632 };
n@893 1633 },
n@893 1634
n@893 1635 "CLASS": function( className ) {
n@893 1636 var pattern = classCache[ className + " " ];
n@893 1637
n@893 1638 return pattern ||
n@893 1639 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
n@893 1640 classCache( className, function( elem ) {
n@893 1641 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
n@893 1642 });
n@893 1643 },
n@893 1644
n@893 1645 "ATTR": function( name, operator, check ) {
n@893 1646 return function( elem ) {
n@893 1647 var result = Sizzle.attr( elem, name );
n@893 1648
n@893 1649 if ( result == null ) {
n@893 1650 return operator === "!=";
n@893 1651 }
n@893 1652 if ( !operator ) {
n@893 1653 return true;
n@893 1654 }
n@893 1655
n@893 1656 result += "";
n@893 1657
n@893 1658 return operator === "=" ? result === check :
n@893 1659 operator === "!=" ? result !== check :
n@893 1660 operator === "^=" ? check && result.indexOf( check ) === 0 :
n@893 1661 operator === "*=" ? check && result.indexOf( check ) > -1 :
n@893 1662 operator === "$=" ? check && result.slice( -check.length ) === check :
n@893 1663 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
n@893 1664 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
n@893 1665 false;
n@893 1666 };
n@893 1667 },
n@893 1668
n@893 1669 "CHILD": function( type, what, argument, first, last ) {
n@893 1670 var simple = type.slice( 0, 3 ) !== "nth",
n@893 1671 forward = type.slice( -4 ) !== "last",
n@893 1672 ofType = what === "of-type";
n@893 1673
n@893 1674 return first === 1 && last === 0 ?
n@893 1675
n@893 1676 // Shortcut for :nth-*(n)
n@893 1677 function( elem ) {
n@893 1678 return !!elem.parentNode;
n@893 1679 } :
n@893 1680
n@893 1681 function( elem, context, xml ) {
n@893 1682 var cache, outerCache, node, diff, nodeIndex, start,
n@893 1683 dir = simple !== forward ? "nextSibling" : "previousSibling",
n@893 1684 parent = elem.parentNode,
n@893 1685 name = ofType && elem.nodeName.toLowerCase(),
n@893 1686 useCache = !xml && !ofType;
n@893 1687
n@893 1688 if ( parent ) {
n@893 1689
n@893 1690 // :(first|last|only)-(child|of-type)
n@893 1691 if ( simple ) {
n@893 1692 while ( dir ) {
n@893 1693 node = elem;
n@893 1694 while ( (node = node[ dir ]) ) {
n@893 1695 if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
n@893 1696 return false;
n@893 1697 }
n@893 1698 }
n@893 1699 // Reverse direction for :only-* (if we haven't yet done so)
n@893 1700 start = dir = type === "only" && !start && "nextSibling";
n@893 1701 }
n@893 1702 return true;
n@893 1703 }
n@893 1704
n@893 1705 start = [ forward ? parent.firstChild : parent.lastChild ];
n@893 1706
n@893 1707 // non-xml :nth-child(...) stores cache data on `parent`
n@893 1708 if ( forward && useCache ) {
n@893 1709 // Seek `elem` from a previously-cached index
n@893 1710 outerCache = parent[ expando ] || (parent[ expando ] = {});
n@893 1711 cache = outerCache[ type ] || [];
n@893 1712 nodeIndex = cache[0] === dirruns && cache[1];
n@893 1713 diff = cache[0] === dirruns && cache[2];
n@893 1714 node = nodeIndex && parent.childNodes[ nodeIndex ];
n@893 1715
n@893 1716 while ( (node = ++nodeIndex && node && node[ dir ] ||
n@893 1717
n@893 1718 // Fallback to seeking `elem` from the start
n@893 1719 (diff = nodeIndex = 0) || start.pop()) ) {
n@893 1720
n@893 1721 // When found, cache indexes on `parent` and break
n@893 1722 if ( node.nodeType === 1 && ++diff && node === elem ) {
n@893 1723 outerCache[ type ] = [ dirruns, nodeIndex, diff ];
n@893 1724 break;
n@893 1725 }
n@893 1726 }
n@893 1727
n@893 1728 // Use previously-cached element index if available
n@893 1729 } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
n@893 1730 diff = cache[1];
n@893 1731
n@893 1732 // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
n@893 1733 } else {
n@893 1734 // Use the same loop as above to seek `elem` from the start
n@893 1735 while ( (node = ++nodeIndex && node && node[ dir ] ||
n@893 1736 (diff = nodeIndex = 0) || start.pop()) ) {
n@893 1737
n@893 1738 if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
n@893 1739 // Cache the index of each encountered element
n@893 1740 if ( useCache ) {
n@893 1741 (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
n@893 1742 }
n@893 1743
n@893 1744 if ( node === elem ) {
n@893 1745 break;
n@893 1746 }
n@893 1747 }
n@893 1748 }
n@893 1749 }
n@893 1750
n@893 1751 // Incorporate the offset, then check against cycle size
n@893 1752 diff -= last;
n@893 1753 return diff === first || ( diff % first === 0 && diff / first >= 0 );
n@893 1754 }
n@893 1755 };
n@893 1756 },
n@893 1757
n@893 1758 "PSEUDO": function( pseudo, argument ) {
n@893 1759 // pseudo-class names are case-insensitive
n@893 1760 // http://www.w3.org/TR/selectors/#pseudo-classes
n@893 1761 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
n@893 1762 // Remember that setFilters inherits from pseudos
n@893 1763 var args,
n@893 1764 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
n@893 1765 Sizzle.error( "unsupported pseudo: " + pseudo );
n@893 1766
n@893 1767 // The user may use createPseudo to indicate that
n@893 1768 // arguments are needed to create the filter function
n@893 1769 // just as Sizzle does
n@893 1770 if ( fn[ expando ] ) {
n@893 1771 return fn( argument );
n@893 1772 }
n@893 1773
n@893 1774 // But maintain support for old signatures
n@893 1775 if ( fn.length > 1 ) {
n@893 1776 args = [ pseudo, pseudo, "", argument ];
n@893 1777 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
n@893 1778 markFunction(function( seed, matches ) {
n@893 1779 var idx,
n@893 1780 matched = fn( seed, argument ),
n@893 1781 i = matched.length;
n@893 1782 while ( i-- ) {
n@893 1783 idx = indexOf( seed, matched[i] );
n@893 1784 seed[ idx ] = !( matches[ idx ] = matched[i] );
n@893 1785 }
n@893 1786 }) :
n@893 1787 function( elem ) {
n@893 1788 return fn( elem, 0, args );
n@893 1789 };
n@893 1790 }
n@893 1791
n@893 1792 return fn;
n@893 1793 }
n@893 1794 },
n@893 1795
n@893 1796 pseudos: {
n@893 1797 // Potentially complex pseudos
n@893 1798 "not": markFunction(function( selector ) {
n@893 1799 // Trim the selector passed to compile
n@893 1800 // to avoid treating leading and trailing
n@893 1801 // spaces as combinators
n@893 1802 var input = [],
n@893 1803 results = [],
n@893 1804 matcher = compile( selector.replace( rtrim, "$1" ) );
n@893 1805
n@893 1806 return matcher[ expando ] ?
n@893 1807 markFunction(function( seed, matches, context, xml ) {
n@893 1808 var elem,
n@893 1809 unmatched = matcher( seed, null, xml, [] ),
n@893 1810 i = seed.length;
n@893 1811
n@893 1812 // Match elements unmatched by `matcher`
n@893 1813 while ( i-- ) {
n@893 1814 if ( (elem = unmatched[i]) ) {
n@893 1815 seed[i] = !(matches[i] = elem);
n@893 1816 }
n@893 1817 }
n@893 1818 }) :
n@893 1819 function( elem, context, xml ) {
n@893 1820 input[0] = elem;
n@893 1821 matcher( input, null, xml, results );
n@893 1822 // Don't keep the element (issue #299)
n@893 1823 input[0] = null;
n@893 1824 return !results.pop();
n@893 1825 };
n@893 1826 }),
n@893 1827
n@893 1828 "has": markFunction(function( selector ) {
n@893 1829 return function( elem ) {
n@893 1830 return Sizzle( selector, elem ).length > 0;
n@893 1831 };
n@893 1832 }),
n@893 1833
n@893 1834 "contains": markFunction(function( text ) {
n@893 1835 text = text.replace( runescape, funescape );
n@893 1836 return function( elem ) {
n@893 1837 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
n@893 1838 };
n@893 1839 }),
n@893 1840
n@893 1841 // "Whether an element is represented by a :lang() selector
n@893 1842 // is based solely on the element's language value
n@893 1843 // being equal to the identifier C,
n@893 1844 // or beginning with the identifier C immediately followed by "-".
n@893 1845 // The matching of C against the element's language value is performed case-insensitively.
n@893 1846 // The identifier C does not have to be a valid language name."
n@893 1847 // http://www.w3.org/TR/selectors/#lang-pseudo
n@893 1848 "lang": markFunction( function( lang ) {
n@893 1849 // lang value must be a valid identifier
n@893 1850 if ( !ridentifier.test(lang || "") ) {
n@893 1851 Sizzle.error( "unsupported lang: " + lang );
n@893 1852 }
n@893 1853 lang = lang.replace( runescape, funescape ).toLowerCase();
n@893 1854 return function( elem ) {
n@893 1855 var elemLang;
n@893 1856 do {
n@893 1857 if ( (elemLang = documentIsHTML ?
n@893 1858 elem.lang :
n@893 1859 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
n@893 1860
n@893 1861 elemLang = elemLang.toLowerCase();
n@893 1862 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
n@893 1863 }
n@893 1864 } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
n@893 1865 return false;
n@893 1866 };
n@893 1867 }),
n@893 1868
n@893 1869 // Miscellaneous
n@893 1870 "target": function( elem ) {
n@893 1871 var hash = window.location && window.location.hash;
n@893 1872 return hash && hash.slice( 1 ) === elem.id;
n@893 1873 },
n@893 1874
n@893 1875 "root": function( elem ) {
n@893 1876 return elem === docElem;
n@893 1877 },
n@893 1878
n@893 1879 "focus": function( elem ) {
n@893 1880 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
n@893 1881 },
n@893 1882
n@893 1883 // Boolean properties
n@893 1884 "enabled": function( elem ) {
n@893 1885 return elem.disabled === false;
n@893 1886 },
n@893 1887
n@893 1888 "disabled": function( elem ) {
n@893 1889 return elem.disabled === true;
n@893 1890 },
n@893 1891
n@893 1892 "checked": function( elem ) {
n@893 1893 // In CSS3, :checked should return both checked and selected elements
n@893 1894 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
n@893 1895 var nodeName = elem.nodeName.toLowerCase();
n@893 1896 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
n@893 1897 },
n@893 1898
n@893 1899 "selected": function( elem ) {
n@893 1900 // Accessing this property makes selected-by-default
n@893 1901 // options in Safari work properly
n@893 1902 if ( elem.parentNode ) {
n@893 1903 elem.parentNode.selectedIndex;
n@893 1904 }
n@893 1905
n@893 1906 return elem.selected === true;
n@893 1907 },
n@893 1908
n@893 1909 // Contents
n@893 1910 "empty": function( elem ) {
n@893 1911 // http://www.w3.org/TR/selectors/#empty-pseudo
n@893 1912 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
n@893 1913 // but not by others (comment: 8; processing instruction: 7; etc.)
n@893 1914 // nodeType < 6 works because attributes (2) do not appear as children
n@893 1915 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
n@893 1916 if ( elem.nodeType < 6 ) {
n@893 1917 return false;
n@893 1918 }
n@893 1919 }
n@893 1920 return true;
n@893 1921 },
n@893 1922
n@893 1923 "parent": function( elem ) {
n@893 1924 return !Expr.pseudos["empty"]( elem );
n@893 1925 },
n@893 1926
n@893 1927 // Element/input types
n@893 1928 "header": function( elem ) {
n@893 1929 return rheader.test( elem.nodeName );
n@893 1930 },
n@893 1931
n@893 1932 "input": function( elem ) {
n@893 1933 return rinputs.test( elem.nodeName );
n@893 1934 },
n@893 1935
n@893 1936 "button": function( elem ) {
n@893 1937 var name = elem.nodeName.toLowerCase();
n@893 1938 return name === "input" && elem.type === "button" || name === "button";
n@893 1939 },
n@893 1940
n@893 1941 "text": function( elem ) {
n@893 1942 var attr;
n@893 1943 return elem.nodeName.toLowerCase() === "input" &&
n@893 1944 elem.type === "text" &&
n@893 1945
n@893 1946 // Support: IE<8
n@893 1947 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
n@893 1948 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
n@893 1949 },
n@893 1950
n@893 1951 // Position-in-collection
n@893 1952 "first": createPositionalPseudo(function() {
n@893 1953 return [ 0 ];
n@893 1954 }),
n@893 1955
n@893 1956 "last": createPositionalPseudo(function( matchIndexes, length ) {
n@893 1957 return [ length - 1 ];
n@893 1958 }),
n@893 1959
n@893 1960 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
n@893 1961 return [ argument < 0 ? argument + length : argument ];
n@893 1962 }),
n@893 1963
n@893 1964 "even": createPositionalPseudo(function( matchIndexes, length ) {
n@893 1965 var i = 0;
n@893 1966 for ( ; i < length; i += 2 ) {
n@893 1967 matchIndexes.push( i );
n@893 1968 }
n@893 1969 return matchIndexes;
n@893 1970 }),
n@893 1971
n@893 1972 "odd": createPositionalPseudo(function( matchIndexes, length ) {
n@893 1973 var i = 1;
n@893 1974 for ( ; i < length; i += 2 ) {
n@893 1975 matchIndexes.push( i );
n@893 1976 }
n@893 1977 return matchIndexes;
n@893 1978 }),
n@893 1979
n@893 1980 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
n@893 1981 var i = argument < 0 ? argument + length : argument;
n@893 1982 for ( ; --i >= 0; ) {
n@893 1983 matchIndexes.push( i );
n@893 1984 }
n@893 1985 return matchIndexes;
n@893 1986 }),
n@893 1987
n@893 1988 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
n@893 1989 var i = argument < 0 ? argument + length : argument;
n@893 1990 for ( ; ++i < length; ) {
n@893 1991 matchIndexes.push( i );
n@893 1992 }
n@893 1993 return matchIndexes;
n@893 1994 })
n@893 1995 }
n@893 1996 };
n@893 1997
n@893 1998 Expr.pseudos["nth"] = Expr.pseudos["eq"];
n@893 1999
n@893 2000 // Add button/input type pseudos
n@893 2001 for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
n@893 2002 Expr.pseudos[ i ] = createInputPseudo( i );
n@893 2003 }
n@893 2004 for ( i in { submit: true, reset: true } ) {
n@893 2005 Expr.pseudos[ i ] = createButtonPseudo( i );
n@893 2006 }
n@893 2007
n@893 2008 // Easy API for creating new setFilters
n@893 2009 function setFilters() {}
n@893 2010 setFilters.prototype = Expr.filters = Expr.pseudos;
n@893 2011 Expr.setFilters = new setFilters();
n@893 2012
n@893 2013 tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
n@893 2014 var matched, match, tokens, type,
n@893 2015 soFar, groups, preFilters,
n@893 2016 cached = tokenCache[ selector + " " ];
n@893 2017
n@893 2018 if ( cached ) {
n@893 2019 return parseOnly ? 0 : cached.slice( 0 );
n@893 2020 }
n@893 2021
n@893 2022 soFar = selector;
n@893 2023 groups = [];
n@893 2024 preFilters = Expr.preFilter;
n@893 2025
n@893 2026 while ( soFar ) {
n@893 2027
n@893 2028 // Comma and first run
n@893 2029 if ( !matched || (match = rcomma.exec( soFar )) ) {
n@893 2030 if ( match ) {
n@893 2031 // Don't consume trailing commas as valid
n@893 2032 soFar = soFar.slice( match[0].length ) || soFar;
n@893 2033 }
n@893 2034 groups.push( (tokens = []) );
n@893 2035 }
n@893 2036
n@893 2037 matched = false;
n@893 2038
n@893 2039 // Combinators
n@893 2040 if ( (match = rcombinators.exec( soFar )) ) {
n@893 2041 matched = match.shift();
n@893 2042 tokens.push({
n@893 2043 value: matched,
n@893 2044 // Cast descendant combinators to space
n@893 2045 type: match[0].replace( rtrim, " " )
n@893 2046 });
n@893 2047 soFar = soFar.slice( matched.length );
n@893 2048 }
n@893 2049
n@893 2050 // Filters
n@893 2051 for ( type in Expr.filter ) {
n@893 2052 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
n@893 2053 (match = preFilters[ type ]( match ))) ) {
n@893 2054 matched = match.shift();
n@893 2055 tokens.push({
n@893 2056 value: matched,
n@893 2057 type: type,
n@893 2058 matches: match
n@893 2059 });
n@893 2060 soFar = soFar.slice( matched.length );
n@893 2061 }
n@893 2062 }
n@893 2063
n@893 2064 if ( !matched ) {
n@893 2065 break;
n@893 2066 }
n@893 2067 }
n@893 2068
n@893 2069 // Return the length of the invalid excess
n@893 2070 // if we're just parsing
n@893 2071 // Otherwise, throw an error or return tokens
n@893 2072 return parseOnly ?
n@893 2073 soFar.length :
n@893 2074 soFar ?
n@893 2075 Sizzle.error( selector ) :
n@893 2076 // Cache the tokens
n@893 2077 tokenCache( selector, groups ).slice( 0 );
n@893 2078 };
n@893 2079
n@893 2080 function toSelector( tokens ) {
n@893 2081 var i = 0,
n@893 2082 len = tokens.length,
n@893 2083 selector = "";
n@893 2084 for ( ; i < len; i++ ) {
n@893 2085 selector += tokens[i].value;
n@893 2086 }
n@893 2087 return selector;
n@893 2088 }
n@893 2089
n@893 2090 function addCombinator( matcher, combinator, base ) {
n@893 2091 var dir = combinator.dir,
n@893 2092 checkNonElements = base && dir === "parentNode",
n@893 2093 doneName = done++;
n@893 2094
n@893 2095 return combinator.first ?
n@893 2096 // Check against closest ancestor/preceding element
n@893 2097 function( elem, context, xml ) {
n@893 2098 while ( (elem = elem[ dir ]) ) {
n@893 2099 if ( elem.nodeType === 1 || checkNonElements ) {
n@893 2100 return matcher( elem, context, xml );
n@893 2101 }
n@893 2102 }
n@893 2103 } :
n@893 2104
n@893 2105 // Check against all ancestor/preceding elements
n@893 2106 function( elem, context, xml ) {
n@893 2107 var oldCache, outerCache,
n@893 2108 newCache = [ dirruns, doneName ];
n@893 2109
n@893 2110 // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
n@893 2111 if ( xml ) {
n@893 2112 while ( (elem = elem[ dir ]) ) {
n@893 2113 if ( elem.nodeType === 1 || checkNonElements ) {
n@893 2114 if ( matcher( elem, context, xml ) ) {
n@893 2115 return true;
n@893 2116 }
n@893 2117 }
n@893 2118 }
n@893 2119 } else {
n@893 2120 while ( (elem = elem[ dir ]) ) {
n@893 2121 if ( elem.nodeType === 1 || checkNonElements ) {
n@893 2122 outerCache = elem[ expando ] || (elem[ expando ] = {});
n@893 2123 if ( (oldCache = outerCache[ dir ]) &&
n@893 2124 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
n@893 2125
n@893 2126 // Assign to newCache so results back-propagate to previous elements
n@893 2127 return (newCache[ 2 ] = oldCache[ 2 ]);
n@893 2128 } else {
n@893 2129 // Reuse newcache so results back-propagate to previous elements
n@893 2130 outerCache[ dir ] = newCache;
n@893 2131
n@893 2132 // A match means we're done; a fail means we have to keep checking
n@893 2133 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
n@893 2134 return true;
n@893 2135 }
n@893 2136 }
n@893 2137 }
n@893 2138 }
n@893 2139 }
n@893 2140 };
n@893 2141 }
n@893 2142
n@893 2143 function elementMatcher( matchers ) {
n@893 2144 return matchers.length > 1 ?
n@893 2145 function( elem, context, xml ) {
n@893 2146 var i = matchers.length;
n@893 2147 while ( i-- ) {
n@893 2148 if ( !matchers[i]( elem, context, xml ) ) {
n@893 2149 return false;
n@893 2150 }
n@893 2151 }
n@893 2152 return true;
n@893 2153 } :
n@893 2154 matchers[0];
n@893 2155 }
n@893 2156
n@893 2157 function multipleContexts( selector, contexts, results ) {
n@893 2158 var i = 0,
n@893 2159 len = contexts.length;
n@893 2160 for ( ; i < len; i++ ) {
n@893 2161 Sizzle( selector, contexts[i], results );
n@893 2162 }
n@893 2163 return results;
n@893 2164 }
n@893 2165
n@893 2166 function condense( unmatched, map, filter, context, xml ) {
n@893 2167 var elem,
n@893 2168 newUnmatched = [],
n@893 2169 i = 0,
n@893 2170 len = unmatched.length,
n@893 2171 mapped = map != null;
n@893 2172
n@893 2173 for ( ; i < len; i++ ) {
n@893 2174 if ( (elem = unmatched[i]) ) {
n@893 2175 if ( !filter || filter( elem, context, xml ) ) {
n@893 2176 newUnmatched.push( elem );
n@893 2177 if ( mapped ) {
n@893 2178 map.push( i );
n@893 2179 }
n@893 2180 }
n@893 2181 }
n@893 2182 }
n@893 2183
n@893 2184 return newUnmatched;
n@893 2185 }
n@893 2186
n@893 2187 function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
n@893 2188 if ( postFilter && !postFilter[ expando ] ) {
n@893 2189 postFilter = setMatcher( postFilter );
n@893 2190 }
n@893 2191 if ( postFinder && !postFinder[ expando ] ) {
n@893 2192 postFinder = setMatcher( postFinder, postSelector );
n@893 2193 }
n@893 2194 return markFunction(function( seed, results, context, xml ) {
n@893 2195 var temp, i, elem,
n@893 2196 preMap = [],
n@893 2197 postMap = [],
n@893 2198 preexisting = results.length,
n@893 2199
n@893 2200 // Get initial elements from seed or context
n@893 2201 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
n@893 2202
n@893 2203 // Prefilter to get matcher input, preserving a map for seed-results synchronization
n@893 2204 matcherIn = preFilter && ( seed || !selector ) ?
n@893 2205 condense( elems, preMap, preFilter, context, xml ) :
n@893 2206 elems,
n@893 2207
n@893 2208 matcherOut = matcher ?
n@893 2209 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
n@893 2210 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
n@893 2211
n@893 2212 // ...intermediate processing is necessary
n@893 2213 [] :
n@893 2214
n@893 2215 // ...otherwise use results directly
n@893 2216 results :
n@893 2217 matcherIn;
n@893 2218
n@893 2219 // Find primary matches
n@893 2220 if ( matcher ) {
n@893 2221 matcher( matcherIn, matcherOut, context, xml );
n@893 2222 }
n@893 2223
n@893 2224 // Apply postFilter
n@893 2225 if ( postFilter ) {
n@893 2226 temp = condense( matcherOut, postMap );
n@893 2227 postFilter( temp, [], context, xml );
n@893 2228
n@893 2229 // Un-match failing elements by moving them back to matcherIn
n@893 2230 i = temp.length;
n@893 2231 while ( i-- ) {
n@893 2232 if ( (elem = temp[i]) ) {
n@893 2233 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
n@893 2234 }
n@893 2235 }
n@893 2236 }
n@893 2237
n@893 2238 if ( seed ) {
n@893 2239 if ( postFinder || preFilter ) {
n@893 2240 if ( postFinder ) {
n@893 2241 // Get the final matcherOut by condensing this intermediate into postFinder contexts
n@893 2242 temp = [];
n@893 2243 i = matcherOut.length;
n@893 2244 while ( i-- ) {
n@893 2245 if ( (elem = matcherOut[i]) ) {
n@893 2246 // Restore matcherIn since elem is not yet a final match
n@893 2247 temp.push( (matcherIn[i] = elem) );
n@893 2248 }
n@893 2249 }
n@893 2250 postFinder( null, (matcherOut = []), temp, xml );
n@893 2251 }
n@893 2252
n@893 2253 // Move matched elements from seed to results to keep them synchronized
n@893 2254 i = matcherOut.length;
n@893 2255 while ( i-- ) {
n@893 2256 if ( (elem = matcherOut[i]) &&
n@893 2257 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
n@893 2258
n@893 2259 seed[temp] = !(results[temp] = elem);
n@893 2260 }
n@893 2261 }
n@893 2262 }
n@893 2263
n@893 2264 // Add elements to results, through postFinder if defined
n@893 2265 } else {
n@893 2266 matcherOut = condense(
n@893 2267 matcherOut === results ?
n@893 2268 matcherOut.splice( preexisting, matcherOut.length ) :
n@893 2269 matcherOut
n@893 2270 );
n@893 2271 if ( postFinder ) {
n@893 2272 postFinder( null, results, matcherOut, xml );
n@893 2273 } else {
n@893 2274 push.apply( results, matcherOut );
n@893 2275 }
n@893 2276 }
n@893 2277 });
n@893 2278 }
n@893 2279
n@893 2280 function matcherFromTokens( tokens ) {
n@893 2281 var checkContext, matcher, j,
n@893 2282 len = tokens.length,
n@893 2283 leadingRelative = Expr.relative[ tokens[0].type ],
n@893 2284 implicitRelative = leadingRelative || Expr.relative[" "],
n@893 2285 i = leadingRelative ? 1 : 0,
n@893 2286
n@893 2287 // The foundational matcher ensures that elements are reachable from top-level context(s)
n@893 2288 matchContext = addCombinator( function( elem ) {
n@893 2289 return elem === checkContext;
n@893 2290 }, implicitRelative, true ),
n@893 2291 matchAnyContext = addCombinator( function( elem ) {
n@893 2292 return indexOf( checkContext, elem ) > -1;
n@893 2293 }, implicitRelative, true ),
n@893 2294 matchers = [ function( elem, context, xml ) {
n@893 2295 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
n@893 2296 (checkContext = context).nodeType ?
n@893 2297 matchContext( elem, context, xml ) :
n@893 2298 matchAnyContext( elem, context, xml ) );
n@893 2299 // Avoid hanging onto element (issue #299)
n@893 2300 checkContext = null;
n@893 2301 return ret;
n@893 2302 } ];
n@893 2303
n@893 2304 for ( ; i < len; i++ ) {
n@893 2305 if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
n@893 2306 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
n@893 2307 } else {
n@893 2308 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
n@893 2309
n@893 2310 // Return special upon seeing a positional matcher
n@893 2311 if ( matcher[ expando ] ) {
n@893 2312 // Find the next relative operator (if any) for proper handling
n@893 2313 j = ++i;
n@893 2314 for ( ; j < len; j++ ) {
n@893 2315 if ( Expr.relative[ tokens[j].type ] ) {
n@893 2316 break;
n@893 2317 }
n@893 2318 }
n@893 2319 return setMatcher(
n@893 2320 i > 1 && elementMatcher( matchers ),
n@893 2321 i > 1 && toSelector(
n@893 2322 // If the preceding token was a descendant combinator, insert an implicit any-element `*`
n@893 2323 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
n@893 2324 ).replace( rtrim, "$1" ),
n@893 2325 matcher,
n@893 2326 i < j && matcherFromTokens( tokens.slice( i, j ) ),
n@893 2327 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
n@893 2328 j < len && toSelector( tokens )
n@893 2329 );
n@893 2330 }
n@893 2331 matchers.push( matcher );
n@893 2332 }
n@893 2333 }
n@893 2334
n@893 2335 return elementMatcher( matchers );
n@893 2336 }
n@893 2337
n@893 2338 function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
n@893 2339 var bySet = setMatchers.length > 0,
n@893 2340 byElement = elementMatchers.length > 0,
n@893 2341 superMatcher = function( seed, context, xml, results, outermost ) {
n@893 2342 var elem, j, matcher,
n@893 2343 matchedCount = 0,
n@893 2344 i = "0",
n@893 2345 unmatched = seed && [],
n@893 2346 setMatched = [],
n@893 2347 contextBackup = outermostContext,
n@893 2348 // We must always have either seed elements or outermost context
n@893 2349 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
n@893 2350 // Use integer dirruns iff this is the outermost matcher
n@893 2351 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
n@893 2352 len = elems.length;
n@893 2353
n@893 2354 if ( outermost ) {
n@893 2355 outermostContext = context !== document && context;
n@893 2356 }
n@893 2357
n@893 2358 // Add elements passing elementMatchers directly to results
n@893 2359 // Keep `i` a string if there are no elements so `matchedCount` will be "00" below
n@893 2360 // Support: IE<9, Safari
n@893 2361 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
n@893 2362 for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
n@893 2363 if ( byElement && elem ) {
n@893 2364 j = 0;
n@893 2365 while ( (matcher = elementMatchers[j++]) ) {
n@893 2366 if ( matcher( elem, context, xml ) ) {
n@893 2367 results.push( elem );
n@893 2368 break;
n@893 2369 }
n@893 2370 }
n@893 2371 if ( outermost ) {
n@893 2372 dirruns = dirrunsUnique;
n@893 2373 }
n@893 2374 }
n@893 2375
n@893 2376 // Track unmatched elements for set filters
n@893 2377 if ( bySet ) {
n@893 2378 // They will have gone through all possible matchers
n@893 2379 if ( (elem = !matcher && elem) ) {
n@893 2380 matchedCount--;
n@893 2381 }
n@893 2382
n@893 2383 // Lengthen the array for every element, matched or not
n@893 2384 if ( seed ) {
n@893 2385 unmatched.push( elem );
n@893 2386 }
n@893 2387 }
n@893 2388 }
n@893 2389
n@893 2390 // Apply set filters to unmatched elements
n@893 2391 matchedCount += i;
n@893 2392 if ( bySet && i !== matchedCount ) {
n@893 2393 j = 0;
n@893 2394 while ( (matcher = setMatchers[j++]) ) {
n@893 2395 matcher( unmatched, setMatched, context, xml );
n@893 2396 }
n@893 2397
n@893 2398 if ( seed ) {
n@893 2399 // Reintegrate element matches to eliminate the need for sorting
n@893 2400 if ( matchedCount > 0 ) {
n@893 2401 while ( i-- ) {
n@893 2402 if ( !(unmatched[i] || setMatched[i]) ) {
n@893 2403 setMatched[i] = pop.call( results );
n@893 2404 }
n@893 2405 }
n@893 2406 }
n@893 2407
n@893 2408 // Discard index placeholder values to get only actual matches
n@893 2409 setMatched = condense( setMatched );
n@893 2410 }
n@893 2411
n@893 2412 // Add matches to results
n@893 2413 push.apply( results, setMatched );
n@893 2414
n@893 2415 // Seedless set matches succeeding multiple successful matchers stipulate sorting
n@893 2416 if ( outermost && !seed && setMatched.length > 0 &&
n@893 2417 ( matchedCount + setMatchers.length ) > 1 ) {
n@893 2418
n@893 2419 Sizzle.uniqueSort( results );
n@893 2420 }
n@893 2421 }
n@893 2422
n@893 2423 // Override manipulation of globals by nested matchers
n@893 2424 if ( outermost ) {
n@893 2425 dirruns = dirrunsUnique;
n@893 2426 outermostContext = contextBackup;
n@893 2427 }
n@893 2428
n@893 2429 return unmatched;
n@893 2430 };
n@893 2431
n@893 2432 return bySet ?
n@893 2433 markFunction( superMatcher ) :
n@893 2434 superMatcher;
n@893 2435 }
n@893 2436
n@893 2437 compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
n@893 2438 var i,
n@893 2439 setMatchers = [],
n@893 2440 elementMatchers = [],
n@893 2441 cached = compilerCache[ selector + " " ];
n@893 2442
n@893 2443 if ( !cached ) {
n@893 2444 // Generate a function of recursive functions that can be used to check each element
n@893 2445 if ( !match ) {
n@893 2446 match = tokenize( selector );
n@893 2447 }
n@893 2448 i = match.length;
n@893 2449 while ( i-- ) {
n@893 2450 cached = matcherFromTokens( match[i] );
n@893 2451 if ( cached[ expando ] ) {
n@893 2452 setMatchers.push( cached );
n@893 2453 } else {
n@893 2454 elementMatchers.push( cached );
n@893 2455 }
n@893 2456 }
n@893 2457
n@893 2458 // Cache the compiled function
n@893 2459 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
n@893 2460
n@893 2461 // Save selector and tokenization
n@893 2462 cached.selector = selector;
n@893 2463 }
n@893 2464 return cached;
n@893 2465 };
n@893 2466
n@893 2467 /**
n@893 2468 * A low-level selection function that works with Sizzle's compiled
n@893 2469 * selector functions
n@893 2470 * @param {String|Function} selector A selector or a pre-compiled
n@893 2471 * selector function built with Sizzle.compile
n@893 2472 * @param {Element} context
n@893 2473 * @param {Array} [results]
n@893 2474 * @param {Array} [seed] A set of elements to match against
n@893 2475 */
n@893 2476 select = Sizzle.select = function( selector, context, results, seed ) {
n@893 2477 var i, tokens, token, type, find,
n@893 2478 compiled = typeof selector === "function" && selector,
n@893 2479 match = !seed && tokenize( (selector = compiled.selector || selector) );
n@893 2480
n@893 2481 results = results || [];
n@893 2482
n@893 2483 // Try to minimize operations if there is no seed and only one group
n@893 2484 if ( match.length === 1 ) {
n@893 2485
n@893 2486 // Take a shortcut and set the context if the root selector is an ID
n@893 2487 tokens = match[0] = match[0].slice( 0 );
n@893 2488 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
n@893 2489 support.getById && context.nodeType === 9 && documentIsHTML &&
n@893 2490 Expr.relative[ tokens[1].type ] ) {
n@893 2491
n@893 2492 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
n@893 2493 if ( !context ) {
n@893 2494 return results;
n@893 2495
n@893 2496 // Precompiled matchers will still verify ancestry, so step up a level
n@893 2497 } else if ( compiled ) {
n@893 2498 context = context.parentNode;
n@893 2499 }
n@893 2500
n@893 2501 selector = selector.slice( tokens.shift().value.length );
n@893 2502 }
n@893 2503
n@893 2504 // Fetch a seed set for right-to-left matching
n@893 2505 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
n@893 2506 while ( i-- ) {
n@893 2507 token = tokens[i];
n@893 2508
n@893 2509 // Abort if we hit a combinator
n@893 2510 if ( Expr.relative[ (type = token.type) ] ) {
n@893 2511 break;
n@893 2512 }
n@893 2513 if ( (find = Expr.find[ type ]) ) {
n@893 2514 // Search, expanding context for leading sibling combinators
n@893 2515 if ( (seed = find(
n@893 2516 token.matches[0].replace( runescape, funescape ),
n@893 2517 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
n@893 2518 )) ) {
n@893 2519
n@893 2520 // If seed is empty or no tokens remain, we can return early
n@893 2521 tokens.splice( i, 1 );
n@893 2522 selector = seed.length && toSelector( tokens );
n@893 2523 if ( !selector ) {
n@893 2524 push.apply( results, seed );
n@893 2525 return results;
n@893 2526 }
n@893 2527
n@893 2528 break;
n@893 2529 }
n@893 2530 }
n@893 2531 }
n@893 2532 }
n@893 2533
n@893 2534 // Compile and execute a filtering function if one is not provided
n@893 2535 // Provide `match` to avoid retokenization if we modified the selector above
n@893 2536 ( compiled || compile( selector, match ) )(
n@893 2537 seed,
n@893 2538 context,
n@893 2539 !documentIsHTML,
n@893 2540 results,
n@893 2541 rsibling.test( selector ) && testContext( context.parentNode ) || context
n@893 2542 );
n@893 2543 return results;
n@893 2544 };
n@893 2545
n@893 2546 // One-time assignments
n@893 2547
n@893 2548 // Sort stability
n@893 2549 support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
n@893 2550
n@893 2551 // Support: Chrome 14-35+
n@893 2552 // Always assume duplicates if they aren't passed to the comparison function
n@893 2553 support.detectDuplicates = !!hasDuplicate;
n@893 2554
n@893 2555 // Initialize against the default document
n@893 2556 setDocument();
n@893 2557
n@893 2558 // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
n@893 2559 // Detached nodes confoundingly follow *each other*
n@893 2560 support.sortDetached = assert(function( div1 ) {
n@893 2561 // Should return 1, but returns 4 (following)
n@893 2562 return div1.compareDocumentPosition( document.createElement("div") ) & 1;
n@893 2563 });
n@893 2564
n@893 2565 // Support: IE<8
n@893 2566 // Prevent attribute/property "interpolation"
n@893 2567 // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
n@893 2568 if ( !assert(function( div ) {
n@893 2569 div.innerHTML = "<a href='#'></a>";
n@893 2570 return div.firstChild.getAttribute("href") === "#" ;
n@893 2571 }) ) {
n@893 2572 addHandle( "type|href|height|width", function( elem, name, isXML ) {
n@893 2573 if ( !isXML ) {
n@893 2574 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
n@893 2575 }
n@893 2576 });
n@893 2577 }
n@893 2578
n@893 2579 // Support: IE<9
n@893 2580 // Use defaultValue in place of getAttribute("value")
n@893 2581 if ( !support.attributes || !assert(function( div ) {
n@893 2582 div.innerHTML = "<input/>";
n@893 2583 div.firstChild.setAttribute( "value", "" );
n@893 2584 return div.firstChild.getAttribute( "value" ) === "";
n@893 2585 }) ) {
n@893 2586 addHandle( "value", function( elem, name, isXML ) {
n@893 2587 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
n@893 2588 return elem.defaultValue;
n@893 2589 }
n@893 2590 });
n@893 2591 }
n@893 2592
n@893 2593 // Support: IE<9
n@893 2594 // Use getAttributeNode to fetch booleans when getAttribute lies
n@893 2595 if ( !assert(function( div ) {
n@893 2596 return div.getAttribute("disabled") == null;
n@893 2597 }) ) {
n@893 2598 addHandle( booleans, function( elem, name, isXML ) {
n@893 2599 var val;
n@893 2600 if ( !isXML ) {
n@893 2601 return elem[ name ] === true ? name.toLowerCase() :
n@893 2602 (val = elem.getAttributeNode( name )) && val.specified ?
n@893 2603 val.value :
n@893 2604 null;
n@893 2605 }
n@893 2606 });
n@893 2607 }
n@893 2608
n@893 2609 return Sizzle;
n@893 2610
n@893 2611 })( window );
n@893 2612
n@893 2613
n@893 2614
n@893 2615 jQuery.find = Sizzle;
n@893 2616 jQuery.expr = Sizzle.selectors;
n@893 2617 jQuery.expr[":"] = jQuery.expr.pseudos;
n@893 2618 jQuery.unique = Sizzle.uniqueSort;
n@893 2619 jQuery.text = Sizzle.getText;
n@893 2620 jQuery.isXMLDoc = Sizzle.isXML;
n@893 2621 jQuery.contains = Sizzle.contains;
n@893 2622
n@893 2623
n@893 2624
n@893 2625 var rneedsContext = jQuery.expr.match.needsContext;
n@893 2626
n@893 2627 var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
n@893 2628
n@893 2629
n@893 2630
n@893 2631 var risSimple = /^.[^:#\[\.,]*$/;
n@893 2632
n@893 2633 // Implement the identical functionality for filter and not
n@893 2634 function winnow( elements, qualifier, not ) {
n@893 2635 if ( jQuery.isFunction( qualifier ) ) {
n@893 2636 return jQuery.grep( elements, function( elem, i ) {
n@893 2637 /* jshint -W018 */
n@893 2638 return !!qualifier.call( elem, i, elem ) !== not;
n@893 2639 });
n@893 2640
n@893 2641 }
n@893 2642
n@893 2643 if ( qualifier.nodeType ) {
n@893 2644 return jQuery.grep( elements, function( elem ) {
n@893 2645 return ( elem === qualifier ) !== not;
n@893 2646 });
n@893 2647
n@893 2648 }
n@893 2649
n@893 2650 if ( typeof qualifier === "string" ) {
n@893 2651 if ( risSimple.test( qualifier ) ) {
n@893 2652 return jQuery.filter( qualifier, elements, not );
n@893 2653 }
n@893 2654
n@893 2655 qualifier = jQuery.filter( qualifier, elements );
n@893 2656 }
n@893 2657
n@893 2658 return jQuery.grep( elements, function( elem ) {
n@893 2659 return ( indexOf.call( qualifier, elem ) >= 0 ) !== not;
n@893 2660 });
n@893 2661 }
n@893 2662
n@893 2663 jQuery.filter = function( expr, elems, not ) {
n@893 2664 var elem = elems[ 0 ];
n@893 2665
n@893 2666 if ( not ) {
n@893 2667 expr = ":not(" + expr + ")";
n@893 2668 }
n@893 2669
n@893 2670 return elems.length === 1 && elem.nodeType === 1 ?
n@893 2671 jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
n@893 2672 jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
n@893 2673 return elem.nodeType === 1;
n@893 2674 }));
n@893 2675 };
n@893 2676
n@893 2677 jQuery.fn.extend({
n@893 2678 find: function( selector ) {
n@893 2679 var i,
n@893 2680 len = this.length,
n@893 2681 ret = [],
n@893 2682 self = this;
n@893 2683
n@893 2684 if ( typeof selector !== "string" ) {
n@893 2685 return this.pushStack( jQuery( selector ).filter(function() {
n@893 2686 for ( i = 0; i < len; i++ ) {
n@893 2687 if ( jQuery.contains( self[ i ], this ) ) {
n@893 2688 return true;
n@893 2689 }
n@893 2690 }
n@893 2691 }) );
n@893 2692 }
n@893 2693
n@893 2694 for ( i = 0; i < len; i++ ) {
n@893 2695 jQuery.find( selector, self[ i ], ret );
n@893 2696 }
n@893 2697
n@893 2698 // Needed because $( selector, context ) becomes $( context ).find( selector )
n@893 2699 ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
n@893 2700 ret.selector = this.selector ? this.selector + " " + selector : selector;
n@893 2701 return ret;
n@893 2702 },
n@893 2703 filter: function( selector ) {
n@893 2704 return this.pushStack( winnow(this, selector || [], false) );
n@893 2705 },
n@893 2706 not: function( selector ) {
n@893 2707 return this.pushStack( winnow(this, selector || [], true) );
n@893 2708 },
n@893 2709 is: function( selector ) {
n@893 2710 return !!winnow(
n@893 2711 this,
n@893 2712
n@893 2713 // If this is a positional/relative selector, check membership in the returned set
n@893 2714 // so $("p:first").is("p:last") won't return true for a doc with two "p".
n@893 2715 typeof selector === "string" && rneedsContext.test( selector ) ?
n@893 2716 jQuery( selector ) :
n@893 2717 selector || [],
n@893 2718 false
n@893 2719 ).length;
n@893 2720 }
n@893 2721 });
n@893 2722
n@893 2723
n@893 2724 // Initialize a jQuery object
n@893 2725
n@893 2726
n@893 2727 // A central reference to the root jQuery(document)
n@893 2728 var rootjQuery,
n@893 2729
n@893 2730 // A simple way to check for HTML strings
n@893 2731 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
n@893 2732 // Strict HTML recognition (#11290: must start with <)
n@893 2733 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
n@893 2734
n@893 2735 init = jQuery.fn.init = function( selector, context ) {
n@893 2736 var match, elem;
n@893 2737
n@893 2738 // HANDLE: $(""), $(null), $(undefined), $(false)
n@893 2739 if ( !selector ) {
n@893 2740 return this;
n@893 2741 }
n@893 2742
n@893 2743 // Handle HTML strings
n@893 2744 if ( typeof selector === "string" ) {
n@893 2745 if ( selector[0] === "<" && selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) {
n@893 2746 // Assume that strings that start and end with <> are HTML and skip the regex check
n@893 2747 match = [ null, selector, null ];
n@893 2748
n@893 2749 } else {
n@893 2750 match = rquickExpr.exec( selector );
n@893 2751 }
n@893 2752
n@893 2753 // Match html or make sure no context is specified for #id
n@893 2754 if ( match && (match[1] || !context) ) {
n@893 2755
n@893 2756 // HANDLE: $(html) -> $(array)
n@893 2757 if ( match[1] ) {
n@893 2758 context = context instanceof jQuery ? context[0] : context;
n@893 2759
n@893 2760 // Option to run scripts is true for back-compat
n@893 2761 // Intentionally let the error be thrown if parseHTML is not present
n@893 2762 jQuery.merge( this, jQuery.parseHTML(
n@893 2763 match[1],
n@893 2764 context && context.nodeType ? context.ownerDocument || context : document,
n@893 2765 true
n@893 2766 ) );
n@893 2767
n@893 2768 // HANDLE: $(html, props)
n@893 2769 if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
n@893 2770 for ( match in context ) {
n@893 2771 // Properties of context are called as methods if possible
n@893 2772 if ( jQuery.isFunction( this[ match ] ) ) {
n@893 2773 this[ match ]( context[ match ] );
n@893 2774
n@893 2775 // ...and otherwise set as attributes
n@893 2776 } else {
n@893 2777 this.attr( match, context[ match ] );
n@893 2778 }
n@893 2779 }
n@893 2780 }
n@893 2781
n@893 2782 return this;
n@893 2783
n@893 2784 // HANDLE: $(#id)
n@893 2785 } else {
n@893 2786 elem = document.getElementById( match[2] );
n@893 2787
n@893 2788 // Support: Blackberry 4.6
n@893 2789 // gEBID returns nodes no longer in the document (#6963)
n@893 2790 if ( elem && elem.parentNode ) {
n@893 2791 // Inject the element directly into the jQuery object
n@893 2792 this.length = 1;
n@893 2793 this[0] = elem;
n@893 2794 }
n@893 2795
n@893 2796 this.context = document;
n@893 2797 this.selector = selector;
n@893 2798 return this;
n@893 2799 }
n@893 2800
n@893 2801 // HANDLE: $(expr, $(...))
n@893 2802 } else if ( !context || context.jquery ) {
n@893 2803 return ( context || rootjQuery ).find( selector );
n@893 2804
n@893 2805 // HANDLE: $(expr, context)
n@893 2806 // (which is just equivalent to: $(context).find(expr)
n@893 2807 } else {
n@893 2808 return this.constructor( context ).find( selector );
n@893 2809 }
n@893 2810
n@893 2811 // HANDLE: $(DOMElement)
n@893 2812 } else if ( selector.nodeType ) {
n@893 2813 this.context = this[0] = selector;
n@893 2814 this.length = 1;
n@893 2815 return this;
n@893 2816
n@893 2817 // HANDLE: $(function)
n@893 2818 // Shortcut for document ready
n@893 2819 } else if ( jQuery.isFunction( selector ) ) {
n@893 2820 return typeof rootjQuery.ready !== "undefined" ?
n@893 2821 rootjQuery.ready( selector ) :
n@893 2822 // Execute immediately if ready is not present
n@893 2823 selector( jQuery );
n@893 2824 }
n@893 2825
n@893 2826 if ( selector.selector !== undefined ) {
n@893 2827 this.selector = selector.selector;
n@893 2828 this.context = selector.context;
n@893 2829 }
n@893 2830
n@893 2831 return jQuery.makeArray( selector, this );
n@893 2832 };
n@893 2833
n@893 2834 // Give the init function the jQuery prototype for later instantiation
n@893 2835 init.prototype = jQuery.fn;
n@893 2836
n@893 2837 // Initialize central reference
n@893 2838 rootjQuery = jQuery( document );
n@893 2839
n@893 2840
n@893 2841 var rparentsprev = /^(?:parents|prev(?:Until|All))/,
n@893 2842 // Methods guaranteed to produce a unique set when starting from a unique set
n@893 2843 guaranteedUnique = {
n@893 2844 children: true,
n@893 2845 contents: true,
n@893 2846 next: true,
n@893 2847 prev: true
n@893 2848 };
n@893 2849
n@893 2850 jQuery.extend({
n@893 2851 dir: function( elem, dir, until ) {
n@893 2852 var matched = [],
n@893 2853 truncate = until !== undefined;
n@893 2854
n@893 2855 while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) {
n@893 2856 if ( elem.nodeType === 1 ) {
n@893 2857 if ( truncate && jQuery( elem ).is( until ) ) {
n@893 2858 break;
n@893 2859 }
n@893 2860 matched.push( elem );
n@893 2861 }
n@893 2862 }
n@893 2863 return matched;
n@893 2864 },
n@893 2865
n@893 2866 sibling: function( n, elem ) {
n@893 2867 var matched = [];
n@893 2868
n@893 2869 for ( ; n; n = n.nextSibling ) {
n@893 2870 if ( n.nodeType === 1 && n !== elem ) {
n@893 2871 matched.push( n );
n@893 2872 }
n@893 2873 }
n@893 2874
n@893 2875 return matched;
n@893 2876 }
n@893 2877 });
n@893 2878
n@893 2879 jQuery.fn.extend({
n@893 2880 has: function( target ) {
n@893 2881 var targets = jQuery( target, this ),
n@893 2882 l = targets.length;
n@893 2883
n@893 2884 return this.filter(function() {
n@893 2885 var i = 0;
n@893 2886 for ( ; i < l; i++ ) {
n@893 2887 if ( jQuery.contains( this, targets[i] ) ) {
n@893 2888 return true;
n@893 2889 }
n@893 2890 }
n@893 2891 });
n@893 2892 },
n@893 2893
n@893 2894 closest: function( selectors, context ) {
n@893 2895 var cur,
n@893 2896 i = 0,
n@893 2897 l = this.length,
n@893 2898 matched = [],
n@893 2899 pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
n@893 2900 jQuery( selectors, context || this.context ) :
n@893 2901 0;
n@893 2902
n@893 2903 for ( ; i < l; i++ ) {
n@893 2904 for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
n@893 2905 // Always skip document fragments
n@893 2906 if ( cur.nodeType < 11 && (pos ?
n@893 2907 pos.index(cur) > -1 :
n@893 2908
n@893 2909 // Don't pass non-elements to Sizzle
n@893 2910 cur.nodeType === 1 &&
n@893 2911 jQuery.find.matchesSelector(cur, selectors)) ) {
n@893 2912
n@893 2913 matched.push( cur );
n@893 2914 break;
n@893 2915 }
n@893 2916 }
n@893 2917 }
n@893 2918
n@893 2919 return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched );
n@893 2920 },
n@893 2921
n@893 2922 // Determine the position of an element within the set
n@893 2923 index: function( elem ) {
n@893 2924
n@893 2925 // No argument, return index in parent
n@893 2926 if ( !elem ) {
n@893 2927 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
n@893 2928 }
n@893 2929
n@893 2930 // Index in selector
n@893 2931 if ( typeof elem === "string" ) {
n@893 2932 return indexOf.call( jQuery( elem ), this[ 0 ] );
n@893 2933 }
n@893 2934
n@893 2935 // Locate the position of the desired element
n@893 2936 return indexOf.call( this,
n@893 2937
n@893 2938 // If it receives a jQuery object, the first element is used
n@893 2939 elem.jquery ? elem[ 0 ] : elem
n@893 2940 );
n@893 2941 },
n@893 2942
n@893 2943 add: function( selector, context ) {
n@893 2944 return this.pushStack(
n@893 2945 jQuery.unique(
n@893 2946 jQuery.merge( this.get(), jQuery( selector, context ) )
n@893 2947 )
n@893 2948 );
n@893 2949 },
n@893 2950
n@893 2951 addBack: function( selector ) {
n@893 2952 return this.add( selector == null ?
n@893 2953 this.prevObject : this.prevObject.filter(selector)
n@893 2954 );
n@893 2955 }
n@893 2956 });
n@893 2957
n@893 2958 function sibling( cur, dir ) {
n@893 2959 while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {}
n@893 2960 return cur;
n@893 2961 }
n@893 2962
n@893 2963 jQuery.each({
n@893 2964 parent: function( elem ) {
n@893 2965 var parent = elem.parentNode;
n@893 2966 return parent && parent.nodeType !== 11 ? parent : null;
n@893 2967 },
n@893 2968 parents: function( elem ) {
n@893 2969 return jQuery.dir( elem, "parentNode" );
n@893 2970 },
n@893 2971 parentsUntil: function( elem, i, until ) {
n@893 2972 return jQuery.dir( elem, "parentNode", until );
n@893 2973 },
n@893 2974 next: function( elem ) {
n@893 2975 return sibling( elem, "nextSibling" );
n@893 2976 },
n@893 2977 prev: function( elem ) {
n@893 2978 return sibling( elem, "previousSibling" );
n@893 2979 },
n@893 2980 nextAll: function( elem ) {
n@893 2981 return jQuery.dir( elem, "nextSibling" );
n@893 2982 },
n@893 2983 prevAll: function( elem ) {
n@893 2984 return jQuery.dir( elem, "previousSibling" );
n@893 2985 },
n@893 2986 nextUntil: function( elem, i, until ) {
n@893 2987 return jQuery.dir( elem, "nextSibling", until );
n@893 2988 },
n@893 2989 prevUntil: function( elem, i, until ) {
n@893 2990 return jQuery.dir( elem, "previousSibling", until );
n@893 2991 },
n@893 2992 siblings: function( elem ) {
n@893 2993 return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
n@893 2994 },
n@893 2995 children: function( elem ) {
n@893 2996 return jQuery.sibling( elem.firstChild );
n@893 2997 },
n@893 2998 contents: function( elem ) {
n@893 2999 return elem.contentDocument || jQuery.merge( [], elem.childNodes );
n@893 3000 }
n@893 3001 }, function( name, fn ) {
n@893 3002 jQuery.fn[ name ] = function( until, selector ) {
n@893 3003 var matched = jQuery.map( this, fn, until );
n@893 3004
n@893 3005 if ( name.slice( -5 ) !== "Until" ) {
n@893 3006 selector = until;
n@893 3007 }
n@893 3008
n@893 3009 if ( selector && typeof selector === "string" ) {
n@893 3010 matched = jQuery.filter( selector, matched );
n@893 3011 }
n@893 3012
n@893 3013 if ( this.length > 1 ) {
n@893 3014 // Remove duplicates
n@893 3015 if ( !guaranteedUnique[ name ] ) {
n@893 3016 jQuery.unique( matched );
n@893 3017 }
n@893 3018
n@893 3019 // Reverse order for parents* and prev-derivatives
n@893 3020 if ( rparentsprev.test( name ) ) {
n@893 3021 matched.reverse();
n@893 3022 }
n@893 3023 }
n@893 3024
n@893 3025 return this.pushStack( matched );
n@893 3026 };
n@893 3027 });
n@893 3028 var rnotwhite = (/\S+/g);
n@893 3029
n@893 3030
n@893 3031
n@893 3032 // String to Object options format cache
n@893 3033 var optionsCache = {};
n@893 3034
n@893 3035 // Convert String-formatted options into Object-formatted ones and store in cache
n@893 3036 function createOptions( options ) {
n@893 3037 var object = optionsCache[ options ] = {};
n@893 3038 jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
n@893 3039 object[ flag ] = true;
n@893 3040 });
n@893 3041 return object;
n@893 3042 }
n@893 3043
n@893 3044 /*
n@893 3045 * Create a callback list using the following parameters:
n@893 3046 *
n@893 3047 * options: an optional list of space-separated options that will change how
n@893 3048 * the callback list behaves or a more traditional option object
n@893 3049 *
n@893 3050 * By default a callback list will act like an event callback list and can be
n@893 3051 * "fired" multiple times.
n@893 3052 *
n@893 3053 * Possible options:
n@893 3054 *
n@893 3055 * once: will ensure the callback list can only be fired once (like a Deferred)
n@893 3056 *
n@893 3057 * memory: will keep track of previous values and will call any callback added
n@893 3058 * after the list has been fired right away with the latest "memorized"
n@893 3059 * values (like a Deferred)
n@893 3060 *
n@893 3061 * unique: will ensure a callback can only be added once (no duplicate in the list)
n@893 3062 *
n@893 3063 * stopOnFalse: interrupt callings when a callback returns false
n@893 3064 *
n@893 3065 */
n@893 3066 jQuery.Callbacks = function( options ) {
n@893 3067
n@893 3068 // Convert options from String-formatted to Object-formatted if needed
n@893 3069 // (we check in cache first)
n@893 3070 options = typeof options === "string" ?
n@893 3071 ( optionsCache[ options ] || createOptions( options ) ) :
n@893 3072 jQuery.extend( {}, options );
n@893 3073
n@893 3074 var // Last fire value (for non-forgettable lists)
n@893 3075 memory,
n@893 3076 // Flag to know if list was already fired
n@893 3077 fired,
n@893 3078 // Flag to know if list is currently firing
n@893 3079 firing,
n@893 3080 // First callback to fire (used internally by add and fireWith)
n@893 3081 firingStart,
n@893 3082 // End of the loop when firing
n@893 3083 firingLength,
n@893 3084 // Index of currently firing callback (modified by remove if needed)
n@893 3085 firingIndex,
n@893 3086 // Actual callback list
n@893 3087 list = [],
n@893 3088 // Stack of fire calls for repeatable lists
n@893 3089 stack = !options.once && [],
n@893 3090 // Fire callbacks
n@893 3091 fire = function( data ) {
n@893 3092 memory = options.memory && data;
n@893 3093 fired = true;
n@893 3094 firingIndex = firingStart || 0;
n@893 3095 firingStart = 0;
n@893 3096 firingLength = list.length;
n@893 3097 firing = true;
n@893 3098 for ( ; list && firingIndex < firingLength; firingIndex++ ) {
n@893 3099 if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
n@893 3100 memory = false; // To prevent further calls using add
n@893 3101 break;
n@893 3102 }
n@893 3103 }
n@893 3104 firing = false;
n@893 3105 if ( list ) {
n@893 3106 if ( stack ) {
n@893 3107 if ( stack.length ) {
n@893 3108 fire( stack.shift() );
n@893 3109 }
n@893 3110 } else if ( memory ) {
n@893 3111 list = [];
n@893 3112 } else {
n@893 3113 self.disable();
n@893 3114 }
n@893 3115 }
n@893 3116 },
n@893 3117 // Actual Callbacks object
n@893 3118 self = {
n@893 3119 // Add a callback or a collection of callbacks to the list
n@893 3120 add: function() {
n@893 3121 if ( list ) {
n@893 3122 // First, we save the current length
n@893 3123 var start = list.length;
n@893 3124 (function add( args ) {
n@893 3125 jQuery.each( args, function( _, arg ) {
n@893 3126 var type = jQuery.type( arg );
n@893 3127 if ( type === "function" ) {
n@893 3128 if ( !options.unique || !self.has( arg ) ) {
n@893 3129 list.push( arg );
n@893 3130 }
n@893 3131 } else if ( arg && arg.length && type !== "string" ) {
n@893 3132 // Inspect recursively
n@893 3133 add( arg );
n@893 3134 }
n@893 3135 });
n@893 3136 })( arguments );
n@893 3137 // Do we need to add the callbacks to the
n@893 3138 // current firing batch?
n@893 3139 if ( firing ) {
n@893 3140 firingLength = list.length;
n@893 3141 // With memory, if we're not firing then
n@893 3142 // we should call right away
n@893 3143 } else if ( memory ) {
n@893 3144 firingStart = start;
n@893 3145 fire( memory );
n@893 3146 }
n@893 3147 }
n@893 3148 return this;
n@893 3149 },
n@893 3150 // Remove a callback from the list
n@893 3151 remove: function() {
n@893 3152 if ( list ) {
n@893 3153 jQuery.each( arguments, function( _, arg ) {
n@893 3154 var index;
n@893 3155 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
n@893 3156 list.splice( index, 1 );
n@893 3157 // Handle firing indexes
n@893 3158 if ( firing ) {
n@893 3159 if ( index <= firingLength ) {
n@893 3160 firingLength--;
n@893 3161 }
n@893 3162 if ( index <= firingIndex ) {
n@893 3163 firingIndex--;
n@893 3164 }
n@893 3165 }
n@893 3166 }
n@893 3167 });
n@893 3168 }
n@893 3169 return this;
n@893 3170 },
n@893 3171 // Check if a given callback is in the list.
n@893 3172 // If no argument is given, return whether or not list has callbacks attached.
n@893 3173 has: function( fn ) {
n@893 3174 return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
n@893 3175 },
n@893 3176 // Remove all callbacks from the list
n@893 3177 empty: function() {
n@893 3178 list = [];
n@893 3179 firingLength = 0;
n@893 3180 return this;
n@893 3181 },
n@893 3182 // Have the list do nothing anymore
n@893 3183 disable: function() {
n@893 3184 list = stack = memory = undefined;
n@893 3185 return this;
n@893 3186 },
n@893 3187 // Is it disabled?
n@893 3188 disabled: function() {
n@893 3189 return !list;
n@893 3190 },
n@893 3191 // Lock the list in its current state
n@893 3192 lock: function() {
n@893 3193 stack = undefined;
n@893 3194 if ( !memory ) {
n@893 3195 self.disable();
n@893 3196 }
n@893 3197 return this;
n@893 3198 },
n@893 3199 // Is it locked?
n@893 3200 locked: function() {
n@893 3201 return !stack;
n@893 3202 },
n@893 3203 // Call all callbacks with the given context and arguments
n@893 3204 fireWith: function( context, args ) {
n@893 3205 if ( list && ( !fired || stack ) ) {
n@893 3206 args = args || [];
n@893 3207 args = [ context, args.slice ? args.slice() : args ];
n@893 3208 if ( firing ) {
n@893 3209 stack.push( args );
n@893 3210 } else {
n@893 3211 fire( args );
n@893 3212 }
n@893 3213 }
n@893 3214 return this;
n@893 3215 },
n@893 3216 // Call all the callbacks with the given arguments
n@893 3217 fire: function() {
n@893 3218 self.fireWith( this, arguments );
n@893 3219 return this;
n@893 3220 },
n@893 3221 // To know if the callbacks have already been called at least once
n@893 3222 fired: function() {
n@893 3223 return !!fired;
n@893 3224 }
n@893 3225 };
n@893 3226
n@893 3227 return self;
n@893 3228 };
n@893 3229
n@893 3230
n@893 3231 jQuery.extend({
n@893 3232
n@893 3233 Deferred: function( func ) {
n@893 3234 var tuples = [
n@893 3235 // action, add listener, listener list, final state
n@893 3236 [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
n@893 3237 [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
n@893 3238 [ "notify", "progress", jQuery.Callbacks("memory") ]
n@893 3239 ],
n@893 3240 state = "pending",
n@893 3241 promise = {
n@893 3242 state: function() {
n@893 3243 return state;
n@893 3244 },
n@893 3245 always: function() {
n@893 3246 deferred.done( arguments ).fail( arguments );
n@893 3247 return this;
n@893 3248 },
n@893 3249 then: function( /* fnDone, fnFail, fnProgress */ ) {
n@893 3250 var fns = arguments;
n@893 3251 return jQuery.Deferred(function( newDefer ) {
n@893 3252 jQuery.each( tuples, function( i, tuple ) {
n@893 3253 var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
n@893 3254 // deferred[ done | fail | progress ] for forwarding actions to newDefer
n@893 3255 deferred[ tuple[1] ](function() {
n@893 3256 var returned = fn && fn.apply( this, arguments );
n@893 3257 if ( returned && jQuery.isFunction( returned.promise ) ) {
n@893 3258 returned.promise()
n@893 3259 .done( newDefer.resolve )
n@893 3260 .fail( newDefer.reject )
n@893 3261 .progress( newDefer.notify );
n@893 3262 } else {
n@893 3263 newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
n@893 3264 }
n@893 3265 });
n@893 3266 });
n@893 3267 fns = null;
n@893 3268 }).promise();
n@893 3269 },
n@893 3270 // Get a promise for this deferred
n@893 3271 // If obj is provided, the promise aspect is added to the object
n@893 3272 promise: function( obj ) {
n@893 3273 return obj != null ? jQuery.extend( obj, promise ) : promise;
n@893 3274 }
n@893 3275 },
n@893 3276 deferred = {};
n@893 3277
n@893 3278 // Keep pipe for back-compat
n@893 3279 promise.pipe = promise.then;
n@893 3280
n@893 3281 // Add list-specific methods
n@893 3282 jQuery.each( tuples, function( i, tuple ) {
n@893 3283 var list = tuple[ 2 ],
n@893 3284 stateString = tuple[ 3 ];
n@893 3285
n@893 3286 // promise[ done | fail | progress ] = list.add
n@893 3287 promise[ tuple[1] ] = list.add;
n@893 3288
n@893 3289 // Handle state
n@893 3290 if ( stateString ) {
n@893 3291 list.add(function() {
n@893 3292 // state = [ resolved | rejected ]
n@893 3293 state = stateString;
n@893 3294
n@893 3295 // [ reject_list | resolve_list ].disable; progress_list.lock
n@893 3296 }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
n@893 3297 }
n@893 3298
n@893 3299 // deferred[ resolve | reject | notify ]
n@893 3300 deferred[ tuple[0] ] = function() {
n@893 3301 deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
n@893 3302 return this;
n@893 3303 };
n@893 3304 deferred[ tuple[0] + "With" ] = list.fireWith;
n@893 3305 });
n@893 3306
n@893 3307 // Make the deferred a promise
n@893 3308 promise.promise( deferred );
n@893 3309
n@893 3310 // Call given func if any
n@893 3311 if ( func ) {
n@893 3312 func.call( deferred, deferred );
n@893 3313 }
n@893 3314
n@893 3315 // All done!
n@893 3316 return deferred;
n@893 3317 },
n@893 3318
n@893 3319 // Deferred helper
n@893 3320 when: function( subordinate /* , ..., subordinateN */ ) {
n@893 3321 var i = 0,
n@893 3322 resolveValues = slice.call( arguments ),
n@893 3323 length = resolveValues.length,
n@893 3324
n@893 3325 // the count of uncompleted subordinates
n@893 3326 remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
n@893 3327
n@893 3328 // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
n@893 3329 deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
n@893 3330
n@893 3331 // Update function for both resolve and progress values
n@893 3332 updateFunc = function( i, contexts, values ) {
n@893 3333 return function( value ) {
n@893 3334 contexts[ i ] = this;
n@893 3335 values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
n@893 3336 if ( values === progressValues ) {
n@893 3337 deferred.notifyWith( contexts, values );
n@893 3338 } else if ( !( --remaining ) ) {
n@893 3339 deferred.resolveWith( contexts, values );
n@893 3340 }
n@893 3341 };
n@893 3342 },
n@893 3343
n@893 3344 progressValues, progressContexts, resolveContexts;
n@893 3345
n@893 3346 // Add listeners to Deferred subordinates; treat others as resolved
n@893 3347 if ( length > 1 ) {
n@893 3348 progressValues = new Array( length );
n@893 3349 progressContexts = new Array( length );
n@893 3350 resolveContexts = new Array( length );
n@893 3351 for ( ; i < length; i++ ) {
n@893 3352 if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
n@893 3353 resolveValues[ i ].promise()
n@893 3354 .done( updateFunc( i, resolveContexts, resolveValues ) )
n@893 3355 .fail( deferred.reject )
n@893 3356 .progress( updateFunc( i, progressContexts, progressValues ) );
n@893 3357 } else {
n@893 3358 --remaining;
n@893 3359 }
n@893 3360 }
n@893 3361 }
n@893 3362
n@893 3363 // If we're not waiting on anything, resolve the master
n@893 3364 if ( !remaining ) {
n@893 3365 deferred.resolveWith( resolveContexts, resolveValues );
n@893 3366 }
n@893 3367
n@893 3368 return deferred.promise();
n@893 3369 }
n@893 3370 });
n@893 3371
n@893 3372
n@893 3373 // The deferred used on DOM ready
n@893 3374 var readyList;
n@893 3375
n@893 3376 jQuery.fn.ready = function( fn ) {
n@893 3377 // Add the callback
n@893 3378 jQuery.ready.promise().done( fn );
n@893 3379
n@893 3380 return this;
n@893 3381 };
n@893 3382
n@893 3383 jQuery.extend({
n@893 3384 // Is the DOM ready to be used? Set to true once it occurs.
n@893 3385 isReady: false,
n@893 3386
n@893 3387 // A counter to track how many items to wait for before
n@893 3388 // the ready event fires. See #6781
n@893 3389 readyWait: 1,
n@893 3390
n@893 3391 // Hold (or release) the ready event
n@893 3392 holdReady: function( hold ) {
n@893 3393 if ( hold ) {
n@893 3394 jQuery.readyWait++;
n@893 3395 } else {
n@893 3396 jQuery.ready( true );
n@893 3397 }
n@893 3398 },
n@893 3399
n@893 3400 // Handle when the DOM is ready
n@893 3401 ready: function( wait ) {
n@893 3402
n@893 3403 // Abort if there are pending holds or we're already ready
n@893 3404 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
n@893 3405 return;
n@893 3406 }
n@893 3407
n@893 3408 // Remember that the DOM is ready
n@893 3409 jQuery.isReady = true;
n@893 3410
n@893 3411 // If a normal DOM Ready event fired, decrement, and wait if need be
n@893 3412 if ( wait !== true && --jQuery.readyWait > 0 ) {
n@893 3413 return;
n@893 3414 }
n@893 3415
n@893 3416 // If there are functions bound, to execute
n@893 3417 readyList.resolveWith( document, [ jQuery ] );
n@893 3418
n@893 3419 // Trigger any bound ready events
n@893 3420 if ( jQuery.fn.triggerHandler ) {
n@893 3421 jQuery( document ).triggerHandler( "ready" );
n@893 3422 jQuery( document ).off( "ready" );
n@893 3423 }
n@893 3424 }
n@893 3425 });
n@893 3426
n@893 3427 /**
n@893 3428 * The ready event handler and self cleanup method
n@893 3429 */
n@893 3430 function completed() {
n@893 3431 document.removeEventListener( "DOMContentLoaded", completed, false );
n@893 3432 window.removeEventListener( "load", completed, false );
n@893 3433 jQuery.ready();
n@893 3434 }
n@893 3435
n@893 3436 jQuery.ready.promise = function( obj ) {
n@893 3437 if ( !readyList ) {
n@893 3438
n@893 3439 readyList = jQuery.Deferred();
n@893 3440
n@893 3441 // Catch cases where $(document).ready() is called after the browser event has already occurred.
n@893 3442 // We once tried to use readyState "interactive" here, but it caused issues like the one
n@893 3443 // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
n@893 3444 if ( document.readyState === "complete" ) {
n@893 3445 // Handle it asynchronously to allow scripts the opportunity to delay ready
n@893 3446 setTimeout( jQuery.ready );
n@893 3447
n@893 3448 } else {
n@893 3449
n@893 3450 // Use the handy event callback
n@893 3451 document.addEventListener( "DOMContentLoaded", completed, false );
n@893 3452
n@893 3453 // A fallback to window.onload, that will always work
n@893 3454 window.addEventListener( "load", completed, false );
n@893 3455 }
n@893 3456 }
n@893 3457 return readyList.promise( obj );
n@893 3458 };
n@893 3459
n@893 3460 // Kick off the DOM ready check even if the user does not
n@893 3461 jQuery.ready.promise();
n@893 3462
n@893 3463
n@893 3464
n@893 3465
n@893 3466 // Multifunctional method to get and set values of a collection
n@893 3467 // The value/s can optionally be executed if it's a function
n@893 3468 var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
n@893 3469 var i = 0,
n@893 3470 len = elems.length,
n@893 3471 bulk = key == null;
n@893 3472
n@893 3473 // Sets many values
n@893 3474 if ( jQuery.type( key ) === "object" ) {
n@893 3475 chainable = true;
n@893 3476 for ( i in key ) {
n@893 3477 jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
n@893 3478 }
n@893 3479
n@893 3480 // Sets one value
n@893 3481 } else if ( value !== undefined ) {
n@893 3482 chainable = true;
n@893 3483
n@893 3484 if ( !jQuery.isFunction( value ) ) {
n@893 3485 raw = true;
n@893 3486 }
n@893 3487
n@893 3488 if ( bulk ) {
n@893 3489 // Bulk operations run against the entire set
n@893 3490 if ( raw ) {
n@893 3491 fn.call( elems, value );
n@893 3492 fn = null;
n@893 3493
n@893 3494 // ...except when executing function values
n@893 3495 } else {
n@893 3496 bulk = fn;
n@893 3497 fn = function( elem, key, value ) {
n@893 3498 return bulk.call( jQuery( elem ), value );
n@893 3499 };
n@893 3500 }
n@893 3501 }
n@893 3502
n@893 3503 if ( fn ) {
n@893 3504 for ( ; i < len; i++ ) {
n@893 3505 fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
n@893 3506 }
n@893 3507 }
n@893 3508 }
n@893 3509
n@893 3510 return chainable ?
n@893 3511 elems :
n@893 3512
n@893 3513 // Gets
n@893 3514 bulk ?
n@893 3515 fn.call( elems ) :
n@893 3516 len ? fn( elems[0], key ) : emptyGet;
n@893 3517 };
n@893 3518
n@893 3519
n@893 3520 /**
n@893 3521 * Determines whether an object can have data
n@893 3522 */
n@893 3523 jQuery.acceptData = function( owner ) {
n@893 3524 // Accepts only:
n@893 3525 // - Node
n@893 3526 // - Node.ELEMENT_NODE
n@893 3527 // - Node.DOCUMENT_NODE
n@893 3528 // - Object
n@893 3529 // - Any
n@893 3530 /* jshint -W018 */
n@893 3531 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
n@893 3532 };
n@893 3533
n@893 3534
n@893 3535 function Data() {
n@893 3536 // Support: Android<4,
n@893 3537 // Old WebKit does not have Object.preventExtensions/freeze method,
n@893 3538 // return new empty object instead with no [[set]] accessor
n@893 3539 Object.defineProperty( this.cache = {}, 0, {
n@893 3540 get: function() {
n@893 3541 return {};
n@893 3542 }
n@893 3543 });
n@893 3544
n@893 3545 this.expando = jQuery.expando + Data.uid++;
n@893 3546 }
n@893 3547
n@893 3548 Data.uid = 1;
n@893 3549 Data.accepts = jQuery.acceptData;
n@893 3550
n@893 3551 Data.prototype = {
n@893 3552 key: function( owner ) {
n@893 3553 // We can accept data for non-element nodes in modern browsers,
n@893 3554 // but we should not, see #8335.
n@893 3555 // Always return the key for a frozen object.
n@893 3556 if ( !Data.accepts( owner ) ) {
n@893 3557 return 0;
n@893 3558 }
n@893 3559
n@893 3560 var descriptor = {},
n@893 3561 // Check if the owner object already has a cache key
n@893 3562 unlock = owner[ this.expando ];
n@893 3563
n@893 3564 // If not, create one
n@893 3565 if ( !unlock ) {
n@893 3566 unlock = Data.uid++;
n@893 3567
n@893 3568 // Secure it in a non-enumerable, non-writable property
n@893 3569 try {
n@893 3570 descriptor[ this.expando ] = { value: unlock };
n@893 3571 Object.defineProperties( owner, descriptor );
n@893 3572
n@893 3573 // Support: Android<4
n@893 3574 // Fallback to a less secure definition
n@893 3575 } catch ( e ) {
n@893 3576 descriptor[ this.expando ] = unlock;
n@893 3577 jQuery.extend( owner, descriptor );
n@893 3578 }
n@893 3579 }
n@893 3580
n@893 3581 // Ensure the cache object
n@893 3582 if ( !this.cache[ unlock ] ) {
n@893 3583 this.cache[ unlock ] = {};
n@893 3584 }
n@893 3585
n@893 3586 return unlock;
n@893 3587 },
n@893 3588 set: function( owner, data, value ) {
n@893 3589 var prop,
n@893 3590 // There may be an unlock assigned to this node,
n@893 3591 // if there is no entry for this "owner", create one inline
n@893 3592 // and set the unlock as though an owner entry had always existed
n@893 3593 unlock = this.key( owner ),
n@893 3594 cache = this.cache[ unlock ];
n@893 3595
n@893 3596 // Handle: [ owner, key, value ] args
n@893 3597 if ( typeof data === "string" ) {
n@893 3598 cache[ data ] = value;
n@893 3599
n@893 3600 // Handle: [ owner, { properties } ] args
n@893 3601 } else {
n@893 3602 // Fresh assignments by object are shallow copied
n@893 3603 if ( jQuery.isEmptyObject( cache ) ) {
n@893 3604 jQuery.extend( this.cache[ unlock ], data );
n@893 3605 // Otherwise, copy the properties one-by-one to the cache object
n@893 3606 } else {
n@893 3607 for ( prop in data ) {
n@893 3608 cache[ prop ] = data[ prop ];
n@893 3609 }
n@893 3610 }
n@893 3611 }
n@893 3612 return cache;
n@893 3613 },
n@893 3614 get: function( owner, key ) {
n@893 3615 // Either a valid cache is found, or will be created.
n@893 3616 // New caches will be created and the unlock returned,
n@893 3617 // allowing direct access to the newly created
n@893 3618 // empty data object. A valid owner object must be provided.
n@893 3619 var cache = this.cache[ this.key( owner ) ];
n@893 3620
n@893 3621 return key === undefined ?
n@893 3622 cache : cache[ key ];
n@893 3623 },
n@893 3624 access: function( owner, key, value ) {
n@893 3625 var stored;
n@893 3626 // In cases where either:
n@893 3627 //
n@893 3628 // 1. No key was specified
n@893 3629 // 2. A string key was specified, but no value provided
n@893 3630 //
n@893 3631 // Take the "read" path and allow the get method to determine
n@893 3632 // which value to return, respectively either:
n@893 3633 //
n@893 3634 // 1. The entire cache object
n@893 3635 // 2. The data stored at the key
n@893 3636 //
n@893 3637 if ( key === undefined ||
n@893 3638 ((key && typeof key === "string") && value === undefined) ) {
n@893 3639
n@893 3640 stored = this.get( owner, key );
n@893 3641
n@893 3642 return stored !== undefined ?
n@893 3643 stored : this.get( owner, jQuery.camelCase(key) );
n@893 3644 }
n@893 3645
n@893 3646 // [*]When the key is not a string, or both a key and value
n@893 3647 // are specified, set or extend (existing objects) with either:
n@893 3648 //
n@893 3649 // 1. An object of properties
n@893 3650 // 2. A key and value
n@893 3651 //
n@893 3652 this.set( owner, key, value );
n@893 3653
n@893 3654 // Since the "set" path can have two possible entry points
n@893 3655 // return the expected data based on which path was taken[*]
n@893 3656 return value !== undefined ? value : key;
n@893 3657 },
n@893 3658 remove: function( owner, key ) {
n@893 3659 var i, name, camel,
n@893 3660 unlock = this.key( owner ),
n@893 3661 cache = this.cache[ unlock ];
n@893 3662
n@893 3663 if ( key === undefined ) {
n@893 3664 this.cache[ unlock ] = {};
n@893 3665
n@893 3666 } else {
n@893 3667 // Support array or space separated string of keys
n@893 3668 if ( jQuery.isArray( key ) ) {
n@893 3669 // If "name" is an array of keys...
n@893 3670 // When data is initially created, via ("key", "val") signature,
n@893 3671 // keys will be converted to camelCase.
n@893 3672 // Since there is no way to tell _how_ a key was added, remove
n@893 3673 // both plain key and camelCase key. #12786
n@893 3674 // This will only penalize the array argument path.
n@893 3675 name = key.concat( key.map( jQuery.camelCase ) );
n@893 3676 } else {
n@893 3677 camel = jQuery.camelCase( key );
n@893 3678 // Try the string as a key before any manipulation
n@893 3679 if ( key in cache ) {
n@893 3680 name = [ key, camel ];
n@893 3681 } else {
n@893 3682 // If a key with the spaces exists, use it.
n@893 3683 // Otherwise, create an array by matching non-whitespace
n@893 3684 name = camel;
n@893 3685 name = name in cache ?
n@893 3686 [ name ] : ( name.match( rnotwhite ) || [] );
n@893 3687 }
n@893 3688 }
n@893 3689
n@893 3690 i = name.length;
n@893 3691 while ( i-- ) {
n@893 3692 delete cache[ name[ i ] ];
n@893 3693 }
n@893 3694 }
n@893 3695 },
n@893 3696 hasData: function( owner ) {
n@893 3697 return !jQuery.isEmptyObject(
n@893 3698 this.cache[ owner[ this.expando ] ] || {}
n@893 3699 );
n@893 3700 },
n@893 3701 discard: function( owner ) {
n@893 3702 if ( owner[ this.expando ] ) {
n@893 3703 delete this.cache[ owner[ this.expando ] ];
n@893 3704 }
n@893 3705 }
n@893 3706 };
n@893 3707 var data_priv = new Data();
n@893 3708
n@893 3709 var data_user = new Data();
n@893 3710
n@893 3711
n@893 3712
n@893 3713 // Implementation Summary
n@893 3714 //
n@893 3715 // 1. Enforce API surface and semantic compatibility with 1.9.x branch
n@893 3716 // 2. Improve the module's maintainability by reducing the storage
n@893 3717 // paths to a single mechanism.
n@893 3718 // 3. Use the same single mechanism to support "private" and "user" data.
n@893 3719 // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
n@893 3720 // 5. Avoid exposing implementation details on user objects (eg. expando properties)
n@893 3721 // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
n@893 3722
n@893 3723 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
n@893 3724 rmultiDash = /([A-Z])/g;
n@893 3725
n@893 3726 function dataAttr( elem, key, data ) {
n@893 3727 var name;
n@893 3728
n@893 3729 // If nothing was found internally, try to fetch any
n@893 3730 // data from the HTML5 data-* attribute
n@893 3731 if ( data === undefined && elem.nodeType === 1 ) {
n@893 3732 name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
n@893 3733 data = elem.getAttribute( name );
n@893 3734
n@893 3735 if ( typeof data === "string" ) {
n@893 3736 try {
n@893 3737 data = data === "true" ? true :
n@893 3738 data === "false" ? false :
n@893 3739 data === "null" ? null :
n@893 3740 // Only convert to a number if it doesn't change the string
n@893 3741 +data + "" === data ? +data :
n@893 3742 rbrace.test( data ) ? jQuery.parseJSON( data ) :
n@893 3743 data;
n@893 3744 } catch( e ) {}
n@893 3745
n@893 3746 // Make sure we set the data so it isn't changed later
n@893 3747 data_user.set( elem, key, data );
n@893 3748 } else {
n@893 3749 data = undefined;
n@893 3750 }
n@893 3751 }
n@893 3752 return data;
n@893 3753 }
n@893 3754
n@893 3755 jQuery.extend({
n@893 3756 hasData: function( elem ) {
n@893 3757 return data_user.hasData( elem ) || data_priv.hasData( elem );
n@893 3758 },
n@893 3759
n@893 3760 data: function( elem, name, data ) {
n@893 3761 return data_user.access( elem, name, data );
n@893 3762 },
n@893 3763
n@893 3764 removeData: function( elem, name ) {
n@893 3765 data_user.remove( elem, name );
n@893 3766 },
n@893 3767
n@893 3768 // TODO: Now that all calls to _data and _removeData have been replaced
n@893 3769 // with direct calls to data_priv methods, these can be deprecated.
n@893 3770 _data: function( elem, name, data ) {
n@893 3771 return data_priv.access( elem, name, data );
n@893 3772 },
n@893 3773
n@893 3774 _removeData: function( elem, name ) {
n@893 3775 data_priv.remove( elem, name );
n@893 3776 }
n@893 3777 });
n@893 3778
n@893 3779 jQuery.fn.extend({
n@893 3780 data: function( key, value ) {
n@893 3781 var i, name, data,
n@893 3782 elem = this[ 0 ],
n@893 3783 attrs = elem && elem.attributes;
n@893 3784
n@893 3785 // Gets all values
n@893 3786 if ( key === undefined ) {
n@893 3787 if ( this.length ) {
n@893 3788 data = data_user.get( elem );
n@893 3789
n@893 3790 if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) {
n@893 3791 i = attrs.length;
n@893 3792 while ( i-- ) {
n@893 3793
n@893 3794 // Support: IE11+
n@893 3795 // The attrs elements can be null (#14894)
n@893 3796 if ( attrs[ i ] ) {
n@893 3797 name = attrs[ i ].name;
n@893 3798 if ( name.indexOf( "data-" ) === 0 ) {
n@893 3799 name = jQuery.camelCase( name.slice(5) );
n@893 3800 dataAttr( elem, name, data[ name ] );
n@893 3801 }
n@893 3802 }
n@893 3803 }
n@893 3804 data_priv.set( elem, "hasDataAttrs", true );
n@893 3805 }
n@893 3806 }
n@893 3807
n@893 3808 return data;
n@893 3809 }
n@893 3810
n@893 3811 // Sets multiple values
n@893 3812 if ( typeof key === "object" ) {
n@893 3813 return this.each(function() {
n@893 3814 data_user.set( this, key );
n@893 3815 });
n@893 3816 }
n@893 3817
n@893 3818 return access( this, function( value ) {
n@893 3819 var data,
n@893 3820 camelKey = jQuery.camelCase( key );
n@893 3821
n@893 3822 // The calling jQuery object (element matches) is not empty
n@893 3823 // (and therefore has an element appears at this[ 0 ]) and the
n@893 3824 // `value` parameter was not undefined. An empty jQuery object
n@893 3825 // will result in `undefined` for elem = this[ 0 ] which will
n@893 3826 // throw an exception if an attempt to read a data cache is made.
n@893 3827 if ( elem && value === undefined ) {
n@893 3828 // Attempt to get data from the cache
n@893 3829 // with the key as-is
n@893 3830 data = data_user.get( elem, key );
n@893 3831 if ( data !== undefined ) {
n@893 3832 return data;
n@893 3833 }
n@893 3834
n@893 3835 // Attempt to get data from the cache
n@893 3836 // with the key camelized
n@893 3837 data = data_user.get( elem, camelKey );
n@893 3838 if ( data !== undefined ) {
n@893 3839 return data;
n@893 3840 }
n@893 3841
n@893 3842 // Attempt to "discover" the data in
n@893 3843 // HTML5 custom data-* attrs
n@893 3844 data = dataAttr( elem, camelKey, undefined );
n@893 3845 if ( data !== undefined ) {
n@893 3846 return data;
n@893 3847 }
n@893 3848
n@893 3849 // We tried really hard, but the data doesn't exist.
n@893 3850 return;
n@893 3851 }
n@893 3852
n@893 3853 // Set the data...
n@893 3854 this.each(function() {
n@893 3855 // First, attempt to store a copy or reference of any
n@893 3856 // data that might've been store with a camelCased key.
n@893 3857 var data = data_user.get( this, camelKey );
n@893 3858
n@893 3859 // For HTML5 data-* attribute interop, we have to
n@893 3860 // store property names with dashes in a camelCase form.
n@893 3861 // This might not apply to all properties...*
n@893 3862 data_user.set( this, camelKey, value );
n@893 3863
n@893 3864 // *... In the case of properties that might _actually_
n@893 3865 // have dashes, we need to also store a copy of that
n@893 3866 // unchanged property.
n@893 3867 if ( key.indexOf("-") !== -1 && data !== undefined ) {
n@893 3868 data_user.set( this, key, value );
n@893 3869 }
n@893 3870 });
n@893 3871 }, null, value, arguments.length > 1, null, true );
n@893 3872 },
n@893 3873
n@893 3874 removeData: function( key ) {
n@893 3875 return this.each(function() {
n@893 3876 data_user.remove( this, key );
n@893 3877 });
n@893 3878 }
n@893 3879 });
n@893 3880
n@893 3881
n@893 3882 jQuery.extend({
n@893 3883 queue: function( elem, type, data ) {
n@893 3884 var queue;
n@893 3885
n@893 3886 if ( elem ) {
n@893 3887 type = ( type || "fx" ) + "queue";
n@893 3888 queue = data_priv.get( elem, type );
n@893 3889
n@893 3890 // Speed up dequeue by getting out quickly if this is just a lookup
n@893 3891 if ( data ) {
n@893 3892 if ( !queue || jQuery.isArray( data ) ) {
n@893 3893 queue = data_priv.access( elem, type, jQuery.makeArray(data) );
n@893 3894 } else {
n@893 3895 queue.push( data );
n@893 3896 }
n@893 3897 }
n@893 3898 return queue || [];
n@893 3899 }
n@893 3900 },
n@893 3901
n@893 3902 dequeue: function( elem, type ) {
n@893 3903 type = type || "fx";
n@893 3904
n@893 3905 var queue = jQuery.queue( elem, type ),
n@893 3906 startLength = queue.length,
n@893 3907 fn = queue.shift(),
n@893 3908 hooks = jQuery._queueHooks( elem, type ),
n@893 3909 next = function() {
n@893 3910 jQuery.dequeue( elem, type );
n@893 3911 };
n@893 3912
n@893 3913 // If the fx queue is dequeued, always remove the progress sentinel
n@893 3914 if ( fn === "inprogress" ) {
n@893 3915 fn = queue.shift();
n@893 3916 startLength--;
n@893 3917 }
n@893 3918
n@893 3919 if ( fn ) {
n@893 3920
n@893 3921 // Add a progress sentinel to prevent the fx queue from being
n@893 3922 // automatically dequeued
n@893 3923 if ( type === "fx" ) {
n@893 3924 queue.unshift( "inprogress" );
n@893 3925 }
n@893 3926
n@893 3927 // Clear up the last queue stop function
n@893 3928 delete hooks.stop;
n@893 3929 fn.call( elem, next, hooks );
n@893 3930 }
n@893 3931
n@893 3932 if ( !startLength && hooks ) {
n@893 3933 hooks.empty.fire();
n@893 3934 }
n@893 3935 },
n@893 3936
n@893 3937 // Not public - generate a queueHooks object, or return the current one
n@893 3938 _queueHooks: function( elem, type ) {
n@893 3939 var key = type + "queueHooks";
n@893 3940 return data_priv.get( elem, key ) || data_priv.access( elem, key, {
n@893 3941 empty: jQuery.Callbacks("once memory").add(function() {
n@893 3942 data_priv.remove( elem, [ type + "queue", key ] );
n@893 3943 })
n@893 3944 });
n@893 3945 }
n@893 3946 });
n@893 3947
n@893 3948 jQuery.fn.extend({
n@893 3949 queue: function( type, data ) {
n@893 3950 var setter = 2;
n@893 3951
n@893 3952 if ( typeof type !== "string" ) {
n@893 3953 data = type;
n@893 3954 type = "fx";
n@893 3955 setter--;
n@893 3956 }
n@893 3957
n@893 3958 if ( arguments.length < setter ) {
n@893 3959 return jQuery.queue( this[0], type );
n@893 3960 }
n@893 3961
n@893 3962 return data === undefined ?
n@893 3963 this :
n@893 3964 this.each(function() {
n@893 3965 var queue = jQuery.queue( this, type, data );
n@893 3966
n@893 3967 // Ensure a hooks for this queue
n@893 3968 jQuery._queueHooks( this, type );
n@893 3969
n@893 3970 if ( type === "fx" && queue[0] !== "inprogress" ) {
n@893 3971 jQuery.dequeue( this, type );
n@893 3972 }
n@893 3973 });
n@893 3974 },
n@893 3975 dequeue: function( type ) {
n@893 3976 return this.each(function() {
n@893 3977 jQuery.dequeue( this, type );
n@893 3978 });
n@893 3979 },
n@893 3980 clearQueue: function( type ) {
n@893 3981 return this.queue( type || "fx", [] );
n@893 3982 },
n@893 3983 // Get a promise resolved when queues of a certain type
n@893 3984 // are emptied (fx is the type by default)
n@893 3985 promise: function( type, obj ) {
n@893 3986 var tmp,
n@893 3987 count = 1,
n@893 3988 defer = jQuery.Deferred(),
n@893 3989 elements = this,
n@893 3990 i = this.length,
n@893 3991 resolve = function() {
n@893 3992 if ( !( --count ) ) {
n@893 3993 defer.resolveWith( elements, [ elements ] );
n@893 3994 }
n@893 3995 };
n@893 3996
n@893 3997 if ( typeof type !== "string" ) {
n@893 3998 obj = type;
n@893 3999 type = undefined;
n@893 4000 }
n@893 4001 type = type || "fx";
n@893 4002
n@893 4003 while ( i-- ) {
n@893 4004 tmp = data_priv.get( elements[ i ], type + "queueHooks" );
n@893 4005 if ( tmp && tmp.empty ) {
n@893 4006 count++;
n@893 4007 tmp.empty.add( resolve );
n@893 4008 }
n@893 4009 }
n@893 4010 resolve();
n@893 4011 return defer.promise( obj );
n@893 4012 }
n@893 4013 });
n@893 4014 var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;
n@893 4015
n@893 4016 var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
n@893 4017
n@893 4018 var isHidden = function( elem, el ) {
n@893 4019 // isHidden might be called from jQuery#filter function;
n@893 4020 // in that case, element will be second argument
n@893 4021 elem = el || elem;
n@893 4022 return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
n@893 4023 };
n@893 4024
n@893 4025 var rcheckableType = (/^(?:checkbox|radio)$/i);
n@893 4026
n@893 4027
n@893 4028
n@893 4029 (function() {
n@893 4030 var fragment = document.createDocumentFragment(),
n@893 4031 div = fragment.appendChild( document.createElement( "div" ) ),
n@893 4032 input = document.createElement( "input" );
n@893 4033
n@893 4034 // Support: Safari<=5.1
n@893 4035 // Check state lost if the name is set (#11217)
n@893 4036 // Support: Windows Web Apps (WWA)
n@893 4037 // `name` and `type` must use .setAttribute for WWA (#14901)
n@893 4038 input.setAttribute( "type", "radio" );
n@893 4039 input.setAttribute( "checked", "checked" );
n@893 4040 input.setAttribute( "name", "t" );
n@893 4041
n@893 4042 div.appendChild( input );
n@893 4043
n@893 4044 // Support: Safari<=5.1, Android<4.2
n@893 4045 // Older WebKit doesn't clone checked state correctly in fragments
n@893 4046 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
n@893 4047
n@893 4048 // Support: IE<=11+
n@893 4049 // Make sure textarea (and checkbox) defaultValue is properly cloned
n@893 4050 div.innerHTML = "<textarea>x</textarea>";
n@893 4051 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
n@893 4052 })();
n@893 4053 var strundefined = typeof undefined;
n@893 4054
n@893 4055
n@893 4056
n@893 4057 support.focusinBubbles = "onfocusin" in window;
n@893 4058
n@893 4059
n@893 4060 var
n@893 4061 rkeyEvent = /^key/,
n@893 4062 rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/,
n@893 4063 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
n@893 4064 rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
n@893 4065
n@893 4066 function returnTrue() {
n@893 4067 return true;
n@893 4068 }
n@893 4069
n@893 4070 function returnFalse() {
n@893 4071 return false;
n@893 4072 }
n@893 4073
n@893 4074 function safeActiveElement() {
n@893 4075 try {
n@893 4076 return document.activeElement;
n@893 4077 } catch ( err ) { }
n@893 4078 }
n@893 4079
n@893 4080 /*
n@893 4081 * Helper functions for managing events -- not part of the public interface.
n@893 4082 * Props to Dean Edwards' addEvent library for many of the ideas.
n@893 4083 */
n@893 4084 jQuery.event = {
n@893 4085
n@893 4086 global: {},
n@893 4087
n@893 4088 add: function( elem, types, handler, data, selector ) {
n@893 4089
n@893 4090 var handleObjIn, eventHandle, tmp,
n@893 4091 events, t, handleObj,
n@893 4092 special, handlers, type, namespaces, origType,
n@893 4093 elemData = data_priv.get( elem );
n@893 4094
n@893 4095 // Don't attach events to noData or text/comment nodes (but allow plain objects)
n@893 4096 if ( !elemData ) {
n@893 4097 return;
n@893 4098 }
n@893 4099
n@893 4100 // Caller can pass in an object of custom data in lieu of the handler
n@893 4101 if ( handler.handler ) {
n@893 4102 handleObjIn = handler;
n@893 4103 handler = handleObjIn.handler;
n@893 4104 selector = handleObjIn.selector;
n@893 4105 }
n@893 4106
n@893 4107 // Make sure that the handler has a unique ID, used to find/remove it later
n@893 4108 if ( !handler.guid ) {
n@893 4109 handler.guid = jQuery.guid++;
n@893 4110 }
n@893 4111
n@893 4112 // Init the element's event structure and main handler, if this is the first
n@893 4113 if ( !(events = elemData.events) ) {
n@893 4114 events = elemData.events = {};
n@893 4115 }
n@893 4116 if ( !(eventHandle = elemData.handle) ) {
n@893 4117 eventHandle = elemData.handle = function( e ) {
n@893 4118 // Discard the second event of a jQuery.event.trigger() and
n@893 4119 // when an event is called after a page has unloaded
n@893 4120 return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ?
n@893 4121 jQuery.event.dispatch.apply( elem, arguments ) : undefined;
n@893 4122 };
n@893 4123 }
n@893 4124
n@893 4125 // Handle multiple events separated by a space
n@893 4126 types = ( types || "" ).match( rnotwhite ) || [ "" ];
n@893 4127 t = types.length;
n@893 4128 while ( t-- ) {
n@893 4129 tmp = rtypenamespace.exec( types[t] ) || [];
n@893 4130 type = origType = tmp[1];
n@893 4131 namespaces = ( tmp[2] || "" ).split( "." ).sort();
n@893 4132
n@893 4133 // There *must* be a type, no attaching namespace-only handlers
n@893 4134 if ( !type ) {
n@893 4135 continue;
n@893 4136 }
n@893 4137
n@893 4138 // If event changes its type, use the special event handlers for the changed type
n@893 4139 special = jQuery.event.special[ type ] || {};
n@893 4140
n@893 4141 // If selector defined, determine special event api type, otherwise given type
n@893 4142 type = ( selector ? special.delegateType : special.bindType ) || type;
n@893 4143
n@893 4144 // Update special based on newly reset type
n@893 4145 special = jQuery.event.special[ type ] || {};
n@893 4146
n@893 4147 // handleObj is passed to all event handlers
n@893 4148 handleObj = jQuery.extend({
n@893 4149 type: type,
n@893 4150 origType: origType,
n@893 4151 data: data,
n@893 4152 handler: handler,
n@893 4153 guid: handler.guid,
n@893 4154 selector: selector,
n@893 4155 needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
n@893 4156 namespace: namespaces.join(".")
n@893 4157 }, handleObjIn );
n@893 4158
n@893 4159 // Init the event handler queue if we're the first
n@893 4160 if ( !(handlers = events[ type ]) ) {
n@893 4161 handlers = events[ type ] = [];
n@893 4162 handlers.delegateCount = 0;
n@893 4163
n@893 4164 // Only use addEventListener if the special events handler returns false
n@893 4165 if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
n@893 4166 if ( elem.addEventListener ) {
n@893 4167 elem.addEventListener( type, eventHandle, false );
n@893 4168 }
n@893 4169 }
n@893 4170 }
n@893 4171
n@893 4172 if ( special.add ) {
n@893 4173 special.add.call( elem, handleObj );
n@893 4174
n@893 4175 if ( !handleObj.handler.guid ) {
n@893 4176 handleObj.handler.guid = handler.guid;
n@893 4177 }
n@893 4178 }
n@893 4179
n@893 4180 // Add to the element's handler list, delegates in front
n@893 4181 if ( selector ) {
n@893 4182 handlers.splice( handlers.delegateCount++, 0, handleObj );
n@893 4183 } else {
n@893 4184 handlers.push( handleObj );
n@893 4185 }
n@893 4186
n@893 4187 // Keep track of which events have ever been used, for event optimization
n@893 4188 jQuery.event.global[ type ] = true;
n@893 4189 }
n@893 4190
n@893 4191 },
n@893 4192
n@893 4193 // Detach an event or set of events from an element
n@893 4194 remove: function( elem, types, handler, selector, mappedTypes ) {
n@893 4195
n@893 4196 var j, origCount, tmp,
n@893 4197 events, t, handleObj,
n@893 4198 special, handlers, type, namespaces, origType,
n@893 4199 elemData = data_priv.hasData( elem ) && data_priv.get( elem );
n@893 4200
n@893 4201 if ( !elemData || !(events = elemData.events) ) {
n@893 4202 return;
n@893 4203 }
n@893 4204
n@893 4205 // Once for each type.namespace in types; type may be omitted
n@893 4206 types = ( types || "" ).match( rnotwhite ) || [ "" ];
n@893 4207 t = types.length;
n@893 4208 while ( t-- ) {
n@893 4209 tmp = rtypenamespace.exec( types[t] ) || [];
n@893 4210 type = origType = tmp[1];
n@893 4211 namespaces = ( tmp[2] || "" ).split( "." ).sort();
n@893 4212
n@893 4213 // Unbind all events (on this namespace, if provided) for the element
n@893 4214 if ( !type ) {
n@893 4215 for ( type in events ) {
n@893 4216 jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
n@893 4217 }
n@893 4218 continue;
n@893 4219 }
n@893 4220
n@893 4221 special = jQuery.event.special[ type ] || {};
n@893 4222 type = ( selector ? special.delegateType : special.bindType ) || type;
n@893 4223 handlers = events[ type ] || [];
n@893 4224 tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
n@893 4225
n@893 4226 // Remove matching events
n@893 4227 origCount = j = handlers.length;
n@893 4228 while ( j-- ) {
n@893 4229 handleObj = handlers[ j ];
n@893 4230
n@893 4231 if ( ( mappedTypes || origType === handleObj.origType ) &&
n@893 4232 ( !handler || handler.guid === handleObj.guid ) &&
n@893 4233 ( !tmp || tmp.test( handleObj.namespace ) ) &&
n@893 4234 ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
n@893 4235 handlers.splice( j, 1 );
n@893 4236
n@893 4237 if ( handleObj.selector ) {
n@893 4238 handlers.delegateCount--;
n@893 4239 }
n@893 4240 if ( special.remove ) {
n@893 4241 special.remove.call( elem, handleObj );
n@893 4242 }
n@893 4243 }
n@893 4244 }
n@893 4245
n@893 4246 // Remove generic event handler if we removed something and no more handlers exist
n@893 4247 // (avoids potential for endless recursion during removal of special event handlers)
n@893 4248 if ( origCount && !handlers.length ) {
n@893 4249 if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
n@893 4250 jQuery.removeEvent( elem, type, elemData.handle );
n@893 4251 }
n@893 4252
n@893 4253 delete events[ type ];
n@893 4254 }
n@893 4255 }
n@893 4256
n@893 4257 // Remove the expando if it's no longer used
n@893 4258 if ( jQuery.isEmptyObject( events ) ) {
n@893 4259 delete elemData.handle;
n@893 4260 data_priv.remove( elem, "events" );
n@893 4261 }
n@893 4262 },
n@893 4263
n@893 4264 trigger: function( event, data, elem, onlyHandlers ) {
n@893 4265
n@893 4266 var i, cur, tmp, bubbleType, ontype, handle, special,
n@893 4267 eventPath = [ elem || document ],
n@893 4268 type = hasOwn.call( event, "type" ) ? event.type : event,
n@893 4269 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
n@893 4270
n@893 4271 cur = tmp = elem = elem || document;
n@893 4272
n@893 4273 // Don't do events on text and comment nodes
n@893 4274 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
n@893 4275 return;
n@893 4276 }
n@893 4277
n@893 4278 // focus/blur morphs to focusin/out; ensure we're not firing them right now
n@893 4279 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
n@893 4280 return;
n@893 4281 }
n@893 4282
n@893 4283 if ( type.indexOf(".") >= 0 ) {
n@893 4284 // Namespaced trigger; create a regexp to match event type in handle()
n@893 4285 namespaces = type.split(".");
n@893 4286 type = namespaces.shift();
n@893 4287 namespaces.sort();
n@893 4288 }
n@893 4289 ontype = type.indexOf(":") < 0 && "on" + type;
n@893 4290
n@893 4291 // Caller can pass in a jQuery.Event object, Object, or just an event type string
n@893 4292 event = event[ jQuery.expando ] ?
n@893 4293 event :
n@893 4294 new jQuery.Event( type, typeof event === "object" && event );
n@893 4295
n@893 4296 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
n@893 4297 event.isTrigger = onlyHandlers ? 2 : 3;
n@893 4298 event.namespace = namespaces.join(".");
n@893 4299 event.namespace_re = event.namespace ?
n@893 4300 new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
n@893 4301 null;
n@893 4302
n@893 4303 // Clean up the event in case it is being reused
n@893 4304 event.result = undefined;
n@893 4305 if ( !event.target ) {
n@893 4306 event.target = elem;
n@893 4307 }
n@893 4308
n@893 4309 // Clone any incoming data and prepend the event, creating the handler arg list
n@893 4310 data = data == null ?
n@893 4311 [ event ] :
n@893 4312 jQuery.makeArray( data, [ event ] );
n@893 4313
n@893 4314 // Allow special events to draw outside the lines
n@893 4315 special = jQuery.event.special[ type ] || {};
n@893 4316 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
n@893 4317 return;
n@893 4318 }
n@893 4319
n@893 4320 // Determine event propagation path in advance, per W3C events spec (#9951)
n@893 4321 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
n@893 4322 if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
n@893 4323
n@893 4324 bubbleType = special.delegateType || type;
n@893 4325 if ( !rfocusMorph.test( bubbleType + type ) ) {
n@893 4326 cur = cur.parentNode;
n@893 4327 }
n@893 4328 for ( ; cur; cur = cur.parentNode ) {
n@893 4329 eventPath.push( cur );
n@893 4330 tmp = cur;
n@893 4331 }
n@893 4332
n@893 4333 // Only add window if we got to document (e.g., not plain obj or detached DOM)
n@893 4334 if ( tmp === (elem.ownerDocument || document) ) {
n@893 4335 eventPath.push( tmp.defaultView || tmp.parentWindow || window );
n@893 4336 }
n@893 4337 }
n@893 4338
n@893 4339 // Fire handlers on the event path
n@893 4340 i = 0;
n@893 4341 while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
n@893 4342
n@893 4343 event.type = i > 1 ?
n@893 4344 bubbleType :
n@893 4345 special.bindType || type;
n@893 4346
n@893 4347 // jQuery handler
n@893 4348 handle = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( cur, "handle" );
n@893 4349 if ( handle ) {
n@893 4350 handle.apply( cur, data );
n@893 4351 }
n@893 4352
n@893 4353 // Native handler
n@893 4354 handle = ontype && cur[ ontype ];
n@893 4355 if ( handle && handle.apply && jQuery.acceptData( cur ) ) {
n@893 4356 event.result = handle.apply( cur, data );
n@893 4357 if ( event.result === false ) {
n@893 4358 event.preventDefault();
n@893 4359 }
n@893 4360 }
n@893 4361 }
n@893 4362 event.type = type;
n@893 4363
n@893 4364 // If nobody prevented the default action, do it now
n@893 4365 if ( !onlyHandlers && !event.isDefaultPrevented() ) {
n@893 4366
n@893 4367 if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&
n@893 4368 jQuery.acceptData( elem ) ) {
n@893 4369
n@893 4370 // Call a native DOM method on the target with the same name name as the event.
n@893 4371 // Don't do default actions on window, that's where global variables be (#6170)
n@893 4372 if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
n@893 4373
n@893 4374 // Don't re-trigger an onFOO event when we call its FOO() method
n@893 4375 tmp = elem[ ontype ];
n@893 4376
n@893 4377 if ( tmp ) {
n@893 4378 elem[ ontype ] = null;
n@893 4379 }
n@893 4380
n@893 4381 // Prevent re-triggering of the same event, since we already bubbled it above
n@893 4382 jQuery.event.triggered = type;
n@893 4383 elem[ type ]();
n@893 4384 jQuery.event.triggered = undefined;
n@893 4385
n@893 4386 if ( tmp ) {
n@893 4387 elem[ ontype ] = tmp;
n@893 4388 }
n@893 4389 }
n@893 4390 }
n@893 4391 }
n@893 4392
n@893 4393 return event.result;
n@893 4394 },
n@893 4395
n@893 4396 dispatch: function( event ) {
n@893 4397
n@893 4398 // Make a writable jQuery.Event from the native event object
n@893 4399 event = jQuery.event.fix( event );
n@893 4400
n@893 4401 var i, j, ret, matched, handleObj,
n@893 4402 handlerQueue = [],
n@893 4403 args = slice.call( arguments ),
n@893 4404 handlers = ( data_priv.get( this, "events" ) || {} )[ event.type ] || [],
n@893 4405 special = jQuery.event.special[ event.type ] || {};
n@893 4406
n@893 4407 // Use the fix-ed jQuery.Event rather than the (read-only) native event
n@893 4408 args[0] = event;
n@893 4409 event.delegateTarget = this;
n@893 4410
n@893 4411 // Call the preDispatch hook for the mapped type, and let it bail if desired
n@893 4412 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
n@893 4413 return;
n@893 4414 }
n@893 4415
n@893 4416 // Determine handlers
n@893 4417 handlerQueue = jQuery.event.handlers.call( this, event, handlers );
n@893 4418
n@893 4419 // Run delegates first; they may want to stop propagation beneath us
n@893 4420 i = 0;
n@893 4421 while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
n@893 4422 event.currentTarget = matched.elem;
n@893 4423
n@893 4424 j = 0;
n@893 4425 while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
n@893 4426
n@893 4427 // Triggered event must either 1) have no namespace, or 2) have namespace(s)
n@893 4428 // a subset or equal to those in the bound event (both can have no namespace).
n@893 4429 if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
n@893 4430
n@893 4431 event.handleObj = handleObj;
n@893 4432 event.data = handleObj.data;
n@893 4433
n@893 4434 ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
n@893 4435 .apply( matched.elem, args );
n@893 4436
n@893 4437 if ( ret !== undefined ) {
n@893 4438 if ( (event.result = ret) === false ) {
n@893 4439 event.preventDefault();
n@893 4440 event.stopPropagation();
n@893 4441 }
n@893 4442 }
n@893 4443 }
n@893 4444 }
n@893 4445 }
n@893 4446
n@893 4447 // Call the postDispatch hook for the mapped type
n@893 4448 if ( special.postDispatch ) {
n@893 4449 special.postDispatch.call( this, event );
n@893 4450 }
n@893 4451
n@893 4452 return event.result;
n@893 4453 },
n@893 4454
n@893 4455 handlers: function( event, handlers ) {
n@893 4456 var i, matches, sel, handleObj,
n@893 4457 handlerQueue = [],
n@893 4458 delegateCount = handlers.delegateCount,
n@893 4459 cur = event.target;
n@893 4460
n@893 4461 // Find delegate handlers
n@893 4462 // Black-hole SVG <use> instance trees (#13180)
n@893 4463 // Avoid non-left-click bubbling in Firefox (#3861)
n@893 4464 if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
n@893 4465
n@893 4466 for ( ; cur !== this; cur = cur.parentNode || this ) {
n@893 4467
n@893 4468 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
n@893 4469 if ( cur.disabled !== true || event.type !== "click" ) {
n@893 4470 matches = [];
n@893 4471 for ( i = 0; i < delegateCount; i++ ) {
n@893 4472 handleObj = handlers[ i ];
n@893 4473
n@893 4474 // Don't conflict with Object.prototype properties (#13203)
n@893 4475 sel = handleObj.selector + " ";
n@893 4476
n@893 4477 if ( matches[ sel ] === undefined ) {
n@893 4478 matches[ sel ] = handleObj.needsContext ?
n@893 4479 jQuery( sel, this ).index( cur ) >= 0 :
n@893 4480 jQuery.find( sel, this, null, [ cur ] ).length;
n@893 4481 }
n@893 4482 if ( matches[ sel ] ) {
n@893 4483 matches.push( handleObj );
n@893 4484 }
n@893 4485 }
n@893 4486 if ( matches.length ) {
n@893 4487 handlerQueue.push({ elem: cur, handlers: matches });
n@893 4488 }
n@893 4489 }
n@893 4490 }
n@893 4491 }
n@893 4492
n@893 4493 // Add the remaining (directly-bound) handlers
n@893 4494 if ( delegateCount < handlers.length ) {
n@893 4495 handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
n@893 4496 }
n@893 4497
n@893 4498 return handlerQueue;
n@893 4499 },
n@893 4500
n@893 4501 // Includes some event props shared by KeyEvent and MouseEvent
n@893 4502 props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
n@893 4503
n@893 4504 fixHooks: {},
n@893 4505
n@893 4506 keyHooks: {
n@893 4507 props: "char charCode key keyCode".split(" "),
n@893 4508 filter: function( event, original ) {
n@893 4509
n@893 4510 // Add which for key events
n@893 4511 if ( event.which == null ) {
n@893 4512 event.which = original.charCode != null ? original.charCode : original.keyCode;
n@893 4513 }
n@893 4514
n@893 4515 return event;
n@893 4516 }
n@893 4517 },
n@893 4518
n@893 4519 mouseHooks: {
n@893 4520 props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
n@893 4521 filter: function( event, original ) {
n@893 4522 var eventDoc, doc, body,
n@893 4523 button = original.button;
n@893 4524
n@893 4525 // Calculate pageX/Y if missing and clientX/Y available
n@893 4526 if ( event.pageX == null && original.clientX != null ) {
n@893 4527 eventDoc = event.target.ownerDocument || document;
n@893 4528 doc = eventDoc.documentElement;
n@893 4529 body = eventDoc.body;
n@893 4530
n@893 4531 event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
n@893 4532 event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
n@893 4533 }
n@893 4534
n@893 4535 // Add which for click: 1 === left; 2 === middle; 3 === right
n@893 4536 // Note: button is not normalized, so don't use it
n@893 4537 if ( !event.which && button !== undefined ) {
n@893 4538 event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
n@893 4539 }
n@893 4540
n@893 4541 return event;
n@893 4542 }
n@893 4543 },
n@893 4544
n@893 4545 fix: function( event ) {
n@893 4546 if ( event[ jQuery.expando ] ) {
n@893 4547 return event;
n@893 4548 }
n@893 4549
n@893 4550 // Create a writable copy of the event object and normalize some properties
n@893 4551 var i, prop, copy,
n@893 4552 type = event.type,
n@893 4553 originalEvent = event,
n@893 4554 fixHook = this.fixHooks[ type ];
n@893 4555
n@893 4556 if ( !fixHook ) {
n@893 4557 this.fixHooks[ type ] = fixHook =
n@893 4558 rmouseEvent.test( type ) ? this.mouseHooks :
n@893 4559 rkeyEvent.test( type ) ? this.keyHooks :
n@893 4560 {};
n@893 4561 }
n@893 4562 copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
n@893 4563
n@893 4564 event = new jQuery.Event( originalEvent );
n@893 4565
n@893 4566 i = copy.length;
n@893 4567 while ( i-- ) {
n@893 4568 prop = copy[ i ];
n@893 4569 event[ prop ] = originalEvent[ prop ];
n@893 4570 }
n@893 4571
n@893 4572 // Support: Cordova 2.5 (WebKit) (#13255)
n@893 4573 // All events should have a target; Cordova deviceready doesn't
n@893 4574 if ( !event.target ) {
n@893 4575 event.target = document;
n@893 4576 }
n@893 4577
n@893 4578 // Support: Safari 6.0+, Chrome<28
n@893 4579 // Target should not be a text node (#504, #13143)
n@893 4580 if ( event.target.nodeType === 3 ) {
n@893 4581 event.target = event.target.parentNode;
n@893 4582 }
n@893 4583
n@893 4584 return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
n@893 4585 },
n@893 4586
n@893 4587 special: {
n@893 4588 load: {
n@893 4589 // Prevent triggered image.load events from bubbling to window.load
n@893 4590 noBubble: true
n@893 4591 },
n@893 4592 focus: {
n@893 4593 // Fire native event if possible so blur/focus sequence is correct
n@893 4594 trigger: function() {
n@893 4595 if ( this !== safeActiveElement() && this.focus ) {
n@893 4596 this.focus();
n@893 4597 return false;
n@893 4598 }
n@893 4599 },
n@893 4600 delegateType: "focusin"
n@893 4601 },
n@893 4602 blur: {
n@893 4603 trigger: function() {
n@893 4604 if ( this === safeActiveElement() && this.blur ) {
n@893 4605 this.blur();
n@893 4606 return false;
n@893 4607 }
n@893 4608 },
n@893 4609 delegateType: "focusout"
n@893 4610 },
n@893 4611 click: {
n@893 4612 // For checkbox, fire native event so checked state will be right
n@893 4613 trigger: function() {
n@893 4614 if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
n@893 4615 this.click();
n@893 4616 return false;
n@893 4617 }
n@893 4618 },
n@893 4619
n@893 4620 // For cross-browser consistency, don't fire native .click() on links
n@893 4621 _default: function( event ) {
n@893 4622 return jQuery.nodeName( event.target, "a" );
n@893 4623 }
n@893 4624 },
n@893 4625
n@893 4626 beforeunload: {
n@893 4627 postDispatch: function( event ) {
n@893 4628
n@893 4629 // Support: Firefox 20+
n@893 4630 // Firefox doesn't alert if the returnValue field is not set.
n@893 4631 if ( event.result !== undefined && event.originalEvent ) {
n@893 4632 event.originalEvent.returnValue = event.result;
n@893 4633 }
n@893 4634 }
n@893 4635 }
n@893 4636 },
n@893 4637
n@893 4638 simulate: function( type, elem, event, bubble ) {
n@893 4639 // Piggyback on a donor event to simulate a different one.
n@893 4640 // Fake originalEvent to avoid donor's stopPropagation, but if the
n@893 4641 // simulated event prevents default then we do the same on the donor.
n@893 4642 var e = jQuery.extend(
n@893 4643 new jQuery.Event(),
n@893 4644 event,
n@893 4645 {
n@893 4646 type: type,
n@893 4647 isSimulated: true,
n@893 4648 originalEvent: {}
n@893 4649 }
n@893 4650 );
n@893 4651 if ( bubble ) {
n@893 4652 jQuery.event.trigger( e, null, elem );
n@893 4653 } else {
n@893 4654 jQuery.event.dispatch.call( elem, e );
n@893 4655 }
n@893 4656 if ( e.isDefaultPrevented() ) {
n@893 4657 event.preventDefault();
n@893 4658 }
n@893 4659 }
n@893 4660 };
n@893 4661
n@893 4662 jQuery.removeEvent = function( elem, type, handle ) {
n@893 4663 if ( elem.removeEventListener ) {
n@893 4664 elem.removeEventListener( type, handle, false );
n@893 4665 }
n@893 4666 };
n@893 4667
n@893 4668 jQuery.Event = function( src, props ) {
n@893 4669 // Allow instantiation without the 'new' keyword
n@893 4670 if ( !(this instanceof jQuery.Event) ) {
n@893 4671 return new jQuery.Event( src, props );
n@893 4672 }
n@893 4673
n@893 4674 // Event object
n@893 4675 if ( src && src.type ) {
n@893 4676 this.originalEvent = src;
n@893 4677 this.type = src.type;
n@893 4678
n@893 4679 // Events bubbling up the document may have been marked as prevented
n@893 4680 // by a handler lower down the tree; reflect the correct value.
n@893 4681 this.isDefaultPrevented = src.defaultPrevented ||
n@893 4682 src.defaultPrevented === undefined &&
n@893 4683 // Support: Android<4.0
n@893 4684 src.returnValue === false ?
n@893 4685 returnTrue :
n@893 4686 returnFalse;
n@893 4687
n@893 4688 // Event type
n@893 4689 } else {
n@893 4690 this.type = src;
n@893 4691 }
n@893 4692
n@893 4693 // Put explicitly provided properties onto the event object
n@893 4694 if ( props ) {
n@893 4695 jQuery.extend( this, props );
n@893 4696 }
n@893 4697
n@893 4698 // Create a timestamp if incoming event doesn't have one
n@893 4699 this.timeStamp = src && src.timeStamp || jQuery.now();
n@893 4700
n@893 4701 // Mark it as fixed
n@893 4702 this[ jQuery.expando ] = true;
n@893 4703 };
n@893 4704
n@893 4705 // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
n@893 4706 // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
n@893 4707 jQuery.Event.prototype = {
n@893 4708 isDefaultPrevented: returnFalse,
n@893 4709 isPropagationStopped: returnFalse,
n@893 4710 isImmediatePropagationStopped: returnFalse,
n@893 4711
n@893 4712 preventDefault: function() {
n@893 4713 var e = this.originalEvent;
n@893 4714
n@893 4715 this.isDefaultPrevented = returnTrue;
n@893 4716
n@893 4717 if ( e && e.preventDefault ) {
n@893 4718 e.preventDefault();
n@893 4719 }
n@893 4720 },
n@893 4721 stopPropagation: function() {
n@893 4722 var e = this.originalEvent;
n@893 4723
n@893 4724 this.isPropagationStopped = returnTrue;
n@893 4725
n@893 4726 if ( e && e.stopPropagation ) {
n@893 4727 e.stopPropagation();
n@893 4728 }
n@893 4729 },
n@893 4730 stopImmediatePropagation: function() {
n@893 4731 var e = this.originalEvent;
n@893 4732
n@893 4733 this.isImmediatePropagationStopped = returnTrue;
n@893 4734
n@893 4735 if ( e && e.stopImmediatePropagation ) {
n@893 4736 e.stopImmediatePropagation();
n@893 4737 }
n@893 4738
n@893 4739 this.stopPropagation();
n@893 4740 }
n@893 4741 };
n@893 4742
n@893 4743 // Create mouseenter/leave events using mouseover/out and event-time checks
n@893 4744 // Support: Chrome 15+
n@893 4745 jQuery.each({
n@893 4746 mouseenter: "mouseover",
n@893 4747 mouseleave: "mouseout",
n@893 4748 pointerenter: "pointerover",
n@893 4749 pointerleave: "pointerout"
n@893 4750 }, function( orig, fix ) {
n@893 4751 jQuery.event.special[ orig ] = {
n@893 4752 delegateType: fix,
n@893 4753 bindType: fix,
n@893 4754
n@893 4755 handle: function( event ) {
n@893 4756 var ret,
n@893 4757 target = this,
n@893 4758 related = event.relatedTarget,
n@893 4759 handleObj = event.handleObj;
n@893 4760
n@893 4761 // For mousenter/leave call the handler if related is outside the target.
n@893 4762 // NB: No relatedTarget if the mouse left/entered the browser window
n@893 4763 if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
n@893 4764 event.type = handleObj.origType;
n@893 4765 ret = handleObj.handler.apply( this, arguments );
n@893 4766 event.type = fix;
n@893 4767 }
n@893 4768 return ret;
n@893 4769 }
n@893 4770 };
n@893 4771 });
n@893 4772
n@893 4773 // Support: Firefox, Chrome, Safari
n@893 4774 // Create "bubbling" focus and blur events
n@893 4775 if ( !support.focusinBubbles ) {
n@893 4776 jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
n@893 4777
n@893 4778 // Attach a single capturing handler on the document while someone wants focusin/focusout
n@893 4779 var handler = function( event ) {
n@893 4780 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
n@893 4781 };
n@893 4782
n@893 4783 jQuery.event.special[ fix ] = {
n@893 4784 setup: function() {
n@893 4785 var doc = this.ownerDocument || this,
n@893 4786 attaches = data_priv.access( doc, fix );
n@893 4787
n@893 4788 if ( !attaches ) {
n@893 4789 doc.addEventListener( orig, handler, true );
n@893 4790 }
n@893 4791 data_priv.access( doc, fix, ( attaches || 0 ) + 1 );
n@893 4792 },
n@893 4793 teardown: function() {
n@893 4794 var doc = this.ownerDocument || this,
n@893 4795 attaches = data_priv.access( doc, fix ) - 1;
n@893 4796
n@893 4797 if ( !attaches ) {
n@893 4798 doc.removeEventListener( orig, handler, true );
n@893 4799 data_priv.remove( doc, fix );
n@893 4800
n@893 4801 } else {
n@893 4802 data_priv.access( doc, fix, attaches );
n@893 4803 }
n@893 4804 }
n@893 4805 };
n@893 4806 });
n@893 4807 }
n@893 4808
n@893 4809 jQuery.fn.extend({
n@893 4810
n@893 4811 on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
n@893 4812 var origFn, type;
n@893 4813
n@893 4814 // Types can be a map of types/handlers
n@893 4815 if ( typeof types === "object" ) {
n@893 4816 // ( types-Object, selector, data )
n@893 4817 if ( typeof selector !== "string" ) {
n@893 4818 // ( types-Object, data )
n@893 4819 data = data || selector;
n@893 4820 selector = undefined;
n@893 4821 }
n@893 4822 for ( type in types ) {
n@893 4823 this.on( type, selector, data, types[ type ], one );
n@893 4824 }
n@893 4825 return this;
n@893 4826 }
n@893 4827
n@893 4828 if ( data == null && fn == null ) {
n@893 4829 // ( types, fn )
n@893 4830 fn = selector;
n@893 4831 data = selector = undefined;
n@893 4832 } else if ( fn == null ) {
n@893 4833 if ( typeof selector === "string" ) {
n@893 4834 // ( types, selector, fn )
n@893 4835 fn = data;
n@893 4836 data = undefined;
n@893 4837 } else {
n@893 4838 // ( types, data, fn )
n@893 4839 fn = data;
n@893 4840 data = selector;
n@893 4841 selector = undefined;
n@893 4842 }
n@893 4843 }
n@893 4844 if ( fn === false ) {
n@893 4845 fn = returnFalse;
n@893 4846 } else if ( !fn ) {
n@893 4847 return this;
n@893 4848 }
n@893 4849
n@893 4850 if ( one === 1 ) {
n@893 4851 origFn = fn;
n@893 4852 fn = function( event ) {
n@893 4853 // Can use an empty set, since event contains the info
n@893 4854 jQuery().off( event );
n@893 4855 return origFn.apply( this, arguments );
n@893 4856 };
n@893 4857 // Use same guid so caller can remove using origFn
n@893 4858 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
n@893 4859 }
n@893 4860 return this.each( function() {
n@893 4861 jQuery.event.add( this, types, fn, data, selector );
n@893 4862 });
n@893 4863 },
n@893 4864 one: function( types, selector, data, fn ) {
n@893 4865 return this.on( types, selector, data, fn, 1 );
n@893 4866 },
n@893 4867 off: function( types, selector, fn ) {
n@893 4868 var handleObj, type;
n@893 4869 if ( types && types.preventDefault && types.handleObj ) {
n@893 4870 // ( event ) dispatched jQuery.Event
n@893 4871 handleObj = types.handleObj;
n@893 4872 jQuery( types.delegateTarget ).off(
n@893 4873 handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
n@893 4874 handleObj.selector,
n@893 4875 handleObj.handler
n@893 4876 );
n@893 4877 return this;
n@893 4878 }
n@893 4879 if ( typeof types === "object" ) {
n@893 4880 // ( types-object [, selector] )
n@893 4881 for ( type in types ) {
n@893 4882 this.off( type, selector, types[ type ] );
n@893 4883 }
n@893 4884 return this;
n@893 4885 }
n@893 4886 if ( selector === false || typeof selector === "function" ) {
n@893 4887 // ( types [, fn] )
n@893 4888 fn = selector;
n@893 4889 selector = undefined;
n@893 4890 }
n@893 4891 if ( fn === false ) {
n@893 4892 fn = returnFalse;
n@893 4893 }
n@893 4894 return this.each(function() {
n@893 4895 jQuery.event.remove( this, types, fn, selector );
n@893 4896 });
n@893 4897 },
n@893 4898
n@893 4899 trigger: function( type, data ) {
n@893 4900 return this.each(function() {
n@893 4901 jQuery.event.trigger( type, data, this );
n@893 4902 });
n@893 4903 },
n@893 4904 triggerHandler: function( type, data ) {
n@893 4905 var elem = this[0];
n@893 4906 if ( elem ) {
n@893 4907 return jQuery.event.trigger( type, data, elem, true );
n@893 4908 }
n@893 4909 }
n@893 4910 });
n@893 4911
n@893 4912
n@893 4913 var
n@893 4914 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
n@893 4915 rtagName = /<([\w:]+)/,
n@893 4916 rhtml = /<|&#?\w+;/,
n@893 4917 rnoInnerhtml = /<(?:script|style|link)/i,
n@893 4918 // checked="checked" or checked
n@893 4919 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
n@893 4920 rscriptType = /^$|\/(?:java|ecma)script/i,
n@893 4921 rscriptTypeMasked = /^true\/(.*)/,
n@893 4922 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
n@893 4923
n@893 4924 // We have to close these tags to support XHTML (#13200)
n@893 4925 wrapMap = {
n@893 4926
n@893 4927 // Support: IE9
n@893 4928 option: [ 1, "<select multiple='multiple'>", "</select>" ],
n@893 4929
n@893 4930 thead: [ 1, "<table>", "</table>" ],
n@893 4931 col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
n@893 4932 tr: [ 2, "<table><tbody>", "</tbody></table>" ],
n@893 4933 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
n@893 4934
n@893 4935 _default: [ 0, "", "" ]
n@893 4936 };
n@893 4937
n@893 4938 // Support: IE9
n@893 4939 wrapMap.optgroup = wrapMap.option;
n@893 4940
n@893 4941 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
n@893 4942 wrapMap.th = wrapMap.td;
n@893 4943
n@893 4944 // Support: 1.x compatibility
n@893 4945 // Manipulating tables requires a tbody
n@893 4946 function manipulationTarget( elem, content ) {
n@893 4947 return jQuery.nodeName( elem, "table" ) &&
n@893 4948 jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
n@893 4949
n@893 4950 elem.getElementsByTagName("tbody")[0] ||
n@893 4951 elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
n@893 4952 elem;
n@893 4953 }
n@893 4954
n@893 4955 // Replace/restore the type attribute of script elements for safe DOM manipulation
n@893 4956 function disableScript( elem ) {
n@893 4957 elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
n@893 4958 return elem;
n@893 4959 }
n@893 4960 function restoreScript( elem ) {
n@893 4961 var match = rscriptTypeMasked.exec( elem.type );
n@893 4962
n@893 4963 if ( match ) {
n@893 4964 elem.type = match[ 1 ];
n@893 4965 } else {
n@893 4966 elem.removeAttribute("type");
n@893 4967 }
n@893 4968
n@893 4969 return elem;
n@893 4970 }
n@893 4971
n@893 4972 // Mark scripts as having already been evaluated
n@893 4973 function setGlobalEval( elems, refElements ) {
n@893 4974 var i = 0,
n@893 4975 l = elems.length;
n@893 4976
n@893 4977 for ( ; i < l; i++ ) {
n@893 4978 data_priv.set(
n@893 4979 elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" )
n@893 4980 );
n@893 4981 }
n@893 4982 }
n@893 4983
n@893 4984 function cloneCopyEvent( src, dest ) {
n@893 4985 var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
n@893 4986
n@893 4987 if ( dest.nodeType !== 1 ) {
n@893 4988 return;
n@893 4989 }
n@893 4990
n@893 4991 // 1. Copy private data: events, handlers, etc.
n@893 4992 if ( data_priv.hasData( src ) ) {
n@893 4993 pdataOld = data_priv.access( src );
n@893 4994 pdataCur = data_priv.set( dest, pdataOld );
n@893 4995 events = pdataOld.events;
n@893 4996
n@893 4997 if ( events ) {
n@893 4998 delete pdataCur.handle;
n@893 4999 pdataCur.events = {};
n@893 5000
n@893 5001 for ( type in events ) {
n@893 5002 for ( i = 0, l = events[ type ].length; i < l; i++ ) {
n@893 5003 jQuery.event.add( dest, type, events[ type ][ i ] );
n@893 5004 }
n@893 5005 }
n@893 5006 }
n@893 5007 }
n@893 5008
n@893 5009 // 2. Copy user data
n@893 5010 if ( data_user.hasData( src ) ) {
n@893 5011 udataOld = data_user.access( src );
n@893 5012 udataCur = jQuery.extend( {}, udataOld );
n@893 5013
n@893 5014 data_user.set( dest, udataCur );
n@893 5015 }
n@893 5016 }
n@893 5017
n@893 5018 function getAll( context, tag ) {
n@893 5019 var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) :
n@893 5020 context.querySelectorAll ? context.querySelectorAll( tag || "*" ) :
n@893 5021 [];
n@893 5022
n@893 5023 return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
n@893 5024 jQuery.merge( [ context ], ret ) :
n@893 5025 ret;
n@893 5026 }
n@893 5027
n@893 5028 // Fix IE bugs, see support tests
n@893 5029 function fixInput( src, dest ) {
n@893 5030 var nodeName = dest.nodeName.toLowerCase();
n@893 5031
n@893 5032 // Fails to persist the checked state of a cloned checkbox or radio button.
n@893 5033 if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
n@893 5034 dest.checked = src.checked;
n@893 5035
n@893 5036 // Fails to return the selected option to the default selected state when cloning options
n@893 5037 } else if ( nodeName === "input" || nodeName === "textarea" ) {
n@893 5038 dest.defaultValue = src.defaultValue;
n@893 5039 }
n@893 5040 }
n@893 5041
n@893 5042 jQuery.extend({
n@893 5043 clone: function( elem, dataAndEvents, deepDataAndEvents ) {
n@893 5044 var i, l, srcElements, destElements,
n@893 5045 clone = elem.cloneNode( true ),
n@893 5046 inPage = jQuery.contains( elem.ownerDocument, elem );
n@893 5047
n@893 5048 // Fix IE cloning issues
n@893 5049 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
n@893 5050 !jQuery.isXMLDoc( elem ) ) {
n@893 5051
n@893 5052 // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
n@893 5053 destElements = getAll( clone );
n@893 5054 srcElements = getAll( elem );
n@893 5055
n@893 5056 for ( i = 0, l = srcElements.length; i < l; i++ ) {
n@893 5057 fixInput( srcElements[ i ], destElements[ i ] );
n@893 5058 }
n@893 5059 }
n@893 5060
n@893 5061 // Copy the events from the original to the clone
n@893 5062 if ( dataAndEvents ) {
n@893 5063 if ( deepDataAndEvents ) {
n@893 5064 srcElements = srcElements || getAll( elem );
n@893 5065 destElements = destElements || getAll( clone );
n@893 5066
n@893 5067 for ( i = 0, l = srcElements.length; i < l; i++ ) {
n@893 5068 cloneCopyEvent( srcElements[ i ], destElements[ i ] );
n@893 5069 }
n@893 5070 } else {
n@893 5071 cloneCopyEvent( elem, clone );
n@893 5072 }
n@893 5073 }
n@893 5074
n@893 5075 // Preserve script evaluation history
n@893 5076 destElements = getAll( clone, "script" );
n@893 5077 if ( destElements.length > 0 ) {
n@893 5078 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
n@893 5079 }
n@893 5080
n@893 5081 // Return the cloned set
n@893 5082 return clone;
n@893 5083 },
n@893 5084
n@893 5085 buildFragment: function( elems, context, scripts, selection ) {
n@893 5086 var elem, tmp, tag, wrap, contains, j,
n@893 5087 fragment = context.createDocumentFragment(),
n@893 5088 nodes = [],
n@893 5089 i = 0,
n@893 5090 l = elems.length;
n@893 5091
n@893 5092 for ( ; i < l; i++ ) {
n@893 5093 elem = elems[ i ];
n@893 5094
n@893 5095 if ( elem || elem === 0 ) {
n@893 5096
n@893 5097 // Add nodes directly
n@893 5098 if ( jQuery.type( elem ) === "object" ) {
n@893 5099 // Support: QtWebKit, PhantomJS
n@893 5100 // push.apply(_, arraylike) throws on ancient WebKit
n@893 5101 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
n@893 5102
n@893 5103 // Convert non-html into a text node
n@893 5104 } else if ( !rhtml.test( elem ) ) {
n@893 5105 nodes.push( context.createTextNode( elem ) );
n@893 5106
n@893 5107 // Convert html into DOM nodes
n@893 5108 } else {
n@893 5109 tmp = tmp || fragment.appendChild( context.createElement("div") );
n@893 5110
n@893 5111 // Deserialize a standard representation
n@893 5112 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
n@893 5113 wrap = wrapMap[ tag ] || wrapMap._default;
n@893 5114 tmp.innerHTML = wrap[ 1 ] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[ 2 ];
n@893 5115
n@893 5116 // Descend through wrappers to the right content
n@893 5117 j = wrap[ 0 ];
n@893 5118 while ( j-- ) {
n@893 5119 tmp = tmp.lastChild;
n@893 5120 }
n@893 5121
n@893 5122 // Support: QtWebKit, PhantomJS
n@893 5123 // push.apply(_, arraylike) throws on ancient WebKit
n@893 5124 jQuery.merge( nodes, tmp.childNodes );
n@893 5125
n@893 5126 // Remember the top-level container
n@893 5127 tmp = fragment.firstChild;
n@893 5128
n@893 5129 // Ensure the created nodes are orphaned (#12392)
n@893 5130 tmp.textContent = "";
n@893 5131 }
n@893 5132 }
n@893 5133 }
n@893 5134
n@893 5135 // Remove wrapper from fragment
n@893 5136 fragment.textContent = "";
n@893 5137
n@893 5138 i = 0;
n@893 5139 while ( (elem = nodes[ i++ ]) ) {
n@893 5140
n@893 5141 // #4087 - If origin and destination elements are the same, and this is
n@893 5142 // that element, do not do anything
n@893 5143 if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
n@893 5144 continue;
n@893 5145 }
n@893 5146
n@893 5147 contains = jQuery.contains( elem.ownerDocument, elem );
n@893 5148
n@893 5149 // Append to fragment
n@893 5150 tmp = getAll( fragment.appendChild( elem ), "script" );
n@893 5151
n@893 5152 // Preserve script evaluation history
n@893 5153 if ( contains ) {
n@893 5154 setGlobalEval( tmp );
n@893 5155 }
n@893 5156
n@893 5157 // Capture executables
n@893 5158 if ( scripts ) {
n@893 5159 j = 0;
n@893 5160 while ( (elem = tmp[ j++ ]) ) {
n@893 5161 if ( rscriptType.test( elem.type || "" ) ) {
n@893 5162 scripts.push( elem );
n@893 5163 }
n@893 5164 }
n@893 5165 }
n@893 5166 }
n@893 5167
n@893 5168 return fragment;
n@893 5169 },
n@893 5170
n@893 5171 cleanData: function( elems ) {
n@893 5172 var data, elem, type, key,
n@893 5173 special = jQuery.event.special,
n@893 5174 i = 0;
n@893 5175
n@893 5176 for ( ; (elem = elems[ i ]) !== undefined; i++ ) {
n@893 5177 if ( jQuery.acceptData( elem ) ) {
n@893 5178 key = elem[ data_priv.expando ];
n@893 5179
n@893 5180 if ( key && (data = data_priv.cache[ key ]) ) {
n@893 5181 if ( data.events ) {
n@893 5182 for ( type in data.events ) {
n@893 5183 if ( special[ type ] ) {
n@893 5184 jQuery.event.remove( elem, type );
n@893 5185
n@893 5186 // This is a shortcut to avoid jQuery.event.remove's overhead
n@893 5187 } else {
n@893 5188 jQuery.removeEvent( elem, type, data.handle );
n@893 5189 }
n@893 5190 }
n@893 5191 }
n@893 5192 if ( data_priv.cache[ key ] ) {
n@893 5193 // Discard any remaining `private` data
n@893 5194 delete data_priv.cache[ key ];
n@893 5195 }
n@893 5196 }
n@893 5197 }
n@893 5198 // Discard any remaining `user` data
n@893 5199 delete data_user.cache[ elem[ data_user.expando ] ];
n@893 5200 }
n@893 5201 }
n@893 5202 });
n@893 5203
n@893 5204 jQuery.fn.extend({
n@893 5205 text: function( value ) {
n@893 5206 return access( this, function( value ) {
n@893 5207 return value === undefined ?
n@893 5208 jQuery.text( this ) :
n@893 5209 this.empty().each(function() {
n@893 5210 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
n@893 5211 this.textContent = value;
n@893 5212 }
n@893 5213 });
n@893 5214 }, null, value, arguments.length );
n@893 5215 },
n@893 5216
n@893 5217 append: function() {
n@893 5218 return this.domManip( arguments, function( elem ) {
n@893 5219 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
n@893 5220 var target = manipulationTarget( this, elem );
n@893 5221 target.appendChild( elem );
n@893 5222 }
n@893 5223 });
n@893 5224 },
n@893 5225
n@893 5226 prepend: function() {
n@893 5227 return this.domManip( arguments, function( elem ) {
n@893 5228 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
n@893 5229 var target = manipulationTarget( this, elem );
n@893 5230 target.insertBefore( elem, target.firstChild );
n@893 5231 }
n@893 5232 });
n@893 5233 },
n@893 5234
n@893 5235 before: function() {
n@893 5236 return this.domManip( arguments, function( elem ) {
n@893 5237 if ( this.parentNode ) {
n@893 5238 this.parentNode.insertBefore( elem, this );
n@893 5239 }
n@893 5240 });
n@893 5241 },
n@893 5242
n@893 5243 after: function() {
n@893 5244 return this.domManip( arguments, function( elem ) {
n@893 5245 if ( this.parentNode ) {
n@893 5246 this.parentNode.insertBefore( elem, this.nextSibling );
n@893 5247 }
n@893 5248 });
n@893 5249 },
n@893 5250
n@893 5251 remove: function( selector, keepData /* Internal Use Only */ ) {
n@893 5252 var elem,
n@893 5253 elems = selector ? jQuery.filter( selector, this ) : this,
n@893 5254 i = 0;
n@893 5255
n@893 5256 for ( ; (elem = elems[i]) != null; i++ ) {
n@893 5257 if ( !keepData && elem.nodeType === 1 ) {
n@893 5258 jQuery.cleanData( getAll( elem ) );
n@893 5259 }
n@893 5260
n@893 5261 if ( elem.parentNode ) {
n@893 5262 if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
n@893 5263 setGlobalEval( getAll( elem, "script" ) );
n@893 5264 }
n@893 5265 elem.parentNode.removeChild( elem );
n@893 5266 }
n@893 5267 }
n@893 5268
n@893 5269 return this;
n@893 5270 },
n@893 5271
n@893 5272 empty: function() {
n@893 5273 var elem,
n@893 5274 i = 0;
n@893 5275
n@893 5276 for ( ; (elem = this[i]) != null; i++ ) {
n@893 5277 if ( elem.nodeType === 1 ) {
n@893 5278
n@893 5279 // Prevent memory leaks
n@893 5280 jQuery.cleanData( getAll( elem, false ) );
n@893 5281
n@893 5282 // Remove any remaining nodes
n@893 5283 elem.textContent = "";
n@893 5284 }
n@893 5285 }
n@893 5286
n@893 5287 return this;
n@893 5288 },
n@893 5289
n@893 5290 clone: function( dataAndEvents, deepDataAndEvents ) {
n@893 5291 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
n@893 5292 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
n@893 5293
n@893 5294 return this.map(function() {
n@893 5295 return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
n@893 5296 });
n@893 5297 },
n@893 5298
n@893 5299 html: function( value ) {
n@893 5300 return access( this, function( value ) {
n@893 5301 var elem = this[ 0 ] || {},
n@893 5302 i = 0,
n@893 5303 l = this.length;
n@893 5304
n@893 5305 if ( value === undefined && elem.nodeType === 1 ) {
n@893 5306 return elem.innerHTML;
n@893 5307 }
n@893 5308
n@893 5309 // See if we can take a shortcut and just use innerHTML
n@893 5310 if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
n@893 5311 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
n@893 5312
n@893 5313 value = value.replace( rxhtmlTag, "<$1></$2>" );
n@893 5314
n@893 5315 try {
n@893 5316 for ( ; i < l; i++ ) {
n@893 5317 elem = this[ i ] || {};
n@893 5318
n@893 5319 // Remove element nodes and prevent memory leaks
n@893 5320 if ( elem.nodeType === 1 ) {
n@893 5321 jQuery.cleanData( getAll( elem, false ) );
n@893 5322 elem.innerHTML = value;
n@893 5323 }
n@893 5324 }
n@893 5325
n@893 5326 elem = 0;
n@893 5327
n@893 5328 // If using innerHTML throws an exception, use the fallback method
n@893 5329 } catch( e ) {}
n@893 5330 }
n@893 5331
n@893 5332 if ( elem ) {
n@893 5333 this.empty().append( value );
n@893 5334 }
n@893 5335 }, null, value, arguments.length );
n@893 5336 },
n@893 5337
n@893 5338 replaceWith: function() {
n@893 5339 var arg = arguments[ 0 ];
n@893 5340
n@893 5341 // Make the changes, replacing each context element with the new content
n@893 5342 this.domManip( arguments, function( elem ) {
n@893 5343 arg = this.parentNode;
n@893 5344
n@893 5345 jQuery.cleanData( getAll( this ) );
n@893 5346
n@893 5347 if ( arg ) {
n@893 5348 arg.replaceChild( elem, this );
n@893 5349 }
n@893 5350 });
n@893 5351
n@893 5352 // Force removal if there was no new content (e.g., from empty arguments)
n@893 5353 return arg && (arg.length || arg.nodeType) ? this : this.remove();
n@893 5354 },
n@893 5355
n@893 5356 detach: function( selector ) {
n@893 5357 return this.remove( selector, true );
n@893 5358 },
n@893 5359
n@893 5360 domManip: function( args, callback ) {
n@893 5361
n@893 5362 // Flatten any nested arrays
n@893 5363 args = concat.apply( [], args );
n@893 5364
n@893 5365 var fragment, first, scripts, hasScripts, node, doc,
n@893 5366 i = 0,
n@893 5367 l = this.length,
n@893 5368 set = this,
n@893 5369 iNoClone = l - 1,
n@893 5370 value = args[ 0 ],
n@893 5371 isFunction = jQuery.isFunction( value );
n@893 5372
n@893 5373 // We can't cloneNode fragments that contain checked, in WebKit
n@893 5374 if ( isFunction ||
n@893 5375 ( l > 1 && typeof value === "string" &&
n@893 5376 !support.checkClone && rchecked.test( value ) ) ) {
n@893 5377 return this.each(function( index ) {
n@893 5378 var self = set.eq( index );
n@893 5379 if ( isFunction ) {
n@893 5380 args[ 0 ] = value.call( this, index, self.html() );
n@893 5381 }
n@893 5382 self.domManip( args, callback );
n@893 5383 });
n@893 5384 }
n@893 5385
n@893 5386 if ( l ) {
n@893 5387 fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
n@893 5388 first = fragment.firstChild;
n@893 5389
n@893 5390 if ( fragment.childNodes.length === 1 ) {
n@893 5391 fragment = first;
n@893 5392 }
n@893 5393
n@893 5394 if ( first ) {
n@893 5395 scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
n@893 5396 hasScripts = scripts.length;
n@893 5397
n@893 5398 // Use the original fragment for the last item instead of the first because it can end up
n@893 5399 // being emptied incorrectly in certain situations (#8070).
n@893 5400 for ( ; i < l; i++ ) {
n@893 5401 node = fragment;
n@893 5402
n@893 5403 if ( i !== iNoClone ) {
n@893 5404 node = jQuery.clone( node, true, true );
n@893 5405
n@893 5406 // Keep references to cloned scripts for later restoration
n@893 5407 if ( hasScripts ) {
n@893 5408 // Support: QtWebKit
n@893 5409 // jQuery.merge because push.apply(_, arraylike) throws
n@893 5410 jQuery.merge( scripts, getAll( node, "script" ) );
n@893 5411 }
n@893 5412 }
n@893 5413
n@893 5414 callback.call( this[ i ], node, i );
n@893 5415 }
n@893 5416
n@893 5417 if ( hasScripts ) {
n@893 5418 doc = scripts[ scripts.length - 1 ].ownerDocument;
n@893 5419
n@893 5420 // Reenable scripts
n@893 5421 jQuery.map( scripts, restoreScript );
n@893 5422
n@893 5423 // Evaluate executable scripts on first document insertion
n@893 5424 for ( i = 0; i < hasScripts; i++ ) {
n@893 5425 node = scripts[ i ];
n@893 5426 if ( rscriptType.test( node.type || "" ) &&
n@893 5427 !data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
n@893 5428
n@893 5429 if ( node.src ) {
n@893 5430 // Optional AJAX dependency, but won't run scripts if not present
n@893 5431 if ( jQuery._evalUrl ) {
n@893 5432 jQuery._evalUrl( node.src );
n@893 5433 }
n@893 5434 } else {
n@893 5435 jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) );
n@893 5436 }
n@893 5437 }
n@893 5438 }
n@893 5439 }
n@893 5440 }
n@893 5441 }
n@893 5442
n@893 5443 return this;
n@893 5444 }
n@893 5445 });
n@893 5446
n@893 5447 jQuery.each({
n@893 5448 appendTo: "append",
n@893 5449 prependTo: "prepend",
n@893 5450 insertBefore: "before",
n@893 5451 insertAfter: "after",
n@893 5452 replaceAll: "replaceWith"
n@893 5453 }, function( name, original ) {
n@893 5454 jQuery.fn[ name ] = function( selector ) {
n@893 5455 var elems,
n@893 5456 ret = [],
n@893 5457 insert = jQuery( selector ),
n@893 5458 last = insert.length - 1,
n@893 5459 i = 0;
n@893 5460
n@893 5461 for ( ; i <= last; i++ ) {
n@893 5462 elems = i === last ? this : this.clone( true );
n@893 5463 jQuery( insert[ i ] )[ original ]( elems );
n@893 5464
n@893 5465 // Support: QtWebKit
n@893 5466 // .get() because push.apply(_, arraylike) throws
n@893 5467 push.apply( ret, elems.get() );
n@893 5468 }
n@893 5469
n@893 5470 return this.pushStack( ret );
n@893 5471 };
n@893 5472 });
n@893 5473
n@893 5474
n@893 5475 var iframe,
n@893 5476 elemdisplay = {};
n@893 5477
n@893 5478 /**
n@893 5479 * Retrieve the actual display of a element
n@893 5480 * @param {String} name nodeName of the element
n@893 5481 * @param {Object} doc Document object
n@893 5482 */
n@893 5483 // Called only from within defaultDisplay
n@893 5484 function actualDisplay( name, doc ) {
n@893 5485 var style,
n@893 5486 elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
n@893 5487
n@893 5488 // getDefaultComputedStyle might be reliably used only on attached element
n@893 5489 display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ?
n@893 5490
n@893 5491 // Use of this method is a temporary fix (more like optimization) until something better comes along,
n@893 5492 // since it was removed from specification and supported only in FF
n@893 5493 style.display : jQuery.css( elem[ 0 ], "display" );
n@893 5494
n@893 5495 // We don't have any data stored on the element,
n@893 5496 // so use "detach" method as fast way to get rid of the element
n@893 5497 elem.detach();
n@893 5498
n@893 5499 return display;
n@893 5500 }
n@893 5501
n@893 5502 /**
n@893 5503 * Try to determine the default display value of an element
n@893 5504 * @param {String} nodeName
n@893 5505 */
n@893 5506 function defaultDisplay( nodeName ) {
n@893 5507 var doc = document,
n@893 5508 display = elemdisplay[ nodeName ];
n@893 5509
n@893 5510 if ( !display ) {
n@893 5511 display = actualDisplay( nodeName, doc );
n@893 5512
n@893 5513 // If the simple way fails, read from inside an iframe
n@893 5514 if ( display === "none" || !display ) {
n@893 5515
n@893 5516 // Use the already-created iframe if possible
n@893 5517 iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement );
n@893 5518
n@893 5519 // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
n@893 5520 doc = iframe[ 0 ].contentDocument;
n@893 5521
n@893 5522 // Support: IE
n@893 5523 doc.write();
n@893 5524 doc.close();
n@893 5525
n@893 5526 display = actualDisplay( nodeName, doc );
n@893 5527 iframe.detach();
n@893 5528 }
n@893 5529
n@893 5530 // Store the correct default display
n@893 5531 elemdisplay[ nodeName ] = display;
n@893 5532 }
n@893 5533
n@893 5534 return display;
n@893 5535 }
n@893 5536 var rmargin = (/^margin/);
n@893 5537
n@893 5538 var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
n@893 5539
n@893 5540 var getStyles = function( elem ) {
n@893 5541 // Support: IE<=11+, Firefox<=30+ (#15098, #14150)
n@893 5542 // IE throws on elements created in popups
n@893 5543 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
n@893 5544 if ( elem.ownerDocument.defaultView.opener ) {
n@893 5545 return elem.ownerDocument.defaultView.getComputedStyle( elem, null );
n@893 5546 }
n@893 5547
n@893 5548 return window.getComputedStyle( elem, null );
n@893 5549 };
n@893 5550
n@893 5551
n@893 5552
n@893 5553 function curCSS( elem, name, computed ) {
n@893 5554 var width, minWidth, maxWidth, ret,
n@893 5555 style = elem.style;
n@893 5556
n@893 5557 computed = computed || getStyles( elem );
n@893 5558
n@893 5559 // Support: IE9
n@893 5560 // getPropertyValue is only needed for .css('filter') (#12537)
n@893 5561 if ( computed ) {
n@893 5562 ret = computed.getPropertyValue( name ) || computed[ name ];
n@893 5563 }
n@893 5564
n@893 5565 if ( computed ) {
n@893 5566
n@893 5567 if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
n@893 5568 ret = jQuery.style( elem, name );
n@893 5569 }
n@893 5570
n@893 5571 // Support: iOS < 6
n@893 5572 // A tribute to the "awesome hack by Dean Edwards"
n@893 5573 // iOS < 6 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
n@893 5574 // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
n@893 5575 if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
n@893 5576
n@893 5577 // Remember the original values
n@893 5578 width = style.width;
n@893 5579 minWidth = style.minWidth;
n@893 5580 maxWidth = style.maxWidth;
n@893 5581
n@893 5582 // Put in the new values to get a computed value out
n@893 5583 style.minWidth = style.maxWidth = style.width = ret;
n@893 5584 ret = computed.width;
n@893 5585
n@893 5586 // Revert the changed values
n@893 5587 style.width = width;
n@893 5588 style.minWidth = minWidth;
n@893 5589 style.maxWidth = maxWidth;
n@893 5590 }
n@893 5591 }
n@893 5592
n@893 5593 return ret !== undefined ?
n@893 5594 // Support: IE
n@893 5595 // IE returns zIndex value as an integer.
n@893 5596 ret + "" :
n@893 5597 ret;
n@893 5598 }
n@893 5599
n@893 5600
n@893 5601 function addGetHookIf( conditionFn, hookFn ) {
n@893 5602 // Define the hook, we'll check on the first run if it's really needed.
n@893 5603 return {
n@893 5604 get: function() {
n@893 5605 if ( conditionFn() ) {
n@893 5606 // Hook not needed (or it's not possible to use it due
n@893 5607 // to missing dependency), remove it.
n@893 5608 delete this.get;
n@893 5609 return;
n@893 5610 }
n@893 5611
n@893 5612 // Hook needed; redefine it so that the support test is not executed again.
n@893 5613 return (this.get = hookFn).apply( this, arguments );
n@893 5614 }
n@893 5615 };
n@893 5616 }
n@893 5617
n@893 5618
n@893 5619 (function() {
n@893 5620 var pixelPositionVal, boxSizingReliableVal,
n@893 5621 docElem = document.documentElement,
n@893 5622 container = document.createElement( "div" ),
n@893 5623 div = document.createElement( "div" );
n@893 5624
n@893 5625 if ( !div.style ) {
n@893 5626 return;
n@893 5627 }
n@893 5628
n@893 5629 // Support: IE9-11+
n@893 5630 // Style of cloned element affects source element cloned (#8908)
n@893 5631 div.style.backgroundClip = "content-box";
n@893 5632 div.cloneNode( true ).style.backgroundClip = "";
n@893 5633 support.clearCloneStyle = div.style.backgroundClip === "content-box";
n@893 5634
n@893 5635 container.style.cssText = "border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;" +
n@893 5636 "position:absolute";
n@893 5637 container.appendChild( div );
n@893 5638
n@893 5639 // Executing both pixelPosition & boxSizingReliable tests require only one layout
n@893 5640 // so they're executed at the same time to save the second computation.
n@893 5641 function computePixelPositionAndBoxSizingReliable() {
n@893 5642 div.style.cssText =
n@893 5643 // Support: Firefox<29, Android 2.3
n@893 5644 // Vendor-prefix box-sizing
n@893 5645 "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
n@893 5646 "box-sizing:border-box;display:block;margin-top:1%;top:1%;" +
n@893 5647 "border:1px;padding:1px;width:4px;position:absolute";
n@893 5648 div.innerHTML = "";
n@893 5649 docElem.appendChild( container );
n@893 5650
n@893 5651 var divStyle = window.getComputedStyle( div, null );
n@893 5652 pixelPositionVal = divStyle.top !== "1%";
n@893 5653 boxSizingReliableVal = divStyle.width === "4px";
n@893 5654
n@893 5655 docElem.removeChild( container );
n@893 5656 }
n@893 5657
n@893 5658 // Support: node.js jsdom
n@893 5659 // Don't assume that getComputedStyle is a property of the global object
n@893 5660 if ( window.getComputedStyle ) {
n@893 5661 jQuery.extend( support, {
n@893 5662 pixelPosition: function() {
n@893 5663
n@893 5664 // This test is executed only once but we still do memoizing
n@893 5665 // since we can use the boxSizingReliable pre-computing.
n@893 5666 // No need to check if the test was already performed, though.
n@893 5667 computePixelPositionAndBoxSizingReliable();
n@893 5668 return pixelPositionVal;
n@893 5669 },
n@893 5670 boxSizingReliable: function() {
n@893 5671 if ( boxSizingReliableVal == null ) {
n@893 5672 computePixelPositionAndBoxSizingReliable();
n@893 5673 }
n@893 5674 return boxSizingReliableVal;
n@893 5675 },
n@893 5676 reliableMarginRight: function() {
n@893 5677
n@893 5678 // Support: Android 2.3
n@893 5679 // Check if div with explicit width and no margin-right incorrectly
n@893 5680 // gets computed margin-right based on width of container. (#3333)
n@893 5681 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
n@893 5682 // This support function is only executed once so no memoizing is needed.
n@893 5683 var ret,
n@893 5684 marginDiv = div.appendChild( document.createElement( "div" ) );
n@893 5685
n@893 5686 // Reset CSS: box-sizing; display; margin; border; padding
n@893 5687 marginDiv.style.cssText = div.style.cssText =
n@893 5688 // Support: Firefox<29, Android 2.3
n@893 5689 // Vendor-prefix box-sizing
n@893 5690 "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
n@893 5691 "box-sizing:content-box;display:block;margin:0;border:0;padding:0";
n@893 5692 marginDiv.style.marginRight = marginDiv.style.width = "0";
n@893 5693 div.style.width = "1px";
n@893 5694 docElem.appendChild( container );
n@893 5695
n@893 5696 ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight );
n@893 5697
n@893 5698 docElem.removeChild( container );
n@893 5699 div.removeChild( marginDiv );
n@893 5700
n@893 5701 return ret;
n@893 5702 }
n@893 5703 });
n@893 5704 }
n@893 5705 })();
n@893 5706
n@893 5707
n@893 5708 // A method for quickly swapping in/out CSS properties to get correct calculations.
n@893 5709 jQuery.swap = function( elem, options, callback, args ) {
n@893 5710 var ret, name,
n@893 5711 old = {};
n@893 5712
n@893 5713 // Remember the old values, and insert the new ones
n@893 5714 for ( name in options ) {
n@893 5715 old[ name ] = elem.style[ name ];
n@893 5716 elem.style[ name ] = options[ name ];
n@893 5717 }
n@893 5718
n@893 5719 ret = callback.apply( elem, args || [] );
n@893 5720
n@893 5721 // Revert the old values
n@893 5722 for ( name in options ) {
n@893 5723 elem.style[ name ] = old[ name ];
n@893 5724 }
n@893 5725
n@893 5726 return ret;
n@893 5727 };
n@893 5728
n@893 5729
n@893 5730 var
n@893 5731 // Swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
n@893 5732 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
n@893 5733 rdisplayswap = /^(none|table(?!-c[ea]).+)/,
n@893 5734 rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),
n@893 5735 rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ),
n@893 5736
n@893 5737 cssShow = { position: "absolute", visibility: "hidden", display: "block" },
n@893 5738 cssNormalTransform = {
n@893 5739 letterSpacing: "0",
n@893 5740 fontWeight: "400"
n@893 5741 },
n@893 5742
n@893 5743 cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
n@893 5744
n@893 5745 // Return a css property mapped to a potentially vendor prefixed property
n@893 5746 function vendorPropName( style, name ) {
n@893 5747
n@893 5748 // Shortcut for names that are not vendor prefixed
n@893 5749 if ( name in style ) {
n@893 5750 return name;
n@893 5751 }
n@893 5752
n@893 5753 // Check for vendor prefixed names
n@893 5754 var capName = name[0].toUpperCase() + name.slice(1),
n@893 5755 origName = name,
n@893 5756 i = cssPrefixes.length;
n@893 5757
n@893 5758 while ( i-- ) {
n@893 5759 name = cssPrefixes[ i ] + capName;
n@893 5760 if ( name in style ) {
n@893 5761 return name;
n@893 5762 }
n@893 5763 }
n@893 5764
n@893 5765 return origName;
n@893 5766 }
n@893 5767
n@893 5768 function setPositiveNumber( elem, value, subtract ) {
n@893 5769 var matches = rnumsplit.exec( value );
n@893 5770 return matches ?
n@893 5771 // Guard against undefined "subtract", e.g., when used as in cssHooks
n@893 5772 Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
n@893 5773 value;
n@893 5774 }
n@893 5775
n@893 5776 function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
n@893 5777 var i = extra === ( isBorderBox ? "border" : "content" ) ?
n@893 5778 // If we already have the right measurement, avoid augmentation
n@893 5779 4 :
n@893 5780 // Otherwise initialize for horizontal or vertical properties
n@893 5781 name === "width" ? 1 : 0,
n@893 5782
n@893 5783 val = 0;
n@893 5784
n@893 5785 for ( ; i < 4; i += 2 ) {
n@893 5786 // Both box models exclude margin, so add it if we want it
n@893 5787 if ( extra === "margin" ) {
n@893 5788 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
n@893 5789 }
n@893 5790
n@893 5791 if ( isBorderBox ) {
n@893 5792 // border-box includes padding, so remove it if we want content
n@893 5793 if ( extra === "content" ) {
n@893 5794 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
n@893 5795 }
n@893 5796
n@893 5797 // At this point, extra isn't border nor margin, so remove border
n@893 5798 if ( extra !== "margin" ) {
n@893 5799 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
n@893 5800 }
n@893 5801 } else {
n@893 5802 // At this point, extra isn't content, so add padding
n@893 5803 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
n@893 5804
n@893 5805 // At this point, extra isn't content nor padding, so add border
n@893 5806 if ( extra !== "padding" ) {
n@893 5807 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
n@893 5808 }
n@893 5809 }
n@893 5810 }
n@893 5811
n@893 5812 return val;
n@893 5813 }
n@893 5814
n@893 5815 function getWidthOrHeight( elem, name, extra ) {
n@893 5816
n@893 5817 // Start with offset property, which is equivalent to the border-box value
n@893 5818 var valueIsBorderBox = true,
n@893 5819 val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
n@893 5820 styles = getStyles( elem ),
n@893 5821 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
n@893 5822
n@893 5823 // Some non-html elements return undefined for offsetWidth, so check for null/undefined
n@893 5824 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
n@893 5825 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
n@893 5826 if ( val <= 0 || val == null ) {
n@893 5827 // Fall back to computed then uncomputed css if necessary
n@893 5828 val = curCSS( elem, name, styles );
n@893 5829 if ( val < 0 || val == null ) {
n@893 5830 val = elem.style[ name ];
n@893 5831 }
n@893 5832
n@893 5833 // Computed unit is not pixels. Stop here and return.
n@893 5834 if ( rnumnonpx.test(val) ) {
n@893 5835 return val;
n@893 5836 }
n@893 5837
n@893 5838 // Check for style in case a browser which returns unreliable values
n@893 5839 // for getComputedStyle silently falls back to the reliable elem.style
n@893 5840 valueIsBorderBox = isBorderBox &&
n@893 5841 ( support.boxSizingReliable() || val === elem.style[ name ] );
n@893 5842
n@893 5843 // Normalize "", auto, and prepare for extra
n@893 5844 val = parseFloat( val ) || 0;
n@893 5845 }
n@893 5846
n@893 5847 // Use the active box-sizing model to add/subtract irrelevant styles
n@893 5848 return ( val +
n@893 5849 augmentWidthOrHeight(
n@893 5850 elem,
n@893 5851 name,
n@893 5852 extra || ( isBorderBox ? "border" : "content" ),
n@893 5853 valueIsBorderBox,
n@893 5854 styles
n@893 5855 )
n@893 5856 ) + "px";
n@893 5857 }
n@893 5858
n@893 5859 function showHide( elements, show ) {
n@893 5860 var display, elem, hidden,
n@893 5861 values = [],
n@893 5862 index = 0,
n@893 5863 length = elements.length;
n@893 5864
n@893 5865 for ( ; index < length; index++ ) {
n@893 5866 elem = elements[ index ];
n@893 5867 if ( !elem.style ) {
n@893 5868 continue;
n@893 5869 }
n@893 5870
n@893 5871 values[ index ] = data_priv.get( elem, "olddisplay" );
n@893 5872 display = elem.style.display;
n@893 5873 if ( show ) {
n@893 5874 // Reset the inline display of this element to learn if it is
n@893 5875 // being hidden by cascaded rules or not
n@893 5876 if ( !values[ index ] && display === "none" ) {
n@893 5877 elem.style.display = "";
n@893 5878 }
n@893 5879
n@893 5880 // Set elements which have been overridden with display: none
n@893 5881 // in a stylesheet to whatever the default browser style is
n@893 5882 // for such an element
n@893 5883 if ( elem.style.display === "" && isHidden( elem ) ) {
n@893 5884 values[ index ] = data_priv.access( elem, "olddisplay", defaultDisplay(elem.nodeName) );
n@893 5885 }
n@893 5886 } else {
n@893 5887 hidden = isHidden( elem );
n@893 5888
n@893 5889 if ( display !== "none" || !hidden ) {
n@893 5890 data_priv.set( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
n@893 5891 }
n@893 5892 }
n@893 5893 }
n@893 5894
n@893 5895 // Set the display of most of the elements in a second loop
n@893 5896 // to avoid the constant reflow
n@893 5897 for ( index = 0; index < length; index++ ) {
n@893 5898 elem = elements[ index ];
n@893 5899 if ( !elem.style ) {
n@893 5900 continue;
n@893 5901 }
n@893 5902 if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
n@893 5903 elem.style.display = show ? values[ index ] || "" : "none";
n@893 5904 }
n@893 5905 }
n@893 5906
n@893 5907 return elements;
n@893 5908 }
n@893 5909
n@893 5910 jQuery.extend({
n@893 5911
n@893 5912 // Add in style property hooks for overriding the default
n@893 5913 // behavior of getting and setting a style property
n@893 5914 cssHooks: {
n@893 5915 opacity: {
n@893 5916 get: function( elem, computed ) {
n@893 5917 if ( computed ) {
n@893 5918
n@893 5919 // We should always get a number back from opacity
n@893 5920 var ret = curCSS( elem, "opacity" );
n@893 5921 return ret === "" ? "1" : ret;
n@893 5922 }
n@893 5923 }
n@893 5924 }
n@893 5925 },
n@893 5926
n@893 5927 // Don't automatically add "px" to these possibly-unitless properties
n@893 5928 cssNumber: {
n@893 5929 "columnCount": true,
n@893 5930 "fillOpacity": true,
n@893 5931 "flexGrow": true,
n@893 5932 "flexShrink": true,
n@893 5933 "fontWeight": true,
n@893 5934 "lineHeight": true,
n@893 5935 "opacity": true,
n@893 5936 "order": true,
n@893 5937 "orphans": true,
n@893 5938 "widows": true,
n@893 5939 "zIndex": true,
n@893 5940 "zoom": true
n@893 5941 },
n@893 5942
n@893 5943 // Add in properties whose names you wish to fix before
n@893 5944 // setting or getting the value
n@893 5945 cssProps: {
n@893 5946 "float": "cssFloat"
n@893 5947 },
n@893 5948
n@893 5949 // Get and set the style property on a DOM Node
n@893 5950 style: function( elem, name, value, extra ) {
n@893 5951
n@893 5952 // Don't set styles on text and comment nodes
n@893 5953 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
n@893 5954 return;
n@893 5955 }
n@893 5956
n@893 5957 // Make sure that we're working with the right name
n@893 5958 var ret, type, hooks,
n@893 5959 origName = jQuery.camelCase( name ),
n@893 5960 style = elem.style;
n@893 5961
n@893 5962 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
n@893 5963
n@893 5964 // Gets hook for the prefixed version, then unprefixed version
n@893 5965 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
n@893 5966
n@893 5967 // Check if we're setting a value
n@893 5968 if ( value !== undefined ) {
n@893 5969 type = typeof value;
n@893 5970
n@893 5971 // Convert "+=" or "-=" to relative numbers (#7345)
n@893 5972 if ( type === "string" && (ret = rrelNum.exec( value )) ) {
n@893 5973 value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
n@893 5974 // Fixes bug #9237
n@893 5975 type = "number";
n@893 5976 }
n@893 5977
n@893 5978 // Make sure that null and NaN values aren't set (#7116)
n@893 5979 if ( value == null || value !== value ) {
n@893 5980 return;
n@893 5981 }
n@893 5982
n@893 5983 // If a number, add 'px' to the (except for certain CSS properties)
n@893 5984 if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
n@893 5985 value += "px";
n@893 5986 }
n@893 5987
n@893 5988 // Support: IE9-11+
n@893 5989 // background-* props affect original clone's values
n@893 5990 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
n@893 5991 style[ name ] = "inherit";
n@893 5992 }
n@893 5993
n@893 5994 // If a hook was provided, use that value, otherwise just set the specified value
n@893 5995 if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
n@893 5996 style[ name ] = value;
n@893 5997 }
n@893 5998
n@893 5999 } else {
n@893 6000 // If a hook was provided get the non-computed value from there
n@893 6001 if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
n@893 6002 return ret;
n@893 6003 }
n@893 6004
n@893 6005 // Otherwise just get the value from the style object
n@893 6006 return style[ name ];
n@893 6007 }
n@893 6008 },
n@893 6009
n@893 6010 css: function( elem, name, extra, styles ) {
n@893 6011 var val, num, hooks,
n@893 6012 origName = jQuery.camelCase( name );
n@893 6013
n@893 6014 // Make sure that we're working with the right name
n@893 6015 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
n@893 6016
n@893 6017 // Try prefixed name followed by the unprefixed name
n@893 6018 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
n@893 6019
n@893 6020 // If a hook was provided get the computed value from there
n@893 6021 if ( hooks && "get" in hooks ) {
n@893 6022 val = hooks.get( elem, true, extra );
n@893 6023 }
n@893 6024
n@893 6025 // Otherwise, if a way to get the computed value exists, use that
n@893 6026 if ( val === undefined ) {
n@893 6027 val = curCSS( elem, name, styles );
n@893 6028 }
n@893 6029
n@893 6030 // Convert "normal" to computed value
n@893 6031 if ( val === "normal" && name in cssNormalTransform ) {
n@893 6032 val = cssNormalTransform[ name ];
n@893 6033 }
n@893 6034
n@893 6035 // Make numeric if forced or a qualifier was provided and val looks numeric
n@893 6036 if ( extra === "" || extra ) {
n@893 6037 num = parseFloat( val );
n@893 6038 return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
n@893 6039 }
n@893 6040 return val;
n@893 6041 }
n@893 6042 });
n@893 6043
n@893 6044 jQuery.each([ "height", "width" ], function( i, name ) {
n@893 6045 jQuery.cssHooks[ name ] = {
n@893 6046 get: function( elem, computed, extra ) {
n@893 6047 if ( computed ) {
n@893 6048
n@893 6049 // Certain elements can have dimension info if we invisibly show them
n@893 6050 // but it must have a current display style that would benefit
n@893 6051 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ?
n@893 6052 jQuery.swap( elem, cssShow, function() {
n@893 6053 return getWidthOrHeight( elem, name, extra );
n@893 6054 }) :
n@893 6055 getWidthOrHeight( elem, name, extra );
n@893 6056 }
n@893 6057 },
n@893 6058
n@893 6059 set: function( elem, value, extra ) {
n@893 6060 var styles = extra && getStyles( elem );
n@893 6061 return setPositiveNumber( elem, value, extra ?
n@893 6062 augmentWidthOrHeight(
n@893 6063 elem,
n@893 6064 name,
n@893 6065 extra,
n@893 6066 jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
n@893 6067 styles
n@893 6068 ) : 0
n@893 6069 );
n@893 6070 }
n@893 6071 };
n@893 6072 });
n@893 6073
n@893 6074 // Support: Android 2.3
n@893 6075 jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
n@893 6076 function( elem, computed ) {
n@893 6077 if ( computed ) {
n@893 6078 return jQuery.swap( elem, { "display": "inline-block" },
n@893 6079 curCSS, [ elem, "marginRight" ] );
n@893 6080 }
n@893 6081 }
n@893 6082 );
n@893 6083
n@893 6084 // These hooks are used by animate to expand properties
n@893 6085 jQuery.each({
n@893 6086 margin: "",
n@893 6087 padding: "",
n@893 6088 border: "Width"
n@893 6089 }, function( prefix, suffix ) {
n@893 6090 jQuery.cssHooks[ prefix + suffix ] = {
n@893 6091 expand: function( value ) {
n@893 6092 var i = 0,
n@893 6093 expanded = {},
n@893 6094
n@893 6095 // Assumes a single number if not a string
n@893 6096 parts = typeof value === "string" ? value.split(" ") : [ value ];
n@893 6097
n@893 6098 for ( ; i < 4; i++ ) {
n@893 6099 expanded[ prefix + cssExpand[ i ] + suffix ] =
n@893 6100 parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
n@893 6101 }
n@893 6102
n@893 6103 return expanded;
n@893 6104 }
n@893 6105 };
n@893 6106
n@893 6107 if ( !rmargin.test( prefix ) ) {
n@893 6108 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
n@893 6109 }
n@893 6110 });
n@893 6111
n@893 6112 jQuery.fn.extend({
n@893 6113 css: function( name, value ) {
n@893 6114 return access( this, function( elem, name, value ) {
n@893 6115 var styles, len,
n@893 6116 map = {},
n@893 6117 i = 0;
n@893 6118
n@893 6119 if ( jQuery.isArray( name ) ) {
n@893 6120 styles = getStyles( elem );
n@893 6121 len = name.length;
n@893 6122
n@893 6123 for ( ; i < len; i++ ) {
n@893 6124 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
n@893 6125 }
n@893 6126
n@893 6127 return map;
n@893 6128 }
n@893 6129
n@893 6130 return value !== undefined ?
n@893 6131 jQuery.style( elem, name, value ) :
n@893 6132 jQuery.css( elem, name );
n@893 6133 }, name, value, arguments.length > 1 );
n@893 6134 },
n@893 6135 show: function() {
n@893 6136 return showHide( this, true );
n@893 6137 },
n@893 6138 hide: function() {
n@893 6139 return showHide( this );
n@893 6140 },
n@893 6141 toggle: function( state ) {
n@893 6142 if ( typeof state === "boolean" ) {
n@893 6143 return state ? this.show() : this.hide();
n@893 6144 }
n@893 6145
n@893 6146 return this.each(function() {
n@893 6147 if ( isHidden( this ) ) {
n@893 6148 jQuery( this ).show();
n@893 6149 } else {
n@893 6150 jQuery( this ).hide();
n@893 6151 }
n@893 6152 });
n@893 6153 }
n@893 6154 });
n@893 6155
n@893 6156
n@893 6157 function Tween( elem, options, prop, end, easing ) {
n@893 6158 return new Tween.prototype.init( elem, options, prop, end, easing );
n@893 6159 }
n@893 6160 jQuery.Tween = Tween;
n@893 6161
n@893 6162 Tween.prototype = {
n@893 6163 constructor: Tween,
n@893 6164 init: function( elem, options, prop, end, easing, unit ) {
n@893 6165 this.elem = elem;
n@893 6166 this.prop = prop;
n@893 6167 this.easing = easing || "swing";
n@893 6168 this.options = options;
n@893 6169 this.start = this.now = this.cur();
n@893 6170 this.end = end;
n@893 6171 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
n@893 6172 },
n@893 6173 cur: function() {
n@893 6174 var hooks = Tween.propHooks[ this.prop ];
n@893 6175
n@893 6176 return hooks && hooks.get ?
n@893 6177 hooks.get( this ) :
n@893 6178 Tween.propHooks._default.get( this );
n@893 6179 },
n@893 6180 run: function( percent ) {
n@893 6181 var eased,
n@893 6182 hooks = Tween.propHooks[ this.prop ];
n@893 6183
n@893 6184 if ( this.options.duration ) {
n@893 6185 this.pos = eased = jQuery.easing[ this.easing ](
n@893 6186 percent, this.options.duration * percent, 0, 1, this.options.duration
n@893 6187 );
n@893 6188 } else {
n@893 6189 this.pos = eased = percent;
n@893 6190 }
n@893 6191 this.now = ( this.end - this.start ) * eased + this.start;
n@893 6192
n@893 6193 if ( this.options.step ) {
n@893 6194 this.options.step.call( this.elem, this.now, this );
n@893 6195 }
n@893 6196
n@893 6197 if ( hooks && hooks.set ) {
n@893 6198 hooks.set( this );
n@893 6199 } else {
n@893 6200 Tween.propHooks._default.set( this );
n@893 6201 }
n@893 6202 return this;
n@893 6203 }
n@893 6204 };
n@893 6205
n@893 6206 Tween.prototype.init.prototype = Tween.prototype;
n@893 6207
n@893 6208 Tween.propHooks = {
n@893 6209 _default: {
n@893 6210 get: function( tween ) {
n@893 6211 var result;
n@893 6212
n@893 6213 if ( tween.elem[ tween.prop ] != null &&
n@893 6214 (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
n@893 6215 return tween.elem[ tween.prop ];
n@893 6216 }
n@893 6217
n@893 6218 // Passing an empty string as a 3rd parameter to .css will automatically
n@893 6219 // attempt a parseFloat and fallback to a string if the parse fails.
n@893 6220 // Simple values such as "10px" are parsed to Float;
n@893 6221 // complex values such as "rotate(1rad)" are returned as-is.
n@893 6222 result = jQuery.css( tween.elem, tween.prop, "" );
n@893 6223 // Empty strings, null, undefined and "auto" are converted to 0.
n@893 6224 return !result || result === "auto" ? 0 : result;
n@893 6225 },
n@893 6226 set: function( tween ) {
n@893 6227 // Use step hook for back compat.
n@893 6228 // Use cssHook if its there.
n@893 6229 // Use .style if available and use plain properties where available.
n@893 6230 if ( jQuery.fx.step[ tween.prop ] ) {
n@893 6231 jQuery.fx.step[ tween.prop ]( tween );
n@893 6232 } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
n@893 6233 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
n@893 6234 } else {
n@893 6235 tween.elem[ tween.prop ] = tween.now;
n@893 6236 }
n@893 6237 }
n@893 6238 }
n@893 6239 };
n@893 6240
n@893 6241 // Support: IE9
n@893 6242 // Panic based approach to setting things on disconnected nodes
n@893 6243 Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
n@893 6244 set: function( tween ) {
n@893 6245 if ( tween.elem.nodeType && tween.elem.parentNode ) {
n@893 6246 tween.elem[ tween.prop ] = tween.now;
n@893 6247 }
n@893 6248 }
n@893 6249 };
n@893 6250
n@893 6251 jQuery.easing = {
n@893 6252 linear: function( p ) {
n@893 6253 return p;
n@893 6254 },
n@893 6255 swing: function( p ) {
n@893 6256 return 0.5 - Math.cos( p * Math.PI ) / 2;
n@893 6257 }
n@893 6258 };
n@893 6259
n@893 6260 jQuery.fx = Tween.prototype.init;
n@893 6261
n@893 6262 // Back Compat <1.8 extension point
n@893 6263 jQuery.fx.step = {};
n@893 6264
n@893 6265
n@893 6266
n@893 6267
n@893 6268 var
n@893 6269 fxNow, timerId,
n@893 6270 rfxtypes = /^(?:toggle|show|hide)$/,
n@893 6271 rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ),
n@893 6272 rrun = /queueHooks$/,
n@893 6273 animationPrefilters = [ defaultPrefilter ],
n@893 6274 tweeners = {
n@893 6275 "*": [ function( prop, value ) {
n@893 6276 var tween = this.createTween( prop, value ),
n@893 6277 target = tween.cur(),
n@893 6278 parts = rfxnum.exec( value ),
n@893 6279 unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
n@893 6280
n@893 6281 // Starting value computation is required for potential unit mismatches
n@893 6282 start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) &&
n@893 6283 rfxnum.exec( jQuery.css( tween.elem, prop ) ),
n@893 6284 scale = 1,
n@893 6285 maxIterations = 20;
n@893 6286
n@893 6287 if ( start && start[ 3 ] !== unit ) {
n@893 6288 // Trust units reported by jQuery.css
n@893 6289 unit = unit || start[ 3 ];
n@893 6290
n@893 6291 // Make sure we update the tween properties later on
n@893 6292 parts = parts || [];
n@893 6293
n@893 6294 // Iteratively approximate from a nonzero starting point
n@893 6295 start = +target || 1;
n@893 6296
n@893 6297 do {
n@893 6298 // If previous iteration zeroed out, double until we get *something*.
n@893 6299 // Use string for doubling so we don't accidentally see scale as unchanged below
n@893 6300 scale = scale || ".5";
n@893 6301
n@893 6302 // Adjust and apply
n@893 6303 start = start / scale;
n@893 6304 jQuery.style( tween.elem, prop, start + unit );
n@893 6305
n@893 6306 // Update scale, tolerating zero or NaN from tween.cur(),
n@893 6307 // break the loop if scale is unchanged or perfect, or if we've just had enough
n@893 6308 } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
n@893 6309 }
n@893 6310
n@893 6311 // Update tween properties
n@893 6312 if ( parts ) {
n@893 6313 start = tween.start = +start || +target || 0;
n@893 6314 tween.unit = unit;
n@893 6315 // If a +=/-= token was provided, we're doing a relative animation
n@893 6316 tween.end = parts[ 1 ] ?
n@893 6317 start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :
n@893 6318 +parts[ 2 ];
n@893 6319 }
n@893 6320
n@893 6321 return tween;
n@893 6322 } ]
n@893 6323 };
n@893 6324
n@893 6325 // Animations created synchronously will run synchronously
n@893 6326 function createFxNow() {
n@893 6327 setTimeout(function() {
n@893 6328 fxNow = undefined;
n@893 6329 });
n@893 6330 return ( fxNow = jQuery.now() );
n@893 6331 }
n@893 6332
n@893 6333 // Generate parameters to create a standard animation
n@893 6334 function genFx( type, includeWidth ) {
n@893 6335 var which,
n@893 6336 i = 0,
n@893 6337 attrs = { height: type };
n@893 6338
n@893 6339 // If we include width, step value is 1 to do all cssExpand values,
n@893 6340 // otherwise step value is 2 to skip over Left and Right
n@893 6341 includeWidth = includeWidth ? 1 : 0;
n@893 6342 for ( ; i < 4 ; i += 2 - includeWidth ) {
n@893 6343 which = cssExpand[ i ];
n@893 6344 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
n@893 6345 }
n@893 6346
n@893 6347 if ( includeWidth ) {
n@893 6348 attrs.opacity = attrs.width = type;
n@893 6349 }
n@893 6350
n@893 6351 return attrs;
n@893 6352 }
n@893 6353
n@893 6354 function createTween( value, prop, animation ) {
n@893 6355 var tween,
n@893 6356 collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
n@893 6357 index = 0,
n@893 6358 length = collection.length;
n@893 6359 for ( ; index < length; index++ ) {
n@893 6360 if ( (tween = collection[ index ].call( animation, prop, value )) ) {
n@893 6361
n@893 6362 // We're done with this property
n@893 6363 return tween;
n@893 6364 }
n@893 6365 }
n@893 6366 }
n@893 6367
n@893 6368 function defaultPrefilter( elem, props, opts ) {
n@893 6369 /* jshint validthis: true */
n@893 6370 var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
n@893 6371 anim = this,
n@893 6372 orig = {},
n@893 6373 style = elem.style,
n@893 6374 hidden = elem.nodeType && isHidden( elem ),
n@893 6375 dataShow = data_priv.get( elem, "fxshow" );
n@893 6376
n@893 6377 // Handle queue: false promises
n@893 6378 if ( !opts.queue ) {
n@893 6379 hooks = jQuery._queueHooks( elem, "fx" );
n@893 6380 if ( hooks.unqueued == null ) {
n@893 6381 hooks.unqueued = 0;
n@893 6382 oldfire = hooks.empty.fire;
n@893 6383 hooks.empty.fire = function() {
n@893 6384 if ( !hooks.unqueued ) {
n@893 6385 oldfire();
n@893 6386 }
n@893 6387 };
n@893 6388 }
n@893 6389 hooks.unqueued++;
n@893 6390
n@893 6391 anim.always(function() {
n@893 6392 // Ensure the complete handler is called before this completes
n@893 6393 anim.always(function() {
n@893 6394 hooks.unqueued--;
n@893 6395 if ( !jQuery.queue( elem, "fx" ).length ) {
n@893 6396 hooks.empty.fire();
n@893 6397 }
n@893 6398 });
n@893 6399 });
n@893 6400 }
n@893 6401
n@893 6402 // Height/width overflow pass
n@893 6403 if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
n@893 6404 // Make sure that nothing sneaks out
n@893 6405 // Record all 3 overflow attributes because IE9-10 do not
n@893 6406 // change the overflow attribute when overflowX and
n@893 6407 // overflowY are set to the same value
n@893 6408 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
n@893 6409
n@893 6410 // Set display property to inline-block for height/width
n@893 6411 // animations on inline elements that are having width/height animated
n@893 6412 display = jQuery.css( elem, "display" );
n@893 6413
n@893 6414 // Test default display if display is currently "none"
n@893 6415 checkDisplay = display === "none" ?
n@893 6416 data_priv.get( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
n@893 6417
n@893 6418 if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
n@893 6419 style.display = "inline-block";
n@893 6420 }
n@893 6421 }
n@893 6422
n@893 6423 if ( opts.overflow ) {
n@893 6424 style.overflow = "hidden";
n@893 6425 anim.always(function() {
n@893 6426 style.overflow = opts.overflow[ 0 ];
n@893 6427 style.overflowX = opts.overflow[ 1 ];
n@893 6428 style.overflowY = opts.overflow[ 2 ];
n@893 6429 });
n@893 6430 }
n@893 6431
n@893 6432 // show/hide pass
n@893 6433 for ( prop in props ) {
n@893 6434 value = props[ prop ];
n@893 6435 if ( rfxtypes.exec( value ) ) {
n@893 6436 delete props[ prop ];
n@893 6437 toggle = toggle || value === "toggle";
n@893 6438 if ( value === ( hidden ? "hide" : "show" ) ) {
n@893 6439
n@893 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@893 6441 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
n@893 6442 hidden = true;
n@893 6443 } else {
n@893 6444 continue;
n@893 6445 }
n@893 6446 }
n@893 6447 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
n@893 6448
n@893 6449 // Any non-fx value stops us from restoring the original display value
n@893 6450 } else {
n@893 6451 display = undefined;
n@893 6452 }
n@893 6453 }
n@893 6454
n@893 6455 if ( !jQuery.isEmptyObject( orig ) ) {
n@893 6456 if ( dataShow ) {
n@893 6457 if ( "hidden" in dataShow ) {
n@893 6458 hidden = dataShow.hidden;
n@893 6459 }
n@893 6460 } else {
n@893 6461 dataShow = data_priv.access( elem, "fxshow", {} );
n@893 6462 }
n@893 6463
n@893 6464 // Store state if its toggle - enables .stop().toggle() to "reverse"
n@893 6465 if ( toggle ) {
n@893 6466 dataShow.hidden = !hidden;
n@893 6467 }
n@893 6468 if ( hidden ) {
n@893 6469 jQuery( elem ).show();
n@893 6470 } else {
n@893 6471 anim.done(function() {
n@893 6472 jQuery( elem ).hide();
n@893 6473 });
n@893 6474 }
n@893 6475 anim.done(function() {
n@893 6476 var prop;
n@893 6477
n@893 6478 data_priv.remove( elem, "fxshow" );
n@893 6479 for ( prop in orig ) {
n@893 6480 jQuery.style( elem, prop, orig[ prop ] );
n@893 6481 }
n@893 6482 });
n@893 6483 for ( prop in orig ) {
n@893 6484 tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
n@893 6485
n@893 6486 if ( !( prop in dataShow ) ) {
n@893 6487 dataShow[ prop ] = tween.start;
n@893 6488 if ( hidden ) {
n@893 6489 tween.end = tween.start;
n@893 6490 tween.start = prop === "width" || prop === "height" ? 1 : 0;
n@893 6491 }
n@893 6492 }
n@893 6493 }
n@893 6494
n@893 6495 // If this is a noop like .hide().hide(), restore an overwritten display value
n@893 6496 } else if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" ) {
n@893 6497 style.display = display;
n@893 6498 }
n@893 6499 }
n@893 6500
n@893 6501 function propFilter( props, specialEasing ) {
n@893 6502 var index, name, easing, value, hooks;
n@893 6503
n@893 6504 // camelCase, specialEasing and expand cssHook pass
n@893 6505 for ( index in props ) {
n@893 6506 name = jQuery.camelCase( index );
n@893 6507 easing = specialEasing[ name ];
n@893 6508 value = props[ index ];
n@893 6509 if ( jQuery.isArray( value ) ) {
n@893 6510 easing = value[ 1 ];
n@893 6511 value = props[ index ] = value[ 0 ];
n@893 6512 }
n@893 6513
n@893 6514 if ( index !== name ) {
n@893 6515 props[ name ] = value;
n@893 6516 delete props[ index ];
n@893 6517 }
n@893 6518
n@893 6519 hooks = jQuery.cssHooks[ name ];
n@893 6520 if ( hooks && "expand" in hooks ) {
n@893 6521 value = hooks.expand( value );
n@893 6522 delete props[ name ];
n@893 6523
n@893 6524 // Not quite $.extend, this won't overwrite existing keys.
n@893 6525 // Reusing 'index' because we have the correct "name"
n@893 6526 for ( index in value ) {
n@893 6527 if ( !( index in props ) ) {
n@893 6528 props[ index ] = value[ index ];
n@893 6529 specialEasing[ index ] = easing;
n@893 6530 }
n@893 6531 }
n@893 6532 } else {
n@893 6533 specialEasing[ name ] = easing;
n@893 6534 }
n@893 6535 }
n@893 6536 }
n@893 6537
n@893 6538 function Animation( elem, properties, options ) {
n@893 6539 var result,
n@893 6540 stopped,
n@893 6541 index = 0,
n@893 6542 length = animationPrefilters.length,
n@893 6543 deferred = jQuery.Deferred().always( function() {
n@893 6544 // Don't match elem in the :animated selector
n@893 6545 delete tick.elem;
n@893 6546 }),
n@893 6547 tick = function() {
n@893 6548 if ( stopped ) {
n@893 6549 return false;
n@893 6550 }
n@893 6551 var currentTime = fxNow || createFxNow(),
n@893 6552 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
n@893 6553 // Support: Android 2.3
n@893 6554 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
n@893 6555 temp = remaining / animation.duration || 0,
n@893 6556 percent = 1 - temp,
n@893 6557 index = 0,
n@893 6558 length = animation.tweens.length;
n@893 6559
n@893 6560 for ( ; index < length ; index++ ) {
n@893 6561 animation.tweens[ index ].run( percent );
n@893 6562 }
n@893 6563
n@893 6564 deferred.notifyWith( elem, [ animation, percent, remaining ]);
n@893 6565
n@893 6566 if ( percent < 1 && length ) {
n@893 6567 return remaining;
n@893 6568 } else {
n@893 6569 deferred.resolveWith( elem, [ animation ] );
n@893 6570 return false;
n@893 6571 }
n@893 6572 },
n@893 6573 animation = deferred.promise({
n@893 6574 elem: elem,
n@893 6575 props: jQuery.extend( {}, properties ),
n@893 6576 opts: jQuery.extend( true, { specialEasing: {} }, options ),
n@893 6577 originalProperties: properties,
n@893 6578 originalOptions: options,
n@893 6579 startTime: fxNow || createFxNow(),
n@893 6580 duration: options.duration,
n@893 6581 tweens: [],
n@893 6582 createTween: function( prop, end ) {
n@893 6583 var tween = jQuery.Tween( elem, animation.opts, prop, end,
n@893 6584 animation.opts.specialEasing[ prop ] || animation.opts.easing );
n@893 6585 animation.tweens.push( tween );
n@893 6586 return tween;
n@893 6587 },
n@893 6588 stop: function( gotoEnd ) {
n@893 6589 var index = 0,
n@893 6590 // If we are going to the end, we want to run all the tweens
n@893 6591 // otherwise we skip this part
n@893 6592 length = gotoEnd ? animation.tweens.length : 0;
n@893 6593 if ( stopped ) {
n@893 6594 return this;
n@893 6595 }
n@893 6596 stopped = true;
n@893 6597 for ( ; index < length ; index++ ) {
n@893 6598 animation.tweens[ index ].run( 1 );
n@893 6599 }
n@893 6600
n@893 6601 // Resolve when we played the last frame; otherwise, reject
n@893 6602 if ( gotoEnd ) {
n@893 6603 deferred.resolveWith( elem, [ animation, gotoEnd ] );
n@893 6604 } else {
n@893 6605 deferred.rejectWith( elem, [ animation, gotoEnd ] );
n@893 6606 }
n@893 6607 return this;
n@893 6608 }
n@893 6609 }),
n@893 6610 props = animation.props;
n@893 6611
n@893 6612 propFilter( props, animation.opts.specialEasing );
n@893 6613
n@893 6614 for ( ; index < length ; index++ ) {
n@893 6615 result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
n@893 6616 if ( result ) {
n@893 6617 return result;
n@893 6618 }
n@893 6619 }
n@893 6620
n@893 6621 jQuery.map( props, createTween, animation );
n@893 6622
n@893 6623 if ( jQuery.isFunction( animation.opts.start ) ) {
n@893 6624 animation.opts.start.call( elem, animation );
n@893 6625 }
n@893 6626
n@893 6627 jQuery.fx.timer(
n@893 6628 jQuery.extend( tick, {
n@893 6629 elem: elem,
n@893 6630 anim: animation,
n@893 6631 queue: animation.opts.queue
n@893 6632 })
n@893 6633 );
n@893 6634
n@893 6635 // attach callbacks from options
n@893 6636 return animation.progress( animation.opts.progress )
n@893 6637 .done( animation.opts.done, animation.opts.complete )
n@893 6638 .fail( animation.opts.fail )
n@893 6639 .always( animation.opts.always );
n@893 6640 }
n@893 6641
n@893 6642 jQuery.Animation = jQuery.extend( Animation, {
n@893 6643
n@893 6644 tweener: function( props, callback ) {
n@893 6645 if ( jQuery.isFunction( props ) ) {
n@893 6646 callback = props;
n@893 6647 props = [ "*" ];
n@893 6648 } else {
n@893 6649 props = props.split(" ");
n@893 6650 }
n@893 6651
n@893 6652 var prop,
n@893 6653 index = 0,
n@893 6654 length = props.length;
n@893 6655
n@893 6656 for ( ; index < length ; index++ ) {
n@893 6657 prop = props[ index ];
n@893 6658 tweeners[ prop ] = tweeners[ prop ] || [];
n@893 6659 tweeners[ prop ].unshift( callback );
n@893 6660 }
n@893 6661 },
n@893 6662
n@893 6663 prefilter: function( callback, prepend ) {
n@893 6664 if ( prepend ) {
n@893 6665 animationPrefilters.unshift( callback );
n@893 6666 } else {
n@893 6667 animationPrefilters.push( callback );
n@893 6668 }
n@893 6669 }
n@893 6670 });
n@893 6671
n@893 6672 jQuery.speed = function( speed, easing, fn ) {
n@893 6673 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
n@893 6674 complete: fn || !fn && easing ||
n@893 6675 jQuery.isFunction( speed ) && speed,
n@893 6676 duration: speed,
n@893 6677 easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
n@893 6678 };
n@893 6679
n@893 6680 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
n@893 6681 opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
n@893 6682
n@893 6683 // Normalize opt.queue - true/undefined/null -> "fx"
n@893 6684 if ( opt.queue == null || opt.queue === true ) {
n@893 6685 opt.queue = "fx";
n@893 6686 }
n@893 6687
n@893 6688 // Queueing
n@893 6689 opt.old = opt.complete;
n@893 6690
n@893 6691 opt.complete = function() {
n@893 6692 if ( jQuery.isFunction( opt.old ) ) {
n@893 6693 opt.old.call( this );
n@893 6694 }
n@893 6695
n@893 6696 if ( opt.queue ) {
n@893 6697 jQuery.dequeue( this, opt.queue );
n@893 6698 }
n@893 6699 };
n@893 6700
n@893 6701 return opt;
n@893 6702 };
n@893 6703
n@893 6704 jQuery.fn.extend({
n@893 6705 fadeTo: function( speed, to, easing, callback ) {
n@893 6706
n@893 6707 // Show any hidden elements after setting opacity to 0
n@893 6708 return this.filter( isHidden ).css( "opacity", 0 ).show()
n@893 6709
n@893 6710 // Animate to the value specified
n@893 6711 .end().animate({ opacity: to }, speed, easing, callback );
n@893 6712 },
n@893 6713 animate: function( prop, speed, easing, callback ) {
n@893 6714 var empty = jQuery.isEmptyObject( prop ),
n@893 6715 optall = jQuery.speed( speed, easing, callback ),
n@893 6716 doAnimation = function() {
n@893 6717 // Operate on a copy of prop so per-property easing won't be lost
n@893 6718 var anim = Animation( this, jQuery.extend( {}, prop ), optall );
n@893 6719
n@893 6720 // Empty animations, or finishing resolves immediately
n@893 6721 if ( empty || data_priv.get( this, "finish" ) ) {
n@893 6722 anim.stop( true );
n@893 6723 }
n@893 6724 };
n@893 6725 doAnimation.finish = doAnimation;
n@893 6726
n@893 6727 return empty || optall.queue === false ?
n@893 6728 this.each( doAnimation ) :
n@893 6729 this.queue( optall.queue, doAnimation );
n@893 6730 },
n@893 6731 stop: function( type, clearQueue, gotoEnd ) {
n@893 6732 var stopQueue = function( hooks ) {
n@893 6733 var stop = hooks.stop;
n@893 6734 delete hooks.stop;
n@893 6735 stop( gotoEnd );
n@893 6736 };
n@893 6737
n@893 6738 if ( typeof type !== "string" ) {
n@893 6739 gotoEnd = clearQueue;
n@893 6740 clearQueue = type;
n@893 6741 type = undefined;
n@893 6742 }
n@893 6743 if ( clearQueue && type !== false ) {
n@893 6744 this.queue( type || "fx", [] );
n@893 6745 }
n@893 6746
n@893 6747 return this.each(function() {
n@893 6748 var dequeue = true,
n@893 6749 index = type != null && type + "queueHooks",
n@893 6750 timers = jQuery.timers,
n@893 6751 data = data_priv.get( this );
n@893 6752
n@893 6753 if ( index ) {
n@893 6754 if ( data[ index ] && data[ index ].stop ) {
n@893 6755 stopQueue( data[ index ] );
n@893 6756 }
n@893 6757 } else {
n@893 6758 for ( index in data ) {
n@893 6759 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
n@893 6760 stopQueue( data[ index ] );
n@893 6761 }
n@893 6762 }
n@893 6763 }
n@893 6764
n@893 6765 for ( index = timers.length; index--; ) {
n@893 6766 if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
n@893 6767 timers[ index ].anim.stop( gotoEnd );
n@893 6768 dequeue = false;
n@893 6769 timers.splice( index, 1 );
n@893 6770 }
n@893 6771 }
n@893 6772
n@893 6773 // Start the next in the queue if the last step wasn't forced.
n@893 6774 // Timers currently will call their complete callbacks, which
n@893 6775 // will dequeue but only if they were gotoEnd.
n@893 6776 if ( dequeue || !gotoEnd ) {
n@893 6777 jQuery.dequeue( this, type );
n@893 6778 }
n@893 6779 });
n@893 6780 },
n@893 6781 finish: function( type ) {
n@893 6782 if ( type !== false ) {
n@893 6783 type = type || "fx";
n@893 6784 }
n@893 6785 return this.each(function() {
n@893 6786 var index,
n@893 6787 data = data_priv.get( this ),
n@893 6788 queue = data[ type + "queue" ],
n@893 6789 hooks = data[ type + "queueHooks" ],
n@893 6790 timers = jQuery.timers,
n@893 6791 length = queue ? queue.length : 0;
n@893 6792
n@893 6793 // Enable finishing flag on private data
n@893 6794 data.finish = true;
n@893 6795
n@893 6796 // Empty the queue first
n@893 6797 jQuery.queue( this, type, [] );
n@893 6798
n@893 6799 if ( hooks && hooks.stop ) {
n@893 6800 hooks.stop.call( this, true );
n@893 6801 }
n@893 6802
n@893 6803 // Look for any active animations, and finish them
n@893 6804 for ( index = timers.length; index--; ) {
n@893 6805 if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
n@893 6806 timers[ index ].anim.stop( true );
n@893 6807 timers.splice( index, 1 );
n@893 6808 }
n@893 6809 }
n@893 6810
n@893 6811 // Look for any animations in the old queue and finish them
n@893 6812 for ( index = 0; index < length; index++ ) {
n@893 6813 if ( queue[ index ] && queue[ index ].finish ) {
n@893 6814 queue[ index ].finish.call( this );
n@893 6815 }
n@893 6816 }
n@893 6817
n@893 6818 // Turn off finishing flag
n@893 6819 delete data.finish;
n@893 6820 });
n@893 6821 }
n@893 6822 });
n@893 6823
n@893 6824 jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
n@893 6825 var cssFn = jQuery.fn[ name ];
n@893 6826 jQuery.fn[ name ] = function( speed, easing, callback ) {
n@893 6827 return speed == null || typeof speed === "boolean" ?
n@893 6828 cssFn.apply( this, arguments ) :
n@893 6829 this.animate( genFx( name, true ), speed, easing, callback );
n@893 6830 };
n@893 6831 });
n@893 6832
n@893 6833 // Generate shortcuts for custom animations
n@893 6834 jQuery.each({
n@893 6835 slideDown: genFx("show"),
n@893 6836 slideUp: genFx("hide"),
n@893 6837 slideToggle: genFx("toggle"),
n@893 6838 fadeIn: { opacity: "show" },
n@893 6839 fadeOut: { opacity: "hide" },
n@893 6840 fadeToggle: { opacity: "toggle" }
n@893 6841 }, function( name, props ) {
n@893 6842 jQuery.fn[ name ] = function( speed, easing, callback ) {
n@893 6843 return this.animate( props, speed, easing, callback );
n@893 6844 };
n@893 6845 });
n@893 6846
n@893 6847 jQuery.timers = [];
n@893 6848 jQuery.fx.tick = function() {
n@893 6849 var timer,
n@893 6850 i = 0,
n@893 6851 timers = jQuery.timers;
n@893 6852
n@893 6853 fxNow = jQuery.now();
n@893 6854
n@893 6855 for ( ; i < timers.length; i++ ) {
n@893 6856 timer = timers[ i ];
n@893 6857 // Checks the timer has not already been removed
n@893 6858 if ( !timer() && timers[ i ] === timer ) {
n@893 6859 timers.splice( i--, 1 );
n@893 6860 }
n@893 6861 }
n@893 6862
n@893 6863 if ( !timers.length ) {
n@893 6864 jQuery.fx.stop();
n@893 6865 }
n@893 6866 fxNow = undefined;
n@893 6867 };
n@893 6868
n@893 6869 jQuery.fx.timer = function( timer ) {
n@893 6870 jQuery.timers.push( timer );
n@893 6871 if ( timer() ) {
n@893 6872 jQuery.fx.start();
n@893 6873 } else {
n@893 6874 jQuery.timers.pop();
n@893 6875 }
n@893 6876 };
n@893 6877
n@893 6878 jQuery.fx.interval = 13;
n@893 6879
n@893 6880 jQuery.fx.start = function() {
n@893 6881 if ( !timerId ) {
n@893 6882 timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
n@893 6883 }
n@893 6884 };
n@893 6885
n@893 6886 jQuery.fx.stop = function() {
n@893 6887 clearInterval( timerId );
n@893 6888 timerId = null;
n@893 6889 };
n@893 6890
n@893 6891 jQuery.fx.speeds = {
n@893 6892 slow: 600,
n@893 6893 fast: 200,
n@893 6894 // Default speed
n@893 6895 _default: 400
n@893 6896 };
n@893 6897
n@893 6898
n@893 6899 // Based off of the plugin by Clint Helfers, with permission.
n@893 6900 // http://blindsignals.com/index.php/2009/07/jquery-delay/
n@893 6901 jQuery.fn.delay = function( time, type ) {
n@893 6902 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
n@893 6903 type = type || "fx";
n@893 6904
n@893 6905 return this.queue( type, function( next, hooks ) {
n@893 6906 var timeout = setTimeout( next, time );
n@893 6907 hooks.stop = function() {
n@893 6908 clearTimeout( timeout );
n@893 6909 };
n@893 6910 });
n@893 6911 };
n@893 6912
n@893 6913
n@893 6914 (function() {
n@893 6915 var input = document.createElement( "input" ),
n@893 6916 select = document.createElement( "select" ),
n@893 6917 opt = select.appendChild( document.createElement( "option" ) );
n@893 6918
n@893 6919 input.type = "checkbox";
n@893 6920
n@893 6921 // Support: iOS<=5.1, Android<=4.2+
n@893 6922 // Default value for a checkbox should be "on"
n@893 6923 support.checkOn = input.value !== "";
n@893 6924
n@893 6925 // Support: IE<=11+
n@893 6926 // Must access selectedIndex to make default options select
n@893 6927 support.optSelected = opt.selected;
n@893 6928
n@893 6929 // Support: Android<=2.3
n@893 6930 // Options inside disabled selects are incorrectly marked as disabled
n@893 6931 select.disabled = true;
n@893 6932 support.optDisabled = !opt.disabled;
n@893 6933
n@893 6934 // Support: IE<=11+
n@893 6935 // An input loses its value after becoming a radio
n@893 6936 input = document.createElement( "input" );
n@893 6937 input.value = "t";
n@893 6938 input.type = "radio";
n@893 6939 support.radioValue = input.value === "t";
n@893 6940 })();
n@893 6941
n@893 6942
n@893 6943 var nodeHook, boolHook,
n@893 6944 attrHandle = jQuery.expr.attrHandle;
n@893 6945
n@893 6946 jQuery.fn.extend({
n@893 6947 attr: function( name, value ) {
n@893 6948 return access( this, jQuery.attr, name, value, arguments.length > 1 );
n@893 6949 },
n@893 6950
n@893 6951 removeAttr: function( name ) {
n@893 6952 return this.each(function() {
n@893 6953 jQuery.removeAttr( this, name );
n@893 6954 });
n@893 6955 }
n@893 6956 });
n@893 6957
n@893 6958 jQuery.extend({
n@893 6959 attr: function( elem, name, value ) {
n@893 6960 var hooks, ret,
n@893 6961 nType = elem.nodeType;
n@893 6962
n@893 6963 // don't get/set attributes on text, comment and attribute nodes
n@893 6964 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
n@893 6965 return;
n@893 6966 }
n@893 6967
n@893 6968 // Fallback to prop when attributes are not supported
n@893 6969 if ( typeof elem.getAttribute === strundefined ) {
n@893 6970 return jQuery.prop( elem, name, value );
n@893 6971 }
n@893 6972
n@893 6973 // All attributes are lowercase
n@893 6974 // Grab necessary hook if one is defined
n@893 6975 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
n@893 6976 name = name.toLowerCase();
n@893 6977 hooks = jQuery.attrHooks[ name ] ||
n@893 6978 ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
n@893 6979 }
n@893 6980
n@893 6981 if ( value !== undefined ) {
n@893 6982
n@893 6983 if ( value === null ) {
n@893 6984 jQuery.removeAttr( elem, name );
n@893 6985
n@893 6986 } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
n@893 6987 return ret;
n@893 6988
n@893 6989 } else {
n@893 6990 elem.setAttribute( name, value + "" );
n@893 6991 return value;
n@893 6992 }
n@893 6993
n@893 6994 } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
n@893 6995 return ret;
n@893 6996
n@893 6997 } else {
n@893 6998 ret = jQuery.find.attr( elem, name );
n@893 6999
n@893 7000 // Non-existent attributes return null, we normalize to undefined
n@893 7001 return ret == null ?
n@893 7002 undefined :
n@893 7003 ret;
n@893 7004 }
n@893 7005 },
n@893 7006
n@893 7007 removeAttr: function( elem, value ) {
n@893 7008 var name, propName,
n@893 7009 i = 0,
n@893 7010 attrNames = value && value.match( rnotwhite );
n@893 7011
n@893 7012 if ( attrNames && elem.nodeType === 1 ) {
n@893 7013 while ( (name = attrNames[i++]) ) {
n@893 7014 propName = jQuery.propFix[ name ] || name;
n@893 7015
n@893 7016 // Boolean attributes get special treatment (#10870)
n@893 7017 if ( jQuery.expr.match.bool.test( name ) ) {
n@893 7018 // Set corresponding property to false
n@893 7019 elem[ propName ] = false;
n@893 7020 }
n@893 7021
n@893 7022 elem.removeAttribute( name );
n@893 7023 }
n@893 7024 }
n@893 7025 },
n@893 7026
n@893 7027 attrHooks: {
n@893 7028 type: {
n@893 7029 set: function( elem, value ) {
n@893 7030 if ( !support.radioValue && value === "radio" &&
n@893 7031 jQuery.nodeName( elem, "input" ) ) {
n@893 7032 var val = elem.value;
n@893 7033 elem.setAttribute( "type", value );
n@893 7034 if ( val ) {
n@893 7035 elem.value = val;
n@893 7036 }
n@893 7037 return value;
n@893 7038 }
n@893 7039 }
n@893 7040 }
n@893 7041 }
n@893 7042 });
n@893 7043
n@893 7044 // Hooks for boolean attributes
n@893 7045 boolHook = {
n@893 7046 set: function( elem, value, name ) {
n@893 7047 if ( value === false ) {
n@893 7048 // Remove boolean attributes when set to false
n@893 7049 jQuery.removeAttr( elem, name );
n@893 7050 } else {
n@893 7051 elem.setAttribute( name, name );
n@893 7052 }
n@893 7053 return name;
n@893 7054 }
n@893 7055 };
n@893 7056 jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
n@893 7057 var getter = attrHandle[ name ] || jQuery.find.attr;
n@893 7058
n@893 7059 attrHandle[ name ] = function( elem, name, isXML ) {
n@893 7060 var ret, handle;
n@893 7061 if ( !isXML ) {
n@893 7062 // Avoid an infinite loop by temporarily removing this function from the getter
n@893 7063 handle = attrHandle[ name ];
n@893 7064 attrHandle[ name ] = ret;
n@893 7065 ret = getter( elem, name, isXML ) != null ?
n@893 7066 name.toLowerCase() :
n@893 7067 null;
n@893 7068 attrHandle[ name ] = handle;
n@893 7069 }
n@893 7070 return ret;
n@893 7071 };
n@893 7072 });
n@893 7073
n@893 7074
n@893 7075
n@893 7076
n@893 7077 var rfocusable = /^(?:input|select|textarea|button)$/i;
n@893 7078
n@893 7079 jQuery.fn.extend({
n@893 7080 prop: function( name, value ) {
n@893 7081 return access( this, jQuery.prop, name, value, arguments.length > 1 );
n@893 7082 },
n@893 7083
n@893 7084 removeProp: function( name ) {
n@893 7085 return this.each(function() {
n@893 7086 delete this[ jQuery.propFix[ name ] || name ];
n@893 7087 });
n@893 7088 }
n@893 7089 });
n@893 7090
n@893 7091 jQuery.extend({
n@893 7092 propFix: {
n@893 7093 "for": "htmlFor",
n@893 7094 "class": "className"
n@893 7095 },
n@893 7096
n@893 7097 prop: function( elem, name, value ) {
n@893 7098 var ret, hooks, notxml,
n@893 7099 nType = elem.nodeType;
n@893 7100
n@893 7101 // Don't get/set properties on text, comment and attribute nodes
n@893 7102 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
n@893 7103 return;
n@893 7104 }
n@893 7105
n@893 7106 notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
n@893 7107
n@893 7108 if ( notxml ) {
n@893 7109 // Fix name and attach hooks
n@893 7110 name = jQuery.propFix[ name ] || name;
n@893 7111 hooks = jQuery.propHooks[ name ];
n@893 7112 }
n@893 7113
n@893 7114 if ( value !== undefined ) {
n@893 7115 return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
n@893 7116 ret :
n@893 7117 ( elem[ name ] = value );
n@893 7118
n@893 7119 } else {
n@893 7120 return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
n@893 7121 ret :
n@893 7122 elem[ name ];
n@893 7123 }
n@893 7124 },
n@893 7125
n@893 7126 propHooks: {
n@893 7127 tabIndex: {
n@893 7128 get: function( elem ) {
n@893 7129 return elem.hasAttribute( "tabindex" ) || rfocusable.test( elem.nodeName ) || elem.href ?
n@893 7130 elem.tabIndex :
n@893 7131 -1;
n@893 7132 }
n@893 7133 }
n@893 7134 }
n@893 7135 });
n@893 7136
n@893 7137 if ( !support.optSelected ) {
n@893 7138 jQuery.propHooks.selected = {
n@893 7139 get: function( elem ) {
n@893 7140 var parent = elem.parentNode;
n@893 7141 if ( parent && parent.parentNode ) {
n@893 7142 parent.parentNode.selectedIndex;
n@893 7143 }
n@893 7144 return null;
n@893 7145 }
n@893 7146 };
n@893 7147 }
n@893 7148
n@893 7149 jQuery.each([
n@893 7150 "tabIndex",
n@893 7151 "readOnly",
n@893 7152 "maxLength",
n@893 7153 "cellSpacing",
n@893 7154 "cellPadding",
n@893 7155 "rowSpan",
n@893 7156 "colSpan",
n@893 7157 "useMap",
n@893 7158 "frameBorder",
n@893 7159 "contentEditable"
n@893 7160 ], function() {
n@893 7161 jQuery.propFix[ this.toLowerCase() ] = this;
n@893 7162 });
n@893 7163
n@893 7164
n@893 7165
n@893 7166
n@893 7167 var rclass = /[\t\r\n\f]/g;
n@893 7168
n@893 7169 jQuery.fn.extend({
n@893 7170 addClass: function( value ) {
n@893 7171 var classes, elem, cur, clazz, j, finalValue,
n@893 7172 proceed = typeof value === "string" && value,
n@893 7173 i = 0,
n@893 7174 len = this.length;
n@893 7175
n@893 7176 if ( jQuery.isFunction( value ) ) {
n@893 7177 return this.each(function( j ) {
n@893 7178 jQuery( this ).addClass( value.call( this, j, this.className ) );
n@893 7179 });
n@893 7180 }
n@893 7181
n@893 7182 if ( proceed ) {
n@893 7183 // The disjunction here is for better compressibility (see removeClass)
n@893 7184 classes = ( value || "" ).match( rnotwhite ) || [];
n@893 7185
n@893 7186 for ( ; i < len; i++ ) {
n@893 7187 elem = this[ i ];
n@893 7188 cur = elem.nodeType === 1 && ( elem.className ?
n@893 7189 ( " " + elem.className + " " ).replace( rclass, " " ) :
n@893 7190 " "
n@893 7191 );
n@893 7192
n@893 7193 if ( cur ) {
n@893 7194 j = 0;
n@893 7195 while ( (clazz = classes[j++]) ) {
n@893 7196 if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
n@893 7197 cur += clazz + " ";
n@893 7198 }
n@893 7199 }
n@893 7200
n@893 7201 // only assign if different to avoid unneeded rendering.
n@893 7202 finalValue = jQuery.trim( cur );
n@893 7203 if ( elem.className !== finalValue ) {
n@893 7204 elem.className = finalValue;
n@893 7205 }
n@893 7206 }
n@893 7207 }
n@893 7208 }
n@893 7209
n@893 7210 return this;
n@893 7211 },
n@893 7212
n@893 7213 removeClass: function( value ) {
n@893 7214 var classes, elem, cur, clazz, j, finalValue,
n@893 7215 proceed = arguments.length === 0 || typeof value === "string" && value,
n@893 7216 i = 0,
n@893 7217 len = this.length;
n@893 7218
n@893 7219 if ( jQuery.isFunction( value ) ) {
n@893 7220 return this.each(function( j ) {
n@893 7221 jQuery( this ).removeClass( value.call( this, j, this.className ) );
n@893 7222 });
n@893 7223 }
n@893 7224 if ( proceed ) {
n@893 7225 classes = ( value || "" ).match( rnotwhite ) || [];
n@893 7226
n@893 7227 for ( ; i < len; i++ ) {
n@893 7228 elem = this[ i ];
n@893 7229 // This expression is here for better compressibility (see addClass)
n@893 7230 cur = elem.nodeType === 1 && ( elem.className ?
n@893 7231 ( " " + elem.className + " " ).replace( rclass, " " ) :
n@893 7232 ""
n@893 7233 );
n@893 7234
n@893 7235 if ( cur ) {
n@893 7236 j = 0;
n@893 7237 while ( (clazz = classes[j++]) ) {
n@893 7238 // Remove *all* instances
n@893 7239 while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
n@893 7240 cur = cur.replace( " " + clazz + " ", " " );
n@893 7241 }
n@893 7242 }
n@893 7243
n@893 7244 // Only assign if different to avoid unneeded rendering.
n@893 7245 finalValue = value ? jQuery.trim( cur ) : "";
n@893 7246 if ( elem.className !== finalValue ) {
n@893 7247 elem.className = finalValue;
n@893 7248 }
n@893 7249 }
n@893 7250 }
n@893 7251 }
n@893 7252
n@893 7253 return this;
n@893 7254 },
n@893 7255
n@893 7256 toggleClass: function( value, stateVal ) {
n@893 7257 var type = typeof value;
n@893 7258
n@893 7259 if ( typeof stateVal === "boolean" && type === "string" ) {
n@893 7260 return stateVal ? this.addClass( value ) : this.removeClass( value );
n@893 7261 }
n@893 7262
n@893 7263 if ( jQuery.isFunction( value ) ) {
n@893 7264 return this.each(function( i ) {
n@893 7265 jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
n@893 7266 });
n@893 7267 }
n@893 7268
n@893 7269 return this.each(function() {
n@893 7270 if ( type === "string" ) {
n@893 7271 // Toggle individual class names
n@893 7272 var className,
n@893 7273 i = 0,
n@893 7274 self = jQuery( this ),
n@893 7275 classNames = value.match( rnotwhite ) || [];
n@893 7276
n@893 7277 while ( (className = classNames[ i++ ]) ) {
n@893 7278 // Check each className given, space separated list
n@893 7279 if ( self.hasClass( className ) ) {
n@893 7280 self.removeClass( className );
n@893 7281 } else {
n@893 7282 self.addClass( className );
n@893 7283 }
n@893 7284 }
n@893 7285
n@893 7286 // Toggle whole class name
n@893 7287 } else if ( type === strundefined || type === "boolean" ) {
n@893 7288 if ( this.className ) {
n@893 7289 // store className if set
n@893 7290 data_priv.set( this, "__className__", this.className );
n@893 7291 }
n@893 7292
n@893 7293 // If the element has a class name or if we're passed `false`,
n@893 7294 // then remove the whole classname (if there was one, the above saved it).
n@893 7295 // Otherwise bring back whatever was previously saved (if anything),
n@893 7296 // falling back to the empty string if nothing was stored.
n@893 7297 this.className = this.className || value === false ? "" : data_priv.get( this, "__className__" ) || "";
n@893 7298 }
n@893 7299 });
n@893 7300 },
n@893 7301
n@893 7302 hasClass: function( selector ) {
n@893 7303 var className = " " + selector + " ",
n@893 7304 i = 0,
n@893 7305 l = this.length;
n@893 7306 for ( ; i < l; i++ ) {
n@893 7307 if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
n@893 7308 return true;
n@893 7309 }
n@893 7310 }
n@893 7311
n@893 7312 return false;
n@893 7313 }
n@893 7314 });
n@893 7315
n@893 7316
n@893 7317
n@893 7318
n@893 7319 var rreturn = /\r/g;
n@893 7320
n@893 7321 jQuery.fn.extend({
n@893 7322 val: function( value ) {
n@893 7323 var hooks, ret, isFunction,
n@893 7324 elem = this[0];
n@893 7325
n@893 7326 if ( !arguments.length ) {
n@893 7327 if ( elem ) {
n@893 7328 hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
n@893 7329
n@893 7330 if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
n@893 7331 return ret;
n@893 7332 }
n@893 7333
n@893 7334 ret = elem.value;
n@893 7335
n@893 7336 return typeof ret === "string" ?
n@893 7337 // Handle most common string cases
n@893 7338 ret.replace(rreturn, "") :
n@893 7339 // Handle cases where value is null/undef or number
n@893 7340 ret == null ? "" : ret;
n@893 7341 }
n@893 7342
n@893 7343 return;
n@893 7344 }
n@893 7345
n@893 7346 isFunction = jQuery.isFunction( value );
n@893 7347
n@893 7348 return this.each(function( i ) {
n@893 7349 var val;
n@893 7350
n@893 7351 if ( this.nodeType !== 1 ) {
n@893 7352 return;
n@893 7353 }
n@893 7354
n@893 7355 if ( isFunction ) {
n@893 7356 val = value.call( this, i, jQuery( this ).val() );
n@893 7357 } else {
n@893 7358 val = value;
n@893 7359 }
n@893 7360
n@893 7361 // Treat null/undefined as ""; convert numbers to string
n@893 7362 if ( val == null ) {
n@893 7363 val = "";
n@893 7364
n@893 7365 } else if ( typeof val === "number" ) {
n@893 7366 val += "";
n@893 7367
n@893 7368 } else if ( jQuery.isArray( val ) ) {
n@893 7369 val = jQuery.map( val, function( value ) {
n@893 7370 return value == null ? "" : value + "";
n@893 7371 });
n@893 7372 }
n@893 7373
n@893 7374 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
n@893 7375
n@893 7376 // If set returns undefined, fall back to normal setting
n@893 7377 if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
n@893 7378 this.value = val;
n@893 7379 }
n@893 7380 });
n@893 7381 }
n@893 7382 });
n@893 7383
n@893 7384 jQuery.extend({
n@893 7385 valHooks: {
n@893 7386 option: {
n@893 7387 get: function( elem ) {
n@893 7388 var val = jQuery.find.attr( elem, "value" );
n@893 7389 return val != null ?
n@893 7390 val :
n@893 7391 // Support: IE10-11+
n@893 7392 // option.text throws exceptions (#14686, #14858)
n@893 7393 jQuery.trim( jQuery.text( elem ) );
n@893 7394 }
n@893 7395 },
n@893 7396 select: {
n@893 7397 get: function( elem ) {
n@893 7398 var value, option,
n@893 7399 options = elem.options,
n@893 7400 index = elem.selectedIndex,
n@893 7401 one = elem.type === "select-one" || index < 0,
n@893 7402 values = one ? null : [],
n@893 7403 max = one ? index + 1 : options.length,
n@893 7404 i = index < 0 ?
n@893 7405 max :
n@893 7406 one ? index : 0;
n@893 7407
n@893 7408 // Loop through all the selected options
n@893 7409 for ( ; i < max; i++ ) {
n@893 7410 option = options[ i ];
n@893 7411
n@893 7412 // IE6-9 doesn't update selected after form reset (#2551)
n@893 7413 if ( ( option.selected || i === index ) &&
n@893 7414 // Don't return options that are disabled or in a disabled optgroup
n@893 7415 ( support.optDisabled ? !option.disabled : option.getAttribute( "disabled" ) === null ) &&
n@893 7416 ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
n@893 7417
n@893 7418 // Get the specific value for the option
n@893 7419 value = jQuery( option ).val();
n@893 7420
n@893 7421 // We don't need an array for one selects
n@893 7422 if ( one ) {
n@893 7423 return value;
n@893 7424 }
n@893 7425
n@893 7426 // Multi-Selects return an array
n@893 7427 values.push( value );
n@893 7428 }
n@893 7429 }
n@893 7430
n@893 7431 return values;
n@893 7432 },
n@893 7433
n@893 7434 set: function( elem, value ) {
n@893 7435 var optionSet, option,
n@893 7436 options = elem.options,
n@893 7437 values = jQuery.makeArray( value ),
n@893 7438 i = options.length;
n@893 7439
n@893 7440 while ( i-- ) {
n@893 7441 option = options[ i ];
n@893 7442 if ( (option.selected = jQuery.inArray( option.value, values ) >= 0) ) {
n@893 7443 optionSet = true;
n@893 7444 }
n@893 7445 }
n@893 7446
n@893 7447 // Force browsers to behave consistently when non-matching value is set
n@893 7448 if ( !optionSet ) {
n@893 7449 elem.selectedIndex = -1;
n@893 7450 }
n@893 7451 return values;
n@893 7452 }
n@893 7453 }
n@893 7454 }
n@893 7455 });
n@893 7456
n@893 7457 // Radios and checkboxes getter/setter
n@893 7458 jQuery.each([ "radio", "checkbox" ], function() {
n@893 7459 jQuery.valHooks[ this ] = {
n@893 7460 set: function( elem, value ) {
n@893 7461 if ( jQuery.isArray( value ) ) {
n@893 7462 return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
n@893 7463 }
n@893 7464 }
n@893 7465 };
n@893 7466 if ( !support.checkOn ) {
n@893 7467 jQuery.valHooks[ this ].get = function( elem ) {
n@893 7468 return elem.getAttribute("value") === null ? "on" : elem.value;
n@893 7469 };
n@893 7470 }
n@893 7471 });
n@893 7472
n@893 7473
n@893 7474
n@893 7475
n@893 7476 // Return jQuery for attributes-only inclusion
n@893 7477
n@893 7478
n@893 7479 jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
n@893 7480 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
n@893 7481 "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
n@893 7482
n@893 7483 // Handle event binding
n@893 7484 jQuery.fn[ name ] = function( data, fn ) {
n@893 7485 return arguments.length > 0 ?
n@893 7486 this.on( name, null, data, fn ) :
n@893 7487 this.trigger( name );
n@893 7488 };
n@893 7489 });
n@893 7490
n@893 7491 jQuery.fn.extend({
n@893 7492 hover: function( fnOver, fnOut ) {
n@893 7493 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
n@893 7494 },
n@893 7495
n@893 7496 bind: function( types, data, fn ) {
n@893 7497 return this.on( types, null, data, fn );
n@893 7498 },
n@893 7499 unbind: function( types, fn ) {
n@893 7500 return this.off( types, null, fn );
n@893 7501 },
n@893 7502
n@893 7503 delegate: function( selector, types, data, fn ) {
n@893 7504 return this.on( types, selector, data, fn );
n@893 7505 },
n@893 7506 undelegate: function( selector, types, fn ) {
n@893 7507 // ( namespace ) or ( selector, types [, fn] )
n@893 7508 return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
n@893 7509 }
n@893 7510 });
n@893 7511
n@893 7512
n@893 7513 var nonce = jQuery.now();
n@893 7514
n@893 7515 var rquery = (/\?/);
n@893 7516
n@893 7517
n@893 7518
n@893 7519 // Support: Android 2.3
n@893 7520 // Workaround failure to string-cast null input
n@893 7521 jQuery.parseJSON = function( data ) {
n@893 7522 return JSON.parse( data + "" );
n@893 7523 };
n@893 7524
n@893 7525
n@893 7526 // Cross-browser xml parsing
n@893 7527 jQuery.parseXML = function( data ) {
n@893 7528 var xml, tmp;
n@893 7529 if ( !data || typeof data !== "string" ) {
n@893 7530 return null;
n@893 7531 }
n@893 7532
n@893 7533 // Support: IE9
n@893 7534 try {
n@893 7535 tmp = new DOMParser();
n@893 7536 xml = tmp.parseFromString( data, "text/xml" );
n@893 7537 } catch ( e ) {
n@893 7538 xml = undefined;
n@893 7539 }
n@893 7540
n@893 7541 if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
n@893 7542 jQuery.error( "Invalid XML: " + data );
n@893 7543 }
n@893 7544 return xml;
n@893 7545 };
n@893 7546
n@893 7547
n@893 7548 var
n@893 7549 rhash = /#.*$/,
n@893 7550 rts = /([?&])_=[^&]*/,
n@893 7551 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
n@893 7552 // #7653, #8125, #8152: local protocol detection
n@893 7553 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
n@893 7554 rnoContent = /^(?:GET|HEAD)$/,
n@893 7555 rprotocol = /^\/\//,
n@893 7556 rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
n@893 7557
n@893 7558 /* Prefilters
n@893 7559 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
n@893 7560 * 2) These are called:
n@893 7561 * - BEFORE asking for a transport
n@893 7562 * - AFTER param serialization (s.data is a string if s.processData is true)
n@893 7563 * 3) key is the dataType
n@893 7564 * 4) the catchall symbol "*" can be used
n@893 7565 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
n@893 7566 */
n@893 7567 prefilters = {},
n@893 7568
n@893 7569 /* Transports bindings
n@893 7570 * 1) key is the dataType
n@893 7571 * 2) the catchall symbol "*" can be used
n@893 7572 * 3) selection will start with transport dataType and THEN go to "*" if needed
n@893 7573 */
n@893 7574 transports = {},
n@893 7575
n@893 7576 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
n@893 7577 allTypes = "*/".concat( "*" ),
n@893 7578
n@893 7579 // Document location
n@893 7580 ajaxLocation = window.location.href,
n@893 7581
n@893 7582 // Segment location into parts
n@893 7583 ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
n@893 7584
n@893 7585 // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
n@893 7586 function addToPrefiltersOrTransports( structure ) {
n@893 7587
n@893 7588 // dataTypeExpression is optional and defaults to "*"
n@893 7589 return function( dataTypeExpression, func ) {
n@893 7590
n@893 7591 if ( typeof dataTypeExpression !== "string" ) {
n@893 7592 func = dataTypeExpression;
n@893 7593 dataTypeExpression = "*";
n@893 7594 }
n@893 7595
n@893 7596 var dataType,
n@893 7597 i = 0,
n@893 7598 dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
n@893 7599
n@893 7600 if ( jQuery.isFunction( func ) ) {
n@893 7601 // For each dataType in the dataTypeExpression
n@893 7602 while ( (dataType = dataTypes[i++]) ) {
n@893 7603 // Prepend if requested
n@893 7604 if ( dataType[0] === "+" ) {
n@893 7605 dataType = dataType.slice( 1 ) || "*";
n@893 7606 (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
n@893 7607
n@893 7608 // Otherwise append
n@893 7609 } else {
n@893 7610 (structure[ dataType ] = structure[ dataType ] || []).push( func );
n@893 7611 }
n@893 7612 }
n@893 7613 }
n@893 7614 };
n@893 7615 }
n@893 7616
n@893 7617 // Base inspection function for prefilters and transports
n@893 7618 function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
n@893 7619
n@893 7620 var inspected = {},
n@893 7621 seekingTransport = ( structure === transports );
n@893 7622
n@893 7623 function inspect( dataType ) {
n@893 7624 var selected;
n@893 7625 inspected[ dataType ] = true;
n@893 7626 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
n@893 7627 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
n@893 7628 if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
n@893 7629 options.dataTypes.unshift( dataTypeOrTransport );
n@893 7630 inspect( dataTypeOrTransport );
n@893 7631 return false;
n@893 7632 } else if ( seekingTransport ) {
n@893 7633 return !( selected = dataTypeOrTransport );
n@893 7634 }
n@893 7635 });
n@893 7636 return selected;
n@893 7637 }
n@893 7638
n@893 7639 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
n@893 7640 }
n@893 7641
n@893 7642 // A special extend for ajax options
n@893 7643 // that takes "flat" options (not to be deep extended)
n@893 7644 // Fixes #9887
n@893 7645 function ajaxExtend( target, src ) {
n@893 7646 var key, deep,
n@893 7647 flatOptions = jQuery.ajaxSettings.flatOptions || {};
n@893 7648
n@893 7649 for ( key in src ) {
n@893 7650 if ( src[ key ] !== undefined ) {
n@893 7651 ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
n@893 7652 }
n@893 7653 }
n@893 7654 if ( deep ) {
n@893 7655 jQuery.extend( true, target, deep );
n@893 7656 }
n@893 7657
n@893 7658 return target;
n@893 7659 }
n@893 7660
n@893 7661 /* Handles responses to an ajax request:
n@893 7662 * - finds the right dataType (mediates between content-type and expected dataType)
n@893 7663 * - returns the corresponding response
n@893 7664 */
n@893 7665 function ajaxHandleResponses( s, jqXHR, responses ) {
n@893 7666
n@893 7667 var ct, type, finalDataType, firstDataType,
n@893 7668 contents = s.contents,
n@893 7669 dataTypes = s.dataTypes;
n@893 7670
n@893 7671 // Remove auto dataType and get content-type in the process
n@893 7672 while ( dataTypes[ 0 ] === "*" ) {
n@893 7673 dataTypes.shift();
n@893 7674 if ( ct === undefined ) {
n@893 7675 ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
n@893 7676 }
n@893 7677 }
n@893 7678
n@893 7679 // Check if we're dealing with a known content-type
n@893 7680 if ( ct ) {
n@893 7681 for ( type in contents ) {
n@893 7682 if ( contents[ type ] && contents[ type ].test( ct ) ) {
n@893 7683 dataTypes.unshift( type );
n@893 7684 break;
n@893 7685 }
n@893 7686 }
n@893 7687 }
n@893 7688
n@893 7689 // Check to see if we have a response for the expected dataType
n@893 7690 if ( dataTypes[ 0 ] in responses ) {
n@893 7691 finalDataType = dataTypes[ 0 ];
n@893 7692 } else {
n@893 7693 // Try convertible dataTypes
n@893 7694 for ( type in responses ) {
n@893 7695 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
n@893 7696 finalDataType = type;
n@893 7697 break;
n@893 7698 }
n@893 7699 if ( !firstDataType ) {
n@893 7700 firstDataType = type;
n@893 7701 }
n@893 7702 }
n@893 7703 // Or just use first one
n@893 7704 finalDataType = finalDataType || firstDataType;
n@893 7705 }
n@893 7706
n@893 7707 // If we found a dataType
n@893 7708 // We add the dataType to the list if needed
n@893 7709 // and return the corresponding response
n@893 7710 if ( finalDataType ) {
n@893 7711 if ( finalDataType !== dataTypes[ 0 ] ) {
n@893 7712 dataTypes.unshift( finalDataType );
n@893 7713 }
n@893 7714 return responses[ finalDataType ];
n@893 7715 }
n@893 7716 }
n@893 7717
n@893 7718 /* Chain conversions given the request and the original response
n@893 7719 * Also sets the responseXXX fields on the jqXHR instance
n@893 7720 */
n@893 7721 function ajaxConvert( s, response, jqXHR, isSuccess ) {
n@893 7722 var conv2, current, conv, tmp, prev,
n@893 7723 converters = {},
n@893 7724 // Work with a copy of dataTypes in case we need to modify it for conversion
n@893 7725 dataTypes = s.dataTypes.slice();
n@893 7726
n@893 7727 // Create converters map with lowercased keys
n@893 7728 if ( dataTypes[ 1 ] ) {
n@893 7729 for ( conv in s.converters ) {
n@893 7730 converters[ conv.toLowerCase() ] = s.converters[ conv ];
n@893 7731 }
n@893 7732 }
n@893 7733
n@893 7734 current = dataTypes.shift();
n@893 7735
n@893 7736 // Convert to each sequential dataType
n@893 7737 while ( current ) {
n@893 7738
n@893 7739 if ( s.responseFields[ current ] ) {
n@893 7740 jqXHR[ s.responseFields[ current ] ] = response;
n@893 7741 }
n@893 7742
n@893 7743 // Apply the dataFilter if provided
n@893 7744 if ( !prev && isSuccess && s.dataFilter ) {
n@893 7745 response = s.dataFilter( response, s.dataType );
n@893 7746 }
n@893 7747
n@893 7748 prev = current;
n@893 7749 current = dataTypes.shift();
n@893 7750
n@893 7751 if ( current ) {
n@893 7752
n@893 7753 // There's only work to do if current dataType is non-auto
n@893 7754 if ( current === "*" ) {
n@893 7755
n@893 7756 current = prev;
n@893 7757
n@893 7758 // Convert response if prev dataType is non-auto and differs from current
n@893 7759 } else if ( prev !== "*" && prev !== current ) {
n@893 7760
n@893 7761 // Seek a direct converter
n@893 7762 conv = converters[ prev + " " + current ] || converters[ "* " + current ];
n@893 7763
n@893 7764 // If none found, seek a pair
n@893 7765 if ( !conv ) {
n@893 7766 for ( conv2 in converters ) {
n@893 7767
n@893 7768 // If conv2 outputs current
n@893 7769 tmp = conv2.split( " " );
n@893 7770 if ( tmp[ 1 ] === current ) {
n@893 7771
n@893 7772 // If prev can be converted to accepted input
n@893 7773 conv = converters[ prev + " " + tmp[ 0 ] ] ||
n@893 7774 converters[ "* " + tmp[ 0 ] ];
n@893 7775 if ( conv ) {
n@893 7776 // Condense equivalence converters
n@893 7777 if ( conv === true ) {
n@893 7778 conv = converters[ conv2 ];
n@893 7779
n@893 7780 // Otherwise, insert the intermediate dataType
n@893 7781 } else if ( converters[ conv2 ] !== true ) {
n@893 7782 current = tmp[ 0 ];
n@893 7783 dataTypes.unshift( tmp[ 1 ] );
n@893 7784 }
n@893 7785 break;
n@893 7786 }
n@893 7787 }
n@893 7788 }
n@893 7789 }
n@893 7790
n@893 7791 // Apply converter (if not an equivalence)
n@893 7792 if ( conv !== true ) {
n@893 7793
n@893 7794 // Unless errors are allowed to bubble, catch and return them
n@893 7795 if ( conv && s[ "throws" ] ) {
n@893 7796 response = conv( response );
n@893 7797 } else {
n@893 7798 try {
n@893 7799 response = conv( response );
n@893 7800 } catch ( e ) {
n@893 7801 return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
n@893 7802 }
n@893 7803 }
n@893 7804 }
n@893 7805 }
n@893 7806 }
n@893 7807 }
n@893 7808
n@893 7809 return { state: "success", data: response };
n@893 7810 }
n@893 7811
n@893 7812 jQuery.extend({
n@893 7813
n@893 7814 // Counter for holding the number of active queries
n@893 7815 active: 0,
n@893 7816
n@893 7817 // Last-Modified header cache for next request
n@893 7818 lastModified: {},
n@893 7819 etag: {},
n@893 7820
n@893 7821 ajaxSettings: {
n@893 7822 url: ajaxLocation,
n@893 7823 type: "GET",
n@893 7824 isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
n@893 7825 global: true,
n@893 7826 processData: true,
n@893 7827 async: true,
n@893 7828 contentType: "application/x-www-form-urlencoded; charset=UTF-8",
n@893 7829 /*
n@893 7830 timeout: 0,
n@893 7831 data: null,
n@893 7832 dataType: null,
n@893 7833 username: null,
n@893 7834 password: null,
n@893 7835 cache: null,
n@893 7836 throws: false,
n@893 7837 traditional: false,
n@893 7838 headers: {},
n@893 7839 */
n@893 7840
n@893 7841 accepts: {
n@893 7842 "*": allTypes,
n@893 7843 text: "text/plain",
n@893 7844 html: "text/html",
n@893 7845 xml: "application/xml, text/xml",
n@893 7846 json: "application/json, text/javascript"
n@893 7847 },
n@893 7848
n@893 7849 contents: {
n@893 7850 xml: /xml/,
n@893 7851 html: /html/,
n@893 7852 json: /json/
n@893 7853 },
n@893 7854
n@893 7855 responseFields: {
n@893 7856 xml: "responseXML",
n@893 7857 text: "responseText",
n@893 7858 json: "responseJSON"
n@893 7859 },
n@893 7860
n@893 7861 // Data converters
n@893 7862 // Keys separate source (or catchall "*") and destination types with a single space
n@893 7863 converters: {
n@893 7864
n@893 7865 // Convert anything to text
n@893 7866 "* text": String,
n@893 7867
n@893 7868 // Text to html (true = no transformation)
n@893 7869 "text html": true,
n@893 7870
n@893 7871 // Evaluate text as a json expression
n@893 7872 "text json": jQuery.parseJSON,
n@893 7873
n@893 7874 // Parse text as xml
n@893 7875 "text xml": jQuery.parseXML
n@893 7876 },
n@893 7877
n@893 7878 // For options that shouldn't be deep extended:
n@893 7879 // you can add your own custom options here if
n@893 7880 // and when you create one that shouldn't be
n@893 7881 // deep extended (see ajaxExtend)
n@893 7882 flatOptions: {
n@893 7883 url: true,
n@893 7884 context: true
n@893 7885 }
n@893 7886 },
n@893 7887
n@893 7888 // Creates a full fledged settings object into target
n@893 7889 // with both ajaxSettings and settings fields.
n@893 7890 // If target is omitted, writes into ajaxSettings.
n@893 7891 ajaxSetup: function( target, settings ) {
n@893 7892 return settings ?
n@893 7893
n@893 7894 // Building a settings object
n@893 7895 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
n@893 7896
n@893 7897 // Extending ajaxSettings
n@893 7898 ajaxExtend( jQuery.ajaxSettings, target );
n@893 7899 },
n@893 7900
n@893 7901 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
n@893 7902 ajaxTransport: addToPrefiltersOrTransports( transports ),
n@893 7903
n@893 7904 // Main method
n@893 7905 ajax: function( url, options ) {
n@893 7906
n@893 7907 // If url is an object, simulate pre-1.5 signature
n@893 7908 if ( typeof url === "object" ) {
n@893 7909 options = url;
n@893 7910 url = undefined;
n@893 7911 }
n@893 7912
n@893 7913 // Force options to be an object
n@893 7914 options = options || {};
n@893 7915
n@893 7916 var transport,
n@893 7917 // URL without anti-cache param
n@893 7918 cacheURL,
n@893 7919 // Response headers
n@893 7920 responseHeadersString,
n@893 7921 responseHeaders,
n@893 7922 // timeout handle
n@893 7923 timeoutTimer,
n@893 7924 // Cross-domain detection vars
n@893 7925 parts,
n@893 7926 // To know if global events are to be dispatched
n@893 7927 fireGlobals,
n@893 7928 // Loop variable
n@893 7929 i,
n@893 7930 // Create the final options object
n@893 7931 s = jQuery.ajaxSetup( {}, options ),
n@893 7932 // Callbacks context
n@893 7933 callbackContext = s.context || s,
n@893 7934 // Context for global events is callbackContext if it is a DOM node or jQuery collection
n@893 7935 globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
n@893 7936 jQuery( callbackContext ) :
n@893 7937 jQuery.event,
n@893 7938 // Deferreds
n@893 7939 deferred = jQuery.Deferred(),
n@893 7940 completeDeferred = jQuery.Callbacks("once memory"),
n@893 7941 // Status-dependent callbacks
n@893 7942 statusCode = s.statusCode || {},
n@893 7943 // Headers (they are sent all at once)
n@893 7944 requestHeaders = {},
n@893 7945 requestHeadersNames = {},
n@893 7946 // The jqXHR state
n@893 7947 state = 0,
n@893 7948 // Default abort message
n@893 7949 strAbort = "canceled",
n@893 7950 // Fake xhr
n@893 7951 jqXHR = {
n@893 7952 readyState: 0,
n@893 7953
n@893 7954 // Builds headers hashtable if needed
n@893 7955 getResponseHeader: function( key ) {
n@893 7956 var match;
n@893 7957 if ( state === 2 ) {
n@893 7958 if ( !responseHeaders ) {
n@893 7959 responseHeaders = {};
n@893 7960 while ( (match = rheaders.exec( responseHeadersString )) ) {
n@893 7961 responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
n@893 7962 }
n@893 7963 }
n@893 7964 match = responseHeaders[ key.toLowerCase() ];
n@893 7965 }
n@893 7966 return match == null ? null : match;
n@893 7967 },
n@893 7968
n@893 7969 // Raw string
n@893 7970 getAllResponseHeaders: function() {
n@893 7971 return state === 2 ? responseHeadersString : null;
n@893 7972 },
n@893 7973
n@893 7974 // Caches the header
n@893 7975 setRequestHeader: function( name, value ) {
n@893 7976 var lname = name.toLowerCase();
n@893 7977 if ( !state ) {
n@893 7978 name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
n@893 7979 requestHeaders[ name ] = value;
n@893 7980 }
n@893 7981 return this;
n@893 7982 },
n@893 7983
n@893 7984 // Overrides response content-type header
n@893 7985 overrideMimeType: function( type ) {
n@893 7986 if ( !state ) {
n@893 7987 s.mimeType = type;
n@893 7988 }
n@893 7989 return this;
n@893 7990 },
n@893 7991
n@893 7992 // Status-dependent callbacks
n@893 7993 statusCode: function( map ) {
n@893 7994 var code;
n@893 7995 if ( map ) {
n@893 7996 if ( state < 2 ) {
n@893 7997 for ( code in map ) {
n@893 7998 // Lazy-add the new callback in a way that preserves old ones
n@893 7999 statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
n@893 8000 }
n@893 8001 } else {
n@893 8002 // Execute the appropriate callbacks
n@893 8003 jqXHR.always( map[ jqXHR.status ] );
n@893 8004 }
n@893 8005 }
n@893 8006 return this;
n@893 8007 },
n@893 8008
n@893 8009 // Cancel the request
n@893 8010 abort: function( statusText ) {
n@893 8011 var finalText = statusText || strAbort;
n@893 8012 if ( transport ) {
n@893 8013 transport.abort( finalText );
n@893 8014 }
n@893 8015 done( 0, finalText );
n@893 8016 return this;
n@893 8017 }
n@893 8018 };
n@893 8019
n@893 8020 // Attach deferreds
n@893 8021 deferred.promise( jqXHR ).complete = completeDeferred.add;
n@893 8022 jqXHR.success = jqXHR.done;
n@893 8023 jqXHR.error = jqXHR.fail;
n@893 8024
n@893 8025 // Remove hash character (#7531: and string promotion)
n@893 8026 // Add protocol if not provided (prefilters might expect it)
n@893 8027 // Handle falsy url in the settings object (#10093: consistency with old signature)
n@893 8028 // We also use the url parameter if available
n@893 8029 s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" )
n@893 8030 .replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
n@893 8031
n@893 8032 // Alias method option to type as per ticket #12004
n@893 8033 s.type = options.method || options.type || s.method || s.type;
n@893 8034
n@893 8035 // Extract dataTypes list
n@893 8036 s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
n@893 8037
n@893 8038 // A cross-domain request is in order when we have a protocol:host:port mismatch
n@893 8039 if ( s.crossDomain == null ) {
n@893 8040 parts = rurl.exec( s.url.toLowerCase() );
n@893 8041 s.crossDomain = !!( parts &&
n@893 8042 ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
n@893 8043 ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
n@893 8044 ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
n@893 8045 );
n@893 8046 }
n@893 8047
n@893 8048 // Convert data if not already a string
n@893 8049 if ( s.data && s.processData && typeof s.data !== "string" ) {
n@893 8050 s.data = jQuery.param( s.data, s.traditional );
n@893 8051 }
n@893 8052
n@893 8053 // Apply prefilters
n@893 8054 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
n@893 8055
n@893 8056 // If request was aborted inside a prefilter, stop there
n@893 8057 if ( state === 2 ) {
n@893 8058 return jqXHR;
n@893 8059 }
n@893 8060
n@893 8061 // We can fire global events as of now if asked to
n@893 8062 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
n@893 8063 fireGlobals = jQuery.event && s.global;
n@893 8064
n@893 8065 // Watch for a new set of requests
n@893 8066 if ( fireGlobals && jQuery.active++ === 0 ) {
n@893 8067 jQuery.event.trigger("ajaxStart");
n@893 8068 }
n@893 8069
n@893 8070 // Uppercase the type
n@893 8071 s.type = s.type.toUpperCase();
n@893 8072
n@893 8073 // Determine if request has content
n@893 8074 s.hasContent = !rnoContent.test( s.type );
n@893 8075
n@893 8076 // Save the URL in case we're toying with the If-Modified-Since
n@893 8077 // and/or If-None-Match header later on
n@893 8078 cacheURL = s.url;
n@893 8079
n@893 8080 // More options handling for requests with no content
n@893 8081 if ( !s.hasContent ) {
n@893 8082
n@893 8083 // If data is available, append data to url
n@893 8084 if ( s.data ) {
n@893 8085 cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
n@893 8086 // #9682: remove data so that it's not used in an eventual retry
n@893 8087 delete s.data;
n@893 8088 }
n@893 8089
n@893 8090 // Add anti-cache in url if needed
n@893 8091 if ( s.cache === false ) {
n@893 8092 s.url = rts.test( cacheURL ) ?
n@893 8093
n@893 8094 // If there is already a '_' parameter, set its value
n@893 8095 cacheURL.replace( rts, "$1_=" + nonce++ ) :
n@893 8096
n@893 8097 // Otherwise add one to the end
n@893 8098 cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
n@893 8099 }
n@893 8100 }
n@893 8101
n@893 8102 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
n@893 8103 if ( s.ifModified ) {
n@893 8104 if ( jQuery.lastModified[ cacheURL ] ) {
n@893 8105 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
n@893 8106 }
n@893 8107 if ( jQuery.etag[ cacheURL ] ) {
n@893 8108 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
n@893 8109 }
n@893 8110 }
n@893 8111
n@893 8112 // Set the correct header, if data is being sent
n@893 8113 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
n@893 8114 jqXHR.setRequestHeader( "Content-Type", s.contentType );
n@893 8115 }
n@893 8116
n@893 8117 // Set the Accepts header for the server, depending on the dataType
n@893 8118 jqXHR.setRequestHeader(
n@893 8119 "Accept",
n@893 8120 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
n@893 8121 s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
n@893 8122 s.accepts[ "*" ]
n@893 8123 );
n@893 8124
n@893 8125 // Check for headers option
n@893 8126 for ( i in s.headers ) {
n@893 8127 jqXHR.setRequestHeader( i, s.headers[ i ] );
n@893 8128 }
n@893 8129
n@893 8130 // Allow custom headers/mimetypes and early abort
n@893 8131 if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
n@893 8132 // Abort if not done already and return
n@893 8133 return jqXHR.abort();
n@893 8134 }
n@893 8135
n@893 8136 // Aborting is no longer a cancellation
n@893 8137 strAbort = "abort";
n@893 8138
n@893 8139 // Install callbacks on deferreds
n@893 8140 for ( i in { success: 1, error: 1, complete: 1 } ) {
n@893 8141 jqXHR[ i ]( s[ i ] );
n@893 8142 }
n@893 8143
n@893 8144 // Get transport
n@893 8145 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
n@893 8146
n@893 8147 // If no transport, we auto-abort
n@893 8148 if ( !transport ) {
n@893 8149 done( -1, "No Transport" );
n@893 8150 } else {
n@893 8151 jqXHR.readyState = 1;
n@893 8152
n@893 8153 // Send global event
n@893 8154 if ( fireGlobals ) {
n@893 8155 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
n@893 8156 }
n@893 8157 // Timeout
n@893 8158 if ( s.async && s.timeout > 0 ) {
n@893 8159 timeoutTimer = setTimeout(function() {
n@893 8160 jqXHR.abort("timeout");
n@893 8161 }, s.timeout );
n@893 8162 }
n@893 8163
n@893 8164 try {
n@893 8165 state = 1;
n@893 8166 transport.send( requestHeaders, done );
n@893 8167 } catch ( e ) {
n@893 8168 // Propagate exception as error if not done
n@893 8169 if ( state < 2 ) {
n@893 8170 done( -1, e );
n@893 8171 // Simply rethrow otherwise
n@893 8172 } else {
n@893 8173 throw e;
n@893 8174 }
n@893 8175 }
n@893 8176 }
n@893 8177
n@893 8178 // Callback for when everything is done
n@893 8179 function done( status, nativeStatusText, responses, headers ) {
n@893 8180 var isSuccess, success, error, response, modified,
n@893 8181 statusText = nativeStatusText;
n@893 8182
n@893 8183 // Called once
n@893 8184 if ( state === 2 ) {
n@893 8185 return;
n@893 8186 }
n@893 8187
n@893 8188 // State is "done" now
n@893 8189 state = 2;
n@893 8190
n@893 8191 // Clear timeout if it exists
n@893 8192 if ( timeoutTimer ) {
n@893 8193 clearTimeout( timeoutTimer );
n@893 8194 }
n@893 8195
n@893 8196 // Dereference transport for early garbage collection
n@893 8197 // (no matter how long the jqXHR object will be used)
n@893 8198 transport = undefined;
n@893 8199
n@893 8200 // Cache response headers
n@893 8201 responseHeadersString = headers || "";
n@893 8202
n@893 8203 // Set readyState
n@893 8204 jqXHR.readyState = status > 0 ? 4 : 0;
n@893 8205
n@893 8206 // Determine if successful
n@893 8207 isSuccess = status >= 200 && status < 300 || status === 304;
n@893 8208
n@893 8209 // Get response data
n@893 8210 if ( responses ) {
n@893 8211 response = ajaxHandleResponses( s, jqXHR, responses );
n@893 8212 }
n@893 8213
n@893 8214 // Convert no matter what (that way responseXXX fields are always set)
n@893 8215 response = ajaxConvert( s, response, jqXHR, isSuccess );
n@893 8216
n@893 8217 // If successful, handle type chaining
n@893 8218 if ( isSuccess ) {
n@893 8219
n@893 8220 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
n@893 8221 if ( s.ifModified ) {
n@893 8222 modified = jqXHR.getResponseHeader("Last-Modified");
n@893 8223 if ( modified ) {
n@893 8224 jQuery.lastModified[ cacheURL ] = modified;
n@893 8225 }
n@893 8226 modified = jqXHR.getResponseHeader("etag");
n@893 8227 if ( modified ) {
n@893 8228 jQuery.etag[ cacheURL ] = modified;
n@893 8229 }
n@893 8230 }
n@893 8231
n@893 8232 // if no content
n@893 8233 if ( status === 204 || s.type === "HEAD" ) {
n@893 8234 statusText = "nocontent";
n@893 8235
n@893 8236 // if not modified
n@893 8237 } else if ( status === 304 ) {
n@893 8238 statusText = "notmodified";
n@893 8239
n@893 8240 // If we have data, let's convert it
n@893 8241 } else {
n@893 8242 statusText = response.state;
n@893 8243 success = response.data;
n@893 8244 error = response.error;
n@893 8245 isSuccess = !error;
n@893 8246 }
n@893 8247 } else {
n@893 8248 // Extract error from statusText and normalize for non-aborts
n@893 8249 error = statusText;
n@893 8250 if ( status || !statusText ) {
n@893 8251 statusText = "error";
n@893 8252 if ( status < 0 ) {
n@893 8253 status = 0;
n@893 8254 }
n@893 8255 }
n@893 8256 }
n@893 8257
n@893 8258 // Set data for the fake xhr object
n@893 8259 jqXHR.status = status;
n@893 8260 jqXHR.statusText = ( nativeStatusText || statusText ) + "";
n@893 8261
n@893 8262 // Success/Error
n@893 8263 if ( isSuccess ) {
n@893 8264 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
n@893 8265 } else {
n@893 8266 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
n@893 8267 }
n@893 8268
n@893 8269 // Status-dependent callbacks
n@893 8270 jqXHR.statusCode( statusCode );
n@893 8271 statusCode = undefined;
n@893 8272
n@893 8273 if ( fireGlobals ) {
n@893 8274 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
n@893 8275 [ jqXHR, s, isSuccess ? success : error ] );
n@893 8276 }
n@893 8277
n@893 8278 // Complete
n@893 8279 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
n@893 8280
n@893 8281 if ( fireGlobals ) {
n@893 8282 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
n@893 8283 // Handle the global AJAX counter
n@893 8284 if ( !( --jQuery.active ) ) {
n@893 8285 jQuery.event.trigger("ajaxStop");
n@893 8286 }
n@893 8287 }
n@893 8288 }
n@893 8289
n@893 8290 return jqXHR;
n@893 8291 },
n@893 8292
n@893 8293 getJSON: function( url, data, callback ) {
n@893 8294 return jQuery.get( url, data, callback, "json" );
n@893 8295 },
n@893 8296
n@893 8297 getScript: function( url, callback ) {
n@893 8298 return jQuery.get( url, undefined, callback, "script" );
n@893 8299 }
n@893 8300 });
n@893 8301
n@893 8302 jQuery.each( [ "get", "post" ], function( i, method ) {
n@893 8303 jQuery[ method ] = function( url, data, callback, type ) {
n@893 8304 // Shift arguments if data argument was omitted
n@893 8305 if ( jQuery.isFunction( data ) ) {
n@893 8306 type = type || callback;
n@893 8307 callback = data;
n@893 8308 data = undefined;
n@893 8309 }
n@893 8310
n@893 8311 return jQuery.ajax({
n@893 8312 url: url,
n@893 8313 type: method,
n@893 8314 dataType: type,
n@893 8315 data: data,
n@893 8316 success: callback
n@893 8317 });
n@893 8318 };
n@893 8319 });
n@893 8320
n@893 8321
n@893 8322 jQuery._evalUrl = function( url ) {
n@893 8323 return jQuery.ajax({
n@893 8324 url: url,
n@893 8325 type: "GET",
n@893 8326 dataType: "script",
n@893 8327 async: false,
n@893 8328 global: false,
n@893 8329 "throws": true
n@893 8330 });
n@893 8331 };
n@893 8332
n@893 8333
n@893 8334 jQuery.fn.extend({
n@893 8335 wrapAll: function( html ) {
n@893 8336 var wrap;
n@893 8337
n@893 8338 if ( jQuery.isFunction( html ) ) {
n@893 8339 return this.each(function( i ) {
n@893 8340 jQuery( this ).wrapAll( html.call(this, i) );
n@893 8341 });
n@893 8342 }
n@893 8343
n@893 8344 if ( this[ 0 ] ) {
n@893 8345
n@893 8346 // The elements to wrap the target around
n@893 8347 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
n@893 8348
n@893 8349 if ( this[ 0 ].parentNode ) {
n@893 8350 wrap.insertBefore( this[ 0 ] );
n@893 8351 }
n@893 8352
n@893 8353 wrap.map(function() {
n@893 8354 var elem = this;
n@893 8355
n@893 8356 while ( elem.firstElementChild ) {
n@893 8357 elem = elem.firstElementChild;
n@893 8358 }
n@893 8359
n@893 8360 return elem;
n@893 8361 }).append( this );
n@893 8362 }
n@893 8363
n@893 8364 return this;
n@893 8365 },
n@893 8366
n@893 8367 wrapInner: function( html ) {
n@893 8368 if ( jQuery.isFunction( html ) ) {
n@893 8369 return this.each(function( i ) {
n@893 8370 jQuery( this ).wrapInner( html.call(this, i) );
n@893 8371 });
n@893 8372 }
n@893 8373
n@893 8374 return this.each(function() {
n@893 8375 var self = jQuery( this ),
n@893 8376 contents = self.contents();
n@893 8377
n@893 8378 if ( contents.length ) {
n@893 8379 contents.wrapAll( html );
n@893 8380
n@893 8381 } else {
n@893 8382 self.append( html );
n@893 8383 }
n@893 8384 });
n@893 8385 },
n@893 8386
n@893 8387 wrap: function( html ) {
n@893 8388 var isFunction = jQuery.isFunction( html );
n@893 8389
n@893 8390 return this.each(function( i ) {
n@893 8391 jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
n@893 8392 });
n@893 8393 },
n@893 8394
n@893 8395 unwrap: function() {
n@893 8396 return this.parent().each(function() {
n@893 8397 if ( !jQuery.nodeName( this, "body" ) ) {
n@893 8398 jQuery( this ).replaceWith( this.childNodes );
n@893 8399 }
n@893 8400 }).end();
n@893 8401 }
n@893 8402 });
n@893 8403
n@893 8404
n@893 8405 jQuery.expr.filters.hidden = function( elem ) {
n@893 8406 // Support: Opera <= 12.12
n@893 8407 // Opera reports offsetWidths and offsetHeights less than zero on some elements
n@893 8408 return elem.offsetWidth <= 0 && elem.offsetHeight <= 0;
n@893 8409 };
n@893 8410 jQuery.expr.filters.visible = function( elem ) {
n@893 8411 return !jQuery.expr.filters.hidden( elem );
n@893 8412 };
n@893 8413
n@893 8414
n@893 8415
n@893 8416
n@893 8417 var r20 = /%20/g,
n@893 8418 rbracket = /\[\]$/,
n@893 8419 rCRLF = /\r?\n/g,
n@893 8420 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
n@893 8421 rsubmittable = /^(?:input|select|textarea|keygen)/i;
n@893 8422
n@893 8423 function buildParams( prefix, obj, traditional, add ) {
n@893 8424 var name;
n@893 8425
n@893 8426 if ( jQuery.isArray( obj ) ) {
n@893 8427 // Serialize array item.
n@893 8428 jQuery.each( obj, function( i, v ) {
n@893 8429 if ( traditional || rbracket.test( prefix ) ) {
n@893 8430 // Treat each array item as a scalar.
n@893 8431 add( prefix, v );
n@893 8432
n@893 8433 } else {
n@893 8434 // Item is non-scalar (array or object), encode its numeric index.
n@893 8435 buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
n@893 8436 }
n@893 8437 });
n@893 8438
n@893 8439 } else if ( !traditional && jQuery.type( obj ) === "object" ) {
n@893 8440 // Serialize object item.
n@893 8441 for ( name in obj ) {
n@893 8442 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
n@893 8443 }
n@893 8444
n@893 8445 } else {
n@893 8446 // Serialize scalar item.
n@893 8447 add( prefix, obj );
n@893 8448 }
n@893 8449 }
n@893 8450
n@893 8451 // Serialize an array of form elements or a set of
n@893 8452 // key/values into a query string
n@893 8453 jQuery.param = function( a, traditional ) {
n@893 8454 var prefix,
n@893 8455 s = [],
n@893 8456 add = function( key, value ) {
n@893 8457 // If value is a function, invoke it and return its value
n@893 8458 value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
n@893 8459 s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
n@893 8460 };
n@893 8461
n@893 8462 // Set traditional to true for jQuery <= 1.3.2 behavior.
n@893 8463 if ( traditional === undefined ) {
n@893 8464 traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
n@893 8465 }
n@893 8466
n@893 8467 // If an array was passed in, assume that it is an array of form elements.
n@893 8468 if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
n@893 8469 // Serialize the form elements
n@893 8470 jQuery.each( a, function() {
n@893 8471 add( this.name, this.value );
n@893 8472 });
n@893 8473
n@893 8474 } else {
n@893 8475 // If traditional, encode the "old" way (the way 1.3.2 or older
n@893 8476 // did it), otherwise encode params recursively.
n@893 8477 for ( prefix in a ) {
n@893 8478 buildParams( prefix, a[ prefix ], traditional, add );
n@893 8479 }
n@893 8480 }
n@893 8481
n@893 8482 // Return the resulting serialization
n@893 8483 return s.join( "&" ).replace( r20, "+" );
n@893 8484 };
n@893 8485
n@893 8486 jQuery.fn.extend({
n@893 8487 serialize: function() {
n@893 8488 return jQuery.param( this.serializeArray() );
n@893 8489 },
n@893 8490 serializeArray: function() {
n@893 8491 return this.map(function() {
n@893 8492 // Can add propHook for "elements" to filter or add form elements
n@893 8493 var elements = jQuery.prop( this, "elements" );
n@893 8494 return elements ? jQuery.makeArray( elements ) : this;
n@893 8495 })
n@893 8496 .filter(function() {
n@893 8497 var type = this.type;
n@893 8498
n@893 8499 // Use .is( ":disabled" ) so that fieldset[disabled] works
n@893 8500 return this.name && !jQuery( this ).is( ":disabled" ) &&
n@893 8501 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
n@893 8502 ( this.checked || !rcheckableType.test( type ) );
n@893 8503 })
n@893 8504 .map(function( i, elem ) {
n@893 8505 var val = jQuery( this ).val();
n@893 8506
n@893 8507 return val == null ?
n@893 8508 null :
n@893 8509 jQuery.isArray( val ) ?
n@893 8510 jQuery.map( val, function( val ) {
n@893 8511 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
n@893 8512 }) :
n@893 8513 { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
n@893 8514 }).get();
n@893 8515 }
n@893 8516 });
n@893 8517
n@893 8518
n@893 8519 jQuery.ajaxSettings.xhr = function() {
n@893 8520 try {
n@893 8521 return new XMLHttpRequest();
n@893 8522 } catch( e ) {}
n@893 8523 };
n@893 8524
n@893 8525 var xhrId = 0,
n@893 8526 xhrCallbacks = {},
n@893 8527 xhrSuccessStatus = {
n@893 8528 // file protocol always yields status code 0, assume 200
n@893 8529 0: 200,
n@893 8530 // Support: IE9
n@893 8531 // #1450: sometimes IE returns 1223 when it should be 204
n@893 8532 1223: 204
n@893 8533 },
n@893 8534 xhrSupported = jQuery.ajaxSettings.xhr();
n@893 8535
n@893 8536 // Support: IE9
n@893 8537 // Open requests must be manually aborted on unload (#5280)
n@893 8538 // See https://support.microsoft.com/kb/2856746 for more info
n@893 8539 if ( window.attachEvent ) {
n@893 8540 window.attachEvent( "onunload", function() {
n@893 8541 for ( var key in xhrCallbacks ) {
n@893 8542 xhrCallbacks[ key ]();
n@893 8543 }
n@893 8544 });
n@893 8545 }
n@893 8546
n@893 8547 support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
n@893 8548 support.ajax = xhrSupported = !!xhrSupported;
n@893 8549
n@893 8550 jQuery.ajaxTransport(function( options ) {
n@893 8551 var callback;
n@893 8552
n@893 8553 // Cross domain only allowed if supported through XMLHttpRequest
n@893 8554 if ( support.cors || xhrSupported && !options.crossDomain ) {
n@893 8555 return {
n@893 8556 send: function( headers, complete ) {
n@893 8557 var i,
n@893 8558 xhr = options.xhr(),
n@893 8559 id = ++xhrId;
n@893 8560
n@893 8561 xhr.open( options.type, options.url, options.async, options.username, options.password );
n@893 8562
n@893 8563 // Apply custom fields if provided
n@893 8564 if ( options.xhrFields ) {
n@893 8565 for ( i in options.xhrFields ) {
n@893 8566 xhr[ i ] = options.xhrFields[ i ];
n@893 8567 }
n@893 8568 }
n@893 8569
n@893 8570 // Override mime type if needed
n@893 8571 if ( options.mimeType && xhr.overrideMimeType ) {
n@893 8572 xhr.overrideMimeType( options.mimeType );
n@893 8573 }
n@893 8574
n@893 8575 // X-Requested-With header
n@893 8576 // For cross-domain requests, seeing as conditions for a preflight are
n@893 8577 // akin to a jigsaw puzzle, we simply never set it to be sure.
n@893 8578 // (it can always be set on a per-request basis or even using ajaxSetup)
n@893 8579 // For same-domain requests, won't change header if already provided.
n@893 8580 if ( !options.crossDomain && !headers["X-Requested-With"] ) {
n@893 8581 headers["X-Requested-With"] = "XMLHttpRequest";
n@893 8582 }
n@893 8583
n@893 8584 // Set headers
n@893 8585 for ( i in headers ) {
n@893 8586 xhr.setRequestHeader( i, headers[ i ] );
n@893 8587 }
n@893 8588
n@893 8589 // Callback
n@893 8590 callback = function( type ) {
n@893 8591 return function() {
n@893 8592 if ( callback ) {
n@893 8593 delete xhrCallbacks[ id ];
n@893 8594 callback = xhr.onload = xhr.onerror = null;
n@893 8595
n@893 8596 if ( type === "abort" ) {
n@893 8597 xhr.abort();
n@893 8598 } else if ( type === "error" ) {
n@893 8599 complete(
n@893 8600 // file: protocol always yields status 0; see #8605, #14207
n@893 8601 xhr.status,
n@893 8602 xhr.statusText
n@893 8603 );
n@893 8604 } else {
n@893 8605 complete(
n@893 8606 xhrSuccessStatus[ xhr.status ] || xhr.status,
n@893 8607 xhr.statusText,
n@893 8608 // Support: IE9
n@893 8609 // Accessing binary-data responseText throws an exception
n@893 8610 // (#11426)
n@893 8611 typeof xhr.responseText === "string" ? {
n@893 8612 text: xhr.responseText
n@893 8613 } : undefined,
n@893 8614 xhr.getAllResponseHeaders()
n@893 8615 );
n@893 8616 }
n@893 8617 }
n@893 8618 };
n@893 8619 };
n@893 8620
n@893 8621 // Listen to events
n@893 8622 xhr.onload = callback();
n@893 8623 xhr.onerror = callback("error");
n@893 8624
n@893 8625 // Create the abort callback
n@893 8626 callback = xhrCallbacks[ id ] = callback("abort");
n@893 8627
n@893 8628 try {
n@893 8629 // Do send the request (this may raise an exception)
n@893 8630 xhr.send( options.hasContent && options.data || null );
n@893 8631 } catch ( e ) {
n@893 8632 // #14683: Only rethrow if this hasn't been notified as an error yet
n@893 8633 if ( callback ) {
n@893 8634 throw e;
n@893 8635 }
n@893 8636 }
n@893 8637 },
n@893 8638
n@893 8639 abort: function() {
n@893 8640 if ( callback ) {
n@893 8641 callback();
n@893 8642 }
n@893 8643 }
n@893 8644 };
n@893 8645 }
n@893 8646 });
n@893 8647
n@893 8648
n@893 8649
n@893 8650
n@893 8651 // Install script dataType
n@893 8652 jQuery.ajaxSetup({
n@893 8653 accepts: {
n@893 8654 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
n@893 8655 },
n@893 8656 contents: {
n@893 8657 script: /(?:java|ecma)script/
n@893 8658 },
n@893 8659 converters: {
n@893 8660 "text script": function( text ) {
n@893 8661 jQuery.globalEval( text );
n@893 8662 return text;
n@893 8663 }
n@893 8664 }
n@893 8665 });
n@893 8666
n@893 8667 // Handle cache's special case and crossDomain
n@893 8668 jQuery.ajaxPrefilter( "script", function( s ) {
n@893 8669 if ( s.cache === undefined ) {
n@893 8670 s.cache = false;
n@893 8671 }
n@893 8672 if ( s.crossDomain ) {
n@893 8673 s.type = "GET";
n@893 8674 }
n@893 8675 });
n@893 8676
n@893 8677 // Bind script tag hack transport
n@893 8678 jQuery.ajaxTransport( "script", function( s ) {
n@893 8679 // This transport only deals with cross domain requests
n@893 8680 if ( s.crossDomain ) {
n@893 8681 var script, callback;
n@893 8682 return {
n@893 8683 send: function( _, complete ) {
n@893 8684 script = jQuery("<script>").prop({
n@893 8685 async: true,
n@893 8686 charset: s.scriptCharset,
n@893 8687 src: s.url
n@893 8688 }).on(
n@893 8689 "load error",
n@893 8690 callback = function( evt ) {
n@893 8691 script.remove();
n@893 8692 callback = null;
n@893 8693 if ( evt ) {
n@893 8694 complete( evt.type === "error" ? 404 : 200, evt.type );
n@893 8695 }
n@893 8696 }
n@893 8697 );
n@893 8698 document.head.appendChild( script[ 0 ] );
n@893 8699 },
n@893 8700 abort: function() {
n@893 8701 if ( callback ) {
n@893 8702 callback();
n@893 8703 }
n@893 8704 }
n@893 8705 };
n@893 8706 }
n@893 8707 });
n@893 8708
n@893 8709
n@893 8710
n@893 8711
n@893 8712 var oldCallbacks = [],
n@893 8713 rjsonp = /(=)\?(?=&|$)|\?\?/;
n@893 8714
n@893 8715 // Default jsonp settings
n@893 8716 jQuery.ajaxSetup({
n@893 8717 jsonp: "callback",
n@893 8718 jsonpCallback: function() {
n@893 8719 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
n@893 8720 this[ callback ] = true;
n@893 8721 return callback;
n@893 8722 }
n@893 8723 });
n@893 8724
n@893 8725 // Detect, normalize options and install callbacks for jsonp requests
n@893 8726 jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
n@893 8727
n@893 8728 var callbackName, overwritten, responseContainer,
n@893 8729 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
n@893 8730 "url" :
n@893 8731 typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
n@893 8732 );
n@893 8733
n@893 8734 // Handle iff the expected data type is "jsonp" or we have a parameter to set
n@893 8735 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
n@893 8736
n@893 8737 // Get callback name, remembering preexisting value associated with it
n@893 8738 callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
n@893 8739 s.jsonpCallback() :
n@893 8740 s.jsonpCallback;
n@893 8741
n@893 8742 // Insert callback into url or form data
n@893 8743 if ( jsonProp ) {
n@893 8744 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
n@893 8745 } else if ( s.jsonp !== false ) {
n@893 8746 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
n@893 8747 }
n@893 8748
n@893 8749 // Use data converter to retrieve json after script execution
n@893 8750 s.converters["script json"] = function() {
n@893 8751 if ( !responseContainer ) {
n@893 8752 jQuery.error( callbackName + " was not called" );
n@893 8753 }
n@893 8754 return responseContainer[ 0 ];
n@893 8755 };
n@893 8756
n@893 8757 // force json dataType
n@893 8758 s.dataTypes[ 0 ] = "json";
n@893 8759
n@893 8760 // Install callback
n@893 8761 overwritten = window[ callbackName ];
n@893 8762 window[ callbackName ] = function() {
n@893 8763 responseContainer = arguments;
n@893 8764 };
n@893 8765
n@893 8766 // Clean-up function (fires after converters)
n@893 8767 jqXHR.always(function() {
n@893 8768 // Restore preexisting value
n@893 8769 window[ callbackName ] = overwritten;
n@893 8770
n@893 8771 // Save back as free
n@893 8772 if ( s[ callbackName ] ) {
n@893 8773 // make sure that re-using the options doesn't screw things around
n@893 8774 s.jsonpCallback = originalSettings.jsonpCallback;
n@893 8775
n@893 8776 // save the callback name for future use
n@893 8777 oldCallbacks.push( callbackName );
n@893 8778 }
n@893 8779
n@893 8780 // Call if it was a function and we have a response
n@893 8781 if ( responseContainer && jQuery.isFunction( overwritten ) ) {
n@893 8782 overwritten( responseContainer[ 0 ] );
n@893 8783 }
n@893 8784
n@893 8785 responseContainer = overwritten = undefined;
n@893 8786 });
n@893 8787
n@893 8788 // Delegate to script
n@893 8789 return "script";
n@893 8790 }
n@893 8791 });
n@893 8792
n@893 8793
n@893 8794
n@893 8795
n@893 8796 // data: string of html
n@893 8797 // context (optional): If specified, the fragment will be created in this context, defaults to document
n@893 8798 // keepScripts (optional): If true, will include scripts passed in the html string
n@893 8799 jQuery.parseHTML = function( data, context, keepScripts ) {
n@893 8800 if ( !data || typeof data !== "string" ) {
n@893 8801 return null;
n@893 8802 }
n@893 8803 if ( typeof context === "boolean" ) {
n@893 8804 keepScripts = context;
n@893 8805 context = false;
n@893 8806 }
n@893 8807 context = context || document;
n@893 8808
n@893 8809 var parsed = rsingleTag.exec( data ),
n@893 8810 scripts = !keepScripts && [];
n@893 8811
n@893 8812 // Single tag
n@893 8813 if ( parsed ) {
n@893 8814 return [ context.createElement( parsed[1] ) ];
n@893 8815 }
n@893 8816
n@893 8817 parsed = jQuery.buildFragment( [ data ], context, scripts );
n@893 8818
n@893 8819 if ( scripts && scripts.length ) {
n@893 8820 jQuery( scripts ).remove();
n@893 8821 }
n@893 8822
n@893 8823 return jQuery.merge( [], parsed.childNodes );
n@893 8824 };
n@893 8825
n@893 8826
n@893 8827 // Keep a copy of the old load method
n@893 8828 var _load = jQuery.fn.load;
n@893 8829
n@893 8830 /**
n@893 8831 * Load a url into a page
n@893 8832 */
n@893 8833 jQuery.fn.load = function( url, params, callback ) {
n@893 8834 if ( typeof url !== "string" && _load ) {
n@893 8835 return _load.apply( this, arguments );
n@893 8836 }
n@893 8837
n@893 8838 var selector, type, response,
n@893 8839 self = this,
n@893 8840 off = url.indexOf(" ");
n@893 8841
n@893 8842 if ( off >= 0 ) {
n@893 8843 selector = jQuery.trim( url.slice( off ) );
n@893 8844 url = url.slice( 0, off );
n@893 8845 }
n@893 8846
n@893 8847 // If it's a function
n@893 8848 if ( jQuery.isFunction( params ) ) {
n@893 8849
n@893 8850 // We assume that it's the callback
n@893 8851 callback = params;
n@893 8852 params = undefined;
n@893 8853
n@893 8854 // Otherwise, build a param string
n@893 8855 } else if ( params && typeof params === "object" ) {
n@893 8856 type = "POST";
n@893 8857 }
n@893 8858
n@893 8859 // If we have elements to modify, make the request
n@893 8860 if ( self.length > 0 ) {
n@893 8861 jQuery.ajax({
n@893 8862 url: url,
n@893 8863
n@893 8864 // if "type" variable is undefined, then "GET" method will be used
n@893 8865 type: type,
n@893 8866 dataType: "html",
n@893 8867 data: params
n@893 8868 }).done(function( responseText ) {
n@893 8869
n@893 8870 // Save response for use in complete callback
n@893 8871 response = arguments;
n@893 8872
n@893 8873 self.html( selector ?
n@893 8874
n@893 8875 // If a selector was specified, locate the right elements in a dummy div
n@893 8876 // Exclude scripts to avoid IE 'Permission Denied' errors
n@893 8877 jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
n@893 8878
n@893 8879 // Otherwise use the full result
n@893 8880 responseText );
n@893 8881
n@893 8882 }).complete( callback && function( jqXHR, status ) {
n@893 8883 self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
n@893 8884 });
n@893 8885 }
n@893 8886
n@893 8887 return this;
n@893 8888 };
n@893 8889
n@893 8890
n@893 8891
n@893 8892
n@893 8893 // Attach a bunch of functions for handling common AJAX events
n@893 8894 jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) {
n@893 8895 jQuery.fn[ type ] = function( fn ) {
n@893 8896 return this.on( type, fn );
n@893 8897 };
n@893 8898 });
n@893 8899
n@893 8900
n@893 8901
n@893 8902
n@893 8903 jQuery.expr.filters.animated = function( elem ) {
n@893 8904 return jQuery.grep(jQuery.timers, function( fn ) {
n@893 8905 return elem === fn.elem;
n@893 8906 }).length;
n@893 8907 };
n@893 8908
n@893 8909
n@893 8910
n@893 8911
n@893 8912 var docElem = window.document.documentElement;
n@893 8913
n@893 8914 /**
n@893 8915 * Gets a window from an element
n@893 8916 */
n@893 8917 function getWindow( elem ) {
n@893 8918 return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
n@893 8919 }
n@893 8920
n@893 8921 jQuery.offset = {
n@893 8922 setOffset: function( elem, options, i ) {
n@893 8923 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
n@893 8924 position = jQuery.css( elem, "position" ),
n@893 8925 curElem = jQuery( elem ),
n@893 8926 props = {};
n@893 8927
n@893 8928 // Set position first, in-case top/left are set even on static elem
n@893 8929 if ( position === "static" ) {
n@893 8930 elem.style.position = "relative";
n@893 8931 }
n@893 8932
n@893 8933 curOffset = curElem.offset();
n@893 8934 curCSSTop = jQuery.css( elem, "top" );
n@893 8935 curCSSLeft = jQuery.css( elem, "left" );
n@893 8936 calculatePosition = ( position === "absolute" || position === "fixed" ) &&
n@893 8937 ( curCSSTop + curCSSLeft ).indexOf("auto") > -1;
n@893 8938
n@893 8939 // Need to be able to calculate position if either
n@893 8940 // top or left is auto and position is either absolute or fixed
n@893 8941 if ( calculatePosition ) {
n@893 8942 curPosition = curElem.position();
n@893 8943 curTop = curPosition.top;
n@893 8944 curLeft = curPosition.left;
n@893 8945
n@893 8946 } else {
n@893 8947 curTop = parseFloat( curCSSTop ) || 0;
n@893 8948 curLeft = parseFloat( curCSSLeft ) || 0;
n@893 8949 }
n@893 8950
n@893 8951 if ( jQuery.isFunction( options ) ) {
n@893 8952 options = options.call( elem, i, curOffset );
n@893 8953 }
n@893 8954
n@893 8955 if ( options.top != null ) {
n@893 8956 props.top = ( options.top - curOffset.top ) + curTop;
n@893 8957 }
n@893 8958 if ( options.left != null ) {
n@893 8959 props.left = ( options.left - curOffset.left ) + curLeft;
n@893 8960 }
n@893 8961
n@893 8962 if ( "using" in options ) {
n@893 8963 options.using.call( elem, props );
n@893 8964
n@893 8965 } else {
n@893 8966 curElem.css( props );
n@893 8967 }
n@893 8968 }
n@893 8969 };
n@893 8970
n@893 8971 jQuery.fn.extend({
n@893 8972 offset: function( options ) {
n@893 8973 if ( arguments.length ) {
n@893 8974 return options === undefined ?
n@893 8975 this :
n@893 8976 this.each(function( i ) {
n@893 8977 jQuery.offset.setOffset( this, options, i );
n@893 8978 });
n@893 8979 }
n@893 8980
n@893 8981 var docElem, win,
n@893 8982 elem = this[ 0 ],
n@893 8983 box = { top: 0, left: 0 },
n@893 8984 doc = elem && elem.ownerDocument;
n@893 8985
n@893 8986 if ( !doc ) {
n@893 8987 return;
n@893 8988 }
n@893 8989
n@893 8990 docElem = doc.documentElement;
n@893 8991
n@893 8992 // Make sure it's not a disconnected DOM node
n@893 8993 if ( !jQuery.contains( docElem, elem ) ) {
n@893 8994 return box;
n@893 8995 }
n@893 8996
n@893 8997 // Support: BlackBerry 5, iOS 3 (original iPhone)
n@893 8998 // If we don't have gBCR, just use 0,0 rather than error
n@893 8999 if ( typeof elem.getBoundingClientRect !== strundefined ) {
n@893 9000 box = elem.getBoundingClientRect();
n@893 9001 }
n@893 9002 win = getWindow( doc );
n@893 9003 return {
n@893 9004 top: box.top + win.pageYOffset - docElem.clientTop,
n@893 9005 left: box.left + win.pageXOffset - docElem.clientLeft
n@893 9006 };
n@893 9007 },
n@893 9008
n@893 9009 position: function() {
n@893 9010 if ( !this[ 0 ] ) {
n@893 9011 return;
n@893 9012 }
n@893 9013
n@893 9014 var offsetParent, offset,
n@893 9015 elem = this[ 0 ],
n@893 9016 parentOffset = { top: 0, left: 0 };
n@893 9017
n@893 9018 // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent
n@893 9019 if ( jQuery.css( elem, "position" ) === "fixed" ) {
n@893 9020 // Assume getBoundingClientRect is there when computed position is fixed
n@893 9021 offset = elem.getBoundingClientRect();
n@893 9022
n@893 9023 } else {
n@893 9024 // Get *real* offsetParent
n@893 9025 offsetParent = this.offsetParent();
n@893 9026
n@893 9027 // Get correct offsets
n@893 9028 offset = this.offset();
n@893 9029 if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
n@893 9030 parentOffset = offsetParent.offset();
n@893 9031 }
n@893 9032
n@893 9033 // Add offsetParent borders
n@893 9034 parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
n@893 9035 parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
n@893 9036 }
n@893 9037
n@893 9038 // Subtract parent offsets and element margins
n@893 9039 return {
n@893 9040 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
n@893 9041 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
n@893 9042 };
n@893 9043 },
n@893 9044
n@893 9045 offsetParent: function() {
n@893 9046 return this.map(function() {
n@893 9047 var offsetParent = this.offsetParent || docElem;
n@893 9048
n@893 9049 while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) {
n@893 9050 offsetParent = offsetParent.offsetParent;
n@893 9051 }
n@893 9052
n@893 9053 return offsetParent || docElem;
n@893 9054 });
n@893 9055 }
n@893 9056 });
n@893 9057
n@893 9058 // Create scrollLeft and scrollTop methods
n@893 9059 jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
n@893 9060 var top = "pageYOffset" === prop;
n@893 9061
n@893 9062 jQuery.fn[ method ] = function( val ) {
n@893 9063 return access( this, function( elem, method, val ) {
n@893 9064 var win = getWindow( elem );
n@893 9065
n@893 9066 if ( val === undefined ) {
n@893 9067 return win ? win[ prop ] : elem[ method ];
n@893 9068 }
n@893 9069
n@893 9070 if ( win ) {
n@893 9071 win.scrollTo(
n@893 9072 !top ? val : window.pageXOffset,
n@893 9073 top ? val : window.pageYOffset
n@893 9074 );
n@893 9075
n@893 9076 } else {
n@893 9077 elem[ method ] = val;
n@893 9078 }
n@893 9079 }, method, val, arguments.length, null );
n@893 9080 };
n@893 9081 });
n@893 9082
n@893 9083 // Support: Safari<7+, Chrome<37+
n@893 9084 // Add the top/left cssHooks using jQuery.fn.position
n@893 9085 // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
n@893 9086 // Blink bug: https://code.google.com/p/chromium/issues/detail?id=229280
n@893 9087 // getComputedStyle returns percent when specified for top/left/bottom/right;
n@893 9088 // rather than make the css module depend on the offset module, just check for it here
n@893 9089 jQuery.each( [ "top", "left" ], function( i, prop ) {
n@893 9090 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
n@893 9091 function( elem, computed ) {
n@893 9092 if ( computed ) {
n@893 9093 computed = curCSS( elem, prop );
n@893 9094 // If curCSS returns percentage, fallback to offset
n@893 9095 return rnumnonpx.test( computed ) ?
n@893 9096 jQuery( elem ).position()[ prop ] + "px" :
n@893 9097 computed;
n@893 9098 }
n@893 9099 }
n@893 9100 );
n@893 9101 });
n@893 9102
n@893 9103
n@893 9104 // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
n@893 9105 jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
n@893 9106 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
n@893 9107 // Margin is only for outerHeight, outerWidth
n@893 9108 jQuery.fn[ funcName ] = function( margin, value ) {
n@893 9109 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
n@893 9110 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
n@893 9111
n@893 9112 return access( this, function( elem, type, value ) {
n@893 9113 var doc;
n@893 9114
n@893 9115 if ( jQuery.isWindow( elem ) ) {
n@893 9116 // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
n@893 9117 // isn't a whole lot we can do. See pull request at this URL for discussion:
n@893 9118 // https://github.com/jquery/jquery/pull/764
n@893 9119 return elem.document.documentElement[ "client" + name ];
n@893 9120 }
n@893 9121
n@893 9122 // Get document width or height
n@893 9123 if ( elem.nodeType === 9 ) {
n@893 9124 doc = elem.documentElement;
n@893 9125
n@893 9126 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
n@893 9127 // whichever is greatest
n@893 9128 return Math.max(
n@893 9129 elem.body[ "scroll" + name ], doc[ "scroll" + name ],
n@893 9130 elem.body[ "offset" + name ], doc[ "offset" + name ],
n@893 9131 doc[ "client" + name ]
n@893 9132 );
n@893 9133 }
n@893 9134
n@893 9135 return value === undefined ?
n@893 9136 // Get width or height on the element, requesting but not forcing parseFloat
n@893 9137 jQuery.css( elem, type, extra ) :
n@893 9138
n@893 9139 // Set width or height on the element
n@893 9140 jQuery.style( elem, type, value, extra );
n@893 9141 }, type, chainable ? margin : undefined, chainable, null );
n@893 9142 };
n@893 9143 });
n@893 9144 });
n@893 9145
n@893 9146
n@893 9147 // The number of elements contained in the matched element set
n@893 9148 jQuery.fn.size = function() {
n@893 9149 return this.length;
n@893 9150 };
n@893 9151
n@893 9152 jQuery.fn.andSelf = jQuery.fn.addBack;
n@893 9153
n@893 9154
n@893 9155
n@893 9156
n@893 9157 // Register as a named AMD module, since jQuery can be concatenated with other
n@893 9158 // files that may use define, but not via a proper concatenation script that
n@893 9159 // understands anonymous AMD modules. A named AMD is safest and most robust
n@893 9160 // way to register. Lowercase jquery is used because AMD module names are
n@893 9161 // derived from file names, and jQuery is normally delivered in a lowercase
n@893 9162 // file name. Do this after creating the global so that if an AMD module wants
n@893 9163 // to call noConflict to hide this version of jQuery, it will work.
n@893 9164
n@893 9165 // Note that for maximum portability, libraries that are not jQuery should
n@893 9166 // declare themselves as anonymous modules, and avoid setting a global if an
n@893 9167 // AMD loader is present. jQuery is a special case. For more information, see
n@893 9168 // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
n@893 9169
n@893 9170 if ( typeof define === "function" && define.amd ) {
n@893 9171 define( "jquery", [], function() {
n@893 9172 return jQuery;
n@893 9173 });
n@893 9174 }
n@893 9175
n@893 9176
n@893 9177
n@893 9178
n@893 9179 var
n@893 9180 // Map over jQuery in case of overwrite
n@893 9181 _jQuery = window.jQuery,
n@893 9182
n@893 9183 // Map over the $ in case of overwrite
n@893 9184 _$ = window.$;
n@893 9185
n@893 9186 jQuery.noConflict = function( deep ) {
n@893 9187 if ( window.$ === jQuery ) {
n@893 9188 window.$ = _$;
n@893 9189 }
n@893 9190
n@893 9191 if ( deep && window.jQuery === jQuery ) {
n@893 9192 window.jQuery = _jQuery;
n@893 9193 }
n@893 9194
n@893 9195 return jQuery;
n@893 9196 };
n@893 9197
n@893 9198 // Expose jQuery and $ identifiers, even in AMD
n@893 9199 // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
n@893 9200 // and CommonJS for browser emulators (#13566)
n@893 9201 if ( typeof noGlobal === strundefined ) {
n@893 9202 window.jQuery = window.$ = jQuery;
n@893 9203 }
n@893 9204
n@893 9205
n@893 9206
n@893 9207
n@893 9208 return jQuery;
n@893 9209
n@893 9210 }));