2
* jQuery JavaScript Library v1.11.1
8
* Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
9
* Released under the MIT license
10
* http://jquery.org/license
12
* Date: 2014-05-01T17:42Z
15
(function( global, factory ) {
17
if ( typeof module === "object" && typeof module.exports === "object" ) {
18
// For CommonJS and CommonJS-like environments where a proper window is present,
19
// execute the factory and get jQuery
20
// For environments that do not inherently posses a window with a document
21
// (such as Node.js), expose a jQuery-making factory as module.exports
22
// This accentuates the need for the creation of a real window
23
// e.g. var jQuery = require("jquery")(window);
24
// See ticket #14549 for more info
25
module.exports = global.document ?
26
factory( global, true ) :
29
throw new Error( "jQuery requires a window with a document" );
37
// Pass this if window is not defined yet
38
}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
40
// Can't do this because several apps including ASP.NET trace
41
// the stack via arguments.caller.callee and Firefox dies if
42
// you try to trace through "use strict" call chains. (#13335)
43
// Support: Firefox 18+
48
var slice = deletedIds.slice;
50
var concat = deletedIds.concat;
52
var push = deletedIds.push;
54
var indexOf = deletedIds.indexOf;
58
var toString = class2type.toString;
60
var hasOwn = class2type.hasOwnProperty;
69
// Define a local copy of jQuery
70
jQuery = function( selector, context ) {
71
// The jQuery object is actually just the init constructor 'enhanced'
72
// Need init if jQuery is called (just allow error to be thrown if not included)
73
return new jQuery.fn.init( selector, context );
76
// Support: Android<4.1, IE<9
77
// Make sure we trim BOM and NBSP
78
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
80
// Matches dashed string for camelizing
82
rdashAlpha = /-([\da-z])/gi,
84
// Used by jQuery.camelCase as callback to replace()
85
fcamelCase = function( all, letter ) {
86
return letter.toUpperCase();
89
jQuery.fn = jQuery.prototype = {
90
// The current version of jQuery being used
95
// Start with an empty selector
98
// The default length of a jQuery object is 0
101
toArray: function() {
102
return slice.call( this );
105
// Get the Nth element in the matched element set OR
106
// Get the whole matched element set as a clean array
107
get: function( num ) {
110
// Return just the one element from the set
111
( num < 0 ? this[ num + this.length ] : this[ num ] ) :
113
// Return all the elements in a clean array
117
// Take an array of elements and push it onto the stack
118
// (returning the new matched element set)
119
pushStack: function( elems ) {
121
// Build a new jQuery matched element set
122
var ret = jQuery.merge( this.constructor(), elems );
124
// Add the old object onto the stack (as a reference)
125
ret.prevObject = this;
126
ret.context = this.context;
128
// Return the newly-formed element set
132
// Execute a callback for every element in the matched set.
133
// (You can seed the arguments with an array of args, but this is
134
// only used internally.)
135
each: function( callback, args ) {
136
return jQuery.each( this, callback, args );
139
map: function( callback ) {
140
return this.pushStack( jQuery.map(this, function( elem, i ) {
141
return callback.call( elem, i, elem );
146
return this.pushStack( slice.apply( this, arguments ) );
154
return this.eq( -1 );
158
var len = this.length,
159
j = +i + ( i < 0 ? len : 0 );
160
return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
164
return this.prevObject || this.constructor(null);
167
// For internal use only.
168
// Behaves like an Array's method, not like a jQuery method.
170
sort: deletedIds.sort,
171
splice: deletedIds.splice
174
jQuery.extend = jQuery.fn.extend = function() {
175
var src, copyIsArray, copy, name, options, clone,
176
target = arguments[0] || {},
178
length = arguments.length,
181
// Handle a deep copy situation
182
if ( typeof target === "boolean" ) {
185
// skip the boolean and the target
186
target = arguments[ i ] || {};
190
// Handle case when target is a string or something (possible in deep copy)
191
if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
195
// extend jQuery itself if only one argument is passed
196
if ( i === length ) {
201
for ( ; i < length; i++ ) {
202
// Only deal with non-null/undefined values
203
if ( (options = arguments[ i ]) != null ) {
204
// Extend the base object
205
for ( name in options ) {
206
src = target[ name ];
207
copy = options[ name ];
209
// Prevent never-ending loop
210
if ( target === copy ) {
214
// Recurse if we're merging plain objects or arrays
215
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
218
clone = src && jQuery.isArray(src) ? src : [];
221
clone = src && jQuery.isPlainObject(src) ? src : {};
224
// Never move original objects, clone them
225
target[ name ] = jQuery.extend( deep, clone, copy );
227
// Don't bring in undefined values
228
} else if ( copy !== undefined ) {
229
target[ name ] = copy;
235
// Return the modified object
240
// Unique for each copy of jQuery on the page
241
expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
243
// Assume jQuery is ready without the ready module
246
error: function( msg ) {
247
throw new Error( msg );
252
// See test/unit/core.js for details concerning isFunction.
253
// Since version 1.3, DOM methods and functions like alert
254
// aren't supported. They return false on IE (#2968).
255
isFunction: function( obj ) {
256
return jQuery.type(obj) === "function";
259
isArray: Array.isArray || function( obj ) {
260
return jQuery.type(obj) === "array";
263
isWindow: function( obj ) {
264
/* jshint eqeqeq: false */
265
return obj != null && obj == obj.window;
268
isNumeric: function( obj ) {
269
// parseFloat NaNs numeric-cast false positives (null|true|false|"")
270
// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
271
// subtraction forces infinities to NaN
272
return !jQuery.isArray( obj ) && obj - parseFloat( obj ) >= 0;
275
isEmptyObject: function( obj ) {
277
for ( name in obj ) {
283
isPlainObject: function( obj ) {
286
// Must be an Object.
287
// Because of IE, we also have to check the presence of the constructor property.
288
// Make sure that DOM nodes and window objects don't pass through, as well
289
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
294
// Not own constructor property must be Object
295
if ( obj.constructor &&
296
!hasOwn.call(obj, "constructor") &&
297
!hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
301
// IE8,9 Will throw exceptions on certain host objects #9897
306
// Handle iteration over inherited properties before own properties.
307
if ( support.ownLast ) {
309
return hasOwn.call( obj, key );
313
// Own properties are enumerated firstly, so to speed up,
314
// if last one is own, then all properties are own.
315
for ( key in obj ) {}
317
return key === undefined || hasOwn.call( obj, key );
320
type: function( obj ) {
324
return typeof obj === "object" || typeof obj === "function" ?
325
class2type[ toString.call(obj) ] || "object" :
329
// Evaluates a script in a global context
330
// Workarounds based on findings by Jim Driscoll
331
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
332
globalEval: function( data ) {
333
if ( data && jQuery.trim( data ) ) {
334
// We use execScript on Internet Explorer
335
// We use an anonymous function so that context is window
336
// rather than jQuery in Firefox
337
( window.execScript || function( data ) {
338
window[ "eval" ].call( window, data );
343
// Convert dashed to camelCase; used by the css and data modules
344
// Microsoft forgot to hump their vendor prefix (#9572)
345
camelCase: function( string ) {
346
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
349
nodeName: function( elem, name ) {
350
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
353
// args is for internal usage only
354
each: function( obj, callback, args ) {
358
isArray = isArraylike( obj );
362
for ( ; i < length; i++ ) {
363
value = callback.apply( obj[ i ], args );
365
if ( value === false ) {
371
value = callback.apply( obj[ i ], args );
373
if ( value === false ) {
379
// A special, fast, case for the most common use of each
382
for ( ; i < length; i++ ) {
383
value = callback.call( obj[ i ], i, obj[ i ] );
385
if ( value === false ) {
391
value = callback.call( obj[ i ], i, obj[ i ] );
393
if ( value === false ) {
403
// Support: Android<4.1, IE<9
404
trim: function( text ) {
405
return text == null ?
407
( text + "" ).replace( rtrim, "" );
410
// results is for internal usage only
411
makeArray: function( arr, results ) {
412
var ret = results || [];
415
if ( isArraylike( Object(arr) ) ) {
417
typeof arr === "string" ?
421
push.call( ret, arr );
428
inArray: function( elem, arr, i ) {
433
return indexOf.call( arr, elem, i );
437
i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
439
for ( ; i < len; i++ ) {
440
// Skip accessing in sparse arrays
441
if ( i in arr && arr[ i ] === elem ) {
450
merge: function( first, second ) {
451
var len = +second.length,
456
first[ i++ ] = second[ j++ ];
460
// Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists)
462
while ( second[j] !== undefined ) {
463
first[ i++ ] = second[ j++ ];
472
grep: function( elems, callback, invert ) {
476
length = elems.length,
477
callbackExpect = !invert;
479
// Go through the array, only saving the items
480
// that pass the validator function
481
for ( ; i < length; i++ ) {
482
callbackInverse = !callback( elems[ i ], i );
483
if ( callbackInverse !== callbackExpect ) {
484
matches.push( elems[ i ] );
491
// arg is for internal usage only
492
map: function( elems, callback, arg ) {
495
length = elems.length,
496
isArray = isArraylike( elems ),
499
// Go through the array, translating each of the items to their new values
501
for ( ; i < length; i++ ) {
502
value = callback( elems[ i ], i, arg );
504
if ( value != null ) {
509
// Go through every key on the object,
512
value = callback( elems[ i ], i, arg );
514
if ( value != null ) {
520
// Flatten any nested arrays
521
return concat.apply( [], ret );
524
// A global GUID counter for objects
527
// Bind a function to a context, optionally partially applying any
529
proxy: function( fn, context ) {
530
var args, proxy, tmp;
532
if ( typeof context === "string" ) {
538
// Quick check to determine if target is callable, in the spec
539
// this throws a TypeError, but we will just return undefined.
540
if ( !jQuery.isFunction( fn ) ) {
545
args = slice.call( arguments, 2 );
547
return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
550
// Set the guid of unique handler to the same of original handler, so it can be removed
551
proxy.guid = fn.guid = fn.guid || jQuery.guid++;
557
return +( new Date() );
560
// jQuery.support is not used in Core but other projects attach their
561
// properties to it so it needs to exist.
565
// Populate the class2type map
566
jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
567
class2type[ "[object " + name + "]" ] = name.toLowerCase();
570
function isArraylike( obj ) {
571
var length = obj.length,
572
type = jQuery.type( obj );
574
if ( type === "function" || jQuery.isWindow( obj ) ) {
578
if ( obj.nodeType === 1 && length ) {
582
return type === "array" || length === 0 ||
583
typeof length === "number" && length > 0 && ( length - 1 ) in obj;
587
* Sizzle CSS Selector Engine v1.10.19
588
* http://sizzlejs.com/
590
* Copyright 2013 jQuery Foundation, Inc. and other contributors
591
* Released under the MIT license
592
* http://jquery.org/license
596
(function( window ) {
610
// Local document vars
620
// Instance-specific data
621
expando = "sizzle" + -(new Date()),
622
preferredDoc = window.document,
625
classCache = createCache(),
626
tokenCache = createCache(),
627
compilerCache = createCache(),
628
sortOrder = function( a, b ) {
635
// General-purpose constants
636
strundefined = typeof undefined,
637
MAX_NEGATIVE = 1 << 31,
640
hasOwn = ({}).hasOwnProperty,
643
push_native = arr.push,
646
// Use a stripped-down indexOf if we can't use a native one
647
indexOf = arr.indexOf || function( elem ) {
650
for ( ; i < len; i++ ) {
651
if ( this[i] === elem ) {
658
booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
660
// Regular expressions
662
// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
663
whitespace = "[\\x20\\t\\r\\n\\f]",
664
// http://www.w3.org/TR/css3-syntax/#characters
665
characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
667
// Loosely modeled on CSS identifier characters
668
// An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
669
// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
670
identifier = characterEncoding.replace( "w", "w#" ),
672
// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
673
attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace +
674
// Operator (capture 2)
675
"*([*^$|!~]?=)" + whitespace +
676
// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
677
"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
680
pseudos = ":(" + characterEncoding + ")(?:\\((" +
681
// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
682
// 1. quoted (capture 3; capture 4 or capture 5)
683
"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
684
// 2. simple (capture 6)
685
"((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
686
// 3. anything else (capture 2)
690
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
691
rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
693
rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
694
rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
696
rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
698
rpseudo = new RegExp( pseudos ),
699
ridentifier = new RegExp( "^" + identifier + "$" ),
702
"ID": new RegExp( "^#(" + characterEncoding + ")" ),
703
"CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
704
"TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
705
"ATTR": new RegExp( "^" + attributes ),
706
"PSEUDO": new RegExp( "^" + pseudos ),
707
"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
708
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
709
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
710
"bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
711
// For use in libraries implementing .is()
712
// We use this for POS matching in `select`
713
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
714
whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
717
rinputs = /^(?:input|select|textarea|button)$/i,
720
rnative = /^[^{]+\{\s*\[native \w/,
722
// Easily-parseable/retrievable ID or TAG or CLASS selectors
723
rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
728
// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
729
runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
730
funescape = function( _, escaped, escapedWhitespace ) {
731
var high = "0x" + escaped - 0x10000;
732
// NaN means non-codepoint
733
// Support: Firefox<24
734
// Workaround erroneous numeric interpretation of +"0x"
735
return high !== high || escapedWhitespace ?
739
String.fromCharCode( high + 0x10000 ) :
740
// Supplemental Plane codepoint (surrogate pair)
741
String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
744
// Optimize for push.apply( _, NodeList )
747
(arr = slice.call( preferredDoc.childNodes )),
748
preferredDoc.childNodes
750
// Support: Android<4.0
751
// Detect silently failing push.apply
752
arr[ preferredDoc.childNodes.length ].nodeType;
754
push = { apply: arr.length ?
756
// Leverage slice if possible
757
function( target, els ) {
758
push_native.apply( target, slice.call(els) );
762
// Otherwise append directly
763
function( target, els ) {
764
var j = target.length,
766
// Can't trust NodeList.length
767
while ( (target[j++] = els[i++]) ) {}
768
target.length = j - 1;
773
function Sizzle( selector, context, results, seed ) {
774
var match, elem, m, nodeType,
776
i, groups, old, nid, newContext, newSelector;
778
if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
779
setDocument( context );
782
context = context || document;
783
results = results || [];
785
if ( !selector || typeof selector !== "string" ) {
789
if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
793
if ( documentIsHTML && !seed ) {
796
if ( (match = rquickExpr.exec( selector )) ) {
797
// Speed-up: Sizzle("#ID")
798
if ( (m = match[1]) ) {
799
if ( nodeType === 9 ) {
800
elem = context.getElementById( m );
801
// Check parentNode to catch when Blackberry 4.6 returns
802
// nodes that are no longer in the document (jQuery #6963)
803
if ( elem && elem.parentNode ) {
804
// Handle the case where IE, Opera, and Webkit return items
805
// by name instead of ID
806
if ( elem.id === m ) {
807
results.push( elem );
814
// Context is not a document
815
if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
816
contains( context, elem ) && elem.id === m ) {
817
results.push( elem );
822
// Speed-up: Sizzle("TAG")
823
} else if ( match[2] ) {
824
push.apply( results, context.getElementsByTagName( selector ) );
827
// Speed-up: Sizzle(".CLASS")
828
} else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) {
829
push.apply( results, context.getElementsByClassName( m ) );
835
if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
837
newContext = context;
838
newSelector = nodeType === 9 && selector;
840
// qSA works strangely on Element-rooted queries
841
// We can work around this by specifying an extra ID on the root
842
// and working up from there (Thanks to Andrew Dupont for the technique)
843
// IE 8 doesn't work on object elements
844
if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
845
groups = tokenize( selector );
847
if ( (old = context.getAttribute("id")) ) {
848
nid = old.replace( rescape, "\\$&" );
850
context.setAttribute( "id", nid );
852
nid = "[id='" + nid + "'] ";
856
groups[i] = nid + toSelector( groups[i] );
858
newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context;
859
newSelector = groups.join(",");
865
newContext.querySelectorAll( newSelector )
871
context.removeAttribute("id");
879
return select( selector.replace( rtrim, "$1" ), context, results, seed );
883
* Create key-value caches of limited size
884
* @returns {Function(string, Object)} Returns the Object data after storing it on itself with
885
* property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
886
* deleting the oldest entry
888
function createCache() {
891
function cache( key, value ) {
892
// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
893
if ( keys.push( key + " " ) > Expr.cacheLength ) {
894
// Only keep the most recent entries
895
delete cache[ keys.shift() ];
897
return (cache[ key + " " ] = value);
903
* Mark a function for special use by Sizzle
904
* @param {Function} fn The function to mark
906
function markFunction( fn ) {
907
fn[ expando ] = true;
912
* Support testing using an element
913
* @param {Function} fn Passed the created div and expects a boolean result
915
function assert( fn ) {
916
var div = document.createElement("div");
923
// Remove from its parent by default
924
if ( div.parentNode ) {
925
div.parentNode.removeChild( div );
927
// release memory in IE
933
* Adds the same handler for all of the specified attrs
934
* @param {String} attrs Pipe-separated list of attributes
935
* @param {Function} handler The method that will be applied
937
function addHandle( attrs, handler ) {
938
var arr = attrs.split("|"),
942
Expr.attrHandle[ arr[i] ] = handler;
947
* Checks document order of two siblings
950
* @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
952
function siblingCheck( a, b ) {
954
diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
955
( ~b.sourceIndex || MAX_NEGATIVE ) -
956
( ~a.sourceIndex || MAX_NEGATIVE );
958
// Use IE sourceIndex if available on both nodes
963
// Check if b follows a
965
while ( (cur = cur.nextSibling) ) {
976
* Returns a function to use in pseudos for input types
977
* @param {String} type
979
function createInputPseudo( type ) {
980
return function( elem ) {
981
var name = elem.nodeName.toLowerCase();
982
return name === "input" && elem.type === type;
987
* Returns a function to use in pseudos for buttons
988
* @param {String} type
990
function createButtonPseudo( type ) {
991
return function( elem ) {
992
var name = elem.nodeName.toLowerCase();
993
return (name === "input" || name === "button") && elem.type === type;
998
* Returns a function to use in pseudos for positionals
999
* @param {Function} fn
1001
function createPositionalPseudo( fn ) {
1002
return markFunction(function( argument ) {
1003
argument = +argument;
1004
return markFunction(function( seed, matches ) {
1006
matchIndexes = fn( [], seed.length, argument ),
1007
i = matchIndexes.length;
1009
// Match elements found at the specified indexes
1011
if ( seed[ (j = matchIndexes[i]) ] ) {
1012
seed[j] = !(matches[j] = seed[j]);
1020
* Checks a node for validity as a Sizzle context
1021
* @param {Element|Object=} context
1022
* @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
1024
function testContext( context ) {
1025
return context && typeof context.getElementsByTagName !== strundefined && context;
1028
// Expose support vars for convenience
1029
support = Sizzle.support = {};
1033
* @param {Element|Object} elem An element or a document
1034
* @returns {Boolean} True iff elem is a non-HTML XML node
1036
isXML = Sizzle.isXML = function( elem ) {
1037
// documentElement is verified for cases where it doesn't yet exist
1038
// (such as loading iframes in IE - #4833)
1039
var documentElement = elem && (elem.ownerDocument || elem).documentElement;
1040
return documentElement ? documentElement.nodeName !== "HTML" : false;
1044
* Sets document-related variables once based on the current document
1045
* @param {Element|Object} [doc] An element or document object to use to set the document
1046
* @returns {Object} Returns the current document
1048
setDocument = Sizzle.setDocument = function( node ) {
1050
doc = node ? node.ownerDocument || node : preferredDoc,
1051
parent = doc.defaultView;
1053
// If no document and documentElement is available, return
1054
if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
1060
docElem = doc.documentElement;
1063
documentIsHTML = !isXML( doc );
1066
// If iframe document is assigned to "document" variable and if iframe has been reloaded,
1067
// IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
1068
// IE6-8 do not support the defaultView property so parent will be undefined
1069
if ( parent && parent !== parent.top ) {
1070
// IE11 does not have attachEvent, so all must suffer
1071
if ( parent.addEventListener ) {
1072
parent.addEventListener( "unload", function() {
1075
} else if ( parent.attachEvent ) {
1076
parent.attachEvent( "onunload", function() {
1083
---------------------------------------------------------------------- */
1086
// Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans)
1087
support.attributes = assert(function( div ) {
1088
div.className = "i";
1089
return !div.getAttribute("className");
1093
---------------------------------------------------------------------- */
1095
// Check if getElementsByTagName("*") returns only elements
1096
support.getElementsByTagName = assert(function( div ) {
1097
div.appendChild( doc.createComment("") );
1098
return !div.getElementsByTagName("*").length;
1101
// Check if getElementsByClassName can be trusted
1102
support.getElementsByClassName = rnative.test( doc.getElementsByClassName ) && assert(function( div ) {
1103
div.innerHTML = "<div class='a'></div><div class='a i'></div>";
1105
// Support: Safari<4
1106
// Catch class over-caching
1107
div.firstChild.className = "i";
1108
// Support: Opera<10
1109
// Catch gEBCN failure to find non-leading classes
1110
return div.getElementsByClassName("i").length === 2;
1114
// Check if getElementById returns elements by name
1115
// The broken getElementById methods don't pick up programatically-set names,
1116
// so use a roundabout getElementsByName test
1117
support.getById = assert(function( div ) {
1118
docElem.appendChild( div ).id = expando;
1119
return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
1122
// ID find and filter
1123
if ( support.getById ) {
1124
Expr.find["ID"] = function( id, context ) {
1125
if ( typeof context.getElementById !== strundefined && documentIsHTML ) {
1126
var m = context.getElementById( id );
1127
// Check parentNode to catch when Blackberry 4.6 returns
1128
// nodes that are no longer in the document #6963
1129
return m && m.parentNode ? [ m ] : [];
1132
Expr.filter["ID"] = function( id ) {
1133
var attrId = id.replace( runescape, funescape );
1134
return function( elem ) {
1135
return elem.getAttribute("id") === attrId;
1140
// getElementById is not reliable as a find shortcut
1141
delete Expr.find["ID"];
1143
Expr.filter["ID"] = function( id ) {
1144
var attrId = id.replace( runescape, funescape );
1145
return function( elem ) {
1146
var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
1147
return node && node.value === attrId;
1153
Expr.find["TAG"] = support.getElementsByTagName ?
1154
function( tag, context ) {
1155
if ( typeof context.getElementsByTagName !== strundefined ) {
1156
return context.getElementsByTagName( tag );
1159
function( tag, context ) {
1163
results = context.getElementsByTagName( tag );
1165
// Filter out possible comments
1166
if ( tag === "*" ) {
1167
while ( (elem = results[i++]) ) {
1168
if ( elem.nodeType === 1 ) {
1179
Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
1180
if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) {
1181
return context.getElementsByClassName( className );
1185
/* QSA/matchesSelector
1186
---------------------------------------------------------------------- */
1188
// QSA and matchesSelector support
1190
// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
1193
// qSa(:focus) reports false when true (Chrome 21)
1194
// We allow this because of a bug in IE8/9 that throws an error
1195
// whenever `document.activeElement` is accessed on an iframe
1196
// So, we allow :focus to pass through QSA all the time to avoid the IE error
1197
// See http://bugs.jquery.com/ticket/13378
1200
if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
1202
// Regex strategy adopted from Diego Perini
1203
assert(function( div ) {
1204
// Select is set to empty string on purpose
1205
// This is to test IE's treatment of not explicitly
1206
// setting a boolean content attribute,
1207
// since its presence should be enough
1208
// http://bugs.jquery.com/ticket/12359
1209
div.innerHTML = "<select msallowclip=''><option selected=''></option></select>";
1211
// Support: IE8, Opera 11-12.16
1212
// Nothing should be selected when empty strings follow ^= or $= or *=
1213
// The test attribute must be unknown in Opera but "safe" for WinRT
1214
// http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
1215
if ( div.querySelectorAll("[msallowclip^='']").length ) {
1216
rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
1220
// Boolean attributes and "value" are not treated correctly
1221
if ( !div.querySelectorAll("[selected]").length ) {
1222
rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
1225
// Webkit/Opera - :checked should return selected option elements
1226
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1227
// IE8 throws error here and will not see later tests
1228
if ( !div.querySelectorAll(":checked").length ) {
1229
rbuggyQSA.push(":checked");
1233
assert(function( div ) {
1234
// Support: Windows 8 Native Apps
1235
// The type and name attributes are restricted during .innerHTML assignment
1236
var input = doc.createElement("input");
1237
input.setAttribute( "type", "hidden" );
1238
div.appendChild( input ).setAttribute( "name", "D" );
1241
// Enforce case-sensitivity of name attribute
1242
if ( div.querySelectorAll("[name=d]").length ) {
1243
rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
1246
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
1247
// IE8 throws error here and will not see later tests
1248
if ( !div.querySelectorAll(":enabled").length ) {
1249
rbuggyQSA.push( ":enabled", ":disabled" );
1252
// Opera 10-11 does not throw on post-comma invalid pseudos
1253
div.querySelectorAll("*,:x");
1254
rbuggyQSA.push(",.*:");
1258
if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
1259
docElem.webkitMatchesSelector ||
1260
docElem.mozMatchesSelector ||
1261
docElem.oMatchesSelector ||
1262
docElem.msMatchesSelector) )) ) {
1264
assert(function( div ) {
1265
// Check to see if it's possible to do matchesSelector
1266
// on a disconnected node (IE 9)
1267
support.disconnectedMatch = matches.call( div, "div" );
1269
// This should fail with an exception
1270
// Gecko does not error, returns false instead
1271
matches.call( div, "[s!='']:x" );
1272
rbuggyMatches.push( "!=", pseudos );
1276
rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
1277
rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
1280
---------------------------------------------------------------------- */
1281
hasCompare = rnative.test( docElem.compareDocumentPosition );
1283
// Element contains another
1284
// Purposefully does not implement inclusive descendent
1285
// As in, an element does not contain itself
1286
contains = hasCompare || rnative.test( docElem.contains ) ?
1288
var adown = a.nodeType === 9 ? a.documentElement : a,
1289
bup = b && b.parentNode;
1290
return a === bup || !!( bup && bup.nodeType === 1 && (
1292
adown.contains( bup ) :
1293
a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
1298
while ( (b = b.parentNode) ) {
1308
---------------------------------------------------------------------- */
1310
// Document order sorting
1311
sortOrder = hasCompare ?
1314
// Flag for duplicate removal
1316
hasDuplicate = true;
1320
// Sort on method existence if only one input has compareDocumentPosition
1321
var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
1326
// Calculate position if both inputs belong to the same document
1327
compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
1328
a.compareDocumentPosition( b ) :
1330
// Otherwise we know they are disconnected
1333
// Disconnected nodes
1335
(!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
1337
// Choose the first element that is related to our preferred document
1338
if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
1341
if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
1345
// Maintain original order
1347
( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
1351
return compare & 4 ? -1 : 1;
1354
// Exit early if the nodes are identical
1356
hasDuplicate = true;
1367
// Parentless nodes are either documents or disconnected
1368
if ( !aup || !bup ) {
1369
return a === doc ? -1 :
1374
( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
1377
// If the nodes are siblings, we can do a quick check
1378
} else if ( aup === bup ) {
1379
return siblingCheck( a, b );
1382
// Otherwise we need full lists of their ancestors for comparison
1384
while ( (cur = cur.parentNode) ) {
1388
while ( (cur = cur.parentNode) ) {
1392
// Walk down the tree looking for a discrepancy
1393
while ( ap[i] === bp[i] ) {
1398
// Do a sibling check if the nodes have a common ancestor
1399
siblingCheck( ap[i], bp[i] ) :
1401
// Otherwise nodes in our document sort first
1402
ap[i] === preferredDoc ? -1 :
1403
bp[i] === preferredDoc ? 1 :
1410
Sizzle.matches = function( expr, elements ) {
1411
return Sizzle( expr, null, null, elements );
1414
Sizzle.matchesSelector = function( elem, expr ) {
1415
// Set document vars if needed
1416
if ( ( elem.ownerDocument || elem ) !== document ) {
1417
setDocument( elem );
1420
// Make sure that attribute selectors are quoted
1421
expr = expr.replace( rattributeQuotes, "='$1']" );
1423
if ( support.matchesSelector && documentIsHTML &&
1424
( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
1425
( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
1428
var ret = matches.call( elem, expr );
1430
// IE 9's matchesSelector returns false on disconnected nodes
1431
if ( ret || support.disconnectedMatch ||
1432
// As well, disconnected nodes are said to be in a document
1434
elem.document && elem.document.nodeType !== 11 ) {
1440
return Sizzle( expr, document, null, [ elem ] ).length > 0;
1443
Sizzle.contains = function( context, elem ) {
1444
// Set document vars if needed
1445
if ( ( context.ownerDocument || context ) !== document ) {
1446
setDocument( context );
1448
return contains( context, elem );
1451
Sizzle.attr = function( elem, name ) {
1452
// Set document vars if needed
1453
if ( ( elem.ownerDocument || elem ) !== document ) {
1454
setDocument( elem );
1457
var fn = Expr.attrHandle[ name.toLowerCase() ],
1458
// Don't get fooled by Object.prototype properties (jQuery #13807)
1459
val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
1460
fn( elem, name, !documentIsHTML ) :
1463
return val !== undefined ?
1465
support.attributes || !documentIsHTML ?
1466
elem.getAttribute( name ) :
1467
(val = elem.getAttributeNode(name)) && val.specified ?
1472
Sizzle.error = function( msg ) {
1473
throw new Error( "Syntax error, unrecognized expression: " + msg );
1477
* Document sorting and removing duplicates
1478
* @param {ArrayLike} results
1480
Sizzle.uniqueSort = function( results ) {
1486
// Unless we *know* we can detect duplicates, assume their presence
1487
hasDuplicate = !support.detectDuplicates;
1488
sortInput = !support.sortStable && results.slice( 0 );
1489
results.sort( sortOrder );
1491
if ( hasDuplicate ) {
1492
while ( (elem = results[i++]) ) {
1493
if ( elem === results[ i ] ) {
1494
j = duplicates.push( i );
1498
results.splice( duplicates[ j ], 1 );
1502
// Clear input after sorting to release objects
1503
// See https://github.com/jquery/sizzle/pull/225
1510
* Utility function for retrieving the text value of an array of DOM nodes
1511
* @param {Array|Element} elem
1513
getText = Sizzle.getText = function( elem ) {
1517
nodeType = elem.nodeType;
1520
// If no nodeType, this is expected to be an array
1521
while ( (node = elem[i++]) ) {
1522
// Do not traverse comment nodes
1523
ret += getText( node );
1525
} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
1526
// Use textContent for elements
1527
// innerText usage removed for consistency of new lines (jQuery #11153)
1528
if ( typeof elem.textContent === "string" ) {
1529
return elem.textContent;
1531
// Traverse its children
1532
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1533
ret += getText( elem );
1536
} else if ( nodeType === 3 || nodeType === 4 ) {
1537
return elem.nodeValue;
1539
// Do not include comment or processing instruction nodes
1544
Expr = Sizzle.selectors = {
1546
// Can be adjusted by the user
1549
createPseudo: markFunction,
1558
">": { dir: "parentNode", first: true },
1559
" ": { dir: "parentNode" },
1560
"+": { dir: "previousSibling", first: true },
1561
"~": { dir: "previousSibling" }
1565
"ATTR": function( match ) {
1566
match[1] = match[1].replace( runescape, funescape );
1568
// Move the given value to match[3] whether quoted or unquoted
1569
match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
1571
if ( match[2] === "~=" ) {
1572
match[3] = " " + match[3] + " ";
1575
return match.slice( 0, 4 );
1578
"CHILD": function( match ) {
1579
/* matches from matchExpr["CHILD"]
1580
1 type (only|nth|...)
1581
2 what (child|of-type)
1582
3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
1583
4 xn-component of xn+y argument ([+-]?\d*n|)
1584
5 sign of xn-component
1586
7 sign of y-component
1589
match[1] = match[1].toLowerCase();
1591
if ( match[1].slice( 0, 3 ) === "nth" ) {
1592
// nth-* requires argument
1594
Sizzle.error( match[0] );
1597
// numeric x and y parameters for Expr.filter.CHILD
1598
// remember that false/true cast respectively to 0/1
1599
match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
1600
match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
1602
// other types prohibit arguments
1603
} else if ( match[3] ) {
1604
Sizzle.error( match[0] );
1610
"PSEUDO": function( match ) {
1612
unquoted = !match[6] && match[2];
1614
if ( matchExpr["CHILD"].test( match[0] ) ) {
1618
// Accept quoted arguments as-is
1620
match[2] = match[4] || match[5] || "";
1622
// Strip excess characters from unquoted arguments
1623
} else if ( unquoted && rpseudo.test( unquoted ) &&
1624
// Get excess from tokenize (recursively)
1625
(excess = tokenize( unquoted, true )) &&
1626
// advance to the next closing parenthesis
1627
(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
1629
// excess is a negative index
1630
match[0] = match[0].slice( 0, excess );
1631
match[2] = unquoted.slice( 0, excess );
1634
// Return only captures needed by the pseudo filter method (type and argument)
1635
return match.slice( 0, 3 );
1641
"TAG": function( nodeNameSelector ) {
1642
var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1643
return nodeNameSelector === "*" ?
1644
function() { return true; } :
1646
return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
1650
"CLASS": function( className ) {
1651
var pattern = classCache[ className + " " ];
1654
(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
1655
classCache( className, function( elem ) {
1656
return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" );
1660
"ATTR": function( name, operator, check ) {
1661
return function( elem ) {
1662
var result = Sizzle.attr( elem, name );
1664
if ( result == null ) {
1665
return operator === "!=";
1673
return operator === "=" ? result === check :
1674
operator === "!=" ? result !== check :
1675
operator === "^=" ? check && result.indexOf( check ) === 0 :
1676
operator === "*=" ? check && result.indexOf( check ) > -1 :
1677
operator === "$=" ? check && result.slice( -check.length ) === check :
1678
operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
1679
operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
1684
"CHILD": function( type, what, argument, first, last ) {
1685
var simple = type.slice( 0, 3 ) !== "nth",
1686
forward = type.slice( -4 ) !== "last",
1687
ofType = what === "of-type";
1689
return first === 1 && last === 0 ?
1691
// Shortcut for :nth-*(n)
1693
return !!elem.parentNode;
1696
function( elem, context, xml ) {
1697
var cache, outerCache, node, diff, nodeIndex, start,
1698
dir = simple !== forward ? "nextSibling" : "previousSibling",
1699
parent = elem.parentNode,
1700
name = ofType && elem.nodeName.toLowerCase(),
1701
useCache = !xml && !ofType;
1705
// :(first|last|only)-(child|of-type)
1709
while ( (node = node[ dir ]) ) {
1710
if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
1714
// Reverse direction for :only-* (if we haven't yet done so)
1715
start = dir = type === "only" && !start && "nextSibling";
1720
start = [ forward ? parent.firstChild : parent.lastChild ];
1722
// non-xml :nth-child(...) stores cache data on `parent`
1723
if ( forward && useCache ) {
1724
// Seek `elem` from a previously-cached index
1725
outerCache = parent[ expando ] || (parent[ expando ] = {});
1726
cache = outerCache[ type ] || [];
1727
nodeIndex = cache[0] === dirruns && cache[1];
1728
diff = cache[0] === dirruns && cache[2];
1729
node = nodeIndex && parent.childNodes[ nodeIndex ];
1731
while ( (node = ++nodeIndex && node && node[ dir ] ||
1733
// Fallback to seeking `elem` from the start
1734
(diff = nodeIndex = 0) || start.pop()) ) {
1736
// When found, cache indexes on `parent` and break
1737
if ( node.nodeType === 1 && ++diff && node === elem ) {
1738
outerCache[ type ] = [ dirruns, nodeIndex, diff ];
1743
// Use previously-cached element index if available
1744
} else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
1747
// xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
1749
// Use the same loop as above to seek `elem` from the start
1750
while ( (node = ++nodeIndex && node && node[ dir ] ||
1751
(diff = nodeIndex = 0) || start.pop()) ) {
1753
if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
1754
// Cache the index of each encountered element
1756
(node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
1759
if ( node === elem ) {
1766
// Incorporate the offset, then check against cycle size
1768
return diff === first || ( diff % first === 0 && diff / first >= 0 );
1773
"PSEUDO": function( pseudo, argument ) {
1774
// pseudo-class names are case-insensitive
1775
// http://www.w3.org/TR/selectors/#pseudo-classes
1776
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
1777
// Remember that setFilters inherits from pseudos
1779
fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
1780
Sizzle.error( "unsupported pseudo: " + pseudo );
1782
// The user may use createPseudo to indicate that
1783
// arguments are needed to create the filter function
1784
// just as Sizzle does
1785
if ( fn[ expando ] ) {
1786
return fn( argument );
1789
// But maintain support for old signatures
1790
if ( fn.length > 1 ) {
1791
args = [ pseudo, pseudo, "", argument ];
1792
return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
1793
markFunction(function( seed, matches ) {
1795
matched = fn( seed, argument ),
1798
idx = indexOf.call( seed, matched[i] );
1799
seed[ idx ] = !( matches[ idx ] = matched[i] );
1803
return fn( elem, 0, args );
1812
// Potentially complex pseudos
1813
"not": markFunction(function( selector ) {
1814
// Trim the selector passed to compile
1815
// to avoid treating leading and trailing
1816
// spaces as combinators
1819
matcher = compile( selector.replace( rtrim, "$1" ) );
1821
return matcher[ expando ] ?
1822
markFunction(function( seed, matches, context, xml ) {
1824
unmatched = matcher( seed, null, xml, [] ),
1827
// Match elements unmatched by `matcher`
1829
if ( (elem = unmatched[i]) ) {
1830
seed[i] = !(matches[i] = elem);
1834
function( elem, context, xml ) {
1836
matcher( input, null, xml, results );
1837
return !results.pop();
1841
"has": markFunction(function( selector ) {
1842
return function( elem ) {
1843
return Sizzle( selector, elem ).length > 0;
1847
"contains": markFunction(function( text ) {
1848
return function( elem ) {
1849
return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
1853
// "Whether an element is represented by a :lang() selector
1854
// is based solely on the element's language value
1855
// being equal to the identifier C,
1856
// or beginning with the identifier C immediately followed by "-".
1857
// The matching of C against the element's language value is performed case-insensitively.
1858
// The identifier C does not have to be a valid language name."
1859
// http://www.w3.org/TR/selectors/#lang-pseudo
1860
"lang": markFunction( function( lang ) {
1861
// lang value must be a valid identifier
1862
if ( !ridentifier.test(lang || "") ) {
1863
Sizzle.error( "unsupported lang: " + lang );
1865
lang = lang.replace( runescape, funescape ).toLowerCase();
1866
return function( elem ) {
1869
if ( (elemLang = documentIsHTML ?
1871
elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
1873
elemLang = elemLang.toLowerCase();
1874
return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
1876
} while ( (elem = elem.parentNode) && elem.nodeType === 1 );
1882
"target": function( elem ) {
1883
var hash = window.location && window.location.hash;
1884
return hash && hash.slice( 1 ) === elem.id;
1887
"root": function( elem ) {
1888
return elem === docElem;
1891
"focus": function( elem ) {
1892
return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
1895
// Boolean properties
1896
"enabled": function( elem ) {
1897
return elem.disabled === false;
1900
"disabled": function( elem ) {
1901
return elem.disabled === true;
1904
"checked": function( elem ) {
1905
// In CSS3, :checked should return both checked and selected elements
1906
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1907
var nodeName = elem.nodeName.toLowerCase();
1908
return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
1911
"selected": function( elem ) {
1912
// Accessing this property makes selected-by-default
1913
// options in Safari work properly
1914
if ( elem.parentNode ) {
1915
elem.parentNode.selectedIndex;
1918
return elem.selected === true;
1922
"empty": function( elem ) {
1923
// http://www.w3.org/TR/selectors/#empty-pseudo
1924
// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
1925
// but not by others (comment: 8; processing instruction: 7; etc.)
1926
// nodeType < 6 works because attributes (2) do not appear as children
1927
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1928
if ( elem.nodeType < 6 ) {
1935
"parent": function( elem ) {
1936
return !Expr.pseudos["empty"]( elem );
1939
// Element/input types
1940
"header": function( elem ) {
1941
return rheader.test( elem.nodeName );
1944
"input": function( elem ) {
1945
return rinputs.test( elem.nodeName );
1948
"button": function( elem ) {
1949
var name = elem.nodeName.toLowerCase();
1950
return name === "input" && elem.type === "button" || name === "button";
1953
"text": function( elem ) {
1955
return elem.nodeName.toLowerCase() === "input" &&
1956
elem.type === "text" &&
1959
// New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
1960
( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
1963
// Position-in-collection
1964
"first": createPositionalPseudo(function() {
1968
"last": createPositionalPseudo(function( matchIndexes, length ) {
1969
return [ length - 1 ];
1972
"eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
1973
return [ argument < 0 ? argument + length : argument ];
1976
"even": createPositionalPseudo(function( matchIndexes, length ) {
1978
for ( ; i < length; i += 2 ) {
1979
matchIndexes.push( i );
1981
return matchIndexes;
1984
"odd": createPositionalPseudo(function( matchIndexes, length ) {
1986
for ( ; i < length; i += 2 ) {
1987
matchIndexes.push( i );
1989
return matchIndexes;
1992
"lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
1993
var i = argument < 0 ? argument + length : argument;
1994
for ( ; --i >= 0; ) {
1995
matchIndexes.push( i );
1997
return matchIndexes;
2000
"gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2001
var i = argument < 0 ? argument + length : argument;
2002
for ( ; ++i < length; ) {
2003
matchIndexes.push( i );
2005
return matchIndexes;
2010
Expr.pseudos["nth"] = Expr.pseudos["eq"];
2012
// Add button/input type pseudos
2013
for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
2014
Expr.pseudos[ i ] = createInputPseudo( i );
2016
for ( i in { submit: true, reset: true } ) {
2017
Expr.pseudos[ i ] = createButtonPseudo( i );
2020
// Easy API for creating new setFilters
2021
function setFilters() {}
2022
setFilters.prototype = Expr.filters = Expr.pseudos;
2023
Expr.setFilters = new setFilters();
2025
tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2026
var matched, match, tokens, type,
2027
soFar, groups, preFilters,
2028
cached = tokenCache[ selector + " " ];
2031
return parseOnly ? 0 : cached.slice( 0 );
2036
preFilters = Expr.preFilter;
2040
// Comma and first run
2041
if ( !matched || (match = rcomma.exec( soFar )) ) {
2043
// Don't consume trailing commas as valid
2044
soFar = soFar.slice( match[0].length ) || soFar;
2046
groups.push( (tokens = []) );
2052
if ( (match = rcombinators.exec( soFar )) ) {
2053
matched = match.shift();
2056
// Cast descendant combinators to space
2057
type: match[0].replace( rtrim, " " )
2059
soFar = soFar.slice( matched.length );
2063
for ( type in Expr.filter ) {
2064
if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
2065
(match = preFilters[ type ]( match ))) ) {
2066
matched = match.shift();
2072
soFar = soFar.slice( matched.length );
2081
// Return the length of the invalid excess
2082
// if we're just parsing
2083
// Otherwise, throw an error or return tokens
2087
Sizzle.error( selector ) :
2089
tokenCache( selector, groups ).slice( 0 );
2092
function toSelector( tokens ) {
2094
len = tokens.length,
2096
for ( ; i < len; i++ ) {
2097
selector += tokens[i].value;
2102
function addCombinator( matcher, combinator, base ) {
2103
var dir = combinator.dir,
2104
checkNonElements = base && dir === "parentNode",
2107
return combinator.first ?
2108
// Check against closest ancestor/preceding element
2109
function( elem, context, xml ) {
2110
while ( (elem = elem[ dir ]) ) {
2111
if ( elem.nodeType === 1 || checkNonElements ) {
2112
return matcher( elem, context, xml );
2117
// Check against all ancestor/preceding elements
2118
function( elem, context, xml ) {
2119
var oldCache, outerCache,
2120
newCache = [ dirruns, doneName ];
2122
// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
2124
while ( (elem = elem[ dir ]) ) {
2125
if ( elem.nodeType === 1 || checkNonElements ) {
2126
if ( matcher( elem, context, xml ) ) {
2132
while ( (elem = elem[ dir ]) ) {
2133
if ( elem.nodeType === 1 || checkNonElements ) {
2134
outerCache = elem[ expando ] || (elem[ expando ] = {});
2135
if ( (oldCache = outerCache[ dir ]) &&
2136
oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
2138
// Assign to newCache so results back-propagate to previous elements
2139
return (newCache[ 2 ] = oldCache[ 2 ]);
2141
// Reuse newcache so results back-propagate to previous elements
2142
outerCache[ dir ] = newCache;
2144
// A match means we're done; a fail means we have to keep checking
2145
if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
2155
function elementMatcher( matchers ) {
2156
return matchers.length > 1 ?
2157
function( elem, context, xml ) {
2158
var i = matchers.length;
2160
if ( !matchers[i]( elem, context, xml ) ) {
2169
function multipleContexts( selector, contexts, results ) {
2171
len = contexts.length;
2172
for ( ; i < len; i++ ) {
2173
Sizzle( selector, contexts[i], results );
2178
function condense( unmatched, map, filter, context, xml ) {
2182
len = unmatched.length,
2183
mapped = map != null;
2185
for ( ; i < len; i++ ) {
2186
if ( (elem = unmatched[i]) ) {
2187
if ( !filter || filter( elem, context, xml ) ) {
2188
newUnmatched.push( elem );
2196
return newUnmatched;
2199
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
2200
if ( postFilter && !postFilter[ expando ] ) {
2201
postFilter = setMatcher( postFilter );
2203
if ( postFinder && !postFinder[ expando ] ) {
2204
postFinder = setMatcher( postFinder, postSelector );
2206
return markFunction(function( seed, results, context, xml ) {
2210
preexisting = results.length,
2212
// Get initial elements from seed or context
2213
elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
2215
// Prefilter to get matcher input, preserving a map for seed-results synchronization
2216
matcherIn = preFilter && ( seed || !selector ) ?
2217
condense( elems, preMap, preFilter, context, xml ) :
2220
matcherOut = matcher ?
2221
// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
2222
postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2224
// ...intermediate processing is necessary
2227
// ...otherwise use results directly
2231
// Find primary matches
2233
matcher( matcherIn, matcherOut, context, xml );
2238
temp = condense( matcherOut, postMap );
2239
postFilter( temp, [], context, xml );
2241
// Un-match failing elements by moving them back to matcherIn
2244
if ( (elem = temp[i]) ) {
2245
matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
2251
if ( postFinder || preFilter ) {
2253
// Get the final matcherOut by condensing this intermediate into postFinder contexts
2255
i = matcherOut.length;
2257
if ( (elem = matcherOut[i]) ) {
2258
// Restore matcherIn since elem is not yet a final match
2259
temp.push( (matcherIn[i] = elem) );
2262
postFinder( null, (matcherOut = []), temp, xml );
2265
// Move matched elements from seed to results to keep them synchronized
2266
i = matcherOut.length;
2268
if ( (elem = matcherOut[i]) &&
2269
(temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
2271
seed[temp] = !(results[temp] = elem);
2276
// Add elements to results, through postFinder if defined
2278
matcherOut = condense(
2279
matcherOut === results ?
2280
matcherOut.splice( preexisting, matcherOut.length ) :
2284
postFinder( null, results, matcherOut, xml );
2286
push.apply( results, matcherOut );
2292
function matcherFromTokens( tokens ) {
2293
var checkContext, matcher, j,
2294
len = tokens.length,
2295
leadingRelative = Expr.relative[ tokens[0].type ],
2296
implicitRelative = leadingRelative || Expr.relative[" "],
2297
i = leadingRelative ? 1 : 0,
2299
// The foundational matcher ensures that elements are reachable from top-level context(s)
2300
matchContext = addCombinator( function( elem ) {
2301
return elem === checkContext;
2302
}, implicitRelative, true ),
2303
matchAnyContext = addCombinator( function( elem ) {
2304
return indexOf.call( checkContext, elem ) > -1;
2305
}, implicitRelative, true ),
2306
matchers = [ function( elem, context, xml ) {
2307
return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
2308
(checkContext = context).nodeType ?
2309
matchContext( elem, context, xml ) :
2310
matchAnyContext( elem, context, xml ) );
2313
for ( ; i < len; i++ ) {
2314
if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
2315
matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
2317
matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
2319
// Return special upon seeing a positional matcher
2320
if ( matcher[ expando ] ) {
2321
// Find the next relative operator (if any) for proper handling
2323
for ( ; j < len; j++ ) {
2324
if ( Expr.relative[ tokens[j].type ] ) {
2329
i > 1 && elementMatcher( matchers ),
2330
i > 1 && toSelector(
2331
// If the preceding token was a descendant combinator, insert an implicit any-element `*`
2332
tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
2333
).replace( rtrim, "$1" ),
2335
i < j && matcherFromTokens( tokens.slice( i, j ) ),
2336
j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
2337
j < len && toSelector( tokens )
2340
matchers.push( matcher );
2344
return elementMatcher( matchers );
2347
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2348
var bySet = setMatchers.length > 0,
2349
byElement = elementMatchers.length > 0,
2350
superMatcher = function( seed, context, xml, results, outermost ) {
2351
var elem, j, matcher,
2354
unmatched = seed && [],
2356
contextBackup = outermostContext,
2357
// We must always have either seed elements or outermost context
2358
elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
2359
// Use integer dirruns iff this is the outermost matcher
2360
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
2364
outermostContext = context !== document && context;
2367
// Add elements passing elementMatchers directly to results
2368
// Keep `i` a string if there are no elements so `matchedCount` will be "00" below
2369
// Support: IE<9, Safari
2370
// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
2371
for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
2372
if ( byElement && elem ) {
2374
while ( (matcher = elementMatchers[j++]) ) {
2375
if ( matcher( elem, context, xml ) ) {
2376
results.push( elem );
2381
dirruns = dirrunsUnique;
2385
// Track unmatched elements for set filters
2387
// They will have gone through all possible matchers
2388
if ( (elem = !matcher && elem) ) {
2392
// Lengthen the array for every element, matched or not
2394
unmatched.push( elem );
2399
// Apply set filters to unmatched elements
2401
if ( bySet && i !== matchedCount ) {
2403
while ( (matcher = setMatchers[j++]) ) {
2404
matcher( unmatched, setMatched, context, xml );
2408
// Reintegrate element matches to eliminate the need for sorting
2409
if ( matchedCount > 0 ) {
2411
if ( !(unmatched[i] || setMatched[i]) ) {
2412
setMatched[i] = pop.call( results );
2417
// Discard index placeholder values to get only actual matches
2418
setMatched = condense( setMatched );
2421
// Add matches to results
2422
push.apply( results, setMatched );
2424
// Seedless set matches succeeding multiple successful matchers stipulate sorting
2425
if ( outermost && !seed && setMatched.length > 0 &&
2426
( matchedCount + setMatchers.length ) > 1 ) {
2428
Sizzle.uniqueSort( results );
2432
// Override manipulation of globals by nested matchers
2434
dirruns = dirrunsUnique;
2435
outermostContext = contextBackup;
2442
markFunction( superMatcher ) :
2446
compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2449
elementMatchers = [],
2450
cached = compilerCache[ selector + " " ];
2453
// Generate a function of recursive functions that can be used to check each element
2455
match = tokenize( selector );
2459
cached = matcherFromTokens( match[i] );
2460
if ( cached[ expando ] ) {
2461
setMatchers.push( cached );
2463
elementMatchers.push( cached );
2467
// Cache the compiled function
2468
cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
2470
// Save selector and tokenization
2471
cached.selector = selector;
2477
* A low-level selection function that works with Sizzle's compiled
2478
* selector functions
2479
* @param {String|Function} selector A selector or a pre-compiled
2480
* selector function built with Sizzle.compile
2481
* @param {Element} context
2482
* @param {Array} [results]
2483
* @param {Array} [seed] A set of elements to match against
2485
select = Sizzle.select = function( selector, context, results, seed ) {
2486
var i, tokens, token, type, find,
2487
compiled = typeof selector === "function" && selector,
2488
match = !seed && tokenize( (selector = compiled.selector || selector) );
2490
results = results || [];
2492
// Try to minimize operations if there is no seed and only one group
2493
if ( match.length === 1 ) {
2495
// Take a shortcut and set the context if the root selector is an ID
2496
tokens = match[0] = match[0].slice( 0 );
2497
if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
2498
support.getById && context.nodeType === 9 && documentIsHTML &&
2499
Expr.relative[ tokens[1].type ] ) {
2501
context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
2505
// Precompiled matchers will still verify ancestry, so step up a level
2506
} else if ( compiled ) {
2507
context = context.parentNode;
2510
selector = selector.slice( tokens.shift().value.length );
2513
// Fetch a seed set for right-to-left matching
2514
i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
2518
// Abort if we hit a combinator
2519
if ( Expr.relative[ (type = token.type) ] ) {
2522
if ( (find = Expr.find[ type ]) ) {
2523
// Search, expanding context for leading sibling combinators
2525
token.matches[0].replace( runescape, funescape ),
2526
rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
2529
// If seed is empty or no tokens remain, we can return early
2530
tokens.splice( i, 1 );
2531
selector = seed.length && toSelector( tokens );
2533
push.apply( results, seed );
2543
// Compile and execute a filtering function if one is not provided
2544
// Provide `match` to avoid retokenization if we modified the selector above
2545
( compiled || compile( selector, match ) )(
2550
rsibling.test( selector ) && testContext( context.parentNode ) || context
2555
// One-time assignments
2558
support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
2560
// Support: Chrome<14
2561
// Always assume duplicates if they aren't passed to the comparison function
2562
support.detectDuplicates = !!hasDuplicate;
2564
// Initialize against the default document
2567
// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
2568
// Detached nodes confoundingly follow *each other*
2569
support.sortDetached = assert(function( div1 ) {
2570
// Should return 1, but returns 4 (following)
2571
return div1.compareDocumentPosition( document.createElement("div") ) & 1;
2575
// Prevent attribute/property "interpolation"
2576
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
2577
if ( !assert(function( div ) {
2578
div.innerHTML = "<a href='#'></a>";
2579
return div.firstChild.getAttribute("href") === "#" ;
2581
addHandle( "type|href|height|width", function( elem, name, isXML ) {
2583
return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
2589
// Use defaultValue in place of getAttribute("value")
2590
if ( !support.attributes || !assert(function( div ) {
2591
div.innerHTML = "<input/>";
2592
div.firstChild.setAttribute( "value", "" );
2593
return div.firstChild.getAttribute( "value" ) === "";
2595
addHandle( "value", function( elem, name, isXML ) {
2596
if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
2597
return elem.defaultValue;
2603
// Use getAttributeNode to fetch booleans when getAttribute lies
2604
if ( !assert(function( div ) {
2605
return div.getAttribute("disabled") == null;
2607
addHandle( booleans, function( elem, name, isXML ) {
2610
return elem[ name ] === true ? name.toLowerCase() :
2611
(val = elem.getAttributeNode( name )) && val.specified ?
2624
jQuery.find = Sizzle;
2625
jQuery.expr = Sizzle.selectors;
2626
jQuery.expr[":"] = jQuery.expr.pseudos;
2627
jQuery.unique = Sizzle.uniqueSort;
2628
jQuery.text = Sizzle.getText;
2629
jQuery.isXMLDoc = Sizzle.isXML;
2630
jQuery.contains = Sizzle.contains;
2634
var rneedsContext = jQuery.expr.match.needsContext;
2636
var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
2640
var risSimple = /^.[^:#\[\.,]*$/;
2642
// Implement the identical functionality for filter and not
2643
function winnow( elements, qualifier, not ) {
2644
if ( jQuery.isFunction( qualifier ) ) {
2645
return jQuery.grep( elements, function( elem, i ) {
2647
return !!qualifier.call( elem, i, elem ) !== not;
2652
if ( qualifier.nodeType ) {
2653
return jQuery.grep( elements, function( elem ) {
2654
return ( elem === qualifier ) !== not;
2659
if ( typeof qualifier === "string" ) {
2660
if ( risSimple.test( qualifier ) ) {
2661
return jQuery.filter( qualifier, elements, not );
2664
qualifier = jQuery.filter( qualifier, elements );
2667
return jQuery.grep( elements, function( elem ) {
2668
return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not;
2672
jQuery.filter = function( expr, elems, not ) {
2673
var elem = elems[ 0 ];
2676
expr = ":not(" + expr + ")";
2679
return elems.length === 1 && elem.nodeType === 1 ?
2680
jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
2681
jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
2682
return elem.nodeType === 1;
2687
find: function( selector ) {
2693
if ( typeof selector !== "string" ) {
2694
return this.pushStack( jQuery( selector ).filter(function() {
2695
for ( i = 0; i < len; i++ ) {
2696
if ( jQuery.contains( self[ i ], this ) ) {
2703
for ( i = 0; i < len; i++ ) {
2704
jQuery.find( selector, self[ i ], ret );
2707
// Needed because $( selector, context ) becomes $( context ).find( selector )
2708
ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
2709
ret.selector = this.selector ? this.selector + " " + selector : selector;
2712
filter: function( selector ) {
2713
return this.pushStack( winnow(this, selector || [], false) );
2715
not: function( selector ) {
2716
return this.pushStack( winnow(this, selector || [], true) );
2718
is: function( selector ) {
2722
// If this is a positional/relative selector, check membership in the returned set
2723
// so $("p:first").is("p:last") won't return true for a doc with two "p".
2724
typeof selector === "string" && rneedsContext.test( selector ) ?
2725
jQuery( selector ) :
2733
// Initialize a jQuery object
2736
// A central reference to the root jQuery(document)
2739
// Use the correct document accordingly with window argument (sandbox)
2740
document = window.document,
2742
// A simple way to check for HTML strings
2743
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
2744
// Strict HTML recognition (#11290: must start with <)
2745
rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
2747
init = jQuery.fn.init = function( selector, context ) {
2750
// HANDLE: $(""), $(null), $(undefined), $(false)
2755
// Handle HTML strings
2756
if ( typeof selector === "string" ) {
2757
if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
2758
// Assume that strings that start and end with <> are HTML and skip the regex check
2759
match = [ null, selector, null ];
2762
match = rquickExpr.exec( selector );
2765
// Match html or make sure no context is specified for #id
2766
if ( match && (match[1] || !context) ) {
2768
// HANDLE: $(html) -> $(array)
2770
context = context instanceof jQuery ? context[0] : context;
2772
// scripts is true for back-compat
2773
// Intentionally let the error be thrown if parseHTML is not present
2774
jQuery.merge( this, jQuery.parseHTML(
2776
context && context.nodeType ? context.ownerDocument || context : document,
2780
// HANDLE: $(html, props)
2781
if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
2782
for ( match in context ) {
2783
// Properties of context are called as methods if possible
2784
if ( jQuery.isFunction( this[ match ] ) ) {
2785
this[ match ]( context[ match ] );
2787
// ...and otherwise set as attributes
2789
this.attr( match, context[ match ] );
2798
elem = document.getElementById( match[2] );
2800
// Check parentNode to catch when Blackberry 4.6 returns
2801
// nodes that are no longer in the document #6963
2802
if ( elem && elem.parentNode ) {
2803
// Handle the case where IE and Opera return items
2804
// by name instead of ID
2805
if ( elem.id !== match[2] ) {
2806
return rootjQuery.find( selector );
2809
// Otherwise, we inject the element directly into the jQuery object
2814
this.context = document;
2815
this.selector = selector;
2819
// HANDLE: $(expr, $(...))
2820
} else if ( !context || context.jquery ) {
2821
return ( context || rootjQuery ).find( selector );
2823
// HANDLE: $(expr, context)
2824
// (which is just equivalent to: $(context).find(expr)
2826
return this.constructor( context ).find( selector );
2829
// HANDLE: $(DOMElement)
2830
} else if ( selector.nodeType ) {
2831
this.context = this[0] = selector;
2835
// HANDLE: $(function)
2836
// Shortcut for document ready
2837
} else if ( jQuery.isFunction( selector ) ) {
2838
return typeof rootjQuery.ready !== "undefined" ?
2839
rootjQuery.ready( selector ) :
2840
// Execute immediately if ready is not present
2844
if ( selector.selector !== undefined ) {
2845
this.selector = selector.selector;
2846
this.context = selector.context;
2849
return jQuery.makeArray( selector, this );
2852
// Give the init function the jQuery prototype for later instantiation
2853
init.prototype = jQuery.fn;
2855
// Initialize central reference
2856
rootjQuery = jQuery( document );
2859
var rparentsprev = /^(?:parents|prev(?:Until|All))/,
2860
// methods guaranteed to produce a unique set when starting from a unique set
2861
guaranteedUnique = {
2869
dir: function( elem, dir, until ) {
2873
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
2874
if ( cur.nodeType === 1 ) {
2875
matched.push( cur );
2882
sibling: function( n, elem ) {
2885
for ( ; n; n = n.nextSibling ) {
2886
if ( n.nodeType === 1 && n !== elem ) {
2896
has: function( target ) {
2898
targets = jQuery( target, this ),
2899
len = targets.length;
2901
return this.filter(function() {
2902
for ( i = 0; i < len; i++ ) {
2903
if ( jQuery.contains( this, targets[i] ) ) {
2910
closest: function( selectors, context ) {
2915
pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
2916
jQuery( selectors, context || this.context ) :
2919
for ( ; i < l; i++ ) {
2920
for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
2921
// Always skip document fragments
2922
if ( cur.nodeType < 11 && (pos ?
2923
pos.index(cur) > -1 :
2925
// Don't pass non-elements to Sizzle
2926
cur.nodeType === 1 &&
2927
jQuery.find.matchesSelector(cur, selectors)) ) {
2929
matched.push( cur );
2935
return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched );
2938
// Determine the position of an element within
2939
// the matched set of elements
2940
index: function( elem ) {
2942
// No argument, return index in parent
2944
return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1;
2947
// index in selector
2948
if ( typeof elem === "string" ) {
2949
return jQuery.inArray( this[0], jQuery( elem ) );
2952
// Locate the position of the desired element
2953
return jQuery.inArray(
2954
// If it receives a jQuery object, the first element is used
2955
elem.jquery ? elem[0] : elem, this );
2958
add: function( selector, context ) {
2959
return this.pushStack(
2961
jQuery.merge( this.get(), jQuery( selector, context ) )
2966
addBack: function( selector ) {
2967
return this.add( selector == null ?
2968
this.prevObject : this.prevObject.filter(selector)
2973
function sibling( cur, dir ) {
2976
} while ( cur && cur.nodeType !== 1 );
2982
parent: function( elem ) {
2983
var parent = elem.parentNode;
2984
return parent && parent.nodeType !== 11 ? parent : null;
2986
parents: function( elem ) {
2987
return jQuery.dir( elem, "parentNode" );
2989
parentsUntil: function( elem, i, until ) {
2990
return jQuery.dir( elem, "parentNode", until );
2992
next: function( elem ) {
2993
return sibling( elem, "nextSibling" );
2995
prev: function( elem ) {
2996
return sibling( elem, "previousSibling" );
2998
nextAll: function( elem ) {
2999
return jQuery.dir( elem, "nextSibling" );
3001
prevAll: function( elem ) {
3002
return jQuery.dir( elem, "previousSibling" );
3004
nextUntil: function( elem, i, until ) {
3005
return jQuery.dir( elem, "nextSibling", until );
3007
prevUntil: function( elem, i, until ) {
3008
return jQuery.dir( elem, "previousSibling", until );
3010
siblings: function( elem ) {
3011
return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
3013
children: function( elem ) {
3014
return jQuery.sibling( elem.firstChild );
3016
contents: function( elem ) {
3017
return jQuery.nodeName( elem, "iframe" ) ?
3018
elem.contentDocument || elem.contentWindow.document :
3019
jQuery.merge( [], elem.childNodes );
3021
}, function( name, fn ) {
3022
jQuery.fn[ name ] = function( until, selector ) {
3023
var ret = jQuery.map( this, fn, until );
3025
if ( name.slice( -5 ) !== "Until" ) {
3029
if ( selector && typeof selector === "string" ) {
3030
ret = jQuery.filter( selector, ret );
3033
if ( this.length > 1 ) {
3034
// Remove duplicates
3035
if ( !guaranteedUnique[ name ] ) {
3036
ret = jQuery.unique( ret );
3039
// Reverse order for parents* and prev-derivatives
3040
if ( rparentsprev.test( name ) ) {
3041
ret = ret.reverse();
3045
return this.pushStack( ret );
3048
var rnotwhite = (/\S+/g);
3052
// String to Object options format cache
3053
var optionsCache = {};
3055
// Convert String-formatted options into Object-formatted ones and store in cache
3056
function createOptions( options ) {
3057
var object = optionsCache[ options ] = {};
3058
jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
3059
object[ flag ] = true;
3065
* Create a callback list using the following parameters:
3067
* options: an optional list of space-separated options that will change how
3068
* the callback list behaves or a more traditional option object
3070
* By default a callback list will act like an event callback list and can be
3071
* "fired" multiple times.
3075
* once: will ensure the callback list can only be fired once (like a Deferred)
3077
* memory: will keep track of previous values and will call any callback added
3078
* after the list has been fired right away with the latest "memorized"
3079
* values (like a Deferred)
3081
* unique: will ensure a callback can only be added once (no duplicate in the list)
3083
* stopOnFalse: interrupt callings when a callback returns false
3086
jQuery.Callbacks = function( options ) {
3088
// Convert options from String-formatted to Object-formatted if needed
3089
// (we check in cache first)
3090
options = typeof options === "string" ?
3091
( optionsCache[ options ] || createOptions( options ) ) :
3092
jQuery.extend( {}, options );
3094
var // Flag to know if list is currently firing
3096
// Last fire value (for non-forgettable lists)
3098
// Flag to know if list was already fired
3100
// End of the loop when firing
3102
// Index of currently firing callback (modified by remove if needed)
3104
// First callback to fire (used internally by add and fireWith)
3106
// Actual callback list
3108
// Stack of fire calls for repeatable lists
3109
stack = !options.once && [],
3111
fire = function( data ) {
3112
memory = options.memory && data;
3114
firingIndex = firingStart || 0;
3116
firingLength = list.length;
3118
for ( ; list && firingIndex < firingLength; firingIndex++ ) {
3119
if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
3120
memory = false; // To prevent further calls using add
3127
if ( stack.length ) {
3128
fire( stack.shift() );
3130
} else if ( memory ) {
3137
// Actual Callbacks object
3139
// Add a callback or a collection of callbacks to the list
3142
// First, we save the current length
3143
var start = list.length;
3144
(function add( args ) {
3145
jQuery.each( args, function( _, arg ) {
3146
var type = jQuery.type( arg );
3147
if ( type === "function" ) {
3148
if ( !options.unique || !self.has( arg ) ) {
3151
} else if ( arg && arg.length && type !== "string" ) {
3152
// Inspect recursively
3157
// Do we need to add the callbacks to the
3158
// current firing batch?
3160
firingLength = list.length;
3161
// With memory, if we're not firing then
3162
// we should call right away
3163
} else if ( memory ) {
3164
firingStart = start;
3170
// Remove a callback from the list
3171
remove: function() {
3173
jQuery.each( arguments, function( _, arg ) {
3175
while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
3176
list.splice( index, 1 );
3177
// Handle firing indexes
3179
if ( index <= firingLength ) {
3182
if ( index <= firingIndex ) {
3191
// Check if a given callback is in the list.
3192
// If no argument is given, return whether or not list has callbacks attached.
3193
has: function( fn ) {
3194
return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
3196
// Remove all callbacks from the list
3202
// Have the list do nothing anymore
3203
disable: function() {
3204
list = stack = memory = undefined;
3208
disabled: function() {
3211
// Lock the list in its current state
3220
locked: function() {
3223
// Call all callbacks with the given context and arguments
3224
fireWith: function( context, args ) {
3225
if ( list && ( !fired || stack ) ) {
3227
args = [ context, args.slice ? args.slice() : args ];
3236
// Call all the callbacks with the given arguments
3238
self.fireWith( this, arguments );
3241
// To know if the callbacks have already been called at least once
3253
Deferred: function( func ) {
3255
// action, add listener, listener list, final state
3256
[ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
3257
[ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
3258
[ "notify", "progress", jQuery.Callbacks("memory") ]
3265
always: function() {
3266
deferred.done( arguments ).fail( arguments );
3269
then: function( /* fnDone, fnFail, fnProgress */ ) {
3270
var fns = arguments;
3271
return jQuery.Deferred(function( newDefer ) {
3272
jQuery.each( tuples, function( i, tuple ) {
3273
var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
3274
// deferred[ done | fail | progress ] for forwarding actions to newDefer
3275
deferred[ tuple[1] ](function() {
3276
var returned = fn && fn.apply( this, arguments );
3277
if ( returned && jQuery.isFunction( returned.promise ) ) {
3279
.done( newDefer.resolve )
3280
.fail( newDefer.reject )
3281
.progress( newDefer.notify );
3283
newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
3290
// Get a promise for this deferred
3291
// If obj is provided, the promise aspect is added to the object
3292
promise: function( obj ) {
3293
return obj != null ? jQuery.extend( obj, promise ) : promise;
3298
// Keep pipe for back-compat
3299
promise.pipe = promise.then;
3301
// Add list-specific methods
3302
jQuery.each( tuples, function( i, tuple ) {
3303
var list = tuple[ 2 ],
3304
stateString = tuple[ 3 ];
3306
// promise[ done | fail | progress ] = list.add
3307
promise[ tuple[1] ] = list.add;
3310
if ( stateString ) {
3311
list.add(function() {
3312
// state = [ resolved | rejected ]
3313
state = stateString;
3315
// [ reject_list | resolve_list ].disable; progress_list.lock
3316
}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
3319
// deferred[ resolve | reject | notify ]
3320
deferred[ tuple[0] ] = function() {
3321
deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
3324
deferred[ tuple[0] + "With" ] = list.fireWith;
3327
// Make the deferred a promise
3328
promise.promise( deferred );
3330
// Call given func if any
3332
func.call( deferred, deferred );
3340
when: function( subordinate /* , ..., subordinateN */ ) {
3342
resolveValues = slice.call( arguments ),
3343
length = resolveValues.length,
3345
// the count of uncompleted subordinates
3346
remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
3348
// the master Deferred. If resolveValues consist of only a single Deferred, just use that.
3349
deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
3351
// Update function for both resolve and progress values
3352
updateFunc = function( i, contexts, values ) {
3353
return function( value ) {
3354
contexts[ i ] = this;
3355
values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
3356
if ( values === progressValues ) {
3357
deferred.notifyWith( contexts, values );
3359
} else if ( !(--remaining) ) {
3360
deferred.resolveWith( contexts, values );
3365
progressValues, progressContexts, resolveContexts;
3367
// add listeners to Deferred subordinates; treat others as resolved
3369
progressValues = new Array( length );
3370
progressContexts = new Array( length );
3371
resolveContexts = new Array( length );
3372
for ( ; i < length; i++ ) {
3373
if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
3374
resolveValues[ i ].promise()
3375
.done( updateFunc( i, resolveContexts, resolveValues ) )
3376
.fail( deferred.reject )
3377
.progress( updateFunc( i, progressContexts, progressValues ) );
3384
// if we're not waiting on anything, resolve the master
3386
deferred.resolveWith( resolveContexts, resolveValues );
3389
return deferred.promise();
3394
// The deferred used on DOM ready
3397
jQuery.fn.ready = function( fn ) {
3399
jQuery.ready.promise().done( fn );
3405
// Is the DOM ready to be used? Set to true once it occurs.
3408
// A counter to track how many items to wait for before
3409
// the ready event fires. See #6781
3412
// Hold (or release) the ready event
3413
holdReady: function( hold ) {
3417
jQuery.ready( true );
3421
// Handle when the DOM is ready
3422
ready: function( wait ) {
3424
// Abort if there are pending holds or we're already ready
3425
if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
3429
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
3430
if ( !document.body ) {
3431
return setTimeout( jQuery.ready );
3434
// Remember that the DOM is ready
3435
jQuery.isReady = true;
3437
// If a normal DOM Ready event fired, decrement, and wait if need be
3438
if ( wait !== true && --jQuery.readyWait > 0 ) {
3442
// If there are functions bound, to execute
3443
readyList.resolveWith( document, [ jQuery ] );
3445
// Trigger any bound ready events
3446
if ( jQuery.fn.triggerHandler ) {
3447
jQuery( document ).triggerHandler( "ready" );
3448
jQuery( document ).off( "ready" );
3454
* Clean-up method for dom ready events
3457
if ( document.addEventListener ) {
3458
document.removeEventListener( "DOMContentLoaded", completed, false );
3459
window.removeEventListener( "load", completed, false );
3462
document.detachEvent( "onreadystatechange", completed );
3463
window.detachEvent( "onload", completed );
3468
* The ready event handler and self cleanup method
3470
function completed() {
3471
// readyState === "complete" is good enough for us to call the dom ready in oldIE
3472
if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {
3478
jQuery.ready.promise = function( obj ) {
3481
readyList = jQuery.Deferred();
3483
// Catch cases where $(document).ready() is called after the browser event has already occurred.
3484
// we once tried to use readyState "interactive" here, but it caused issues like the one
3485
// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
3486
if ( document.readyState === "complete" ) {
3487
// Handle it asynchronously to allow scripts the opportunity to delay ready
3488
setTimeout( jQuery.ready );
3490
// Standards-based browsers support DOMContentLoaded
3491
} else if ( document.addEventListener ) {
3492
// Use the handy event callback
3493
document.addEventListener( "DOMContentLoaded", completed, false );
3495
// A fallback to window.onload, that will always work
3496
window.addEventListener( "load", completed, false );
3498
// If IE event model is used
3500
// Ensure firing before onload, maybe late but safe also for iframes
3501
document.attachEvent( "onreadystatechange", completed );
3503
// A fallback to window.onload, that will always work
3504
window.attachEvent( "onload", completed );
3506
// If IE and not a frame
3507
// continually check to see if the document is ready
3511
top = window.frameElement == null && document.documentElement;
3514
if ( top && top.doScroll ) {
3515
(function doScrollCheck() {
3516
if ( !jQuery.isReady ) {
3519
// Use the trick by Diego Perini
3520
// http://javascript.nwbox.com/IEContentLoaded/
3521
top.doScroll("left");
3523
return setTimeout( doScrollCheck, 50 );
3526
// detach all dom ready events
3529
// and execute any waiting functions
3536
return readyList.promise( obj );
3540
var strundefined = typeof undefined;
3545
// Iteration over object's inherited properties before its own
3547
for ( i in jQuery( support ) ) {
3550
support.ownLast = i !== "0";
3552
// Note: most support tests are defined in their respective modules.
3553
// false until the test is run
3554
support.inlineBlockNeedsLayout = false;
3556
// Execute ASAP in case we need to set body.style.zoom
3558
// Minified: var a,b,c,d
3559
var val, div, body, container;
3561
body = document.getElementsByTagName( "body" )[ 0 ];
3562
if ( !body || !body.style ) {
3563
// Return for frameset docs that don't have a body
3568
div = document.createElement( "div" );
3569
container = document.createElement( "div" );
3570
container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
3571
body.appendChild( container ).appendChild( div );
3573
if ( typeof div.style.zoom !== strundefined ) {
3575
// Check if natively block-level elements act like inline-block
3576
// elements when setting their display to 'inline' and giving
3578
div.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1";
3580
support.inlineBlockNeedsLayout = val = div.offsetWidth === 3;
3582
// Prevent IE 6 from affecting layout for positioned elements #11048
3583
// Prevent IE from shrinking the body in IE 7 mode #12869
3585
body.style.zoom = 1;
3589
body.removeChild( container );
3596
var div = document.createElement( "div" );
3598
// Execute the test only if not already executed in another module.
3599
if (support.deleteExpando == null) {
3601
support.deleteExpando = true;
3605
support.deleteExpando = false;
3609
// Null elements to avoid leaks in IE.
3615
* Determines whether an object can have data
3617
jQuery.acceptData = function( elem ) {
3618
var noData = jQuery.noData[ (elem.nodeName + " ").toLowerCase() ],
3619
nodeType = +elem.nodeType || 1;
3621
// Do not set data on non-element DOM nodes because it will not be cleared (#8335).
3622
return nodeType !== 1 && nodeType !== 9 ?
3625
// Nodes accept data unless otherwise specified; rejection can be conditional
3626
!noData || noData !== true && elem.getAttribute("classid") === noData;
3630
var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
3631
rmultiDash = /([A-Z])/g;
3633
function dataAttr( elem, key, data ) {
3634
// If nothing was found internally, try to fetch any
3635
// data from the HTML5 data-* attribute
3636
if ( data === undefined && elem.nodeType === 1 ) {
3638
var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
3640
data = elem.getAttribute( name );
3642
if ( typeof data === "string" ) {
3644
data = data === "true" ? true :
3645
data === "false" ? false :
3646
data === "null" ? null :
3647
// Only convert to a number if it doesn't change the string
3648
+data + "" === data ? +data :
3649
rbrace.test( data ) ? jQuery.parseJSON( data ) :
3653
// Make sure we set the data so it isn't changed later
3654
jQuery.data( elem, key, data );
3664
// checks a cache object for emptiness
3665
function isEmptyDataObject( obj ) {
3667
for ( name in obj ) {
3669
// if the public data object is empty, the private is still empty
3670
if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
3673
if ( name !== "toJSON" ) {
3681
function internalData( elem, name, data, pvt /* Internal Use Only */ ) {
3682
if ( !jQuery.acceptData( elem ) ) {
3687
internalKey = jQuery.expando,
3689
// We have to handle DOM nodes and JS objects differently because IE6-7
3690
// can't GC object references properly across the DOM-JS boundary
3691
isNode = elem.nodeType,
3693
// Only DOM nodes need the global jQuery cache; JS object data is
3694
// attached directly to the object so GC can occur automatically
3695
cache = isNode ? jQuery.cache : elem,
3697
// Only defining an ID for JS objects if its cache already exists allows
3698
// the code to shortcut on the same path as a DOM node with no cache
3699
id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
3701
// Avoid doing any more work than we need to when trying to get data on an
3702
// object that has no data at all
3703
if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) {
3708
// Only DOM nodes need a new unique ID for each element since their data
3709
// ends up in the global cache
3711
id = elem[ internalKey ] = deletedIds.pop() || jQuery.guid++;
3717
if ( !cache[ id ] ) {
3718
// Avoid exposing jQuery metadata on plain JS objects when the object
3719
// is serialized using JSON.stringify
3720
cache[ id ] = isNode ? {} : { toJSON: jQuery.noop };
3723
// An object can be passed to jQuery.data instead of a key/value pair; this gets
3724
// shallow copied over onto the existing cache
3725
if ( typeof name === "object" || typeof name === "function" ) {
3727
cache[ id ] = jQuery.extend( cache[ id ], name );
3729
cache[ id ].data = jQuery.extend( cache[ id ].data, name );
3733
thisCache = cache[ id ];
3735
// jQuery data() is stored in a separate object inside the object's internal data
3736
// cache in order to avoid key collisions between internal data and user-defined
3739
if ( !thisCache.data ) {
3740
thisCache.data = {};
3743
thisCache = thisCache.data;
3746
if ( data !== undefined ) {
3747
thisCache[ jQuery.camelCase( name ) ] = data;
3750
// Check for both converted-to-camel and non-converted data property names
3751
// If a data property was specified
3752
if ( typeof name === "string" ) {
3754
// First Try to find as-is property data
3755
ret = thisCache[ name ];
3757
// Test for null|undefined property data
3758
if ( ret == null ) {
3760
// Try to find the camelCased property
3761
ret = thisCache[ jQuery.camelCase( name ) ];
3770
function internalRemoveData( elem, name, pvt ) {
3771
if ( !jQuery.acceptData( elem ) ) {
3776
isNode = elem.nodeType,
3778
// See jQuery.data for more information
3779
cache = isNode ? jQuery.cache : elem,
3780
id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
3782
// If there is already no cache entry for this object, there is no
3783
// purpose in continuing
3784
if ( !cache[ id ] ) {
3790
thisCache = pvt ? cache[ id ] : cache[ id ].data;
3794
// Support array or space separated string names for data keys
3795
if ( !jQuery.isArray( name ) ) {
3797
// try the string as a key before any manipulation
3798
if ( name in thisCache ) {
3802
// split the camel cased version by spaces unless a key with the spaces exists
3803
name = jQuery.camelCase( name );
3804
if ( name in thisCache ) {
3807
name = name.split(" ");
3811
// If "name" is an array of keys...
3812
// When data is initially created, via ("key", "val") signature,
3813
// keys will be converted to camelCase.
3814
// Since there is no way to tell _how_ a key was added, remove
3815
// both plain key and camelCase key. #12786
3816
// This will only penalize the array argument path.
3817
name = name.concat( jQuery.map( name, jQuery.camelCase ) );
3822
delete thisCache[ name[i] ];
3825
// If there is no data left in the cache, we want to continue
3826
// and let the cache object itself get destroyed
3827
if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) {
3833
// See jQuery.data for more information
3835
delete cache[ id ].data;
3837
// Don't destroy the parent cache unless the internal data object
3838
// had been the only thing left in it
3839
if ( !isEmptyDataObject( cache[ id ] ) ) {
3844
// Destroy the cache
3846
jQuery.cleanData( [ elem ], true );
3848
// Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
3849
/* jshint eqeqeq: false */
3850
} else if ( support.deleteExpando || cache != cache.window ) {
3851
/* jshint eqeqeq: true */
3854
// When all else fails, null
3863
// The following elements (space-suffixed to avoid Object.prototype collisions)
3864
// throw uncatchable exceptions if you attempt to set expando properties
3868
// ...but Flash objects (which have this classid) *can* handle expandos
3869
"object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
3872
hasData: function( elem ) {
3873
elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
3874
return !!elem && !isEmptyDataObject( elem );
3877
data: function( elem, name, data ) {
3878
return internalData( elem, name, data );
3881
removeData: function( elem, name ) {
3882
return internalRemoveData( elem, name );
3885
// For internal use only.
3886
_data: function( elem, name, data ) {
3887
return internalData( elem, name, data, true );
3890
_removeData: function( elem, name ) {
3891
return internalRemoveData( elem, name, true );
3896
data: function( key, value ) {
3899
attrs = elem && elem.attributes;
3901
// Special expections of .data basically thwart jQuery.access,
3902
// so implement the relevant behavior ourselves
3905
if ( key === undefined ) {
3906
if ( this.length ) {
3907
data = jQuery.data( elem );
3909
if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
3914
// The attrs elements can be null (#14894)
3916
name = attrs[ i ].name;
3917
if ( name.indexOf( "data-" ) === 0 ) {
3918
name = jQuery.camelCase( name.slice(5) );
3919
dataAttr( elem, name, data[ name ] );
3923
jQuery._data( elem, "parsedAttrs", true );
3930
// Sets multiple values
3931
if ( typeof key === "object" ) {
3932
return this.each(function() {
3933
jQuery.data( this, key );
3937
return arguments.length > 1 ?
3940
this.each(function() {
3941
jQuery.data( this, key, value );
3945
// Try to fetch any internally stored data first
3946
elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined;
3949
removeData: function( key ) {
3950
return this.each(function() {
3951
jQuery.removeData( this, key );
3958
queue: function( elem, type, data ) {
3962
type = ( type || "fx" ) + "queue";
3963
queue = jQuery._data( elem, type );
3965
// Speed up dequeue by getting out quickly if this is just a lookup
3967
if ( !queue || jQuery.isArray(data) ) {
3968
queue = jQuery._data( elem, type, jQuery.makeArray(data) );
3977
dequeue: function( elem, type ) {
3978
type = type || "fx";
3980
var queue = jQuery.queue( elem, type ),
3981
startLength = queue.length,
3983
hooks = jQuery._queueHooks( elem, type ),
3985
jQuery.dequeue( elem, type );
3988
// If the fx queue is dequeued, always remove the progress sentinel
3989
if ( fn === "inprogress" ) {
3996
// Add a progress sentinel to prevent the fx queue from being
3997
// automatically dequeued
3998
if ( type === "fx" ) {
3999
queue.unshift( "inprogress" );
4002
// clear up the last queue stop function
4004
fn.call( elem, next, hooks );
4007
if ( !startLength && hooks ) {
4012
// not intended for public consumption - generates a queueHooks object, or returns the current one
4013
_queueHooks: function( elem, type ) {
4014
var key = type + "queueHooks";
4015
return jQuery._data( elem, key ) || jQuery._data( elem, key, {
4016
empty: jQuery.Callbacks("once memory").add(function() {
4017
jQuery._removeData( elem, type + "queue" );
4018
jQuery._removeData( elem, key );
4025
queue: function( type, data ) {
4028
if ( typeof type !== "string" ) {
4034
if ( arguments.length < setter ) {
4035
return jQuery.queue( this[0], type );
4038
return data === undefined ?
4040
this.each(function() {
4041
var queue = jQuery.queue( this, type, data );
4043
// ensure a hooks for this queue
4044
jQuery._queueHooks( this, type );
4046
if ( type === "fx" && queue[0] !== "inprogress" ) {
4047
jQuery.dequeue( this, type );
4051
dequeue: function( type ) {
4052
return this.each(function() {
4053
jQuery.dequeue( this, type );
4056
clearQueue: function( type ) {
4057
return this.queue( type || "fx", [] );
4059
// Get a promise resolved when queues of a certain type
4060
// are emptied (fx is the type by default)
4061
promise: function( type, obj ) {
4064
defer = jQuery.Deferred(),
4067
resolve = function() {
4068
if ( !( --count ) ) {
4069
defer.resolveWith( elements, [ elements ] );
4073
if ( typeof type !== "string" ) {
4077
type = type || "fx";
4080
tmp = jQuery._data( elements[ i ], type + "queueHooks" );
4081
if ( tmp && tmp.empty ) {
4083
tmp.empty.add( resolve );
4087
return defer.promise( obj );
4090
var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;
4092
var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
4094
var isHidden = function( elem, el ) {
4095
// isHidden might be called from jQuery#filter function;
4096
// in that case, element will be second argument
4098
return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
4103
// Multifunctional method to get and set values of a collection
4104
// The value/s can optionally be executed if it's a function
4105
var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
4107
length = elems.length,
4111
if ( jQuery.type( key ) === "object" ) {
4114
jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
4118
} else if ( value !== undefined ) {
4121
if ( !jQuery.isFunction( value ) ) {
4126
// Bulk operations run against the entire set
4128
fn.call( elems, value );
4131
// ...except when executing function values
4134
fn = function( elem, key, value ) {
4135
return bulk.call( jQuery( elem ), value );
4141
for ( ; i < length; i++ ) {
4142
fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
4153
length ? fn( elems[0], key ) : emptyGet;
4155
var rcheckableType = (/^(?:checkbox|radio)$/i);
4160
// Minified: var a,b,c
4161
var input = document.createElement( "input" ),
4162
div = document.createElement( "div" ),
4163
fragment = document.createDocumentFragment();
4166
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
4168
// IE strips leading whitespace when .innerHTML is used
4169
support.leadingWhitespace = div.firstChild.nodeType === 3;
4171
// Make sure that tbody elements aren't automatically inserted
4172
// IE will insert them into empty tables
4173
support.tbody = !div.getElementsByTagName( "tbody" ).length;
4175
// Make sure that link elements get serialized correctly by innerHTML
4176
// This requires a wrapper element in IE
4177
support.htmlSerialize = !!div.getElementsByTagName( "link" ).length;
4179
// Makes sure cloning an html5 element does not cause problems
4180
// Where outerHTML is undefined, this still works
4181
support.html5Clone =
4182
document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>";
4184
// Check if a disconnected checkbox will retain its checked
4185
// value of true after appended to the DOM (IE6/7)
4186
input.type = "checkbox";
4187
input.checked = true;
4188
fragment.appendChild( input );
4189
support.appendChecked = input.checked;
4191
// Make sure textarea (and checkbox) defaultValue is properly cloned
4192
// Support: IE6-IE11+
4193
div.innerHTML = "<textarea>x</textarea>";
4194
support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
4196
// #11217 - WebKit loses check when the name is after the checked attribute
4197
fragment.appendChild( div );
4198
div.innerHTML = "<input type='radio' checked='checked' name='t'/>";
4200
// Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
4201
// old WebKit doesn't clone checked state correctly in fragments
4202
support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
4205
// Opera does not clone events (and typeof div.attachEvent === undefined).
4206
// IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
4207
support.noCloneEvent = true;
4208
if ( div.attachEvent ) {
4209
div.attachEvent( "onclick", function() {
4210
support.noCloneEvent = false;
4213
div.cloneNode( true ).click();
4216
// Execute the test only if not already executed in another module.
4217
if (support.deleteExpando == null) {
4219
support.deleteExpando = true;
4223
support.deleteExpando = false;
4231
div = document.createElement( "div" );
4233
// Support: IE<9 (lack submit/change bubble), Firefox 23+ (lack focusin event)
4234
for ( i in { submit: true, change: true, focusin: true }) {
4235
eventName = "on" + i;
4237
if ( !(support[ i + "Bubbles" ] = eventName in window) ) {
4238
// Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
4239
div.setAttribute( eventName, "t" );
4240
support[ i + "Bubbles" ] = div.attributes[ eventName ].expando === false;
4244
// Null elements to avoid leaks in IE.
4249
var rformElems = /^(?:input|select|textarea)$/i,
4251
rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/,
4252
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
4253
rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
4255
function returnTrue() {
4259
function returnFalse() {
4263
function safeActiveElement() {
4265
return document.activeElement;
4270
* Helper functions for managing events -- not part of the public interface.
4271
* Props to Dean Edwards' addEvent library for many of the ideas.
4277
add: function( elem, types, handler, data, selector ) {
4278
var tmp, events, t, handleObjIn,
4279
special, eventHandle, handleObj,
4280
handlers, type, namespaces, origType,
4281
elemData = jQuery._data( elem );
4283
// Don't attach events to noData or text/comment nodes (but allow plain objects)
4288
// Caller can pass in an object of custom data in lieu of the handler
4289
if ( handler.handler ) {
4290
handleObjIn = handler;
4291
handler = handleObjIn.handler;
4292
selector = handleObjIn.selector;
4295
// Make sure that the handler has a unique ID, used to find/remove it later
4296
if ( !handler.guid ) {
4297
handler.guid = jQuery.guid++;
4300
// Init the element's event structure and main handler, if this is the first
4301
if ( !(events = elemData.events) ) {
4302
events = elemData.events = {};
4304
if ( !(eventHandle = elemData.handle) ) {
4305
eventHandle = elemData.handle = function( e ) {
4306
// Discard the second event of a jQuery.event.trigger() and
4307
// when an event is called after a page has unloaded
4308
return typeof jQuery !== strundefined && (!e || jQuery.event.triggered !== e.type) ?
4309
jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
4312
// Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
4313
eventHandle.elem = elem;
4316
// Handle multiple events separated by a space
4317
types = ( types || "" ).match( rnotwhite ) || [ "" ];
4320
tmp = rtypenamespace.exec( types[t] ) || [];
4321
type = origType = tmp[1];
4322
namespaces = ( tmp[2] || "" ).split( "." ).sort();
4324
// There *must* be a type, no attaching namespace-only handlers
4329
// If event changes its type, use the special event handlers for the changed type
4330
special = jQuery.event.special[ type ] || {};
4332
// If selector defined, determine special event api type, otherwise given type
4333
type = ( selector ? special.delegateType : special.bindType ) || type;
4335
// Update special based on newly reset type
4336
special = jQuery.event.special[ type ] || {};
4338
// handleObj is passed to all event handlers
4339
handleObj = jQuery.extend({
4346
needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
4347
namespace: namespaces.join(".")
4350
// Init the event handler queue if we're the first
4351
if ( !(handlers = events[ type ]) ) {
4352
handlers = events[ type ] = [];
4353
handlers.delegateCount = 0;
4355
// Only use addEventListener/attachEvent if the special events handler returns false
4356
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
4357
// Bind the global event handler to the element
4358
if ( elem.addEventListener ) {
4359
elem.addEventListener( type, eventHandle, false );
4361
} else if ( elem.attachEvent ) {
4362
elem.attachEvent( "on" + type, eventHandle );
4367
if ( special.add ) {
4368
special.add.call( elem, handleObj );
4370
if ( !handleObj.handler.guid ) {
4371
handleObj.handler.guid = handler.guid;
4375
// Add to the element's handler list, delegates in front
4377
handlers.splice( handlers.delegateCount++, 0, handleObj );
4379
handlers.push( handleObj );
4382
// Keep track of which events have ever been used, for event optimization
4383
jQuery.event.global[ type ] = true;
4386
// Nullify elem to prevent memory leaks in IE
4390
// Detach an event or set of events from an element
4391
remove: function( elem, types, handler, selector, mappedTypes ) {
4392
var j, handleObj, tmp,
4393
origCount, t, events,
4394
special, handlers, type,
4395
namespaces, origType,
4396
elemData = jQuery.hasData( elem ) && jQuery._data( elem );
4398
if ( !elemData || !(events = elemData.events) ) {
4402
// Once for each type.namespace in types; type may be omitted
4403
types = ( types || "" ).match( rnotwhite ) || [ "" ];
4406
tmp = rtypenamespace.exec( types[t] ) || [];
4407
type = origType = tmp[1];
4408
namespaces = ( tmp[2] || "" ).split( "." ).sort();
4410
// Unbind all events (on this namespace, if provided) for the element
4412
for ( type in events ) {
4413
jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
4418
special = jQuery.event.special[ type ] || {};
4419
type = ( selector ? special.delegateType : special.bindType ) || type;
4420
handlers = events[ type ] || [];
4421
tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
4423
// Remove matching events
4424
origCount = j = handlers.length;
4426
handleObj = handlers[ j ];
4428
if ( ( mappedTypes || origType === handleObj.origType ) &&
4429
( !handler || handler.guid === handleObj.guid ) &&
4430
( !tmp || tmp.test( handleObj.namespace ) ) &&
4431
( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
4432
handlers.splice( j, 1 );
4434
if ( handleObj.selector ) {
4435
handlers.delegateCount--;
4437
if ( special.remove ) {
4438
special.remove.call( elem, handleObj );
4443
// Remove generic event handler if we removed something and no more handlers exist
4444
// (avoids potential for endless recursion during removal of special event handlers)
4445
if ( origCount && !handlers.length ) {
4446
if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
4447
jQuery.removeEvent( elem, type, elemData.handle );
4450
delete events[ type ];
4454
// Remove the expando if it's no longer used
4455
if ( jQuery.isEmptyObject( events ) ) {
4456
delete elemData.handle;
4458
// removeData also checks for emptiness and clears the expando if empty
4459
// so use it instead of delete
4460
jQuery._removeData( elem, "events" );
4464
trigger: function( event, data, elem, onlyHandlers ) {
4465
var handle, ontype, cur,
4466
bubbleType, special, tmp, i,
4467
eventPath = [ elem || document ],
4468
type = hasOwn.call( event, "type" ) ? event.type : event,
4469
namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
4471
cur = tmp = elem = elem || document;
4473
// Don't do events on text and comment nodes
4474
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
4478
// focus/blur morphs to focusin/out; ensure we're not firing them right now
4479
if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
4483
if ( type.indexOf(".") >= 0 ) {
4484
// Namespaced trigger; create a regexp to match event type in handle()
4485
namespaces = type.split(".");
4486
type = namespaces.shift();
4489
ontype = type.indexOf(":") < 0 && "on" + type;
4491
// Caller can pass in a jQuery.Event object, Object, or just an event type string
4492
event = event[ jQuery.expando ] ?
4494
new jQuery.Event( type, typeof event === "object" && event );
4496
// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
4497
event.isTrigger = onlyHandlers ? 2 : 3;
4498
event.namespace = namespaces.join(".");
4499
event.namespace_re = event.namespace ?
4500
new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
4503
// Clean up the event in case it is being reused
4504
event.result = undefined;
4505
if ( !event.target ) {
4506
event.target = elem;
4509
// Clone any incoming data and prepend the event, creating the handler arg list
4510
data = data == null ?
4512
jQuery.makeArray( data, [ event ] );
4514
// Allow special events to draw outside the lines
4515
special = jQuery.event.special[ type ] || {};
4516
if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
4520
// Determine event propagation path in advance, per W3C events spec (#9951)
4521
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
4522
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
4524
bubbleType = special.delegateType || type;
4525
if ( !rfocusMorph.test( bubbleType + type ) ) {
4526
cur = cur.parentNode;
4528
for ( ; cur; cur = cur.parentNode ) {
4529
eventPath.push( cur );
4533
// Only add window if we got to document (e.g., not plain obj or detached DOM)
4534
if ( tmp === (elem.ownerDocument || document) ) {
4535
eventPath.push( tmp.defaultView || tmp.parentWindow || window );
4539
// Fire handlers on the event path
4541
while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
4543
event.type = i > 1 ?
4545
special.bindType || type;
4548
handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
4550
handle.apply( cur, data );
4554
handle = ontype && cur[ ontype ];
4555
if ( handle && handle.apply && jQuery.acceptData( cur ) ) {
4556
event.result = handle.apply( cur, data );
4557
if ( event.result === false ) {
4558
event.preventDefault();
4564
// If nobody prevented the default action, do it now
4565
if ( !onlyHandlers && !event.isDefaultPrevented() ) {
4567
if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&
4568
jQuery.acceptData( elem ) ) {
4570
// Call a native DOM method on the target with the same name name as the event.
4571
// Can't use an .isFunction() check here because IE6/7 fails that test.
4572
// Don't do default actions on window, that's where global variables be (#6170)
4573
if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
4575
// Don't re-trigger an onFOO event when we call its FOO() method
4576
tmp = elem[ ontype ];
4579
elem[ ontype ] = null;
4582
// Prevent re-triggering of the same event, since we already bubbled it above
4583
jQuery.event.triggered = type;
4587
// IE<9 dies on focus/blur to hidden element (#1486,#12518)
4588
// only reproducible on winXP IE8 native, not IE9 in IE8 mode
4590
jQuery.event.triggered = undefined;
4593
elem[ ontype ] = tmp;
4599
return event.result;
4602
dispatch: function( event ) {
4604
// Make a writable jQuery.Event from the native event object
4605
event = jQuery.event.fix( event );
4607
var i, ret, handleObj, matched, j,
4609
args = slice.call( arguments ),
4610
handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
4611
special = jQuery.event.special[ event.type ] || {};
4613
// Use the fix-ed jQuery.Event rather than the (read-only) native event
4615
event.delegateTarget = this;
4617
// Call the preDispatch hook for the mapped type, and let it bail if desired
4618
if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
4622
// Determine handlers
4623
handlerQueue = jQuery.event.handlers.call( this, event, handlers );
4625
// Run delegates first; they may want to stop propagation beneath us
4627
while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
4628
event.currentTarget = matched.elem;
4631
while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
4633
// Triggered event must either 1) have no namespace, or
4634
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
4635
if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
4637
event.handleObj = handleObj;
4638
event.data = handleObj.data;
4640
ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
4641
.apply( matched.elem, args );
4643
if ( ret !== undefined ) {
4644
if ( (event.result = ret) === false ) {
4645
event.preventDefault();
4646
event.stopPropagation();
4653
// Call the postDispatch hook for the mapped type
4654
if ( special.postDispatch ) {
4655
special.postDispatch.call( this, event );
4658
return event.result;
4661
handlers: function( event, handlers ) {
4662
var sel, handleObj, matches, i,
4664
delegateCount = handlers.delegateCount,
4667
// Find delegate handlers
4668
// Black-hole SVG <use> instance trees (#13180)
4669
// Avoid non-left-click bubbling in Firefox (#3861)
4670
if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
4672
/* jshint eqeqeq: false */
4673
for ( ; cur != this; cur = cur.parentNode || this ) {
4674
/* jshint eqeqeq: true */
4676
// Don't check non-elements (#13208)
4677
// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
4678
if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) {
4680
for ( i = 0; i < delegateCount; i++ ) {
4681
handleObj = handlers[ i ];
4683
// Don't conflict with Object.prototype properties (#13203)
4684
sel = handleObj.selector + " ";
4686
if ( matches[ sel ] === undefined ) {
4687
matches[ sel ] = handleObj.needsContext ?
4688
jQuery( sel, this ).index( cur ) >= 0 :
4689
jQuery.find( sel, this, null, [ cur ] ).length;
4691
if ( matches[ sel ] ) {
4692
matches.push( handleObj );
4695
if ( matches.length ) {
4696
handlerQueue.push({ elem: cur, handlers: matches });
4702
// Add the remaining (directly-bound) handlers
4703
if ( delegateCount < handlers.length ) {
4704
handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
4707
return handlerQueue;
4710
fix: function( event ) {
4711
if ( event[ jQuery.expando ] ) {
4715
// Create a writable copy of the event object and normalize some properties
4718
originalEvent = event,
4719
fixHook = this.fixHooks[ type ];
4722
this.fixHooks[ type ] = fixHook =
4723
rmouseEvent.test( type ) ? this.mouseHooks :
4724
rkeyEvent.test( type ) ? this.keyHooks :
4727
copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
4729
event = new jQuery.Event( originalEvent );
4734
event[ prop ] = originalEvent[ prop ];
4738
// Fix target property (#1925)
4739
if ( !event.target ) {
4740
event.target = originalEvent.srcElement || document;
4743
// Support: Chrome 23+, Safari?
4744
// Target should not be a text node (#504, #13143)
4745
if ( event.target.nodeType === 3 ) {
4746
event.target = event.target.parentNode;
4750
// For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
4751
event.metaKey = !!event.metaKey;
4753
return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
4756
// Includes some event props shared by KeyEvent and MouseEvent
4757
props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
4762
props: "char charCode key keyCode".split(" "),
4763
filter: function( event, original ) {
4765
// Add which for key events
4766
if ( event.which == null ) {
4767
event.which = original.charCode != null ? original.charCode : original.keyCode;
4775
props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
4776
filter: function( event, original ) {
4777
var body, eventDoc, doc,
4778
button = original.button,
4779
fromElement = original.fromElement;
4781
// Calculate pageX/Y if missing and clientX/Y available
4782
if ( event.pageX == null && original.clientX != null ) {
4783
eventDoc = event.target.ownerDocument || document;
4784
doc = eventDoc.documentElement;
4785
body = eventDoc.body;
4787
event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
4788
event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
4791
// Add relatedTarget, if necessary
4792
if ( !event.relatedTarget && fromElement ) {
4793
event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
4796
// Add which for click: 1 === left; 2 === middle; 3 === right
4797
// Note: button is not normalized, so don't use it
4798
if ( !event.which && button !== undefined ) {
4799
event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
4808
// Prevent triggered image.load events from bubbling to window.load
4812
// Fire native event if possible so blur/focus sequence is correct
4813
trigger: function() {
4814
if ( this !== safeActiveElement() && this.focus ) {
4820
// If we error on focus to hidden element (#1486, #12518),
4821
// let .trigger() run the handlers
4825
delegateType: "focusin"
4828
trigger: function() {
4829
if ( this === safeActiveElement() && this.blur ) {
4834
delegateType: "focusout"
4837
// For checkbox, fire native event so checked state will be right
4838
trigger: function() {
4839
if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
4845
// For cross-browser consistency, don't fire native .click() on links
4846
_default: function( event ) {
4847
return jQuery.nodeName( event.target, "a" );
4852
postDispatch: function( event ) {
4854
// Support: Firefox 20+
4855
// Firefox doesn't alert if the returnValue field is not set.
4856
if ( event.result !== undefined && event.originalEvent ) {
4857
event.originalEvent.returnValue = event.result;
4863
simulate: function( type, elem, event, bubble ) {
4864
// Piggyback on a donor event to simulate a different one.
4865
// Fake originalEvent to avoid donor's stopPropagation, but if the
4866
// simulated event prevents default then we do the same on the donor.
4867
var e = jQuery.extend(
4877
jQuery.event.trigger( e, null, elem );
4879
jQuery.event.dispatch.call( elem, e );
4881
if ( e.isDefaultPrevented() ) {
4882
event.preventDefault();
4887
jQuery.removeEvent = document.removeEventListener ?
4888
function( elem, type, handle ) {
4889
if ( elem.removeEventListener ) {
4890
elem.removeEventListener( type, handle, false );
4893
function( elem, type, handle ) {
4894
var name = "on" + type;
4896
if ( elem.detachEvent ) {
4898
// #8545, #7054, preventing memory leaks for custom events in IE6-8
4899
// detachEvent needed property on element, by name of that event, to properly expose it to GC
4900
if ( typeof elem[ name ] === strundefined ) {
4901
elem[ name ] = null;
4904
elem.detachEvent( name, handle );
4908
jQuery.Event = function( src, props ) {
4909
// Allow instantiation without the 'new' keyword
4910
if ( !(this instanceof jQuery.Event) ) {
4911
return new jQuery.Event( src, props );
4915
if ( src && src.type ) {
4916
this.originalEvent = src;
4917
this.type = src.type;
4919
// Events bubbling up the document may have been marked as prevented
4920
// by a handler lower down the tree; reflect the correct value.
4921
this.isDefaultPrevented = src.defaultPrevented ||
4922
src.defaultPrevented === undefined &&
4923
// Support: IE < 9, Android < 4.0
4924
src.returnValue === false ?
4933
// Put explicitly provided properties onto the event object
4935
jQuery.extend( this, props );
4938
// Create a timestamp if incoming event doesn't have one
4939
this.timeStamp = src && src.timeStamp || jQuery.now();
4942
this[ jQuery.expando ] = true;
4945
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
4946
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
4947
jQuery.Event.prototype = {
4948
isDefaultPrevented: returnFalse,
4949
isPropagationStopped: returnFalse,
4950
isImmediatePropagationStopped: returnFalse,
4952
preventDefault: function() {
4953
var e = this.originalEvent;
4955
this.isDefaultPrevented = returnTrue;
4960
// If preventDefault exists, run it on the original event
4961
if ( e.preventDefault ) {
4965
// Otherwise set the returnValue property of the original event to false
4967
e.returnValue = false;
4970
stopPropagation: function() {
4971
var e = this.originalEvent;
4973
this.isPropagationStopped = returnTrue;
4977
// If stopPropagation exists, run it on the original event
4978
if ( e.stopPropagation ) {
4979
e.stopPropagation();
4983
// Set the cancelBubble property of the original event to true
4984
e.cancelBubble = true;
4986
stopImmediatePropagation: function() {
4987
var e = this.originalEvent;
4989
this.isImmediatePropagationStopped = returnTrue;
4991
if ( e && e.stopImmediatePropagation ) {
4992
e.stopImmediatePropagation();
4995
this.stopPropagation();
4999
// Create mouseenter/leave events using mouseover/out and event-time checks
5001
mouseenter: "mouseover",
5002
mouseleave: "mouseout",
5003
pointerenter: "pointerover",
5004
pointerleave: "pointerout"
5005
}, function( orig, fix ) {
5006
jQuery.event.special[ orig ] = {
5010
handle: function( event ) {
5013
related = event.relatedTarget,
5014
handleObj = event.handleObj;
5016
// For mousenter/leave call the handler if related is outside the target.
5017
// NB: No relatedTarget if the mouse left/entered the browser window
5018
if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
5019
event.type = handleObj.origType;
5020
ret = handleObj.handler.apply( this, arguments );
5028
// IE submit delegation
5029
if ( !support.submitBubbles ) {
5031
jQuery.event.special.submit = {
5033
// Only need this for delegated form submit events
5034
if ( jQuery.nodeName( this, "form" ) ) {
5038
// Lazy-add a submit handler when a descendant form may potentially be submitted
5039
jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
5040
// Node name check avoids a VML-related crash in IE (#9807)
5041
var elem = e.target,
5042
form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
5043
if ( form && !jQuery._data( form, "submitBubbles" ) ) {
5044
jQuery.event.add( form, "submit._submit", function( event ) {
5045
event._submit_bubble = true;
5047
jQuery._data( form, "submitBubbles", true );
5050
// return undefined since we don't need an event listener
5053
postDispatch: function( event ) {
5054
// If form was submitted by the user, bubble the event up the tree
5055
if ( event._submit_bubble ) {
5056
delete event._submit_bubble;
5057
if ( this.parentNode && !event.isTrigger ) {
5058
jQuery.event.simulate( "submit", this.parentNode, event, true );
5063
teardown: function() {
5064
// Only need this for delegated form submit events
5065
if ( jQuery.nodeName( this, "form" ) ) {
5069
// Remove delegated handlers; cleanData eventually reaps submit handlers attached above
5070
jQuery.event.remove( this, "._submit" );
5075
// IE change delegation and checkbox/radio fix
5076
if ( !support.changeBubbles ) {
5078
jQuery.event.special.change = {
5082
if ( rformElems.test( this.nodeName ) ) {
5083
// IE doesn't fire change on a check/radio until blur; trigger it on click
5084
// after a propertychange. Eat the blur-change in special.change.handle.
5085
// This still fires onchange a second time for check/radio after blur.
5086
if ( this.type === "checkbox" || this.type === "radio" ) {
5087
jQuery.event.add( this, "propertychange._change", function( event ) {
5088
if ( event.originalEvent.propertyName === "checked" ) {
5089
this._just_changed = true;
5092
jQuery.event.add( this, "click._change", function( event ) {
5093
if ( this._just_changed && !event.isTrigger ) {
5094
this._just_changed = false;
5096
// Allow triggered, simulated change events (#11500)
5097
jQuery.event.simulate( "change", this, event, true );
5102
// Delegated event; lazy-add a change handler on descendant inputs
5103
jQuery.event.add( this, "beforeactivate._change", function( e ) {
5104
var elem = e.target;
5106
if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) {
5107
jQuery.event.add( elem, "change._change", function( event ) {
5108
if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
5109
jQuery.event.simulate( "change", this.parentNode, event, true );
5112
jQuery._data( elem, "changeBubbles", true );
5117
handle: function( event ) {
5118
var elem = event.target;
5120
// Swallow native change events from checkbox/radio, we already triggered them above
5121
if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
5122
return event.handleObj.handler.apply( this, arguments );
5126
teardown: function() {
5127
jQuery.event.remove( this, "._change" );
5129
return !rformElems.test( this.nodeName );
5134
// Create "bubbling" focus and blur events
5135
if ( !support.focusinBubbles ) {
5136
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
5138
// Attach a single capturing handler on the document while someone wants focusin/focusout
5139
var handler = function( event ) {
5140
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
5143
jQuery.event.special[ fix ] = {
5145
var doc = this.ownerDocument || this,
5146
attaches = jQuery._data( doc, fix );
5149
doc.addEventListener( orig, handler, true );
5151
jQuery._data( doc, fix, ( attaches || 0 ) + 1 );
5153
teardown: function() {
5154
var doc = this.ownerDocument || this,
5155
attaches = jQuery._data( doc, fix ) - 1;
5158
doc.removeEventListener( orig, handler, true );
5159
jQuery._removeData( doc, fix );
5161
jQuery._data( doc, fix, attaches );
5170
on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
5173
// Types can be a map of types/handlers
5174
if ( typeof types === "object" ) {
5175
// ( types-Object, selector, data )
5176
if ( typeof selector !== "string" ) {
5177
// ( types-Object, data )
5178
data = data || selector;
5179
selector = undefined;
5181
for ( type in types ) {
5182
this.on( type, selector, data, types[ type ], one );
5187
if ( data == null && fn == null ) {
5190
data = selector = undefined;
5191
} else if ( fn == null ) {
5192
if ( typeof selector === "string" ) {
5193
// ( types, selector, fn )
5197
// ( types, data, fn )
5200
selector = undefined;
5203
if ( fn === false ) {
5211
fn = function( event ) {
5212
// Can use an empty set, since event contains the info
5213
jQuery().off( event );
5214
return origFn.apply( this, arguments );
5216
// Use same guid so caller can remove using origFn
5217
fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
5219
return this.each( function() {
5220
jQuery.event.add( this, types, fn, data, selector );
5223
one: function( types, selector, data, fn ) {
5224
return this.on( types, selector, data, fn, 1 );
5226
off: function( types, selector, fn ) {
5227
var handleObj, type;
5228
if ( types && types.preventDefault && types.handleObj ) {
5229
// ( event ) dispatched jQuery.Event
5230
handleObj = types.handleObj;
5231
jQuery( types.delegateTarget ).off(
5232
handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
5238
if ( typeof types === "object" ) {
5239
// ( types-object [, selector] )
5240
for ( type in types ) {
5241
this.off( type, selector, types[ type ] );
5245
if ( selector === false || typeof selector === "function" ) {
5248
selector = undefined;
5250
if ( fn === false ) {
5253
return this.each(function() {
5254
jQuery.event.remove( this, types, fn, selector );
5258
trigger: function( type, data ) {
5259
return this.each(function() {
5260
jQuery.event.trigger( type, data, this );
5263
triggerHandler: function( type, data ) {
5266
return jQuery.event.trigger( type, data, elem, true );
5272
function createSafeFragment( document ) {
5273
var list = nodeNames.split( "|" ),
5274
safeFrag = document.createDocumentFragment();
5276
if ( safeFrag.createElement ) {
5277
while ( list.length ) {
5278
safeFrag.createElement(
5286
var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
5287
"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
5288
rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
5289
rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
5290
rleadingWhitespace = /^\s+/,
5291
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
5292
rtagName = /<([\w:]+)/,
5294
rhtml = /<|&#?\w+;/,
5295
rnoInnerhtml = /<(?:script|style|link)/i,
5296
// checked="checked" or checked
5297
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
5298
rscriptType = /^$|\/(?:java|ecma)script/i,
5299
rscriptTypeMasked = /^true\/(.*)/,
5300
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
5302
// We have to close these tags to support XHTML (#13200)
5304
option: [ 1, "<select multiple='multiple'>", "</select>" ],
5305
legend: [ 1, "<fieldset>", "</fieldset>" ],
5306
area: [ 1, "<map>", "</map>" ],
5307
param: [ 1, "<object>", "</object>" ],
5308
thead: [ 1, "<table>", "</table>" ],
5309
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
5310
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
5311
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
5313
// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
5314
// unless wrapped in a div with non-breaking characters in front of it.
5315
_default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
5317
safeFragment = createSafeFragment( document ),
5318
fragmentDiv = safeFragment.appendChild( document.createElement("div") );
5320
wrapMap.optgroup = wrapMap.option;
5321
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
5322
wrapMap.th = wrapMap.td;
5324
function getAll( context, tag ) {
5327
found = typeof context.getElementsByTagName !== strundefined ? context.getElementsByTagName( tag || "*" ) :
5328
typeof context.querySelectorAll !== strundefined ? context.querySelectorAll( tag || "*" ) :
5332
for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {
5333
if ( !tag || jQuery.nodeName( elem, tag ) ) {
5336
jQuery.merge( found, getAll( elem, tag ) );
5341
return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
5342
jQuery.merge( [ context ], found ) :
5346
// Used in buildFragment, fixes the defaultChecked property
5347
function fixDefaultChecked( elem ) {
5348
if ( rcheckableType.test( elem.type ) ) {
5349
elem.defaultChecked = elem.checked;
5354
// Manipulating tables requires a tbody
5355
function manipulationTarget( elem, content ) {
5356
return jQuery.nodeName( elem, "table" ) &&
5357
jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
5359
elem.getElementsByTagName("tbody")[0] ||
5360
elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
5364
// Replace/restore the type attribute of script elements for safe DOM manipulation
5365
function disableScript( elem ) {
5366
elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type;
5369
function restoreScript( elem ) {
5370
var match = rscriptTypeMasked.exec( elem.type );
5372
elem.type = match[1];
5374
elem.removeAttribute("type");
5379
// Mark scripts as having already been evaluated
5380
function setGlobalEval( elems, refElements ) {
5383
for ( ; (elem = elems[i]) != null; i++ ) {
5384
jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );
5388
function cloneCopyEvent( src, dest ) {
5390
if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
5395
oldData = jQuery._data( src ),
5396
curData = jQuery._data( dest, oldData ),
5397
events = oldData.events;
5400
delete curData.handle;
5401
curData.events = {};
5403
for ( type in events ) {
5404
for ( i = 0, l = events[ type ].length; i < l; i++ ) {
5405
jQuery.event.add( dest, type, events[ type ][ i ] );
5410
// make the cloned public data object a copy from the original
5411
if ( curData.data ) {
5412
curData.data = jQuery.extend( {}, curData.data );
5416
function fixCloneNodeIssues( src, dest ) {
5417
var nodeName, e, data;
5419
// We do not need to do anything for non-Elements
5420
if ( dest.nodeType !== 1 ) {
5424
nodeName = dest.nodeName.toLowerCase();
5426
// IE6-8 copies events bound via attachEvent when using cloneNode.
5427
if ( !support.noCloneEvent && dest[ jQuery.expando ] ) {
5428
data = jQuery._data( dest );
5430
for ( e in data.events ) {
5431
jQuery.removeEvent( dest, e, data.handle );
5434
// Event data gets referenced instead of copied if the expando gets copied too
5435
dest.removeAttribute( jQuery.expando );
5438
// IE blanks contents when cloning scripts, and tries to evaluate newly-set text
5439
if ( nodeName === "script" && dest.text !== src.text ) {
5440
disableScript( dest ).text = src.text;
5441
restoreScript( dest );
5443
// IE6-10 improperly clones children of object elements using classid.
5444
// IE10 throws NoModificationAllowedError if parent is null, #12132.
5445
} else if ( nodeName === "object" ) {
5446
if ( dest.parentNode ) {
5447
dest.outerHTML = src.outerHTML;
5450
// This path appears unavoidable for IE9. When cloning an object
5451
// element in IE9, the outerHTML strategy above is not sufficient.
5452
// If the src has innerHTML and the destination does not,
5453
// copy the src.innerHTML into the dest.innerHTML. #10324
5454
if ( support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
5455
dest.innerHTML = src.innerHTML;
5458
} else if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
5459
// IE6-8 fails to persist the checked state of a cloned checkbox
5460
// or radio button. Worse, IE6-7 fail to give the cloned element
5461
// a checked appearance if the defaultChecked value isn't also set
5463
dest.defaultChecked = dest.checked = src.checked;
5465
// IE6-7 get confused and end up setting the value of a cloned
5466
// checkbox/radio button to an empty string instead of "on"
5467
if ( dest.value !== src.value ) {
5468
dest.value = src.value;
5471
// IE6-8 fails to return the selected option to the default selected
5472
// state when cloning options
5473
} else if ( nodeName === "option" ) {
5474
dest.defaultSelected = dest.selected = src.defaultSelected;
5476
// IE6-8 fails to set the defaultValue to the correct value when
5477
// cloning other types of input fields
5478
} else if ( nodeName === "input" || nodeName === "textarea" ) {
5479
dest.defaultValue = src.defaultValue;
5484
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
5485
var destElements, node, clone, i, srcElements,
5486
inPage = jQuery.contains( elem.ownerDocument, elem );
5488
if ( support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
5489
clone = elem.cloneNode( true );
5491
// IE<=8 does not properly clone detached, unknown element nodes
5493
fragmentDiv.innerHTML = elem.outerHTML;
5494
fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
5497
if ( (!support.noCloneEvent || !support.noCloneChecked) &&
5498
(elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
5500
// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
5501
destElements = getAll( clone );
5502
srcElements = getAll( elem );
5504
// Fix all IE cloning issues
5505
for ( i = 0; (node = srcElements[i]) != null; ++i ) {
5506
// Ensure that the destination node is not null; Fixes #9587
5507
if ( destElements[i] ) {
5508
fixCloneNodeIssues( node, destElements[i] );
5513
// Copy the events from the original to the clone
5514
if ( dataAndEvents ) {
5515
if ( deepDataAndEvents ) {
5516
srcElements = srcElements || getAll( elem );
5517
destElements = destElements || getAll( clone );
5519
for ( i = 0; (node = srcElements[i]) != null; i++ ) {
5520
cloneCopyEvent( node, destElements[i] );
5523
cloneCopyEvent( elem, clone );
5527
// Preserve script evaluation history
5528
destElements = getAll( clone, "script" );
5529
if ( destElements.length > 0 ) {
5530
setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
5533
destElements = srcElements = node = null;
5535
// Return the cloned set
5539
buildFragment: function( elems, context, scripts, selection ) {
5540
var j, elem, contains,
5541
tmp, tag, tbody, wrap,
5544
// Ensure a safe fragment
5545
safe = createSafeFragment( context ),
5550
for ( ; i < l; i++ ) {
5553
if ( elem || elem === 0 ) {
5555
// Add nodes directly
5556
if ( jQuery.type( elem ) === "object" ) {
5557
jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
5559
// Convert non-html into a text node
5560
} else if ( !rhtml.test( elem ) ) {
5561
nodes.push( context.createTextNode( elem ) );
5563
// Convert html into DOM nodes
5565
tmp = tmp || safe.appendChild( context.createElement("div") );
5567
// Deserialize a standard representation
5568
tag = (rtagName.exec( elem ) || [ "", "" ])[ 1 ].toLowerCase();
5569
wrap = wrapMap[ tag ] || wrapMap._default;
5571
tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
5573
// Descend through wrappers to the right content
5576
tmp = tmp.lastChild;
5579
// Manually add leading whitespace removed by IE
5580
if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
5581
nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );
5584
// Remove IE's autoinserted <tbody> from table fragments
5585
if ( !support.tbody ) {
5587
// String was a <table>, *may* have spurious <tbody>
5588
elem = tag === "table" && !rtbody.test( elem ) ?
5591
// String was a bare <thead> or <tfoot>
5592
wrap[1] === "<table>" && !rtbody.test( elem ) ?
5596
j = elem && elem.childNodes.length;
5598
if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
5599
elem.removeChild( tbody );
5604
jQuery.merge( nodes, tmp.childNodes );
5606
// Fix #12392 for WebKit and IE > 9
5607
tmp.textContent = "";
5609
// Fix #12392 for oldIE
5610
while ( tmp.firstChild ) {
5611
tmp.removeChild( tmp.firstChild );
5614
// Remember the top-level container for proper cleanup
5615
tmp = safe.lastChild;
5620
// Fix #11356: Clear elements from fragment
5622
safe.removeChild( tmp );
5625
// Reset defaultChecked for any radios and checkboxes
5626
// about to be appended to the DOM in IE 6/7 (#8060)
5627
if ( !support.appendChecked ) {
5628
jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
5632
while ( (elem = nodes[ i++ ]) ) {
5634
// #4087 - If origin and destination elements are the same, and this is
5635
// that element, do not do anything
5636
if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
5640
contains = jQuery.contains( elem.ownerDocument, elem );
5642
// Append to fragment
5643
tmp = getAll( safe.appendChild( elem ), "script" );
5645
// Preserve script evaluation history
5647
setGlobalEval( tmp );
5650
// Capture executables
5653
while ( (elem = tmp[ j++ ]) ) {
5654
if ( rscriptType.test( elem.type || "" ) ) {
5655
scripts.push( elem );
5666
cleanData: function( elems, /* internal */ acceptData ) {
5667
var elem, type, id, data,
5669
internalKey = jQuery.expando,
5670
cache = jQuery.cache,
5671
deleteExpando = support.deleteExpando,
5672
special = jQuery.event.special;
5674
for ( ; (elem = elems[i]) != null; i++ ) {
5675
if ( acceptData || jQuery.acceptData( elem ) ) {
5677
id = elem[ internalKey ];
5678
data = id && cache[ id ];
5681
if ( data.events ) {
5682
for ( type in data.events ) {
5683
if ( special[ type ] ) {
5684
jQuery.event.remove( elem, type );
5686
// This is a shortcut to avoid jQuery.event.remove's overhead
5688
jQuery.removeEvent( elem, type, data.handle );
5693
// Remove cache only if it was not already removed by jQuery.event.remove
5694
if ( cache[ id ] ) {
5698
// IE does not allow us to delete expando properties from nodes,
5699
// nor does it have a removeAttribute function on Document nodes;
5700
// we must handle all of these cases
5701
if ( deleteExpando ) {
5702
delete elem[ internalKey ];
5704
} else if ( typeof elem.removeAttribute !== strundefined ) {
5705
elem.removeAttribute( internalKey );
5708
elem[ internalKey ] = null;
5711
deletedIds.push( id );
5720
text: function( value ) {
5721
return access( this, function( value ) {
5722
return value === undefined ?
5723
jQuery.text( this ) :
5724
this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
5725
}, null, value, arguments.length );
5728
append: function() {
5729
return this.domManip( arguments, function( elem ) {
5730
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5731
var target = manipulationTarget( this, elem );
5732
target.appendChild( elem );
5737
prepend: function() {
5738
return this.domManip( arguments, function( elem ) {
5739
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5740
var target = manipulationTarget( this, elem );
5741
target.insertBefore( elem, target.firstChild );
5746
before: function() {
5747
return this.domManip( arguments, function( elem ) {
5748
if ( this.parentNode ) {
5749
this.parentNode.insertBefore( elem, this );
5755
return this.domManip( arguments, function( elem ) {
5756
if ( this.parentNode ) {
5757
this.parentNode.insertBefore( elem, this.nextSibling );
5762
remove: function( selector, keepData /* Internal Use Only */ ) {
5764
elems = selector ? jQuery.filter( selector, this ) : this,
5767
for ( ; (elem = elems[i]) != null; i++ ) {
5769
if ( !keepData && elem.nodeType === 1 ) {
5770
jQuery.cleanData( getAll( elem ) );
5773
if ( elem.parentNode ) {
5774
if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
5775
setGlobalEval( getAll( elem, "script" ) );
5777
elem.parentNode.removeChild( elem );
5788
for ( ; (elem = this[i]) != null; i++ ) {
5789
// Remove element nodes and prevent memory leaks
5790
if ( elem.nodeType === 1 ) {
5791
jQuery.cleanData( getAll( elem, false ) );
5794
// Remove any remaining nodes
5795
while ( elem.firstChild ) {
5796
elem.removeChild( elem.firstChild );
5799
// If this is a select, ensure that it displays empty (#12336)
5801
if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
5802
elem.options.length = 0;
5809
clone: function( dataAndEvents, deepDataAndEvents ) {
5810
dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
5811
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
5813
return this.map(function() {
5814
return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
5818
html: function( value ) {
5819
return access( this, function( value ) {
5820
var elem = this[ 0 ] || {},
5824
if ( value === undefined ) {
5825
return elem.nodeType === 1 ?
5826
elem.innerHTML.replace( rinlinejQuery, "" ) :
5830
// See if we can take a shortcut and just use innerHTML
5831
if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
5832
( support.htmlSerialize || !rnoshimcache.test( value ) ) &&
5833
( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
5834
!wrapMap[ (rtagName.exec( value ) || [ "", "" ])[ 1 ].toLowerCase() ] ) {
5836
value = value.replace( rxhtmlTag, "<$1></$2>" );
5839
for (; i < l; i++ ) {
5840
// Remove element nodes and prevent memory leaks
5841
elem = this[i] || {};
5842
if ( elem.nodeType === 1 ) {
5843
jQuery.cleanData( getAll( elem, false ) );
5844
elem.innerHTML = value;
5850
// If using innerHTML throws an exception, use the fallback method
5855
this.empty().append( value );
5857
}, null, value, arguments.length );
5860
replaceWith: function() {
5861
var arg = arguments[ 0 ];
5863
// Make the changes, replacing each context element with the new content
5864
this.domManip( arguments, function( elem ) {
5865
arg = this.parentNode;
5867
jQuery.cleanData( getAll( this ) );
5870
arg.replaceChild( elem, this );
5874
// Force removal if there was no new content (e.g., from empty arguments)
5875
return arg && (arg.length || arg.nodeType) ? this : this.remove();
5878
detach: function( selector ) {
5879
return this.remove( selector, true );
5882
domManip: function( args, callback ) {
5884
// Flatten any nested arrays
5885
args = concat.apply( [], args );
5887
var first, node, hasScripts,
5888
scripts, doc, fragment,
5894
isFunction = jQuery.isFunction( value );
5896
// We can't cloneNode fragments that contain checked, in WebKit
5898
( l > 1 && typeof value === "string" &&
5899
!support.checkClone && rchecked.test( value ) ) ) {
5900
return this.each(function( index ) {
5901
var self = set.eq( index );
5903
args[0] = value.call( this, index, self.html() );
5905
self.domManip( args, callback );
5910
fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
5911
first = fragment.firstChild;
5913
if ( fragment.childNodes.length === 1 ) {
5918
scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
5919
hasScripts = scripts.length;
5921
// Use the original fragment for the last item instead of the first because it can end up
5922
// being emptied incorrectly in certain situations (#8070).
5923
for ( ; i < l; i++ ) {
5926
if ( i !== iNoClone ) {
5927
node = jQuery.clone( node, true, true );
5929
// Keep references to cloned scripts for later restoration
5931
jQuery.merge( scripts, getAll( node, "script" ) );
5935
callback.call( this[i], node, i );
5939
doc = scripts[ scripts.length - 1 ].ownerDocument;
5942
jQuery.map( scripts, restoreScript );
5944
// Evaluate executable scripts on first document insertion
5945
for ( i = 0; i < hasScripts; i++ ) {
5946
node = scripts[ i ];
5947
if ( rscriptType.test( node.type || "" ) &&
5948
!jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
5951
// Optional AJAX dependency, but won't run scripts if not present
5952
if ( jQuery._evalUrl ) {
5953
jQuery._evalUrl( node.src );
5956
jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );
5962
// Fix #11809: Avoid leaking memory
5963
fragment = first = null;
5973
prependTo: "prepend",
5974
insertBefore: "before",
5975
insertAfter: "after",
5976
replaceAll: "replaceWith"
5977
}, function( name, original ) {
5978
jQuery.fn[ name ] = function( selector ) {
5982
insert = jQuery( selector ),
5983
last = insert.length - 1;
5985
for ( ; i <= last; i++ ) {
5986
elems = i === last ? this : this.clone(true);
5987
jQuery( insert[i] )[ original ]( elems );
5989
// Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
5990
push.apply( ret, elems.get() );
5993
return this.pushStack( ret );
6002
* Retrieve the actual display of a element
6003
* @param {String} name nodeName of the element
6004
* @param {Object} doc Document object
6006
// Called only from within defaultDisplay
6007
function actualDisplay( name, doc ) {
6009
elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
6011
// getDefaultComputedStyle might be reliably used only on attached element
6012
display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ?
6014
// Use of this method is a temporary fix (more like optmization) until something better comes along,
6015
// since it was removed from specification and supported only in FF
6016
style.display : jQuery.css( elem[ 0 ], "display" );
6018
// We don't have any data stored on the element,
6019
// so use "detach" method as fast way to get rid of the element
6026
* Try to determine the default display value of an element
6027
* @param {String} nodeName
6029
function defaultDisplay( nodeName ) {
6031
display = elemdisplay[ nodeName ];
6034
display = actualDisplay( nodeName, doc );
6036
// If the simple way fails, read from inside an iframe
6037
if ( display === "none" || !display ) {
6039
// Use the already-created iframe if possible
6040
iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement );
6042
// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
6043
doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentDocument ).document;
6049
display = actualDisplay( nodeName, doc );
6053
// Store the correct default display
6054
elemdisplay[ nodeName ] = display;
6062
var shrinkWrapBlocksVal;
6064
support.shrinkWrapBlocks = function() {
6065
if ( shrinkWrapBlocksVal != null ) {
6066
return shrinkWrapBlocksVal;
6069
// Will be changed later if needed.
6070
shrinkWrapBlocksVal = false;
6072
// Minified: var b,c,d
6073
var div, body, container;
6075
body = document.getElementsByTagName( "body" )[ 0 ];
6076
if ( !body || !body.style ) {
6077
// Test fired too early or in an unsupported environment, exit.
6082
div = document.createElement( "div" );
6083
container = document.createElement( "div" );
6084
container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
6085
body.appendChild( container ).appendChild( div );
6088
// Check if elements with layout shrink-wrap their children
6089
if ( typeof div.style.zoom !== strundefined ) {
6090
// Reset CSS: box-sizing; display; margin; border
6092
// Support: Firefox<29, Android 2.3
6093
// Vendor-prefix box-sizing
6094
"-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
6095
"box-sizing:content-box;display:block;margin:0;border:0;" +
6096
"padding:1px;width:1px;zoom:1";
6097
div.appendChild( document.createElement( "div" ) ).style.width = "5px";
6098
shrinkWrapBlocksVal = div.offsetWidth !== 3;
6101
body.removeChild( container );
6103
return shrinkWrapBlocksVal;
6107
var rmargin = (/^margin/);
6109
var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
6113
var getStyles, curCSS,
6114
rposition = /^(top|right|bottom|left)$/;
6116
if ( window.getComputedStyle ) {
6117
getStyles = function( elem ) {
6118
return elem.ownerDocument.defaultView.getComputedStyle( elem, null );
6121
curCSS = function( elem, name, computed ) {
6122
var width, minWidth, maxWidth, ret,
6125
computed = computed || getStyles( elem );
6127
// getPropertyValue is only needed for .css('filter') in IE9, see #12537
6128
ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined;
6132
if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
6133
ret = jQuery.style( elem, name );
6136
// A tribute to the "awesome hack by Dean Edwards"
6137
// Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
6138
// Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
6139
// this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
6140
if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
6142
// Remember the original values
6143
width = style.width;
6144
minWidth = style.minWidth;
6145
maxWidth = style.maxWidth;
6147
// Put in the new values to get a computed value out
6148
style.minWidth = style.maxWidth = style.width = ret;
6149
ret = computed.width;
6151
// Revert the changed values
6152
style.width = width;
6153
style.minWidth = minWidth;
6154
style.maxWidth = maxWidth;
6159
// IE returns zIndex value as an integer.
6160
return ret === undefined ?
6164
} else if ( document.documentElement.currentStyle ) {
6165
getStyles = function( elem ) {
6166
return elem.currentStyle;
6169
curCSS = function( elem, name, computed ) {
6170
var left, rs, rsLeft, ret,
6173
computed = computed || getStyles( elem );
6174
ret = computed ? computed[ name ] : undefined;
6176
// Avoid setting ret to empty string here
6177
// so we don't default to auto
6178
if ( ret == null && style && style[ name ] ) {
6179
ret = style[ name ];
6182
// From the awesome hack by Dean Edwards
6183
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
6185
// If we're not dealing with a regular pixel number
6186
// but a number that has a weird ending, we need to convert it to pixels
6187
// but not position css attributes, as those are proportional to the parent element instead
6188
// and we can't measure the parent instead because it might trigger a "stacking dolls" problem
6189
if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
6191
// Remember the original values
6193
rs = elem.runtimeStyle;
6194
rsLeft = rs && rs.left;
6196
// Put in the new values to get a computed value out
6198
rs.left = elem.currentStyle.left;
6200
style.left = name === "fontSize" ? "1em" : ret;
6201
ret = style.pixelLeft + "px";
6203
// Revert the changed values
6211
// IE returns zIndex value as an integer.
6212
return ret === undefined ?
6221
function addGetHookIf( conditionFn, hookFn ) {
6222
// Define the hook, we'll check on the first run if it's really needed.
6225
var condition = conditionFn();
6227
if ( condition == null ) {
6228
// The test was not ready at this point; screw the hook this time
6229
// but check again when needed next time.
6234
// Hook not needed (or it's not possible to use it due to missing dependency),
6236
// Since there are no other hooks for marginRight, remove the whole object.
6241
// Hook needed; redefine it so that the support test is not executed again.
6243
return (this.get = hookFn).apply( this, arguments );
6250
// Minified: var b,c,d,e,f,g, h,i
6251
var div, style, a, pixelPositionVal, boxSizingReliableVal,
6252
reliableHiddenOffsetsVal, reliableMarginRightVal;
6255
div = document.createElement( "div" );
6256
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
6257
a = div.getElementsByTagName( "a" )[ 0 ];
6258
style = a && a.style;
6260
// Finish early in limited (non-browser) environments
6265
style.cssText = "float:left;opacity:.5";
6268
// Make sure that element opacity exists (as opposed to filter)
6269
support.opacity = style.opacity === "0.5";
6271
// Verify style float existence
6272
// (IE uses styleFloat instead of cssFloat)
6273
support.cssFloat = !!style.cssFloat;
6275
div.style.backgroundClip = "content-box";
6276
div.cloneNode( true ).style.backgroundClip = "";
6277
support.clearCloneStyle = div.style.backgroundClip === "content-box";
6279
// Support: Firefox<29, Android 2.3
6280
// Vendor-prefix box-sizing
6281
support.boxSizing = style.boxSizing === "" || style.MozBoxSizing === "" ||
6282
style.WebkitBoxSizing === "";
6284
jQuery.extend(support, {
6285
reliableHiddenOffsets: function() {
6286
if ( reliableHiddenOffsetsVal == null ) {
6287
computeStyleTests();
6289
return reliableHiddenOffsetsVal;
6292
boxSizingReliable: function() {
6293
if ( boxSizingReliableVal == null ) {
6294
computeStyleTests();
6296
return boxSizingReliableVal;
6299
pixelPosition: function() {
6300
if ( pixelPositionVal == null ) {
6301
computeStyleTests();
6303
return pixelPositionVal;
6306
// Support: Android 2.3
6307
reliableMarginRight: function() {
6308
if ( reliableMarginRightVal == null ) {
6309
computeStyleTests();
6311
return reliableMarginRightVal;
6315
function computeStyleTests() {
6316
// Minified: var b,c,d,j
6317
var div, body, container, contents;
6319
body = document.getElementsByTagName( "body" )[ 0 ];
6320
if ( !body || !body.style ) {
6321
// Test fired too early or in an unsupported environment, exit.
6326
div = document.createElement( "div" );
6327
container = document.createElement( "div" );
6328
container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
6329
body.appendChild( container ).appendChild( div );
6332
// Support: Firefox<29, Android 2.3
6333
// Vendor-prefix box-sizing
6334
"-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
6335
"box-sizing:border-box;display:block;margin-top:1%;top:1%;" +
6336
"border:1px;padding:1px;width:4px;position:absolute";
6339
// Assume reasonable values in the absence of getComputedStyle
6340
pixelPositionVal = boxSizingReliableVal = false;
6341
reliableMarginRightVal = true;
6343
// Check for getComputedStyle so that this code is not run in IE<9.
6344
if ( window.getComputedStyle ) {
6345
pixelPositionVal = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
6346
boxSizingReliableVal =
6347
( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
6349
// Support: Android 2.3
6350
// Div with explicit width and no margin-right incorrectly
6351
// gets computed margin-right based on width of container (#3333)
6352
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
6353
contents = div.appendChild( document.createElement( "div" ) );
6355
// Reset CSS: box-sizing; display; margin; border; padding
6356
contents.style.cssText = div.style.cssText =
6357
// Support: Firefox<29, Android 2.3
6358
// Vendor-prefix box-sizing
6359
"-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
6360
"box-sizing:content-box;display:block;margin:0;border:0;padding:0";
6361
contents.style.marginRight = contents.style.width = "0";
6362
div.style.width = "1px";
6364
reliableMarginRightVal =
6365
!parseFloat( ( window.getComputedStyle( contents, null ) || {} ).marginRight );
6369
// Check if table cells still have offsetWidth/Height when they are set
6370
// to display:none and there are still other visible table cells in a
6371
// table row; if so, offsetWidth/Height are not reliable for use when
6372
// determining if an element has been hidden directly using
6373
// display:none (it is still safe to use offsets if a parent element is
6374
// hidden; don safety goggles and see bug #4512 for more information).
6375
div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
6376
contents = div.getElementsByTagName( "td" );
6377
contents[ 0 ].style.cssText = "margin:0;border:0;padding:0;display:none";
6378
reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;
6379
if ( reliableHiddenOffsetsVal ) {
6380
contents[ 0 ].style.display = "";
6381
contents[ 1 ].style.display = "none";
6382
reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;
6385
body.removeChild( container );
6391
// A method for quickly swapping in/out CSS properties to get correct calculations.
6392
jQuery.swap = function( elem, options, callback, args ) {
6396
// Remember the old values, and insert the new ones
6397
for ( name in options ) {
6398
old[ name ] = elem.style[ name ];
6399
elem.style[ name ] = options[ name ];
6402
ret = callback.apply( elem, args || [] );
6404
// Revert the old values
6405
for ( name in options ) {
6406
elem.style[ name ] = old[ name ];
6414
ralpha = /alpha\([^)]*\)/i,
6415
ropacity = /opacity\s*=\s*([^)]*)/,
6417
// swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
6418
// see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
6419
rdisplayswap = /^(none|table(?!-c[ea]).+)/,
6420
rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),
6421
rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ),
6423
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
6424
cssNormalTransform = {
6429
cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
6432
// return a css property mapped to a potentially vendor prefixed property
6433
function vendorPropName( style, name ) {
6435
// shortcut for names that are not vendor prefixed
6436
if ( name in style ) {
6440
// check for vendor prefixed names
6441
var capName = name.charAt(0).toUpperCase() + name.slice(1),
6443
i = cssPrefixes.length;
6446
name = cssPrefixes[ i ] + capName;
6447
if ( name in style ) {
6455
function showHide( elements, show ) {
6456
var display, elem, hidden,
6459
length = elements.length;
6461
for ( ; index < length; index++ ) {
6462
elem = elements[ index ];
6463
if ( !elem.style ) {
6467
values[ index ] = jQuery._data( elem, "olddisplay" );
6468
display = elem.style.display;
6470
// Reset the inline display of this element to learn if it is
6471
// being hidden by cascaded rules or not
6472
if ( !values[ index ] && display === "none" ) {
6473
elem.style.display = "";
6476
// Set elements which have been overridden with display: none
6477
// in a stylesheet to whatever the default browser style is
6478
// for such an element
6479
if ( elem.style.display === "" && isHidden( elem ) ) {
6480
values[ index ] = jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) );
6483
hidden = isHidden( elem );
6485
if ( display && display !== "none" || !hidden ) {
6486
jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
6491
// Set the display of most of the elements in a second loop
6492
// to avoid the constant reflow
6493
for ( index = 0; index < length; index++ ) {
6494
elem = elements[ index ];
6495
if ( !elem.style ) {
6498
if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
6499
elem.style.display = show ? values[ index ] || "" : "none";
6506
function setPositiveNumber( elem, value, subtract ) {
6507
var matches = rnumsplit.exec( value );
6509
// Guard against undefined "subtract", e.g., when used as in cssHooks
6510
Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
6514
function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
6515
var i = extra === ( isBorderBox ? "border" : "content" ) ?
6516
// If we already have the right measurement, avoid augmentation
6518
// Otherwise initialize for horizontal or vertical properties
6519
name === "width" ? 1 : 0,
6523
for ( ; i < 4; i += 2 ) {
6524
// both box models exclude margin, so add it if we want it
6525
if ( extra === "margin" ) {
6526
val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
6529
if ( isBorderBox ) {
6530
// border-box includes padding, so remove it if we want content
6531
if ( extra === "content" ) {
6532
val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6535
// at this point, extra isn't border nor margin, so remove border
6536
if ( extra !== "margin" ) {
6537
val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6540
// at this point, extra isn't content, so add padding
6541
val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6543
// at this point, extra isn't content nor padding, so add border
6544
if ( extra !== "padding" ) {
6545
val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6553
function getWidthOrHeight( elem, name, extra ) {
6555
// Start with offset property, which is equivalent to the border-box value
6556
var valueIsBorderBox = true,
6557
val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
6558
styles = getStyles( elem ),
6559
isBorderBox = support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
6561
// some non-html elements return undefined for offsetWidth, so check for null/undefined
6562
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
6563
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
6564
if ( val <= 0 || val == null ) {
6565
// Fall back to computed then uncomputed css if necessary
6566
val = curCSS( elem, name, styles );
6567
if ( val < 0 || val == null ) {
6568
val = elem.style[ name ];
6571
// Computed unit is not pixels. Stop here and return.
6572
if ( rnumnonpx.test(val) ) {
6576
// we need the check for style in case a browser which returns unreliable values
6577
// for getComputedStyle silently falls back to the reliable elem.style
6578
valueIsBorderBox = isBorderBox && ( support.boxSizingReliable() || val === elem.style[ name ] );
6580
// Normalize "", auto, and prepare for extra
6581
val = parseFloat( val ) || 0;
6584
// use the active box-sizing model to add/subtract irrelevant styles
6586
augmentWidthOrHeight(
6589
extra || ( isBorderBox ? "border" : "content" ),
6597
// Add in style property hooks for overriding the default
6598
// behavior of getting and setting a style property
6601
get: function( elem, computed ) {
6603
// We should always get a number back from opacity
6604
var ret = curCSS( elem, "opacity" );
6605
return ret === "" ? "1" : ret;
6611
// Don't automatically add "px" to these possibly-unitless properties
6613
"columnCount": true,
6614
"fillOpacity": true,
6627
// Add in properties whose names you wish to fix before
6628
// setting or getting the value
6630
// normalize float css property
6631
"float": support.cssFloat ? "cssFloat" : "styleFloat"
6634
// Get and set the style property on a DOM Node
6635
style: function( elem, name, value, extra ) {
6636
// Don't set styles on text and comment nodes
6637
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
6641
// Make sure that we're working with the right name
6642
var ret, type, hooks,
6643
origName = jQuery.camelCase( name ),
6646
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
6648
// gets hook for the prefixed version
6649
// followed by the unprefixed version
6650
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6652
// Check if we're setting a value
6653
if ( value !== undefined ) {
6654
type = typeof value;
6656
// convert relative number strings (+= or -=) to relative numbers. #7345
6657
if ( type === "string" && (ret = rrelNum.exec( value )) ) {
6658
value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
6663
// Make sure that null and NaN values aren't set. See: #7116
6664
if ( value == null || value !== value ) {
6668
// If a number was passed in, add 'px' to the (except for certain CSS properties)
6669
if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
6673
// Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
6674
// but it would mean to define eight (for every problematic property) identical functions
6675
if ( !support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
6676
style[ name ] = "inherit";
6679
// If a hook was provided, use that value, otherwise just set the specified value
6680
if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
6683
// Swallow errors from 'invalid' CSS values (#5509)
6685
style[ name ] = value;
6690
// If a hook was provided get the non-computed value from there
6691
if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
6695
// Otherwise just get the value from the style object
6696
return style[ name ];
6700
css: function( elem, name, extra, styles ) {
6701
var num, val, hooks,
6702
origName = jQuery.camelCase( name );
6704
// Make sure that we're working with the right name
6705
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
6707
// gets hook for the prefixed version
6708
// followed by the unprefixed version
6709
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6711
// If a hook was provided get the computed value from there
6712
if ( hooks && "get" in hooks ) {
6713
val = hooks.get( elem, true, extra );
6716
// Otherwise, if a way to get the computed value exists, use that
6717
if ( val === undefined ) {
6718
val = curCSS( elem, name, styles );
6721
//convert "normal" to computed value
6722
if ( val === "normal" && name in cssNormalTransform ) {
6723
val = cssNormalTransform[ name ];
6726
// Return, converting to number if forced or a qualifier was provided and val looks numeric
6727
if ( extra === "" || extra ) {
6728
num = parseFloat( val );
6729
return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
6735
jQuery.each([ "height", "width" ], function( i, name ) {
6736
jQuery.cssHooks[ name ] = {
6737
get: function( elem, computed, extra ) {
6739
// certain elements can have dimension info if we invisibly show them
6740
// however, it must have a current display style that would benefit from this
6741
return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ?
6742
jQuery.swap( elem, cssShow, function() {
6743
return getWidthOrHeight( elem, name, extra );
6745
getWidthOrHeight( elem, name, extra );
6749
set: function( elem, value, extra ) {
6750
var styles = extra && getStyles( elem );
6751
return setPositiveNumber( elem, value, extra ?
6752
augmentWidthOrHeight(
6756
support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
6764
if ( !support.opacity ) {
6765
jQuery.cssHooks.opacity = {
6766
get: function( elem, computed ) {
6767
// IE uses filters for opacity
6768
return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
6769
( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
6770
computed ? "1" : "";
6773
set: function( elem, value ) {
6774
var style = elem.style,
6775
currentStyle = elem.currentStyle,
6776
opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
6777
filter = currentStyle && currentStyle.filter || style.filter || "";
6779
// IE has trouble with opacity if it does not have layout
6780
// Force it by setting the zoom level
6783
// if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
6784
// if value === "", then remove inline opacity #12685
6785
if ( ( value >= 1 || value === "" ) &&
6786
jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
6787
style.removeAttribute ) {
6789
// Setting style.filter to null, "" & " " still leave "filter:" in the cssText
6790
// if "filter:" is present at all, clearType is disabled, we want to avoid this
6791
// style.removeAttribute is IE Only, but so apparently is this code path...
6792
style.removeAttribute( "filter" );
6794
// if there is no filter style applied in a css rule or unset inline opacity, we are done
6795
if ( value === "" || currentStyle && !currentStyle.filter ) {
6800
// otherwise, set new filter values
6801
style.filter = ralpha.test( filter ) ?
6802
filter.replace( ralpha, opacity ) :
6803
filter + " " + opacity;
6808
jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
6809
function( elem, computed ) {
6811
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
6812
// Work around by temporarily setting element display to inline-block
6813
return jQuery.swap( elem, { "display": "inline-block" },
6814
curCSS, [ elem, "marginRight" ] );
6819
// These hooks are used by animate to expand properties
6824
}, function( prefix, suffix ) {
6825
jQuery.cssHooks[ prefix + suffix ] = {
6826
expand: function( value ) {
6830
// assumes a single number if not a string
6831
parts = typeof value === "string" ? value.split(" ") : [ value ];
6833
for ( ; i < 4; i++ ) {
6834
expanded[ prefix + cssExpand[ i ] + suffix ] =
6835
parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
6842
if ( !rmargin.test( prefix ) ) {
6843
jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
6848
css: function( name, value ) {
6849
return access( this, function( elem, name, value ) {
6854
if ( jQuery.isArray( name ) ) {
6855
styles = getStyles( elem );
6858
for ( ; i < len; i++ ) {
6859
map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
6865
return value !== undefined ?
6866
jQuery.style( elem, name, value ) :
6867
jQuery.css( elem, name );
6868
}, name, value, arguments.length > 1 );
6871
return showHide( this, true );
6874
return showHide( this );
6876
toggle: function( state ) {
6877
if ( typeof state === "boolean" ) {
6878
return state ? this.show() : this.hide();
6881
return this.each(function() {
6882
if ( isHidden( this ) ) {
6883
jQuery( this ).show();
6885
jQuery( this ).hide();
6892
function Tween( elem, options, prop, end, easing ) {
6893
return new Tween.prototype.init( elem, options, prop, end, easing );
6895
jQuery.Tween = Tween;
6899
init: function( elem, options, prop, end, easing, unit ) {
6902
this.easing = easing || "swing";
6903
this.options = options;
6904
this.start = this.now = this.cur();
6906
this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
6909
var hooks = Tween.propHooks[ this.prop ];
6911
return hooks && hooks.get ?
6913
Tween.propHooks._default.get( this );
6915
run: function( percent ) {
6917
hooks = Tween.propHooks[ this.prop ];
6919
if ( this.options.duration ) {
6920
this.pos = eased = jQuery.easing[ this.easing ](
6921
percent, this.options.duration * percent, 0, 1, this.options.duration
6924
this.pos = eased = percent;
6926
this.now = ( this.end - this.start ) * eased + this.start;
6928
if ( this.options.step ) {
6929
this.options.step.call( this.elem, this.now, this );
6932
if ( hooks && hooks.set ) {
6935
Tween.propHooks._default.set( this );
6941
Tween.prototype.init.prototype = Tween.prototype;
6945
get: function( tween ) {
6948
if ( tween.elem[ tween.prop ] != null &&
6949
(!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
6950
return tween.elem[ tween.prop ];
6953
// passing an empty string as a 3rd parameter to .css will automatically
6954
// attempt a parseFloat and fallback to a string if the parse fails
6955
// so, simple values such as "10px" are parsed to Float.
6956
// complex values such as "rotate(1rad)" are returned as is.
6957
result = jQuery.css( tween.elem, tween.prop, "" );
6958
// Empty strings, null, undefined and "auto" are converted to 0.
6959
return !result || result === "auto" ? 0 : result;
6961
set: function( tween ) {
6962
// use step hook for back compat - use cssHook if its there - use .style if its
6963
// available and use plain properties where available
6964
if ( jQuery.fx.step[ tween.prop ] ) {
6965
jQuery.fx.step[ tween.prop ]( tween );
6966
} else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
6967
jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
6969
tween.elem[ tween.prop ] = tween.now;
6976
// Panic based approach to setting things on disconnected nodes
6978
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
6979
set: function( tween ) {
6980
if ( tween.elem.nodeType && tween.elem.parentNode ) {
6981
tween.elem[ tween.prop ] = tween.now;
6987
linear: function( p ) {
6990
swing: function( p ) {
6991
return 0.5 - Math.cos( p * Math.PI ) / 2;
6995
jQuery.fx = Tween.prototype.init;
6997
// Back Compat <1.8 extension point
6998
jQuery.fx.step = {};
7005
rfxtypes = /^(?:toggle|show|hide)$/,
7006
rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ),
7007
rrun = /queueHooks$/,
7008
animationPrefilters = [ defaultPrefilter ],
7010
"*": [ function( prop, value ) {
7011
var tween = this.createTween( prop, value ),
7012
target = tween.cur(),
7013
parts = rfxnum.exec( value ),
7014
unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
7016
// Starting value computation is required for potential unit mismatches
7017
start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) &&
7018
rfxnum.exec( jQuery.css( tween.elem, prop ) ),
7022
if ( start && start[ 3 ] !== unit ) {
7023
// Trust units reported by jQuery.css
7024
unit = unit || start[ 3 ];
7026
// Make sure we update the tween properties later on
7027
parts = parts || [];
7029
// Iteratively approximate from a nonzero starting point
7030
start = +target || 1;
7033
// If previous iteration zeroed out, double until we get *something*
7034
// Use a string for doubling factor so we don't accidentally see scale as unchanged below
7035
scale = scale || ".5";
7038
start = start / scale;
7039
jQuery.style( tween.elem, prop, start + unit );
7041
// Update scale, tolerating zero or NaN from tween.cur()
7042
// And breaking the loop if scale is unchanged or perfect, or if we've just had enough
7043
} while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
7046
// Update tween properties
7048
start = tween.start = +start || +target || 0;
7050
// If a +=/-= token was provided, we're doing a relative animation
7051
tween.end = parts[ 1 ] ?
7052
start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :
7060
// Animations created synchronously will run synchronously
7061
function createFxNow() {
7062
setTimeout(function() {
7065
return ( fxNow = jQuery.now() );
7068
// Generate parameters to create a standard animation
7069
function genFx( type, includeWidth ) {
7071
attrs = { height: type },
7074
// if we include width, step value is 1 to do all cssExpand values,
7075
// if we don't include width, step value is 2 to skip over Left and Right
7076
includeWidth = includeWidth ? 1 : 0;
7077
for ( ; i < 4 ; i += 2 - includeWidth ) {
7078
which = cssExpand[ i ];
7079
attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
7082
if ( includeWidth ) {
7083
attrs.opacity = attrs.width = type;
7089
function createTween( value, prop, animation ) {
7091
collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
7093
length = collection.length;
7094
for ( ; index < length; index++ ) {
7095
if ( (tween = collection[ index ].call( animation, prop, value )) ) {
7097
// we're done with this property
7103
function defaultPrefilter( elem, props, opts ) {
7104
/* jshint validthis: true */
7105
var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
7109
hidden = elem.nodeType && isHidden( elem ),
7110
dataShow = jQuery._data( elem, "fxshow" );
7112
// handle queue: false promises
7113
if ( !opts.queue ) {
7114
hooks = jQuery._queueHooks( elem, "fx" );
7115
if ( hooks.unqueued == null ) {
7117
oldfire = hooks.empty.fire;
7118
hooks.empty.fire = function() {
7119
if ( !hooks.unqueued ) {
7126
anim.always(function() {
7127
// doing this makes sure that the complete handler will be called
7128
// before this completes
7129
anim.always(function() {
7131
if ( !jQuery.queue( elem, "fx" ).length ) {
7138
// height/width overflow pass
7139
if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
7140
// Make sure that nothing sneaks out
7141
// Record all 3 overflow attributes because IE does not
7142
// change the overflow attribute when overflowX and
7143
// overflowY are set to the same value
7144
opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
7146
// Set display property to inline-block for height/width
7147
// animations on inline elements that are having width/height animated
7148
display = jQuery.css( elem, "display" );
7150
// Test default display if display is currently "none"
7151
checkDisplay = display === "none" ?
7152
jQuery._data( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
7154
if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
7156
// inline-level elements accept inline-block;
7157
// block-level elements need to be inline with layout
7158
if ( !support.inlineBlockNeedsLayout || defaultDisplay( elem.nodeName ) === "inline" ) {
7159
style.display = "inline-block";
7166
if ( opts.overflow ) {
7167
style.overflow = "hidden";
7168
if ( !support.shrinkWrapBlocks() ) {
7169
anim.always(function() {
7170
style.overflow = opts.overflow[ 0 ];
7171
style.overflowX = opts.overflow[ 1 ];
7172
style.overflowY = opts.overflow[ 2 ];
7178
for ( prop in props ) {
7179
value = props[ prop ];
7180
if ( rfxtypes.exec( value ) ) {
7181
delete props[ prop ];
7182
toggle = toggle || value === "toggle";
7183
if ( value === ( hidden ? "hide" : "show" ) ) {
7185
// 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
7186
if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
7192
orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
7194
// Any non-fx value stops us from restoring the original display value
7196
display = undefined;
7200
if ( !jQuery.isEmptyObject( orig ) ) {
7202
if ( "hidden" in dataShow ) {
7203
hidden = dataShow.hidden;
7206
dataShow = jQuery._data( elem, "fxshow", {} );
7209
// store state if its toggle - enables .stop().toggle() to "reverse"
7211
dataShow.hidden = !hidden;
7214
jQuery( elem ).show();
7216
anim.done(function() {
7217
jQuery( elem ).hide();
7220
anim.done(function() {
7222
jQuery._removeData( elem, "fxshow" );
7223
for ( prop in orig ) {
7224
jQuery.style( elem, prop, orig[ prop ] );
7227
for ( prop in orig ) {
7228
tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
7230
if ( !( prop in dataShow ) ) {
7231
dataShow[ prop ] = tween.start;
7233
tween.end = tween.start;
7234
tween.start = prop === "width" || prop === "height" ? 1 : 0;
7239
// If this is a noop like .hide().hide(), restore an overwritten display value
7240
} else if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" ) {
7241
style.display = display;
7245
function propFilter( props, specialEasing ) {
7246
var index, name, easing, value, hooks;
7248
// camelCase, specialEasing and expand cssHook pass
7249
for ( index in props ) {
7250
name = jQuery.camelCase( index );
7251
easing = specialEasing[ name ];
7252
value = props[ index ];
7253
if ( jQuery.isArray( value ) ) {
7254
easing = value[ 1 ];
7255
value = props[ index ] = value[ 0 ];
7258
if ( index !== name ) {
7259
props[ name ] = value;
7260
delete props[ index ];
7263
hooks = jQuery.cssHooks[ name ];
7264
if ( hooks && "expand" in hooks ) {
7265
value = hooks.expand( value );
7266
delete props[ name ];
7268
// not quite $.extend, this wont overwrite keys already present.
7269
// also - reusing 'index' from above because we have the correct "name"
7270
for ( index in value ) {
7271
if ( !( index in props ) ) {
7272
props[ index ] = value[ index ];
7273
specialEasing[ index ] = easing;
7277
specialEasing[ name ] = easing;
7282
function Animation( elem, properties, options ) {
7286
length = animationPrefilters.length,
7287
deferred = jQuery.Deferred().always( function() {
7288
// don't match elem in the :animated selector
7295
var currentTime = fxNow || createFxNow(),
7296
remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
7297
// archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
7298
temp = remaining / animation.duration || 0,
7301
length = animation.tweens.length;
7303
for ( ; index < length ; index++ ) {
7304
animation.tweens[ index ].run( percent );
7307
deferred.notifyWith( elem, [ animation, percent, remaining ]);
7309
if ( percent < 1 && length ) {
7312
deferred.resolveWith( elem, [ animation ] );
7316
animation = deferred.promise({
7318
props: jQuery.extend( {}, properties ),
7319
opts: jQuery.extend( true, { specialEasing: {} }, options ),
7320
originalProperties: properties,
7321
originalOptions: options,
7322
startTime: fxNow || createFxNow(),
7323
duration: options.duration,
7325
createTween: function( prop, end ) {
7326
var tween = jQuery.Tween( elem, animation.opts, prop, end,
7327
animation.opts.specialEasing[ prop ] || animation.opts.easing );
7328
animation.tweens.push( tween );
7331
stop: function( gotoEnd ) {
7333
// if we are going to the end, we want to run all the tweens
7334
// otherwise we skip this part
7335
length = gotoEnd ? animation.tweens.length : 0;
7340
for ( ; index < length ; index++ ) {
7341
animation.tweens[ index ].run( 1 );
7344
// resolve when we played the last frame
7345
// otherwise, reject
7347
deferred.resolveWith( elem, [ animation, gotoEnd ] );
7349
deferred.rejectWith( elem, [ animation, gotoEnd ] );
7354
props = animation.props;
7356
propFilter( props, animation.opts.specialEasing );
7358
for ( ; index < length ; index++ ) {
7359
result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
7365
jQuery.map( props, createTween, animation );
7367
if ( jQuery.isFunction( animation.opts.start ) ) {
7368
animation.opts.start.call( elem, animation );
7372
jQuery.extend( tick, {
7375
queue: animation.opts.queue
7379
// attach callbacks from options
7380
return animation.progress( animation.opts.progress )
7381
.done( animation.opts.done, animation.opts.complete )
7382
.fail( animation.opts.fail )
7383
.always( animation.opts.always );
7386
jQuery.Animation = jQuery.extend( Animation, {
7387
tweener: function( props, callback ) {
7388
if ( jQuery.isFunction( props ) ) {
7392
props = props.split(" ");
7397
length = props.length;
7399
for ( ; index < length ; index++ ) {
7400
prop = props[ index ];
7401
tweeners[ prop ] = tweeners[ prop ] || [];
7402
tweeners[ prop ].unshift( callback );
7406
prefilter: function( callback, prepend ) {
7408
animationPrefilters.unshift( callback );
7410
animationPrefilters.push( callback );
7415
jQuery.speed = function( speed, easing, fn ) {
7416
var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
7417
complete: fn || !fn && easing ||
7418
jQuery.isFunction( speed ) && speed,
7420
easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
7423
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
7424
opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
7426
// normalize opt.queue - true/undefined/null -> "fx"
7427
if ( opt.queue == null || opt.queue === true ) {
7432
opt.old = opt.complete;
7434
opt.complete = function() {
7435
if ( jQuery.isFunction( opt.old ) ) {
7436
opt.old.call( this );
7440
jQuery.dequeue( this, opt.queue );
7448
fadeTo: function( speed, to, easing, callback ) {
7450
// show any hidden elements after setting opacity to 0
7451
return this.filter( isHidden ).css( "opacity", 0 ).show()
7453
// animate to the value specified
7454
.end().animate({ opacity: to }, speed, easing, callback );
7456
animate: function( prop, speed, easing, callback ) {
7457
var empty = jQuery.isEmptyObject( prop ),
7458
optall = jQuery.speed( speed, easing, callback ),
7459
doAnimation = function() {
7460
// Operate on a copy of prop so per-property easing won't be lost
7461
var anim = Animation( this, jQuery.extend( {}, prop ), optall );
7463
// Empty animations, or finishing resolves immediately
7464
if ( empty || jQuery._data( this, "finish" ) ) {
7468
doAnimation.finish = doAnimation;
7470
return empty || optall.queue === false ?
7471
this.each( doAnimation ) :
7472
this.queue( optall.queue, doAnimation );
7474
stop: function( type, clearQueue, gotoEnd ) {
7475
var stopQueue = function( hooks ) {
7476
var stop = hooks.stop;
7481
if ( typeof type !== "string" ) {
7482
gotoEnd = clearQueue;
7486
if ( clearQueue && type !== false ) {
7487
this.queue( type || "fx", [] );
7490
return this.each(function() {
7492
index = type != null && type + "queueHooks",
7493
timers = jQuery.timers,
7494
data = jQuery._data( this );
7497
if ( data[ index ] && data[ index ].stop ) {
7498
stopQueue( data[ index ] );
7501
for ( index in data ) {
7502
if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
7503
stopQueue( data[ index ] );
7508
for ( index = timers.length; index--; ) {
7509
if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
7510
timers[ index ].anim.stop( gotoEnd );
7512
timers.splice( index, 1 );
7516
// start the next in the queue if the last step wasn't forced
7517
// timers currently will call their complete callbacks, which will dequeue
7518
// but only if they were gotoEnd
7519
if ( dequeue || !gotoEnd ) {
7520
jQuery.dequeue( this, type );
7524
finish: function( type ) {
7525
if ( type !== false ) {
7526
type = type || "fx";
7528
return this.each(function() {
7530
data = jQuery._data( this ),
7531
queue = data[ type + "queue" ],
7532
hooks = data[ type + "queueHooks" ],
7533
timers = jQuery.timers,
7534
length = queue ? queue.length : 0;
7536
// enable finishing flag on private data
7539
// empty the queue first
7540
jQuery.queue( this, type, [] );
7542
if ( hooks && hooks.stop ) {
7543
hooks.stop.call( this, true );
7546
// look for any active animations, and finish them
7547
for ( index = timers.length; index--; ) {
7548
if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
7549
timers[ index ].anim.stop( true );
7550
timers.splice( index, 1 );
7554
// look for any animations in the old queue and finish them
7555
for ( index = 0; index < length; index++ ) {
7556
if ( queue[ index ] && queue[ index ].finish ) {
7557
queue[ index ].finish.call( this );
7561
// turn off finishing flag
7567
jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
7568
var cssFn = jQuery.fn[ name ];
7569
jQuery.fn[ name ] = function( speed, easing, callback ) {
7570
return speed == null || typeof speed === "boolean" ?
7571
cssFn.apply( this, arguments ) :
7572
this.animate( genFx( name, true ), speed, easing, callback );
7576
// Generate shortcuts for custom animations
7578
slideDown: genFx("show"),
7579
slideUp: genFx("hide"),
7580
slideToggle: genFx("toggle"),
7581
fadeIn: { opacity: "show" },
7582
fadeOut: { opacity: "hide" },
7583
fadeToggle: { opacity: "toggle" }
7584
}, function( name, props ) {
7585
jQuery.fn[ name ] = function( speed, easing, callback ) {
7586
return this.animate( props, speed, easing, callback );
7591
jQuery.fx.tick = function() {
7593
timers = jQuery.timers,
7596
fxNow = jQuery.now();
7598
for ( ; i < timers.length; i++ ) {
7599
timer = timers[ i ];
7600
// Checks the timer has not already been removed
7601
if ( !timer() && timers[ i ] === timer ) {
7602
timers.splice( i--, 1 );
7606
if ( !timers.length ) {
7612
jQuery.fx.timer = function( timer ) {
7613
jQuery.timers.push( timer );
7617
jQuery.timers.pop();
7621
jQuery.fx.interval = 13;
7623
jQuery.fx.start = function() {
7625
timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
7629
jQuery.fx.stop = function() {
7630
clearInterval( timerId );
7634
jQuery.fx.speeds = {
7642
// Based off of the plugin by Clint Helfers, with permission.
7643
// http://blindsignals.com/index.php/2009/07/jquery-delay/
7644
jQuery.fn.delay = function( time, type ) {
7645
time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
7646
type = type || "fx";
7648
return this.queue( type, function( next, hooks ) {
7649
var timeout = setTimeout( next, time );
7650
hooks.stop = function() {
7651
clearTimeout( timeout );
7658
// Minified: var a,b,c,d,e
7659
var input, div, select, a, opt;
7662
div = document.createElement( "div" );
7663
div.setAttribute( "className", "t" );
7664
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
7665
a = div.getElementsByTagName("a")[ 0 ];
7667
// First batch of tests.
7668
select = document.createElement("select");
7669
opt = select.appendChild( document.createElement("option") );
7670
input = div.getElementsByTagName("input")[ 0 ];
7672
a.style.cssText = "top:1px";
7674
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
7675
support.getSetAttribute = div.className !== "t";
7677
// Get the style information from getAttribute
7678
// (IE uses .cssText instead)
7679
support.style = /top/.test( a.getAttribute("style") );
7681
// Make sure that URLs aren't manipulated
7682
// (IE normalizes it by default)
7683
support.hrefNormalized = a.getAttribute("href") === "/a";
7685
// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
7686
support.checkOn = !!input.value;
7688
// Make sure that a selected-by-default option has a working selected property.
7689
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
7690
support.optSelected = opt.selected;
7692
// Tests for enctype support on a form (#6743)
7693
support.enctype = !!document.createElement("form").enctype;
7695
// Make sure that the options inside disabled selects aren't marked as disabled
7696
// (WebKit marks them as disabled)
7697
select.disabled = true;
7698
support.optDisabled = !opt.disabled;
7700
// Support: IE8 only
7701
// Check if we can trust getAttribute("value")
7702
input = document.createElement( "input" );
7703
input.setAttribute( "value", "" );
7704
support.input = input.getAttribute( "value" ) === "";
7706
// Check if an input maintains its value after becoming a radio
7708
input.setAttribute( "type", "radio" );
7709
support.radioValue = input.value === "t";
7713
var rreturn = /\r/g;
7716
val: function( value ) {
7717
var hooks, ret, isFunction,
7720
if ( !arguments.length ) {
7722
hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
7724
if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
7730
return typeof ret === "string" ?
7731
// handle most common string cases
7732
ret.replace(rreturn, "") :
7733
// handle cases where value is null/undef or number
7734
ret == null ? "" : ret;
7740
isFunction = jQuery.isFunction( value );
7742
return this.each(function( i ) {
7745
if ( this.nodeType !== 1 ) {
7750
val = value.call( this, i, jQuery( this ).val() );
7755
// Treat null/undefined as ""; convert numbers to string
7756
if ( val == null ) {
7758
} else if ( typeof val === "number" ) {
7760
} else if ( jQuery.isArray( val ) ) {
7761
val = jQuery.map( val, function( value ) {
7762
return value == null ? "" : value + "";
7766
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
7768
// If set returns undefined, fall back to normal setting
7769
if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
7779
get: function( elem ) {
7780
var val = jQuery.find.attr( elem, "value" );
7781
return val != null ?
7783
// Support: IE10-11+
7784
// option.text throws exceptions (#14686, #14858)
7785
jQuery.trim( jQuery.text( elem ) );
7789
get: function( elem ) {
7791
options = elem.options,
7792
index = elem.selectedIndex,
7793
one = elem.type === "select-one" || index < 0,
7794
values = one ? null : [],
7795
max = one ? index + 1 : options.length,
7800
// Loop through all the selected options
7801
for ( ; i < max; i++ ) {
7802
option = options[ i ];
7804
// oldIE doesn't update selected after form reset (#2551)
7805
if ( ( option.selected || i === index ) &&
7806
// Don't return options that are disabled or in a disabled optgroup
7807
( support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
7808
( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
7810
// Get the specific value for the option
7811
value = jQuery( option ).val();
7813
// We don't need an array for one selects
7818
// Multi-Selects return an array
7819
values.push( value );
7826
set: function( elem, value ) {
7827
var optionSet, option,
7828
options = elem.options,
7829
values = jQuery.makeArray( value ),
7833
option = options[ i ];
7835
if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) >= 0 ) {
7838
// When new option element is added to select box we need to
7839
// force reflow of newly added node in order to workaround delay
7840
// of initialization properties
7842
option.selected = optionSet = true;
7846
// Will be executed only in IE6
7847
option.scrollHeight;
7851
option.selected = false;
7855
// Force browsers to behave consistently when non-matching value is set
7857
elem.selectedIndex = -1;
7866
// Radios and checkboxes getter/setter
7867
jQuery.each([ "radio", "checkbox" ], function() {
7868
jQuery.valHooks[ this ] = {
7869
set: function( elem, value ) {
7870
if ( jQuery.isArray( value ) ) {
7871
return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
7875
if ( !support.checkOn ) {
7876
jQuery.valHooks[ this ].get = function( elem ) {
7878
// "" is returned instead of "on" if a value isn't specified
7879
return elem.getAttribute("value") === null ? "on" : elem.value;
7887
var nodeHook, boolHook,
7888
attrHandle = jQuery.expr.attrHandle,
7889
ruseDefault = /^(?:checked|selected)$/i,
7890
getSetAttribute = support.getSetAttribute,
7891
getSetInput = support.input;
7894
attr: function( name, value ) {
7895
return access( this, jQuery.attr, name, value, arguments.length > 1 );
7898
removeAttr: function( name ) {
7899
return this.each(function() {
7900
jQuery.removeAttr( this, name );
7906
attr: function( elem, name, value ) {
7908
nType = elem.nodeType;
7910
// don't get/set attributes on text, comment and attribute nodes
7911
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
7915
// Fallback to prop when attributes are not supported
7916
if ( typeof elem.getAttribute === strundefined ) {
7917
return jQuery.prop( elem, name, value );
7920
// All attributes are lowercase
7921
// Grab necessary hook if one is defined
7922
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
7923
name = name.toLowerCase();
7924
hooks = jQuery.attrHooks[ name ] ||
7925
( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
7928
if ( value !== undefined ) {
7930
if ( value === null ) {
7931
jQuery.removeAttr( elem, name );
7933
} else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
7937
elem.setAttribute( name, value + "" );
7941
} else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
7945
ret = jQuery.find.attr( elem, name );
7947
// Non-existent attributes return null, we normalize to undefined
7948
return ret == null ?
7954
removeAttr: function( elem, value ) {
7957
attrNames = value && value.match( rnotwhite );
7959
if ( attrNames && elem.nodeType === 1 ) {
7960
while ( (name = attrNames[i++]) ) {
7961
propName = jQuery.propFix[ name ] || name;
7963
// Boolean attributes get special treatment (#10870)
7964
if ( jQuery.expr.match.bool.test( name ) ) {
7965
// Set corresponding property to false
7966
if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
7967
elem[ propName ] = false;
7969
// Also clear defaultChecked/defaultSelected (if appropriate)
7971
elem[ jQuery.camelCase( "default-" + name ) ] =
7972
elem[ propName ] = false;
7975
// See #9699 for explanation of this approach (setting first, then removal)
7977
jQuery.attr( elem, name, "" );
7980
elem.removeAttribute( getSetAttribute ? name : propName );
7987
set: function( elem, value ) {
7988
if ( !support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
7989
// Setting the type on a radio button after the value resets the value in IE6-9
7990
// Reset value to default in case type is set after value during creation
7991
var val = elem.value;
7992
elem.setAttribute( "type", value );
8003
// Hook for boolean attributes
8005
set: function( elem, value, name ) {
8006
if ( value === false ) {
8007
// Remove boolean attributes when set to false
8008
jQuery.removeAttr( elem, name );
8009
} else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
8010
// IE<8 needs the *property* name
8011
elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
8013
// Use defaultChecked and defaultSelected for oldIE
8015
elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
8022
// Retrieve booleans specially
8023
jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
8025
var getter = attrHandle[ name ] || jQuery.find.attr;
8027
attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ?
8028
function( elem, name, isXML ) {
8031
// Avoid an infinite loop by temporarily removing this function from the getter
8032
handle = attrHandle[ name ];
8033
attrHandle[ name ] = ret;
8034
ret = getter( elem, name, isXML ) != null ?
8035
name.toLowerCase() :
8037
attrHandle[ name ] = handle;
8041
function( elem, name, isXML ) {
8043
return elem[ jQuery.camelCase( "default-" + name ) ] ?
8044
name.toLowerCase() :
8050
// fix oldIE attroperties
8051
if ( !getSetInput || !getSetAttribute ) {
8052
jQuery.attrHooks.value = {
8053
set: function( elem, value, name ) {
8054
if ( jQuery.nodeName( elem, "input" ) ) {
8055
// Does not return so that setAttribute is also used
8056
elem.defaultValue = value;
8058
// Use nodeHook if defined (#1954); otherwise setAttribute is fine
8059
return nodeHook && nodeHook.set( elem, value, name );
8065
// IE6/7 do not support getting/setting some attributes with get/setAttribute
8066
if ( !getSetAttribute ) {
8068
// Use this for any attribute in IE6/7
8069
// This fixes almost every IE6/7 issue
8071
set: function( elem, value, name ) {
8072
// Set the existing or create a new attribute node
8073
var ret = elem.getAttributeNode( name );
8075
elem.setAttributeNode(
8076
(ret = elem.ownerDocument.createAttribute( name ))
8080
ret.value = value += "";
8082
// Break association with cloned elements by also using setAttribute (#9646)
8083
if ( name === "value" || value === elem.getAttribute( name ) ) {
8089
// Some attributes are constructed with empty-string values when not defined
8090
attrHandle.id = attrHandle.name = attrHandle.coords =
8091
function( elem, name, isXML ) {
8094
return (ret = elem.getAttributeNode( name )) && ret.value !== "" ?
8100
// Fixing value retrieval on a button requires this module
8101
jQuery.valHooks.button = {
8102
get: function( elem, name ) {
8103
var ret = elem.getAttributeNode( name );
8104
if ( ret && ret.specified ) {
8111
// Set contenteditable to false on removals(#10429)
8112
// Setting to empty string throws an error as an invalid value
8113
jQuery.attrHooks.contenteditable = {
8114
set: function( elem, value, name ) {
8115
nodeHook.set( elem, value === "" ? false : value, name );
8119
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
8120
// This is for removals
8121
jQuery.each([ "width", "height" ], function( i, name ) {
8122
jQuery.attrHooks[ name ] = {
8123
set: function( elem, value ) {
8124
if ( value === "" ) {
8125
elem.setAttribute( name, "auto" );
8133
if ( !support.style ) {
8134
jQuery.attrHooks.style = {
8135
get: function( elem ) {
8136
// Return undefined in the case of empty string
8137
// Note: IE uppercases css property names, but if we were to .toLowerCase()
8138
// .cssText, that would destroy case senstitivity in URL's, like in "background"
8139
return elem.style.cssText || undefined;
8141
set: function( elem, value ) {
8142
return ( elem.style.cssText = value + "" );
8150
var rfocusable = /^(?:input|select|textarea|button|object)$/i,
8151
rclickable = /^(?:a|area)$/i;
8154
prop: function( name, value ) {
8155
return access( this, jQuery.prop, name, value, arguments.length > 1 );
8158
removeProp: function( name ) {
8159
name = jQuery.propFix[ name ] || name;
8160
return this.each(function() {
8161
// try/catch handles cases where IE balks (such as removing a property on window)
8163
this[ name ] = undefined;
8164
delete this[ name ];
8173
"class": "className"
8176
prop: function( elem, name, value ) {
8177
var ret, hooks, notxml,
8178
nType = elem.nodeType;
8180
// don't get/set properties on text, comment and attribute nodes
8181
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
8185
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
8188
// Fix name and attach hooks
8189
name = jQuery.propFix[ name ] || name;
8190
hooks = jQuery.propHooks[ name ];
8193
if ( value !== undefined ) {
8194
return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
8196
( elem[ name ] = value );
8199
return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
8207
get: function( elem ) {
8208
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
8209
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
8210
// Use proper attribute retrieval(#12072)
8211
var tabindex = jQuery.find.attr( elem, "tabindex" );
8214
parseInt( tabindex, 10 ) :
8215
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
8223
// Some attributes require a special call on IE
8224
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
8225
if ( !support.hrefNormalized ) {
8226
// href/src property should get the full normalized URL (#10299/#12915)
8227
jQuery.each([ "href", "src" ], function( i, name ) {
8228
jQuery.propHooks[ name ] = {
8229
get: function( elem ) {
8230
return elem.getAttribute( name, 4 );
8236
// Support: Safari, IE9+
8237
// mis-reports the default selected property of an option
8238
// Accessing the parent's selectedIndex property fixes it
8239
if ( !support.optSelected ) {
8240
jQuery.propHooks.selected = {
8241
get: function( elem ) {
8242
var parent = elem.parentNode;
8245
parent.selectedIndex;
8247
// Make sure that it also works with optgroups, see #5701
8248
if ( parent.parentNode ) {
8249
parent.parentNode.selectedIndex;
8269
jQuery.propFix[ this.toLowerCase() ] = this;
8272
// IE6/7 call enctype encoding
8273
if ( !support.enctype ) {
8274
jQuery.propFix.enctype = "encoding";
8280
var rclass = /[\t\r\n\f]/g;
8283
addClass: function( value ) {
8284
var classes, elem, cur, clazz, j, finalValue,
8287
proceed = typeof value === "string" && value;
8289
if ( jQuery.isFunction( value ) ) {
8290
return this.each(function( j ) {
8291
jQuery( this ).addClass( value.call( this, j, this.className ) );
8296
// The disjunction here is for better compressibility (see removeClass)
8297
classes = ( value || "" ).match( rnotwhite ) || [];
8299
for ( ; i < len; i++ ) {
8301
cur = elem.nodeType === 1 && ( elem.className ?
8302
( " " + elem.className + " " ).replace( rclass, " " ) :
8308
while ( (clazz = classes[j++]) ) {
8309
if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
8314
// only assign if different to avoid unneeded rendering.
8315
finalValue = jQuery.trim( cur );
8316
if ( elem.className !== finalValue ) {
8317
elem.className = finalValue;
8326
removeClass: function( value ) {
8327
var classes, elem, cur, clazz, j, finalValue,
8330
proceed = arguments.length === 0 || typeof value === "string" && value;
8332
if ( jQuery.isFunction( value ) ) {
8333
return this.each(function( j ) {
8334
jQuery( this ).removeClass( value.call( this, j, this.className ) );
8338
classes = ( value || "" ).match( rnotwhite ) || [];
8340
for ( ; i < len; i++ ) {
8342
// This expression is here for better compressibility (see addClass)
8343
cur = elem.nodeType === 1 && ( elem.className ?
8344
( " " + elem.className + " " ).replace( rclass, " " ) :
8350
while ( (clazz = classes[j++]) ) {
8351
// Remove *all* instances
8352
while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
8353
cur = cur.replace( " " + clazz + " ", " " );
8357
// only assign if different to avoid unneeded rendering.
8358
finalValue = value ? jQuery.trim( cur ) : "";
8359
if ( elem.className !== finalValue ) {
8360
elem.className = finalValue;
8369
toggleClass: function( value, stateVal ) {
8370
var type = typeof value;
8372
if ( typeof stateVal === "boolean" && type === "string" ) {
8373
return stateVal ? this.addClass( value ) : this.removeClass( value );
8376
if ( jQuery.isFunction( value ) ) {
8377
return this.each(function( i ) {
8378
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
8382
return this.each(function() {
8383
if ( type === "string" ) {
8384
// toggle individual class names
8387
self = jQuery( this ),
8388
classNames = value.match( rnotwhite ) || [];
8390
while ( (className = classNames[ i++ ]) ) {
8391
// check each className given, space separated list
8392
if ( self.hasClass( className ) ) {
8393
self.removeClass( className );
8395
self.addClass( className );
8399
// Toggle whole class name
8400
} else if ( type === strundefined || type === "boolean" ) {
8401
if ( this.className ) {
8402
// store className if set
8403
jQuery._data( this, "__className__", this.className );
8406
// If the element has a class name or if we're passed "false",
8407
// then remove the whole classname (if there was one, the above saved it).
8408
// Otherwise bring back whatever was previously saved (if anything),
8409
// falling back to the empty string if nothing was stored.
8410
this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
8415
hasClass: function( selector ) {
8416
var className = " " + selector + " ",
8419
for ( ; i < l; i++ ) {
8420
if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
8432
// Return jQuery for attributes-only inclusion
8435
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
8436
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
8437
"change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
8439
// Handle event binding
8440
jQuery.fn[ name ] = function( data, fn ) {
8441
return arguments.length > 0 ?
8442
this.on( name, null, data, fn ) :
8443
this.trigger( name );
8448
hover: function( fnOver, fnOut ) {
8449
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
8452
bind: function( types, data, fn ) {
8453
return this.on( types, null, data, fn );
8455
unbind: function( types, fn ) {
8456
return this.off( types, null, fn );
8459
delegate: function( selector, types, data, fn ) {
8460
return this.on( types, selector, data, fn );
8462
undelegate: function( selector, types, fn ) {
8463
// ( namespace ) or ( selector, types [, fn] )
8464
return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
8469
var nonce = jQuery.now();
8471
var rquery = (/\?/);
8475
var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;
8477
jQuery.parseJSON = function( data ) {
8478
// Attempt to parse using the native JSON parser first
8479
if ( window.JSON && window.JSON.parse ) {
8480
// Support: Android 2.3
8481
// Workaround failure to string-cast null input
8482
return window.JSON.parse( data + "" );
8485
var requireNonComma,
8487
str = jQuery.trim( data + "" );
8489
// Guard against invalid (and possibly dangerous) input by ensuring that nothing remains
8490
// after removing valid tokens
8491
return str && !jQuery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) {
8493
// Force termination if we see a misplaced comma
8494
if ( requireNonComma && comma ) {
8498
// Perform no more replacements after returning to outermost depth
8499
if ( depth === 0 ) {
8503
// Commas must not follow "[", "{", or ","
8504
requireNonComma = open || comma;
8506
// Determine new depth
8507
// array/object open ("[" or "{"): depth += true - false (increment)
8508
// array/object close ("]" or "}"): depth += false - true (decrement)
8509
// other cases ("," or primitive): depth += true - true (numeric cast)
8510
depth += !close - !open;
8512
// Remove this token
8515
( Function( "return " + str ) )() :
8516
jQuery.error( "Invalid JSON: " + data );
8520
// Cross-browser xml parsing
8521
jQuery.parseXML = function( data ) {
8523
if ( !data || typeof data !== "string" ) {
8527
if ( window.DOMParser ) { // Standard
8528
tmp = new DOMParser();
8529
xml = tmp.parseFromString( data, "text/xml" );
8531
xml = new ActiveXObject( "Microsoft.XMLDOM" );
8532
xml.async = "false";
8533
xml.loadXML( data );
8538
if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
8539
jQuery.error( "Invalid XML: " + data );
8546
// Document location
8551
rts = /([?&])_=[^&]*/,
8552
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
8553
// #7653, #8125, #8152: local protocol detection
8554
rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
8555
rnoContent = /^(?:GET|HEAD)$/,
8556
rprotocol = /^\/\//,
8557
rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
8560
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
8561
* 2) These are called:
8562
* - BEFORE asking for a transport
8563
* - AFTER param serialization (s.data is a string if s.processData is true)
8564
* 3) key is the dataType
8565
* 4) the catchall symbol "*" can be used
8566
* 5) execution will start with transport dataType and THEN continue down to "*" if needed
8570
/* Transports bindings
8571
* 1) key is the dataType
8572
* 2) the catchall symbol "*" can be used
8573
* 3) selection will start with transport dataType and THEN go to "*" if needed
8577
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
8578
allTypes = "*/".concat("*");
8580
// #8138, IE may throw an exception when accessing
8581
// a field from window.location if document.domain has been set
8583
ajaxLocation = location.href;
8585
// Use the href attribute of an A element
8586
// since IE will modify it given document.location
8587
ajaxLocation = document.createElement( "a" );
8588
ajaxLocation.href = "";
8589
ajaxLocation = ajaxLocation.href;
8592
// Segment location into parts
8593
ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
8595
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
8596
function addToPrefiltersOrTransports( structure ) {
8598
// dataTypeExpression is optional and defaults to "*"
8599
return function( dataTypeExpression, func ) {
8601
if ( typeof dataTypeExpression !== "string" ) {
8602
func = dataTypeExpression;
8603
dataTypeExpression = "*";
8608
dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
8610
if ( jQuery.isFunction( func ) ) {
8611
// For each dataType in the dataTypeExpression
8612
while ( (dataType = dataTypes[i++]) ) {
8613
// Prepend if requested
8614
if ( dataType.charAt( 0 ) === "+" ) {
8615
dataType = dataType.slice( 1 ) || "*";
8616
(structure[ dataType ] = structure[ dataType ] || []).unshift( func );
8620
(structure[ dataType ] = structure[ dataType ] || []).push( func );
8627
// Base inspection function for prefilters and transports
8628
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
8631
seekingTransport = ( structure === transports );
8633
function inspect( dataType ) {
8635
inspected[ dataType ] = true;
8636
jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
8637
var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
8638
if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
8639
options.dataTypes.unshift( dataTypeOrTransport );
8640
inspect( dataTypeOrTransport );
8642
} else if ( seekingTransport ) {
8643
return !( selected = dataTypeOrTransport );
8649
return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
8652
// A special extend for ajax options
8653
// that takes "flat" options (not to be deep extended)
8655
function ajaxExtend( target, src ) {
8657
flatOptions = jQuery.ajaxSettings.flatOptions || {};
8659
for ( key in src ) {
8660
if ( src[ key ] !== undefined ) {
8661
( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
8665
jQuery.extend( true, target, deep );
8671
/* Handles responses to an ajax request:
8672
* - finds the right dataType (mediates between content-type and expected dataType)
8673
* - returns the corresponding response
8675
function ajaxHandleResponses( s, jqXHR, responses ) {
8676
var firstDataType, ct, finalDataType, type,
8677
contents = s.contents,
8678
dataTypes = s.dataTypes;
8680
// Remove auto dataType and get content-type in the process
8681
while ( dataTypes[ 0 ] === "*" ) {
8683
if ( ct === undefined ) {
8684
ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
8688
// Check if we're dealing with a known content-type
8690
for ( type in contents ) {
8691
if ( contents[ type ] && contents[ type ].test( ct ) ) {
8692
dataTypes.unshift( type );
8698
// Check to see if we have a response for the expected dataType
8699
if ( dataTypes[ 0 ] in responses ) {
8700
finalDataType = dataTypes[ 0 ];
8702
// Try convertible dataTypes
8703
for ( type in responses ) {
8704
if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
8705
finalDataType = type;
8708
if ( !firstDataType ) {
8709
firstDataType = type;
8712
// Or just use first one
8713
finalDataType = finalDataType || firstDataType;
8716
// If we found a dataType
8717
// We add the dataType to the list if needed
8718
// and return the corresponding response
8719
if ( finalDataType ) {
8720
if ( finalDataType !== dataTypes[ 0 ] ) {
8721
dataTypes.unshift( finalDataType );
8723
return responses[ finalDataType ];
8727
/* Chain conversions given the request and the original response
8728
* Also sets the responseXXX fields on the jqXHR instance
8730
function ajaxConvert( s, response, jqXHR, isSuccess ) {
8731
var conv2, current, conv, tmp, prev,
8733
// Work with a copy of dataTypes in case we need to modify it for conversion
8734
dataTypes = s.dataTypes.slice();
8736
// Create converters map with lowercased keys
8737
if ( dataTypes[ 1 ] ) {
8738
for ( conv in s.converters ) {
8739
converters[ conv.toLowerCase() ] = s.converters[ conv ];
8743
current = dataTypes.shift();
8745
// Convert to each sequential dataType
8748
if ( s.responseFields[ current ] ) {
8749
jqXHR[ s.responseFields[ current ] ] = response;
8752
// Apply the dataFilter if provided
8753
if ( !prev && isSuccess && s.dataFilter ) {
8754
response = s.dataFilter( response, s.dataType );
8758
current = dataTypes.shift();
8762
// There's only work to do if current dataType is non-auto
8763
if ( current === "*" ) {
8767
// Convert response if prev dataType is non-auto and differs from current
8768
} else if ( prev !== "*" && prev !== current ) {
8770
// Seek a direct converter
8771
conv = converters[ prev + " " + current ] || converters[ "* " + current ];
8773
// If none found, seek a pair
8775
for ( conv2 in converters ) {
8777
// If conv2 outputs current
8778
tmp = conv2.split( " " );
8779
if ( tmp[ 1 ] === current ) {
8781
// If prev can be converted to accepted input
8782
conv = converters[ prev + " " + tmp[ 0 ] ] ||
8783
converters[ "* " + tmp[ 0 ] ];
8785
// Condense equivalence converters
8786
if ( conv === true ) {
8787
conv = converters[ conv2 ];
8789
// Otherwise, insert the intermediate dataType
8790
} else if ( converters[ conv2 ] !== true ) {
8792
dataTypes.unshift( tmp[ 1 ] );
8800
// Apply converter (if not an equivalence)
8801
if ( conv !== true ) {
8803
// Unless errors are allowed to bubble, catch and return them
8804
if ( conv && s[ "throws" ] ) {
8805
response = conv( response );
8808
response = conv( response );
8810
return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
8818
return { state: "success", data: response };
8823
// Counter for holding the number of active queries
8826
// Last-Modified header cache for next request
8833
isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
8837
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
8854
xml: "application/xml, text/xml",
8855
json: "application/json, text/javascript"
8866
text: "responseText",
8867
json: "responseJSON"
8871
// Keys separate source (or catchall "*") and destination types with a single space
8874
// Convert anything to text
8877
// Text to html (true = no transformation)
8880
// Evaluate text as a json expression
8881
"text json": jQuery.parseJSON,
8883
// Parse text as xml
8884
"text xml": jQuery.parseXML
8887
// For options that shouldn't be deep extended:
8888
// you can add your own custom options here if
8889
// and when you create one that shouldn't be
8890
// deep extended (see ajaxExtend)
8897
// Creates a full fledged settings object into target
8898
// with both ajaxSettings and settings fields.
8899
// If target is omitted, writes into ajaxSettings.
8900
ajaxSetup: function( target, settings ) {
8903
// Building a settings object
8904
ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
8906
// Extending ajaxSettings
8907
ajaxExtend( jQuery.ajaxSettings, target );
8910
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
8911
ajaxTransport: addToPrefiltersOrTransports( transports ),
8914
ajax: function( url, options ) {
8916
// If url is an object, simulate pre-1.5 signature
8917
if ( typeof url === "object" ) {
8922
// Force options to be an object
8923
options = options || {};
8925
var // Cross-domain detection vars
8929
// URL without anti-cache param
8931
// Response headers as string
8932
responseHeadersString,
8936
// To know if global events are to be dispatched
8942
// Create the final options object
8943
s = jQuery.ajaxSetup( {}, options ),
8944
// Callbacks context
8945
callbackContext = s.context || s,
8946
// Context for global events is callbackContext if it is a DOM node or jQuery collection
8947
globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
8948
jQuery( callbackContext ) :
8951
deferred = jQuery.Deferred(),
8952
completeDeferred = jQuery.Callbacks("once memory"),
8953
// Status-dependent callbacks
8954
statusCode = s.statusCode || {},
8955
// Headers (they are sent all at once)
8956
requestHeaders = {},
8957
requestHeadersNames = {},
8960
// Default abort message
8961
strAbort = "canceled",
8966
// Builds headers hashtable if needed
8967
getResponseHeader: function( key ) {
8969
if ( state === 2 ) {
8970
if ( !responseHeaders ) {
8971
responseHeaders = {};
8972
while ( (match = rheaders.exec( responseHeadersString )) ) {
8973
responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
8976
match = responseHeaders[ key.toLowerCase() ];
8978
return match == null ? null : match;
8982
getAllResponseHeaders: function() {
8983
return state === 2 ? responseHeadersString : null;
8986
// Caches the header
8987
setRequestHeader: function( name, value ) {
8988
var lname = name.toLowerCase();
8990
name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
8991
requestHeaders[ name ] = value;
8996
// Overrides response content-type header
8997
overrideMimeType: function( type ) {
9004
// Status-dependent callbacks
9005
statusCode: function( map ) {
9009
for ( code in map ) {
9010
// Lazy-add the new callback in a way that preserves old ones
9011
statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
9014
// Execute the appropriate callbacks
9015
jqXHR.always( map[ jqXHR.status ] );
9021
// Cancel the request
9022
abort: function( statusText ) {
9023
var finalText = statusText || strAbort;
9025
transport.abort( finalText );
9027
done( 0, finalText );
9033
deferred.promise( jqXHR ).complete = completeDeferred.add;
9034
jqXHR.success = jqXHR.done;
9035
jqXHR.error = jqXHR.fail;
9037
// Remove hash character (#7531: and string promotion)
9038
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
9039
// Handle falsy url in the settings object (#10093: consistency with old signature)
9040
// We also use the url parameter if available
9041
s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
9043
// Alias method option to type as per ticket #12004
9044
s.type = options.method || options.type || s.method || s.type;
9046
// Extract dataTypes list
9047
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
9049
// A cross-domain request is in order when we have a protocol:host:port mismatch
9050
if ( s.crossDomain == null ) {
9051
parts = rurl.exec( s.url.toLowerCase() );
9052
s.crossDomain = !!( parts &&
9053
( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
9054
( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
9055
( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
9059
// Convert data if not already a string
9060
if ( s.data && s.processData && typeof s.data !== "string" ) {
9061
s.data = jQuery.param( s.data, s.traditional );
9065
inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
9067
// If request was aborted inside a prefilter, stop there
9068
if ( state === 2 ) {
9072
// We can fire global events as of now if asked to
9073
fireGlobals = s.global;
9075
// Watch for a new set of requests
9076
if ( fireGlobals && jQuery.active++ === 0 ) {
9077
jQuery.event.trigger("ajaxStart");
9080
// Uppercase the type
9081
s.type = s.type.toUpperCase();
9083
// Determine if request has content
9084
s.hasContent = !rnoContent.test( s.type );
9086
// Save the URL in case we're toying with the If-Modified-Since
9087
// and/or If-None-Match header later on
9090
// More options handling for requests with no content
9091
if ( !s.hasContent ) {
9093
// If data is available, append data to url
9095
cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
9096
// #9682: remove data so that it's not used in an eventual retry
9100
// Add anti-cache in url if needed
9101
if ( s.cache === false ) {
9102
s.url = rts.test( cacheURL ) ?
9104
// If there is already a '_' parameter, set its value
9105
cacheURL.replace( rts, "$1_=" + nonce++ ) :
9107
// Otherwise add one to the end
9108
cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
9112
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
9113
if ( s.ifModified ) {
9114
if ( jQuery.lastModified[ cacheURL ] ) {
9115
jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
9117
if ( jQuery.etag[ cacheURL ] ) {
9118
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
9122
// Set the correct header, if data is being sent
9123
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
9124
jqXHR.setRequestHeader( "Content-Type", s.contentType );
9127
// Set the Accepts header for the server, depending on the dataType
9128
jqXHR.setRequestHeader(
9130
s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
9131
s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
9135
// Check for headers option
9136
for ( i in s.headers ) {
9137
jqXHR.setRequestHeader( i, s.headers[ i ] );
9140
// Allow custom headers/mimetypes and early abort
9141
if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
9142
// Abort if not done already and return
9143
return jqXHR.abort();
9146
// aborting is no longer a cancellation
9149
// Install callbacks on deferreds
9150
for ( i in { success: 1, error: 1, complete: 1 } ) {
9151
jqXHR[ i ]( s[ i ] );
9155
transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
9157
// If no transport, we auto-abort
9159
done( -1, "No Transport" );
9161
jqXHR.readyState = 1;
9163
// Send global event
9164
if ( fireGlobals ) {
9165
globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
9168
if ( s.async && s.timeout > 0 ) {
9169
timeoutTimer = setTimeout(function() {
9170
jqXHR.abort("timeout");
9176
transport.send( requestHeaders, done );
9178
// Propagate exception as error if not done
9181
// Simply rethrow otherwise
9188
// Callback for when everything is done
9189
function done( status, nativeStatusText, responses, headers ) {
9190
var isSuccess, success, error, response, modified,
9191
statusText = nativeStatusText;
9194
if ( state === 2 ) {
9198
// State is "done" now
9201
// Clear timeout if it exists
9202
if ( timeoutTimer ) {
9203
clearTimeout( timeoutTimer );
9206
// Dereference transport for early garbage collection
9207
// (no matter how long the jqXHR object will be used)
9208
transport = undefined;
9210
// Cache response headers
9211
responseHeadersString = headers || "";
9214
jqXHR.readyState = status > 0 ? 4 : 0;
9216
// Determine if successful
9217
isSuccess = status >= 200 && status < 300 || status === 304;
9219
// Get response data
9221
response = ajaxHandleResponses( s, jqXHR, responses );
9224
// Convert no matter what (that way responseXXX fields are always set)
9225
response = ajaxConvert( s, response, jqXHR, isSuccess );
9227
// If successful, handle type chaining
9230
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
9231
if ( s.ifModified ) {
9232
modified = jqXHR.getResponseHeader("Last-Modified");
9234
jQuery.lastModified[ cacheURL ] = modified;
9236
modified = jqXHR.getResponseHeader("etag");
9238
jQuery.etag[ cacheURL ] = modified;
9243
if ( status === 204 || s.type === "HEAD" ) {
9244
statusText = "nocontent";
9247
} else if ( status === 304 ) {
9248
statusText = "notmodified";
9250
// If we have data, let's convert it
9252
statusText = response.state;
9253
success = response.data;
9254
error = response.error;
9258
// We extract error from statusText
9259
// then normalize statusText and status for non-aborts
9261
if ( status || !statusText ) {
9262
statusText = "error";
9269
// Set data for the fake xhr object
9270
jqXHR.status = status;
9271
jqXHR.statusText = ( nativeStatusText || statusText ) + "";
9275
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
9277
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
9280
// Status-dependent callbacks
9281
jqXHR.statusCode( statusCode );
9282
statusCode = undefined;
9284
if ( fireGlobals ) {
9285
globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
9286
[ jqXHR, s, isSuccess ? success : error ] );
9290
completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
9292
if ( fireGlobals ) {
9293
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
9294
// Handle the global AJAX counter
9295
if ( !( --jQuery.active ) ) {
9296
jQuery.event.trigger("ajaxStop");
9304
getJSON: function( url, data, callback ) {
9305
return jQuery.get( url, data, callback, "json" );
9308
getScript: function( url, callback ) {
9309
return jQuery.get( url, undefined, callback, "script" );
9313
jQuery.each( [ "get", "post" ], function( i, method ) {
9314
jQuery[ method ] = function( url, data, callback, type ) {
9315
// shift arguments if data argument was omitted
9316
if ( jQuery.isFunction( data ) ) {
9317
type = type || callback;
9322
return jQuery.ajax({
9332
// Attach a bunch of functions for handling common AJAX events
9333
jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) {
9334
jQuery.fn[ type ] = function( fn ) {
9335
return this.on( type, fn );
9340
jQuery._evalUrl = function( url ) {
9341
return jQuery.ajax({
9353
wrapAll: function( html ) {
9354
if ( jQuery.isFunction( html ) ) {
9355
return this.each(function(i) {
9356
jQuery(this).wrapAll( html.call(this, i) );
9361
// The elements to wrap the target around
9362
var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
9364
if ( this[0].parentNode ) {
9365
wrap.insertBefore( this[0] );
9368
wrap.map(function() {
9371
while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
9372
elem = elem.firstChild;
9382
wrapInner: function( html ) {
9383
if ( jQuery.isFunction( html ) ) {
9384
return this.each(function(i) {
9385
jQuery(this).wrapInner( html.call(this, i) );
9389
return this.each(function() {
9390
var self = jQuery( this ),
9391
contents = self.contents();
9393
if ( contents.length ) {
9394
contents.wrapAll( html );
9397
self.append( html );
9402
wrap: function( html ) {
9403
var isFunction = jQuery.isFunction( html );
9405
return this.each(function(i) {
9406
jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
9410
unwrap: function() {
9411
return this.parent().each(function() {
9412
if ( !jQuery.nodeName( this, "body" ) ) {
9413
jQuery( this ).replaceWith( this.childNodes );
9420
jQuery.expr.filters.hidden = function( elem ) {
9421
// Support: Opera <= 12.12
9422
// Opera reports offsetWidths and offsetHeights less than zero on some elements
9423
return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 ||
9424
(!support.reliableHiddenOffsets() &&
9425
((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
9428
jQuery.expr.filters.visible = function( elem ) {
9429
return !jQuery.expr.filters.hidden( elem );
9438
rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
9439
rsubmittable = /^(?:input|select|textarea|keygen)/i;
9441
function buildParams( prefix, obj, traditional, add ) {
9444
if ( jQuery.isArray( obj ) ) {
9445
// Serialize array item.
9446
jQuery.each( obj, function( i, v ) {
9447
if ( traditional || rbracket.test( prefix ) ) {
9448
// Treat each array item as a scalar.
9452
// Item is non-scalar (array or object), encode its numeric index.
9453
buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
9457
} else if ( !traditional && jQuery.type( obj ) === "object" ) {
9458
// Serialize object item.
9459
for ( name in obj ) {
9460
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
9464
// Serialize scalar item.
9469
// Serialize an array of form elements or a set of
9470
// key/values into a query string
9471
jQuery.param = function( a, traditional ) {
9474
add = function( key, value ) {
9475
// If value is a function, invoke it and return its value
9476
value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
9477
s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
9480
// Set traditional to true for jQuery <= 1.3.2 behavior.
9481
if ( traditional === undefined ) {
9482
traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
9485
// If an array was passed in, assume that it is an array of form elements.
9486
if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
9487
// Serialize the form elements
9488
jQuery.each( a, function() {
9489
add( this.name, this.value );
9493
// If traditional, encode the "old" way (the way 1.3.2 or older
9494
// did it), otherwise encode params recursively.
9495
for ( prefix in a ) {
9496
buildParams( prefix, a[ prefix ], traditional, add );
9500
// Return the resulting serialization
9501
return s.join( "&" ).replace( r20, "+" );
9505
serialize: function() {
9506
return jQuery.param( this.serializeArray() );
9508
serializeArray: function() {
9509
return this.map(function() {
9510
// Can add propHook for "elements" to filter or add form elements
9511
var elements = jQuery.prop( this, "elements" );
9512
return elements ? jQuery.makeArray( elements ) : this;
9514
.filter(function() {
9515
var type = this.type;
9516
// Use .is(":disabled") so that fieldset[disabled] works
9517
return this.name && !jQuery( this ).is( ":disabled" ) &&
9518
rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
9519
( this.checked || !rcheckableType.test( type ) );
9521
.map(function( i, elem ) {
9522
var val = jQuery( this ).val();
9524
return val == null ?
9526
jQuery.isArray( val ) ?
9527
jQuery.map( val, function( val ) {
9528
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
9530
{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
9536
// Create the request object
9537
// (This is still attached to ajaxSettings for backward compatibility)
9538
jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ?
9542
// XHR cannot access local files, always use ActiveX for that case
9543
return !this.isLocal &&
9546
// oldIE XHR does not support non-RFC2616 methods (#13240)
9547
// See http://msdn.microsoft.com/en-us/library/ie/ms536648(v=vs.85).aspx
9548
// and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9
9549
// Although this check for six methods instead of eight
9550
// since IE also does not support "trace" and "connect"
9551
/^(get|post|head|put|delete|options)$/i.test( this.type ) &&
9553
createStandardXHR() || createActiveXHR();
9555
// For all other browsers, use the standard XMLHttpRequest object
9560
xhrSupported = jQuery.ajaxSettings.xhr();
9563
// Open requests must be manually aborted on unload (#5280)
9564
if ( window.ActiveXObject ) {
9565
jQuery( window ).on( "unload", function() {
9566
for ( var key in xhrCallbacks ) {
9567
xhrCallbacks[ key ]( undefined, true );
9572
// Determine support properties
9573
support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
9574
xhrSupported = support.ajax = !!xhrSupported;
9576
// Create transport if the browser can provide an xhr
9577
if ( xhrSupported ) {
9579
jQuery.ajaxTransport(function( options ) {
9580
// Cross domain only allowed if supported through XMLHttpRequest
9581
if ( !options.crossDomain || support.cors ) {
9586
send: function( headers, complete ) {
9588
xhr = options.xhr(),
9592
xhr.open( options.type, options.url, options.async, options.username, options.password );
9594
// Apply custom fields if provided
9595
if ( options.xhrFields ) {
9596
for ( i in options.xhrFields ) {
9597
xhr[ i ] = options.xhrFields[ i ];
9601
// Override mime type if needed
9602
if ( options.mimeType && xhr.overrideMimeType ) {
9603
xhr.overrideMimeType( options.mimeType );
9606
// X-Requested-With header
9607
// For cross-domain requests, seeing as conditions for a preflight are
9608
// akin to a jigsaw puzzle, we simply never set it to be sure.
9609
// (it can always be set on a per-request basis or even using ajaxSetup)
9610
// For same-domain requests, won't change header if already provided.
9611
if ( !options.crossDomain && !headers["X-Requested-With"] ) {
9612
headers["X-Requested-With"] = "XMLHttpRequest";
9616
for ( i in headers ) {
9618
// IE's ActiveXObject throws a 'Type Mismatch' exception when setting
9619
// request header to a null-value.
9621
// To keep consistent with other XHR implementations, cast the value
9622
// to string and ignore `undefined`.
9623
if ( headers[ i ] !== undefined ) {
9624
xhr.setRequestHeader( i, headers[ i ] + "" );
9628
// Do send the request
9629
// This may raise an exception which is actually
9630
// handled in jQuery.ajax (so no try/catch here)
9631
xhr.send( ( options.hasContent && options.data ) || null );
9634
callback = function( _, isAbort ) {
9635
var status, statusText, responses;
9637
// Was never called and is aborted or complete
9638
if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
9640
delete xhrCallbacks[ id ];
9641
callback = undefined;
9642
xhr.onreadystatechange = jQuery.noop;
9644
// Abort manually if needed
9646
if ( xhr.readyState !== 4 ) {
9651
status = xhr.status;
9654
// Accessing binary-data responseText throws an exception
9656
if ( typeof xhr.responseText === "string" ) {
9657
responses.text = xhr.responseText;
9660
// Firefox throws an exception when accessing
9661
// statusText for faulty cross-domain requests
9663
statusText = xhr.statusText;
9665
// We normalize with Webkit giving an empty statusText
9669
// Filter status for non standard behaviors
9671
// If the request is local and we have data: assume a success
9672
// (success with no data won't get notified, that's the best we
9673
// can do given current implementations)
9674
if ( !status && options.isLocal && !options.crossDomain ) {
9675
status = responses.text ? 200 : 404;
9676
// IE - #1450: sometimes returns 1223 when it should be 204
9677
} else if ( status === 1223 ) {
9683
// Call complete if needed
9685
complete( status, statusText, responses, xhr.getAllResponseHeaders() );
9689
if ( !options.async ) {
9690
// if we're in sync mode we fire the callback
9692
} else if ( xhr.readyState === 4 ) {
9693
// (IE6 & IE7) if it's in cache and has been
9694
// retrieved directly we need to fire the callback
9695
setTimeout( callback );
9697
// Add to the list of active xhr callbacks
9698
xhr.onreadystatechange = xhrCallbacks[ id ] = callback;
9704
callback( undefined, true );
9712
// Functions to create xhrs
9713
function createStandardXHR() {
9715
return new window.XMLHttpRequest();
9719
function createActiveXHR() {
9721
return new window.ActiveXObject( "Microsoft.XMLHTTP" );
9728
// Install script dataType
9731
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
9734
script: /(?:java|ecma)script/
9737
"text script": function( text ) {
9738
jQuery.globalEval( text );
9744
// Handle cache's special case and global
9745
jQuery.ajaxPrefilter( "script", function( s ) {
9746
if ( s.cache === undefined ) {
9749
if ( s.crossDomain ) {
9755
// Bind script tag hack transport
9756
jQuery.ajaxTransport( "script", function(s) {
9758
// This transport only deals with cross domain requests
9759
if ( s.crossDomain ) {
9762
head = document.head || jQuery("head")[0] || document.documentElement;
9766
send: function( _, callback ) {
9768
script = document.createElement("script");
9770
script.async = true;
9772
if ( s.scriptCharset ) {
9773
script.charset = s.scriptCharset;
9778
// Attach handlers for all browsers
9779
script.onload = script.onreadystatechange = function( _, isAbort ) {
9781
if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
9783
// Handle memory leak in IE
9784
script.onload = script.onreadystatechange = null;
9786
// Remove the script
9787
if ( script.parentNode ) {
9788
script.parentNode.removeChild( script );
9791
// Dereference the script
9794
// Callback if not abort
9796
callback( 200, "success" );
9801
// Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
9802
// Use native DOM manipulation to avoid our domManip AJAX trickery
9803
head.insertBefore( script, head.firstChild );
9808
script.onload( undefined, true );
9818
var oldCallbacks = [],
9819
rjsonp = /(=)\?(?=&|$)|\?\?/;
9821
// Default jsonp settings
9824
jsonpCallback: function() {
9825
var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
9826
this[ callback ] = true;
9831
// Detect, normalize options and install callbacks for jsonp requests
9832
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
9834
var callbackName, overwritten, responseContainer,
9835
jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
9837
typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
9840
// Handle iff the expected data type is "jsonp" or we have a parameter to set
9841
if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
9843
// Get callback name, remembering preexisting value associated with it
9844
callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
9848
// Insert callback into url or form data
9850
s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
9851
} else if ( s.jsonp !== false ) {
9852
s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
9855
// Use data converter to retrieve json after script execution
9856
s.converters["script json"] = function() {
9857
if ( !responseContainer ) {
9858
jQuery.error( callbackName + " was not called" );
9860
return responseContainer[ 0 ];
9863
// force json dataType
9864
s.dataTypes[ 0 ] = "json";
9867
overwritten = window[ callbackName ];
9868
window[ callbackName ] = function() {
9869
responseContainer = arguments;
9872
// Clean-up function (fires after converters)
9873
jqXHR.always(function() {
9874
// Restore preexisting value
9875
window[ callbackName ] = overwritten;
9877
// Save back as free
9878
if ( s[ callbackName ] ) {
9879
// make sure that re-using the options doesn't screw things around
9880
s.jsonpCallback = originalSettings.jsonpCallback;
9882
// save the callback name for future use
9883
oldCallbacks.push( callbackName );
9886
// Call if it was a function and we have a response
9887
if ( responseContainer && jQuery.isFunction( overwritten ) ) {
9888
overwritten( responseContainer[ 0 ] );
9891
responseContainer = overwritten = undefined;
9894
// Delegate to script
9902
// data: string of html
9903
// context (optional): If specified, the fragment will be created in this context, defaults to document
9904
// keepScripts (optional): If true, will include scripts passed in the html string
9905
jQuery.parseHTML = function( data, context, keepScripts ) {
9906
if ( !data || typeof data !== "string" ) {
9909
if ( typeof context === "boolean" ) {
9910
keepScripts = context;
9913
context = context || document;
9915
var parsed = rsingleTag.exec( data ),
9916
scripts = !keepScripts && [];
9920
return [ context.createElement( parsed[1] ) ];
9923
parsed = jQuery.buildFragment( [ data ], context, scripts );
9925
if ( scripts && scripts.length ) {
9926
jQuery( scripts ).remove();
9929
return jQuery.merge( [], parsed.childNodes );
9933
// Keep a copy of the old load method
9934
var _load = jQuery.fn.load;
9937
* Load a url into a page
9939
jQuery.fn.load = function( url, params, callback ) {
9940
if ( typeof url !== "string" && _load ) {
9941
return _load.apply( this, arguments );
9944
var selector, response, type,
9946
off = url.indexOf(" ");
9949
selector = jQuery.trim( url.slice( off, url.length ) );
9950
url = url.slice( 0, off );
9953
// If it's a function
9954
if ( jQuery.isFunction( params ) ) {
9956
// We assume that it's the callback
9960
// Otherwise, build a param string
9961
} else if ( params && typeof params === "object" ) {
9965
// If we have elements to modify, make the request
9966
if ( self.length > 0 ) {
9970
// if "type" variable is undefined, then "GET" method will be used
9974
}).done(function( responseText ) {
9976
// Save response for use in complete callback
9977
response = arguments;
9979
self.html( selector ?
9981
// If a selector was specified, locate the right elements in a dummy div
9982
// Exclude scripts to avoid IE 'Permission Denied' errors
9983
jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
9985
// Otherwise use the full result
9988
}).complete( callback && function( jqXHR, status ) {
9989
self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
9999
jQuery.expr.filters.animated = function( elem ) {
10000
return jQuery.grep(jQuery.timers, function( fn ) {
10001
return elem === fn.elem;
10009
var docElem = window.document.documentElement;
10012
* Gets a window from an element
10014
function getWindow( elem ) {
10015
return jQuery.isWindow( elem ) ?
10017
elem.nodeType === 9 ?
10018
elem.defaultView || elem.parentWindow :
10023
setOffset: function( elem, options, i ) {
10024
var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
10025
position = jQuery.css( elem, "position" ),
10026
curElem = jQuery( elem ),
10029
// set position first, in-case top/left are set even on static elem
10030
if ( position === "static" ) {
10031
elem.style.position = "relative";
10034
curOffset = curElem.offset();
10035
curCSSTop = jQuery.css( elem, "top" );
10036
curCSSLeft = jQuery.css( elem, "left" );
10037
calculatePosition = ( position === "absolute" || position === "fixed" ) &&
10038
jQuery.inArray("auto", [ curCSSTop, curCSSLeft ] ) > -1;
10040
// need to be able to calculate position if either top or left is auto and position is either absolute or fixed
10041
if ( calculatePosition ) {
10042
curPosition = curElem.position();
10043
curTop = curPosition.top;
10044
curLeft = curPosition.left;
10046
curTop = parseFloat( curCSSTop ) || 0;
10047
curLeft = parseFloat( curCSSLeft ) || 0;
10050
if ( jQuery.isFunction( options ) ) {
10051
options = options.call( elem, i, curOffset );
10054
if ( options.top != null ) {
10055
props.top = ( options.top - curOffset.top ) + curTop;
10057
if ( options.left != null ) {
10058
props.left = ( options.left - curOffset.left ) + curLeft;
10061
if ( "using" in options ) {
10062
options.using.call( elem, props );
10064
curElem.css( props );
10070
offset: function( options ) {
10071
if ( arguments.length ) {
10072
return options === undefined ?
10074
this.each(function( i ) {
10075
jQuery.offset.setOffset( this, options, i );
10080
box = { top: 0, left: 0 },
10082
doc = elem && elem.ownerDocument;
10088
docElem = doc.documentElement;
10090
// Make sure it's not a disconnected DOM node
10091
if ( !jQuery.contains( docElem, elem ) ) {
10095
// If we don't have gBCR, just use 0,0 rather than error
10096
// BlackBerry 5, iOS 3 (original iPhone)
10097
if ( typeof elem.getBoundingClientRect !== strundefined ) {
10098
box = elem.getBoundingClientRect();
10100
win = getWindow( doc );
10102
top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
10103
left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
10107
position: function() {
10108
if ( !this[ 0 ] ) {
10112
var offsetParent, offset,
10113
parentOffset = { top: 0, left: 0 },
10116
// fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent
10117
if ( jQuery.css( elem, "position" ) === "fixed" ) {
10118
// we assume that getBoundingClientRect is available when computed position is fixed
10119
offset = elem.getBoundingClientRect();
10121
// Get *real* offsetParent
10122
offsetParent = this.offsetParent();
10124
// Get correct offsets
10125
offset = this.offset();
10126
if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
10127
parentOffset = offsetParent.offset();
10130
// Add offsetParent borders
10131
parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
10132
parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
10135
// Subtract parent offsets and element margins
10136
// note: when an element has margin: auto the offsetLeft and marginLeft
10137
// are the same in Safari causing offset.left to incorrectly be 0
10139
top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
10140
left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)
10144
offsetParent: function() {
10145
return this.map(function() {
10146
var offsetParent = this.offsetParent || docElem;
10148
while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) {
10149
offsetParent = offsetParent.offsetParent;
10151
return offsetParent || docElem;
10156
// Create scrollLeft and scrollTop methods
10157
jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
10158
var top = /Y/.test( prop );
10160
jQuery.fn[ method ] = function( val ) {
10161
return access( this, function( elem, method, val ) {
10162
var win = getWindow( elem );
10164
if ( val === undefined ) {
10165
return win ? (prop in win) ? win[ prop ] :
10166
win.document.documentElement[ method ] :
10172
!top ? val : jQuery( win ).scrollLeft(),
10173
top ? val : jQuery( win ).scrollTop()
10177
elem[ method ] = val;
10179
}, method, val, arguments.length, null );
10183
// Add the top/left cssHooks using jQuery.fn.position
10184
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
10185
// getComputedStyle returns percent when specified for top/left/bottom/right
10186
// rather than make the css module depend on the offset module, we just check for it here
10187
jQuery.each( [ "top", "left" ], function( i, prop ) {
10188
jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
10189
function( elem, computed ) {
10191
computed = curCSS( elem, prop );
10192
// if curCSS returns percentage, fallback to offset
10193
return rnumnonpx.test( computed ) ?
10194
jQuery( elem ).position()[ prop ] + "px" :
10202
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
10203
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
10204
jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
10205
// margin is only for outerHeight, outerWidth
10206
jQuery.fn[ funcName ] = function( margin, value ) {
10207
var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
10208
extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
10210
return access( this, function( elem, type, value ) {
10213
if ( jQuery.isWindow( elem ) ) {
10214
// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
10215
// isn't a whole lot we can do. See pull request at this URL for discussion:
10216
// https://github.com/jquery/jquery/pull/764
10217
return elem.document.documentElement[ "client" + name ];
10220
// Get document width or height
10221
if ( elem.nodeType === 9 ) {
10222
doc = elem.documentElement;
10224
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
10225
// unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
10227
elem.body[ "scroll" + name ], doc[ "scroll" + name ],
10228
elem.body[ "offset" + name ], doc[ "offset" + name ],
10229
doc[ "client" + name ]
10233
return value === undefined ?
10234
// Get width or height on the element, requesting but not forcing parseFloat
10235
jQuery.css( elem, type, extra ) :
10237
// Set width or height on the element
10238
jQuery.style( elem, type, value, extra );
10239
}, type, chainable ? margin : undefined, chainable, null );
10245
// The number of elements contained in the matched element set
10246
jQuery.fn.size = function() {
10247
return this.length;
10250
jQuery.fn.andSelf = jQuery.fn.addBack;
10255
// Register as a named AMD module, since jQuery can be concatenated with other
10256
// files that may use define, but not via a proper concatenation script that
10257
// understands anonymous AMD modules. A named AMD is safest and most robust
10258
// way to register. Lowercase jquery is used because AMD module names are
10259
// derived from file names, and jQuery is normally delivered in a lowercase
10260
// file name. Do this after creating the global so that if an AMD module wants
10261
// to call noConflict to hide this version of jQuery, it will work.
10263
// Note that for maximum portability, libraries that are not jQuery should
10264
// declare themselves as anonymous modules, and avoid setting a global if an
10265
// AMD loader is present. jQuery is a special case. For more information, see
10266
// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
10268
if ( typeof define === "function" && define.amd ) {
10269
define( "jquery", [], function() {
10278
// Map over jQuery in case of overwrite
10279
_jQuery = window.jQuery,
10281
// Map over the $ in case of overwrite
10284
jQuery.noConflict = function( deep ) {
10285
if ( window.$ === jQuery ) {
10289
if ( deep && window.jQuery === jQuery ) {
10290
window.jQuery = _jQuery;
10296
// Expose jQuery and $ identifiers, even in
10297
// AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
10298
// and CommonJS for browser emulators (#13566)
10299
if ( typeof noGlobal === strundefined ) {
10300
window.jQuery = window.$ = jQuery;