(function( global, factory ) {
if ( typeof module === "object" && typeof module.exports === "object" ) {
module.exports = global.document ?
factory( global, true ) :
function( w ) {
if ( !w.document ) {
throw new error( "jquery requires a window with a document" );
}
return factory( w );
};
} else {
factory( global );
}
// pass this if window is not defined yet
}(typeof window !== "undefined" ? window : this, function( window, noglobal ) {
var arr = [];
var document = window.document;
var slice = arr.slice;
var concat = arr.concat;
var push = arr.push;
var indexof = arr.indexof;
var class2type = {};
var tostring = class2type.tostring;
var hasown = class2type.hasownproperty;
var support = {};
var
version = "",
// define a local copy of jquery
jquery = function( selector, context ) {
// the jquery object is actually just the init constructor 'enhanced'
// need init if jquery is called (just allow error to be thrown if not included)
return new jquery.fn.init( selector, context );
},
// support: android<4.1
// make sure we trim bom and nbsp
rtrim = /^[\s\ufeff\xa0]+|[\s\ufeff\xa0]+$/g,
// matches dashed string for camelizing
rmsprefix = /^-ms-/,
rdashalpha = /-([\da-z])/gi,
// used by jquery.camelcase as callback to replace()
fcamelcase = function( all, letter ) {
return letter.touppercase();
};
jquery.fn = jquery.prototype = {
// the current version of jquery being used
jquery: version,
constructor: jquery,
// start with an empty selector
selector: "",
// the default length of a jquery object is 0
length: 0,
toarray: function() {
return slice.call( this );
},
// get the nth element in the matched element set or
// get the whole matched element set as a clean array
get: function( num ) {
return num != null ?
// return just the one element from the set
( num < 0 ? this[ num + this.length ] : this[ num ] ) :
// return all the elements in a clean array
slice.call( this );
},
// take an array of elements and push it onto the stack
// (returning the new matched element set)
pushstack: function( elems ) {
// build a new jquery matched element set
var ret = jquery.merge( this.constructor(), elems );
// add the old object onto the stack (as a reference)
ret.prevobject = this;
ret.context = this.context;
// return the newly-formed element set
return ret;
},
// execute a callback for every element in the matched set.
each: function( callback ) {
return jquery.each( this, callback );
},
map: function( callback ) {
return this.pushstack( jquery.map( this, function( elem, i ) {
return callback.call( elem, i, elem );
} ) );
},
slice: function() {
return this.pushstack( slice.apply( this, arguments ) );
},
first: function() {
return this.eq( 0 );
},
last: function() {
return this.eq( -1 );
},
eq: function( i ) {
var len = this.length,
j = +i + ( i < 0 ? len : 0 );
return this.pushstack( j >= 0 && j < len ? [ this[ j ] ] : [] );
},
end: function() {
return this.prevobject || this.constructor();
},
// for internal use only.
// behaves like an array's method, not like a jquery method.
push: push,
sort: arr.sort,
splice: arr.splice
};
jquery.extend = jquery.fn.extend = function() {
var options, name, src, copy, copyisarray, clone,
target = arguments[ 0 ] || {},
i = 1,
length = arguments.length,
deep = false;
// handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
// skip the boolean and the target
target = arguments[ i ] || {};
i++;
}
// handle case when target is a string or something (possible in deep copy)
if ( typeof target !== "object" && !jquery.isfunction( target ) ) {
target = {};
}
// extend jquery itself if only one argument is passed
if ( i === length ) {
target = this;
i--;
}
for ( ; i < length; i++ ) {
// only deal with non-null/undefined values
if ( ( options = arguments[ i ] ) != null ) {
// extend the base object
for ( name in options ) {
src = target[ name ];
copy = options[ name ];
// prevent never-ending loop
if ( target === copy ) {
continue;
}
// recurse if we're merging plain objects or arrays
if ( deep && copy && ( jquery.isplainobject( copy ) ||
( copyisarray = jquery.isarray( copy ) ) ) ) {
if ( copyisarray ) {
copyisarray = false;
clone = src && jquery.isarray( src ) ? src : [];
} else {
clone = src && jquery.isplainobject( src ) ? src : {};
}
// never move original objects, clone them
target[ name ] = jquery.extend( deep, clone, copy );
// don't bring in undefined values
} else if ( copy !== undefined ) {
target[ name ] = copy;
}
}
}
}
// return the modified object
return target;
};
jquery.extend( {
// unique for each copy of jquery on the page
expando: "jquery" + ( version + math.random() ).replace( /\d/g, "" ),
// assume jquery is ready without the ready module
isready: true,
error: function( msg ) {
throw new error( msg );
},
noop: function() {},
isfunction: function( obj ) {
return jquery.type( obj ) === "function";
},
isarray: array.isarray,
iswindow: function( obj ) {
return obj != null && obj === obj.window;
},
isnumeric: function( obj ) {
// parsefloat nans numeric-cast false positives (null|true|false|"")
// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
// subtraction forces infinities to nan
// adding 1 corrects loss of precision from parsefloat (#15100)
var realstringobj = obj && obj.tostring();
return !jquery.isarray( obj ) && ( realstringobj - parsefloat( realstringobj ) + 1 ) >= 0;
},
isplainobject: function( obj ) {
// not plain objects:
// - any object or value whose internal [[class]] property is not "[object object]"
// - dom nodes
// - window
if ( jquery.type( obj ) !== "object" || obj.nodetype || jquery.iswindow( obj ) ) {
return false;
}
if ( obj.constructor &&
!hasown.call( obj.constructor.prototype, "isprototypeof" ) ) {
return false;
}
// if the function hasn't returned already, we're confident that
// |obj| is a plain object, created by {} or constructed with new object
return true;
},
isemptyobject: function( obj ) {
var name;
for ( name in obj ) {
return false;
}
return true;
},
type: function( obj ) {
if ( obj == null ) {
return obj + "";
}
// support: android<4.0, ios<6 (functionish regexp)
return typeof obj === "object" || typeof obj === "function" ?
class2type[ tostring.call( obj ) ] || "object" :
typeof obj;
},
// evaluates a script in a global context
globaleval: function( code ) {
var script,
indirect = eval;
code = jquery.trim( code );
if ( code ) {
// if the code includes a valid, prologue position
// strict mode pragma, execute code by injecting a
// script tag into the document.
if ( code.indexof( "use strict" ) === 1 ) {
script = document.createelement( "script" );
script.text = code;
document.head.appendchild( script ).parentnode.removechild( script );
} else {
// otherwise, avoid the dom node creation, insertion
// and removal by using an indirect global eval
indirect( code );
}
}
},
// convert dashed to camelcase; used by the css and data modules
// support: ie9-11+
// microsoft forgot to hump their vendor prefix (#9572)
camelcase: function( string ) {
return string.replace( rmsprefix, "ms-" ).replace( rdashalpha, fcamelcase );
},
nodename: function( elem, name ) {
return elem.nodename && elem.nodename.tolowercase() === name.tolowercase();
},
each: function( obj, callback ) {
var length, i = 0;
if ( isarraylike( obj ) ) {
length = obj.length;
for ( ; i < length; i++ ) {
if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
break;
}
}
} else {
for ( i in obj ) {
if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
break;
}
}
}
return obj;
},
// support: android<4.1
trim: function( text ) {
return text == null ?
"" :
( text + "" ).replace( rtrim, "" );
},
// results is for internal usage only
makearray: function( arr, results ) {
var ret = results || [];
if ( arr != null ) {
if ( isarraylike( object( arr ) ) ) {
jquery.merge( ret,
typeof arr === "string" ?
[ arr ] : arr
);
} else {
push.call( ret, arr );
}
}
return ret;
},
inarray: function( elem, arr, i ) {
return arr == null ? -1 : indexof.call( arr, elem, i );
},
merge: function( first, second ) {
var len = +second.length,
j = 0,
i = first.length;
for ( ; j < len; j++ ) {
first[ i++ ] = second[ j ];
}
first.length = i;
return first;
},
grep: function( elems, callback, invert ) {
var callbackinverse,
matches = [],
i = 0,
length = elems.length,
callbackexpect = !invert;
// go through the array, only saving the items
// that pass the validator function
for ( ; i < length; i++ ) {
callbackinverse = !callback( elems[ i ], i );
if ( callbackinverse !== callbackexpect ) {
matches.push( elems[ i ] );
}
}
return matches;
},
// arg is for internal usage only
map: function( elems, callback, arg ) {
var length, value,
i = 0,
ret = [];
// go through the array, translating each of the items to their new values
if ( isarraylike( elems ) ) {
length = elems.length;
for ( ; i < length; i++ ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret.push( value );
}
}
// go through every key on the object,
} else {
for ( i in elems ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret.push( value );
}
}
}
// flatten any nested arrays
return concat.apply( [], ret );
},
// a global guid counter for objects
guid: 1,
// bind a function to a context, optionally partially applying any
// arguments.
proxy: function( fn, context ) {
var tmp, args, proxy;
if ( typeof context === "string" ) {
tmp = fn[ context ];
context = fn;
fn = tmp;
}
// quick check to determine if target is callable, in the spec
// this throws a typeerror, but we will just return undefined.
if ( !jquery.isfunction( fn ) ) {
return undefined;
}
// simulated bind
args = slice.call( arguments, 2 );
proxy = function() {
return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
};
// set the guid of unique handler to the same of original handler, so it can be removed
proxy.guid = fn.guid = fn.guid || jquery.guid++;
return proxy;
},
now: date.now,
// jquery.support is not used in core but other projects attach their
// properties to it so it needs to exist.
support: support
} );
// jshint would error on this code due to the symbol not being defined in es5.
// defining this global in .jshintrc would create a danger of using the global
// unguarded in another place, it seems safer to just disable jshint for these
// three lines.
/* jshint ignore: start */
if ( typeof symbol === "function" ) {
jquery.fn[ symbol.iterator ] = arr[ symbol.iterator ];
}
/* jshint ignore: end */
// populate the class2type map
jquery.each( "boolean number string function array date regexp object error symbol".split( " " ),
function( i, name ) {
class2type[ "[object " + name + "]" ] = name.tolowercase();
} );
function isarraylike( obj ) {
// support: ios 8.2 (not reproducible in simulator)
// `in` check used to prevent jit error (gh-2145)
// hasown isn't used here due to false negatives
// regarding nodelist length in ie
var length = !!obj && "length" in obj && obj.length,
type = jquery.type( obj );
if ( type === "function" || jquery.iswindow( obj ) ) {
return false;
}
return type === "array" || length === 0 ||
typeof length === "number" && length > 0 && ( length - 1 ) in obj;
}
var sizzle =
/*!
* sizzle css selector engine v2.2.1
* http://sizzlejs.com/
*
* copyright jquery foundation and other contributors
* released under the mit license
* http://jquery.org/license
*
* date: 2015-10-17
*/
(function( window ) {
var i,
support,
expr,
gettext,
isxml,
tokenize,
compile,
select,
outermostcontext,
sortinput,
hasduplicate,
// local document vars
setdocument,
document,
docelem,
documentishtml,
rbuggyqsa,
rbuggymatches,
matches,
contains,
// instance-specific data
expando = "sizzle" + 1 * new date(),
preferreddoc = window.document,
dirruns = 0,
done = 0,
classcache = createcache(),
tokencache = createcache(),
compilercache = createcache(),
sortorder = function( a, b ) {
if ( a === b ) {
hasduplicate = true;
}
return 0;
},
// general-purpose constants
max_negative = 1 << 31,
// instance methods
hasown = ({}).hasownproperty,
arr = [],
pop = arr.pop,
push_native = arr.push,
push = arr.push,
slice = arr.slice,
// use a stripped-down indexof as it's faster than native
// http://jsperf.com/thor-indexof-vs-for/5
indexof = function( list, elem ) {
var i = 0,
len = list.length;
for ( ; i < len; i++ ) {
if ( list[i] === elem ) {
return i;
}
}
return -1;
},
booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
// regular expressions
// http://www.w3.org/tr/css3-selectors/#whitespace
whitespace = "[\\x20\\t\\r\\n\\f]",
// http://www.w3.org/tr/css21/syndata.html#value-def-identifier
identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
// attribute selectors: http://www.w3.org/tr/selectors/#attribute-selectors
attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
// operator (capture 2)
"*([*^$|!~]?=)" + whitespace +
// "attribute values must be css identifiers [capture 5] or strings [capture 3 or capture 4]"
"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
"*\\]",
pseudos = ":(" + identifier + ")(?:\\((" +
// to reduce the number of selectors needing tokenize in the prefilter, prefer arguments:
// 1. quoted (capture 3; capture 4 or capture 5)
"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
// 2. simple (capture 6)
"((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
// 3. anything else (capture 2)
".*" +
")\\)|)",
// leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
rwhitespace = new regexp( whitespace + "+", "g" ),
rtrim = new regexp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
rcomma = new regexp( "^" + whitespace + "*," + whitespace + "*" ),
rcombinators = new regexp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
rattributequotes = new regexp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
rpseudo = new regexp( pseudos ),
ridentifier = new regexp( "^" + identifier + "$" ),
matchexpr = {
"id": new regexp( "^#(" + identifier + ")" ),
"class": new regexp( "^\\.(" + identifier + ")" ),
"tag": new regexp( "^(" + identifier + "|[*])" ),
"attr": new regexp( "^" + attributes ),
"pseudo": new regexp( "^" + pseudos ),
"child": new regexp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
"bool": new regexp( "^(?:" + booleans + ")$", "i" ),
// for use in libraries implementing .is()
// we use this for pos matching in `select`
"needscontext": new regexp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
},
rinputs = /^(?:input|select|textarea|button)$/i,
rheader = /^h\d$/i,
rnative = /^[^{]+\{\s*\[native \w/,
// easily-parseable/retrievable id or tag or class selectors
rquickexpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
rsibling = /[+~]/,
rescape = /'|\\/g,
// css escapes http://www.w3.org/tr/css21/syndata.html#escaped-characters
runescape = new regexp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
funescape = function( _, escaped, escapedwhitespace ) {
var high = "0x" + escaped - 0x10000;
// nan means non-codepoint
// support: firefox<24
// workaround erroneous numeric interpretation of +"0x"
return high !== high || escapedwhitespace ?
escaped :
high < 0 ?
// bmp codepoint
string.fromcharcode( high + 0x10000 ) :
// supplemental plane codepoint (surrogate pair)
string.fromcharcode( high >> 10 | 0xd800, high & 0x3ff | 0xdc00 );
},
// used for iframes
// see setdocument()
// removing the function wrapper causes a "permission denied"
// error in ie
unloadhandler = function() {
setdocument();
};
// optimize for push.apply( _, nodelist )
try {
push.apply(
(arr = slice.call( preferreddoc.childnodes )),
preferreddoc.childnodes
);
// support: android<4.0
// detect silently failing push.apply
arr[ preferreddoc.childnodes.length ].nodetype;
} catch ( e ) {
push = { apply: arr.length ?
// leverage slice if possible
function( target, els ) {
push_native.apply( target, slice.call(els) );
} :
// support: ie<9
// otherwise append directly
function( target, els ) {
var j = target.length,
i = 0;
// can't trust nodelist.length
while ( (target[j++] = els[i++]) ) {}
target.length = j - 1;
}
};
}
function sizzle( selector, context, results, seed ) {
var m, i, elem, nid, nidselect, match, groups, newselector,
newcontext = context && context.ownerdocument,
// nodetype defaults to 9, since context defaults to document
nodetype = context ? context.nodetype : 9;
results = results || [];
// return early from calls with invalid selector or context
if ( typeof selector !== "string" || !selector ||
nodetype !== 1 && nodetype !== 9 && nodetype !== 11 ) {
return results;
}
// try to shortcut find operations (as opposed to filters) in html documents
if ( !seed ) {
if ( ( context ? context.ownerdocument || context : preferreddoc ) !== document ) {
setdocument( context );
}
context = context || document;
if ( documentishtml ) {
// if the selector is sufficiently simple, try using a "get*by*" dom method
// (excepting documentfragment context, where the methods don't exist)
if ( nodetype !== 11 && (match = rquickexpr.exec( selector )) ) {
// id selector
if ( (m = match[1]) ) {
// document context
if ( nodetype === 9 ) {
if ( (elem = context.getelementbyid( m )) ) {
// support: ie, opera, webkit
// todo: identify versions
// getelementbyid can match elements by name instead of id
if ( elem.id === m ) {
results.push( elem );
return results;
}
} else {
return results;
}
// element context
} else {
// support: ie, opera, webkit
// todo: identify versions
// getelementbyid can match elements by name instead of id
if ( newcontext && (elem = newcontext.getelementbyid( m )) &&
contains( context, elem ) &&
elem.id === m ) {
results.push( elem );
return results;
}
}
// type selector
} else if ( match[2] ) {
push.apply( results, context.getelementsbytagname( selector ) );
return results;
// class selector
} else if ( (m = match[3]) && support.getelementsbyclassname &&
context.getelementsbyclassname ) {
push.apply( results, context.getelementsbyclassname( m ) );
return results;
}
}
// take advantage of queryselectorall
if ( support.qsa &&
!compilercache[ selector + " " ] &&
(!rbuggyqsa || !rbuggyqsa.test( selector )) ) {
if ( nodetype !== 1 ) {
newcontext = context;
newselector = selector;
// qsa looks outside element context, which is not what we want
// thanks to andrew dupont for this workaround technique
// support: ie <=8
// exclude object elements
} else if ( context.nodename.tolowercase() !== "object" ) {
// capture the context id, setting it first if necessary
if ( (nid = context.getattribute( "id" )) ) {
nid = nid.replace( rescape, "\\$&" );
} else {
context.setattribute( "id", (nid = expando) );
}
// prefix every selector in the list
groups = tokenize( selector );
i = groups.length;
nidselect = ridentifier.test( nid ) ? "#" + nid : "[id='" + nid + "']";
while ( i-- ) {
groups[i] = nidselect + " " + toselector( groups[i] );
}
newselector = groups.join( "," );
// expand context for sibling selectors
newcontext = rsibling.test( selector ) && testcontext( context.parentnode ) ||
context;
}
if ( newselector ) {
try {
push.apply( results,
newcontext.queryselectorall( newselector )
);
return results;
} catch ( qsaerror ) {
} finally {
if ( nid === expando ) {
context.removeattribute( "id" );
}
}
}
}
}
}
// all others
return select( selector.replace( rtrim, "$1" ), context, results, seed );
}
/**
* create key-value caches of limited size
* @returns {function(string, object)} returns the object data after storing it on itself with
* property name the (space-suffixed) string and (if the cache is larger than expr.cachelength)
* deleting the oldest entry
*/
function createcache() {
var keys = [];
function cache( key, value ) {
// use (key + " ") to avoid collision with native prototype properties (see issue #157)
if ( keys.push( key + " " ) > expr.cachelength ) {
// only keep the most recent entries
delete cache[ keys.shift() ];
}
return (cache[ key + " " ] = value);
}
return cache;
}
/**
* mark a function for special use by sizzle
* @param {function} fn the function to mark
*/
function markfunction( fn ) {
fn[ expando ] = true;
return fn;
}
/**
* support testing using an element
* @param {function} fn passed the created div and expects a boolean result
*/
function assert( fn ) {
var div = document.createelement("div");
try {
return !!fn( div );
} catch (e) {
return false;
} finally {
// remove from its parent by default
if ( div.parentnode ) {
div.parentnode.removechild( div );
}
// release memory in ie
div = null;
}
}
/**
* adds the same handler for all of the specified attrs
* @param {string} attrs pipe-separated list of attributes
* @param {function} handler the method that will be applied
*/
function addhandle( attrs, handler ) {
var arr = attrs.split("|"),
i = arr.length;
while ( i-- ) {
expr.attrhandle[ arr[i] ] = handler;
}
}
/**
* checks document order of two siblings
* @param {element} a
* @param {element} b
* @returns {number} returns less than 0 if a precedes b, greater than 0 if a follows b
*/
function siblingcheck( a, b ) {
var cur = b && a,
diff = cur && a.nodetype === 1 && b.nodetype === 1 &&
( ~b.sourceindex || max_negative ) -
( ~a.sourceindex || max_negative );
// use ie sourceindex if available on both nodes
if ( diff ) {
return diff;
}
// check if b follows a
if ( cur ) {
while ( (cur = cur.nextsibling) ) {
if ( cur === b ) {
return -1;
}
}
}
return a ? 1 : -1;
}
/**
* returns a function to use in pseudos for input types
* @param {string} type
*/
function createinputpseudo( type ) {
return function( elem ) {
var name = elem.nodename.tolowercase();
return name === "input" && elem.type === type;
};
}
/**
* returns a function to use in pseudos for buttons
* @param {string} type
*/
function createbuttonpseudo( type ) {
return function( elem ) {
var name = elem.nodename.tolowercase();
return (name === "input" || name === "button") && elem.type === type;
};
}
/**
* returns a function to use in pseudos for positionals
* @param {function} fn
*/
function createpositionalpseudo( fn ) {
return markfunction(function( argument ) {
argument = +argument;
return markfunction(function( seed, matches ) {
var j,
matchindexes = fn( [], seed.length, argument ),
i = matchindexes.length;
// match elements found at the specified indexes
while ( i-- ) {
if ( seed[ (j = matchindexes[i]) ] ) {
seed[j] = !(matches[j] = seed[j]);
}
}
});
});
}
/**
* checks a node for validity as a sizzle context
* @param {element|object=} context
* @returns {element|object|boolean} the input node if acceptable, otherwise a falsy value
*/
function testcontext( context ) {
return context && typeof context.getelementsbytagname !== "undefined" && context;
}
// expose support vars for convenience
support = sizzle.support = {};
/**
* detects xml nodes
* @param {element|object} elem an element or a document
* @returns {boolean} true iff elem is a non-html xml node
*/
isxml = sizzle.isxml = function( elem ) {
// documentelement is verified for cases where it doesn't yet exist
// (such as loading iframes in ie - #4833)
var documentelement = elem && (elem.ownerdocument || elem).documentelement;
return documentelement ? documentelement.nodename !== "html" : false;
};
/**
* sets document-related variables once based on the current document
* @param {element|object} [doc] an element or document object to use to set the document
* @returns {object} returns the current document
*/
setdocument = sizzle.setdocument = function( node ) {
var hascompare, parent,
doc = node ? node.ownerdocument || node : preferreddoc;
// return early if doc is invalid or already selected
if ( doc === document || doc.nodetype !== 9 || !doc.documentelement ) {
return document;
}
// update global variables
document = doc;
docelem = document.documentelement;
documentishtml = !isxml( document );
// support: ie 9-11, edge
// accessing iframe documents after unload throws "permission denied" errors (jquery #13936)
if ( (parent = document.defaultview) && parent.top !== parent ) {
// support: ie 11
if ( parent.addeventlistener ) {
parent.addeventlistener( "unload", unloadhandler, false );
// support: ie 9 - 10 only
} else if ( parent.attachevent ) {
parent.attachevent( "onunload", unloadhandler );
}
}
/* attributes
---------------------------------------------------------------------- */
// support: ie<8
// verify that getattribute really returns attributes and not properties
// (excepting ie8 booleans)
support.attributes = assert(function( div ) {
div.classname = "i";
return !div.getattribute("classname");
});
/* getelement(s)by*
---------------------------------------------------------------------- */
// check if getelementsbytagname("*") returns only elements
support.getelementsbytagname = assert(function( div ) {
div.appendchild( document.createcomment("") );
return !div.getelementsbytagname("*").length;
});
// support: ie<9
support.getelementsbyclassname = rnative.test( document.getelementsbyclassname );
// support: ie<10
// check if getelementbyid returns elements by name
// the broken getelementbyid methods don't pick up programatically-set names,
// so use a roundabout getelementsbyname test
support.getbyid = assert(function( div ) {
docelem.appendchild( div ).id = expando;
return !document.getelementsbyname || !document.getelementsbyname( expando ).length;
});
// id find and filter
if ( support.getbyid ) {
expr.find["id"] = function( id, context ) {
if ( typeof context.getelementbyid !== "undefined" && documentishtml ) {
var m = context.getelementbyid( id );
return m ? [ m ] : [];
}
};
expr.filter["id"] = function( id ) {
var attrid = id.replace( runescape, funescape );
return function( elem ) {
return elem.getattribute("id") === attrid;
};
};
} else {
// support: ie6/7
// getelementbyid is not reliable as a find shortcut
delete expr.find["id"];
expr.filter["id"] = function( id ) {
var attrid = id.replace( runescape, funescape );
return function( elem ) {
var node = typeof elem.getattributenode !== "undefined" &&
elem.getattributenode("id");
return node && node.value === attrid;
};
};
}
// tag
expr.find["tag"] = support.getelementsbytagname ?
function( tag, context ) {
if ( typeof context.getelementsbytagname !== "undefined" ) {
return context.getelementsbytagname( tag );
// documentfragment nodes don't have gebtn
} else if ( support.qsa ) {
return context.queryselectorall( tag );
}
} :
function( tag, context ) {
var elem,
tmp = [],
i = 0,
// by happy coincidence, a (broken) gebtn appears on documentfragment nodes too
results = context.getelementsbytagname( tag );
// filter out possible comments
if ( tag === "*" ) {
while ( (elem = results[i++]) ) {
if ( elem.nodetype === 1 ) {
tmp.push( elem );
}
}
return tmp;
}
return results;
};
// class
expr.find["class"] = support.getelementsbyclassname && function( classname, context ) {
if ( typeof context.getelementsbyclassname !== "undefined" && documentishtml ) {
return context.getelementsbyclassname( classname );
}
};
/* qsa/matchesselector
---------------------------------------------------------------------- */
// qsa and matchesselector support
// matchesselector(:active) reports false when true (ie9/opera 11.5)
rbuggymatches = [];
// qsa(:focus) reports false when true (chrome 21)
// we allow this because of a bug in ie8/9 that throws an error
// whenever `document.activeelement` is accessed on an iframe
// so, we allow :focus to pass through qsa all the time to avoid the ie error
// see http://bugs.jquery.com/ticket/13378
rbuggyqsa = [];
if ( (support.qsa = rnative.test( document.queryselectorall )) ) {
// build qsa regex
// regex strategy adopted from diego perini
assert(function( div ) {
// select is set to empty string on purpose
// this is to test ie's treatment of not explicitly
// setting a boolean content attribute,
// since its presence should be enough
// http://bugs.jquery.com/ticket/12359
docelem.appendchild( div ).innerhtml = "" +
"";
// support: ie8, opera 11-12.16
// nothing should be selected when empty strings follow ^= or $= or *=
// the test attribute must be unknown in opera but "safe" for winrt
// http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
if ( div.queryselectorall("[msallowcapture^='']").length ) {
rbuggyqsa.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
}
// support: ie8
// boolean attributes and "value" are not treated correctly
if ( !div.queryselectorall("[selected]").length ) {
rbuggyqsa.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
}
// support: chrome<29, android<4.4, safari<7.0+, ios<7.0+, phantomjs<1.9.8+
if ( !div.queryselectorall( "[id~=" + expando + "-]" ).length ) {
rbuggyqsa.push("~=");
}
// webkit/opera - :checked should return selected option elements
// http://www.w3.org/tr/2011/rec-css3-selectors-20110929/#checked
// ie8 throws error here and will not see later tests
if ( !div.queryselectorall(":checked").length ) {
rbuggyqsa.push(":checked");
}
// support: safari 8+, ios 8+
// https://bugs.webkit.org/show_bug.cgi?id=136851
// in-page `selector#id sibing-combinator selector` fails
if ( !div.queryselectorall( "a#" + expando + "+*" ).length ) {
rbuggyqsa.push(".#.+[+~]");
}
});
assert(function( div ) {
// support: windows 8 native apps
// the type and name attributes are restricted during .innerhtml assignment
var input = document.createelement("input");
input.setattribute( "type", "hidden" );
div.appendchild( input ).setattribute( "name", "d" );
// support: ie8
// enforce case-sensitivity of name attribute
if ( div.queryselectorall("[name=d]").length ) {
rbuggyqsa.push( "name" + whitespace + "*[*^$|!~]?=" );
}
// ff 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
// ie8 throws error here and will not see later tests
if ( !div.queryselectorall(":enabled").length ) {
rbuggyqsa.push( ":enabled", ":disabled" );
}
// opera 10-11 does not throw on post-comma invalid pseudos
div.queryselectorall("*,:x");
rbuggyqsa.push(",.*:");
});
}
if ( (support.matchesselector = rnative.test( (matches = docelem.matches ||
docelem.webkitmatchesselector ||
docelem.mozmatchesselector ||
docelem.omatchesselector ||
docelem.msmatchesselector) )) ) {
assert(function( div ) {
// check to see if it's possible to do matchesselector
// on a disconnected node (ie 9)
support.disconnectedmatch = matches.call( div, "div" );
// this should fail with an exception
// gecko does not error, returns false instead
matches.call( div, "[s!='']:x" );
rbuggymatches.push( "!=", pseudos );
});
}
rbuggyqsa = rbuggyqsa.length && new regexp( rbuggyqsa.join("|") );
rbuggymatches = rbuggymatches.length && new regexp( rbuggymatches.join("|") );
/* contains
---------------------------------------------------------------------- */
hascompare = rnative.test( docelem.comparedocumentposition );
// element contains another
// purposefully self-exclusive
// as in, an element does not contain itself
contains = hascompare || rnative.test( docelem.contains ) ?
function( a, b ) {
var adown = a.nodetype === 9 ? a.documentelement : a,
bup = b && b.parentnode;
return a === bup || !!( bup && bup.nodetype === 1 && (
adown.contains ?
adown.contains( bup ) :
a.comparedocumentposition && a.comparedocumentposition( bup ) & 16
));
} :
function( a, b ) {
if ( b ) {
while ( (b = b.parentnode) ) {
if ( b === a ) {
return true;
}
}
}
return false;
};
/* sorting
---------------------------------------------------------------------- */
// document order sorting
sortorder = hascompare ?
function( a, b ) {
// flag for duplicate removal
if ( a === b ) {
hasduplicate = true;
return 0;
}
// sort on method existence if only one input has comparedocumentposition
var compare = !a.comparedocumentposition - !b.comparedocumentposition;
if ( compare ) {
return compare;
}
// calculate position if both inputs belong to the same document
compare = ( a.ownerdocument || a ) === ( b.ownerdocument || b ) ?
a.comparedocumentposition( b ) :
// otherwise we know they are disconnected
1;
// disconnected nodes
if ( compare & 1 ||
(!support.sortdetached && b.comparedocumentposition( a ) === compare) ) {
// choose the first element that is related to our preferred document
if ( a === document || a.ownerdocument === preferreddoc && contains(preferreddoc, a) ) {
return -1;
}
if ( b === document || b.ownerdocument === preferreddoc && contains(preferreddoc, b) ) {
return 1;
}
// maintain original order
return sortinput ?
( indexof( sortinput, a ) - indexof( sortinput, b ) ) :
0;
}
return compare & 4 ? -1 : 1;
} :
function( a, b ) {
// exit early if the nodes are identical
if ( a === b ) {
hasduplicate = true;
return 0;
}
var cur,
i = 0,
aup = a.parentnode,
bup = b.parentnode,
ap = [ a ],
bp = [ b ];
// parentless nodes are either documents or disconnected
if ( !aup || !bup ) {
return a === document ? -1 :
b === document ? 1 :
aup ? -1 :
bup ? 1 :
sortinput ?
( indexof( sortinput, a ) - indexof( sortinput, b ) ) :
0;
// if the nodes are siblings, we can do a quick check
} else if ( aup === bup ) {
return siblingcheck( a, b );
}
// otherwise we need full lists of their ancestors for comparison
cur = a;
while ( (cur = cur.parentnode) ) {
ap.unshift( cur );
}
cur = b;
while ( (cur = cur.parentnode) ) {
bp.unshift( cur );
}
// walk down the tree looking for a discrepancy
while ( ap[i] === bp[i] ) {
i++;
}
return i ?
// do a sibling check if the nodes have a common ancestor
siblingcheck( ap[i], bp[i] ) :
// otherwise nodes in our document sort first
ap[i] === preferreddoc ? -1 :
bp[i] === preferreddoc ? 1 :
0;
};
return document;
};
sizzle.matches = function( expr, elements ) {
return sizzle( expr, null, null, elements );
};
sizzle.matchesselector = function( elem, expr ) {
// set document vars if needed
if ( ( elem.ownerdocument || elem ) !== document ) {
setdocument( elem );
}
// make sure that attribute selectors are quoted
expr = expr.replace( rattributequotes, "='$1']" );
if ( support.matchesselector && documentishtml &&
!compilercache[ expr + " " ] &&
( !rbuggymatches || !rbuggymatches.test( expr ) ) &&
( !rbuggyqsa || !rbuggyqsa.test( expr ) ) ) {
try {
var ret = matches.call( elem, expr );
// ie 9's matchesselector returns false on disconnected nodes
if ( ret || support.disconnectedmatch ||
// as well, disconnected nodes are said to be in a document
// fragment in ie 9
elem.document && elem.document.nodetype !== 11 ) {
return ret;
}
} catch (e) {}
}
return sizzle( expr, document, null, [ elem ] ).length > 0;
};
sizzle.contains = function( context, elem ) {
// set document vars if needed
if ( ( context.ownerdocument || context ) !== document ) {
setdocument( context );
}
return contains( context, elem );
};
sizzle.attr = function( elem, name ) {
// set document vars if needed
if ( ( elem.ownerdocument || elem ) !== document ) {
setdocument( elem );
}
var fn = expr.attrhandle[ name.tolowercase() ],
// don't get fooled by object.prototype properties (jquery #13807)
val = fn && hasown.call( expr.attrhandle, name.tolowercase() ) ?
fn( elem, name, !documentishtml ) :
undefined;
return val !== undefined ?
val :
support.attributes || !documentishtml ?
elem.getattribute( name ) :
(val = elem.getattributenode(name)) && val.specified ?
val.value :
null;
};
sizzle.error = function( msg ) {
throw new error( "syntax error, unrecognized expression: " + msg );
};
/**
* document sorting and removing duplicates
* @param {arraylike} results
*/
sizzle.uniquesort = function( results ) {
var elem,
duplicates = [],
j = 0,
i = 0;
// unless we *know* we can detect duplicates, assume their presence
hasduplicate = !support.detectduplicates;
sortinput = !support.sortstable && results.slice( 0 );
results.sort( sortorder );
if ( hasduplicate ) {
while ( (elem = results[i++]) ) {
if ( elem === results[ i ] ) {
j = duplicates.push( i );
}
}
while ( j-- ) {
results.splice( duplicates[ j ], 1 );
}
}
// clear input after sorting to release objects
// see https://github.com/jquery/sizzle/pull/225
sortinput = null;
return results;
};
/**
* utility function for retrieving the text value of an array of dom nodes
* @param {array|element} elem
*/
gettext = sizzle.gettext = function( elem ) {
var node,
ret = "",
i = 0,
nodetype = elem.nodetype;
if ( !nodetype ) {
// if no nodetype, this is expected to be an array
while ( (node = elem[i++]) ) {
// do not traverse comment nodes
ret += gettext( node );
}
} else if ( nodetype === 1 || nodetype === 9 || nodetype === 11 ) {
// use textcontent for elements
// innertext usage removed for consistency of new lines (jquery #11153)
if ( typeof elem.textcontent === "string" ) {
return elem.textcontent;
} else {
// traverse its children
for ( elem = elem.firstchild; elem; elem = elem.nextsibling ) {
ret += gettext( elem );
}
}
} else if ( nodetype === 3 || nodetype === 4 ) {
return elem.nodevalue;
}
// do not include comment or processing instruction nodes
return ret;
};
expr = sizzle.selectors = {
// can be adjusted by the user
cachelength: 50,
createpseudo: markfunction,
match: matchexpr,
attrhandle: {},
find: {},
relative: {
">": { dir: "parentnode", first: true },
" ": { dir: "parentnode" },
"+": { dir: "previoussibling", first: true },
"~": { dir: "previoussibling" }
},
prefilter: {
"attr": function( match ) {
match[1] = match[1].replace( runescape, funescape );
// move the given value to match[3] whether quoted or unquoted
match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
if ( match[2] === "~=" ) {
match[3] = " " + match[3] + " ";
}
return match.slice( 0, 4 );
},
"child": function( match ) {
/* matches from matchexpr["child"]
1 type (only|nth|...)
2 what (child|of-type)
3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
4 xn-component of xn+y argument ([+-]?\d*n|)
5 sign of xn-component
6 x of xn-component
7 sign of y-component
8 y of y-component
*/
match[1] = match[1].tolowercase();
if ( match[1].slice( 0, 3 ) === "nth" ) {
// nth-* requires argument
if ( !match[3] ) {
sizzle.error( match[0] );
}
// numeric x and y parameters for expr.filter.child
// remember that false/true cast respectively to 0/1
match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
// other types prohibit arguments
} else if ( match[3] ) {
sizzle.error( match[0] );
}
return match;
},
"pseudo": function( match ) {
var excess,
unquoted = !match[6] && match[2];
if ( matchexpr["child"].test( match[0] ) ) {
return null;
}
// accept quoted arguments as-is
if ( match[3] ) {
match[2] = match[4] || match[5] || "";
// strip excess characters from unquoted arguments
} else if ( unquoted && rpseudo.test( unquoted ) &&
// get excess from tokenize (recursively)
(excess = tokenize( unquoted, true )) &&
// advance to the next closing parenthesis
(excess = unquoted.indexof( ")", unquoted.length - excess ) - unquoted.length) ) {
// excess is a negative index
match[0] = match[0].slice( 0, excess );
match[2] = unquoted.slice( 0, excess );
}
// return only captures needed by the pseudo filter method (type and argument)
return match.slice( 0, 3 );
}
},
filter: {
"tag": function( nodenameselector ) {
var nodename = nodenameselector.replace( runescape, funescape ).tolowercase();
return nodenameselector === "*" ?
function() { return true; } :
function( elem ) {
return elem.nodename && elem.nodename.tolowercase() === nodename;
};
},
"class": function( classname ) {
var pattern = classcache[ classname + " " ];
return pattern ||
(pattern = new regexp( "(^|" + whitespace + ")" + classname + "(" + whitespace + "|$)" )) &&
classcache( classname, function( elem ) {
return pattern.test( typeof elem.classname === "string" && elem.classname || typeof elem.getattribute !== "undefined" && elem.getattribute("class") || "" );
});
},
"attr": function( name, operator, check ) {
return function( elem ) {
var result = sizzle.attr( elem, name );
if ( result == null ) {
return operator === "!=";
}
if ( !operator ) {
return true;
}
result += "";
return operator === "=" ? result === check :
operator === "!=" ? result !== check :
operator === "^=" ? check && result.indexof( check ) === 0 :
operator === "*=" ? check && result.indexof( check ) > -1 :
operator === "$=" ? check && result.slice( -check.length ) === check :
operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexof( check ) > -1 :
operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
false;
};
},
"child": function( type, what, argument, first, last ) {
var simple = type.slice( 0, 3 ) !== "nth",
forward = type.slice( -4 ) !== "last",
oftype = what === "of-type";
return first === 1 && last === 0 ?
// shortcut for :nth-*(n)
function( elem ) {
return !!elem.parentnode;
} :
function( elem, context, xml ) {
var cache, uniquecache, outercache, node, nodeindex, start,
dir = simple !== forward ? "nextsibling" : "previoussibling",
parent = elem.parentnode,
name = oftype && elem.nodename.tolowercase(),
usecache = !xml && !oftype,
diff = false;
if ( parent ) {
// :(first|last|only)-(child|of-type)
if ( simple ) {
while ( dir ) {
node = elem;
while ( (node = node[ dir ]) ) {
if ( oftype ?
node.nodename.tolowercase() === name :
node.nodetype === 1 ) {
return false;
}
}
// reverse direction for :only-* (if we haven't yet done so)
start = dir = type === "only" && !start && "nextsibling";
}
return true;
}
start = [ forward ? parent.firstchild : parent.lastchild ];
// non-xml :nth-child(...) stores cache data on `parent`
if ( forward && usecache ) {
// seek `elem` from a previously-cached index
// ...in a gzip-friendly way
node = parent;
outercache = node[ expando ] || (node[ expando ] = {});
// support: ie <9 only
// defend against cloned attroperties (jquery gh-1709)
uniquecache = outercache[ node.uniqueid ] ||
(outercache[ node.uniqueid ] = {});
cache = uniquecache[ type ] || [];
nodeindex = cache[ 0 ] === dirruns && cache[ 1 ];
diff = nodeindex && cache[ 2 ];
node = nodeindex && parent.childnodes[ nodeindex ];
while ( (node = ++nodeindex && node && node[ dir ] ||
// fallback to seeking `elem` from the start
(diff = nodeindex = 0) || start.pop()) ) {
// when found, cache indexes on `parent` and break
if ( node.nodetype === 1 && ++diff && node === elem ) {
uniquecache[ type ] = [ dirruns, nodeindex, diff ];
break;
}
}
} else {
// use previously-cached element index if available
if ( usecache ) {
// ...in a gzip-friendly way
node = elem;
outercache = node[ expando ] || (node[ expando ] = {});
// support: ie <9 only
// defend against cloned attroperties (jquery gh-1709)
uniquecache = outercache[ node.uniqueid ] ||
(outercache[ node.uniqueid ] = {});
cache = uniquecache[ type ] || [];
nodeindex = cache[ 0 ] === dirruns && cache[ 1 ];
diff = nodeindex;
}
// xml :nth-child(...)
// or :nth-last-child(...) or :nth(-last)?-of-type(...)
if ( diff === false ) {
// use the same loop as above to seek `elem` from the start
while ( (node = ++nodeindex && node && node[ dir ] ||
(diff = nodeindex = 0) || start.pop()) ) {
if ( ( oftype ?
node.nodename.tolowercase() === name :
node.nodetype === 1 ) &&
++diff ) {
// cache the index of each encountered element
if ( usecache ) {
outercache = node[ expando ] || (node[ expando ] = {});
// support: ie <9 only
// defend against cloned attroperties (jquery gh-1709)
uniquecache = outercache[ node.uniqueid ] ||
(outercache[ node.uniqueid ] = {});
uniquecache[ type ] = [ dirruns, diff ];
}
if ( node === elem ) {
break;
}
}
}
}
}
// incorporate the offset, then check against cycle size
diff -= last;
return diff === first || ( diff % first === 0 && diff / first >= 0 );
}
};
},
"pseudo": function( pseudo, argument ) {
// pseudo-class names are case-insensitive
// http://www.w3.org/tr/selectors/#pseudo-classes
// prioritize by case sensitivity in case custom pseudos are added with uppercase letters
// remember that setfilters inherits from pseudos
var args,
fn = expr.pseudos[ pseudo ] || expr.setfilters[ pseudo.tolowercase() ] ||
sizzle.error( "unsupported pseudo: " + pseudo );
// the user may use createpseudo to indicate that
// arguments are needed to create the filter function
// just as sizzle does
if ( fn[ expando ] ) {
return fn( argument );
}
// but maintain support for old signatures
if ( fn.length > 1 ) {
args = [ pseudo, pseudo, "", argument ];
return expr.setfilters.hasownproperty( pseudo.tolowercase() ) ?
markfunction(function( seed, matches ) {
var idx,
matched = fn( seed, argument ),
i = matched.length;
while ( i-- ) {
idx = indexof( seed, matched[i] );
seed[ idx ] = !( matches[ idx ] = matched[i] );
}
}) :
function( elem ) {
return fn( elem, 0, args );
};
}
return fn;
}
},
pseudos: {
// potentially complex pseudos
"not": markfunction(function( selector ) {
// trim the selector passed to compile
// to avoid treating leading and trailing
// spaces as combinators
var input = [],
results = [],
matcher = compile( selector.replace( rtrim, "$1" ) );
return matcher[ expando ] ?
markfunction(function( seed, matches, context, xml ) {
var elem,
unmatched = matcher( seed, null, xml, [] ),
i = seed.length;
// match elements unmatched by `matcher`
while ( i-- ) {
if ( (elem = unmatched[i]) ) {
seed[i] = !(matches[i] = elem);
}
}
}) :
function( elem, context, xml ) {
input[0] = elem;
matcher( input, null, xml, results );
// don't keep the element (issue #299)
input[0] = null;
return !results.pop();
};
}),
"has": markfunction(function( selector ) {
return function( elem ) {
return sizzle( selector, elem ).length > 0;
};
}),
"contains": markfunction(function( text ) {
text = text.replace( runescape, funescape );
return function( elem ) {
return ( elem.textcontent || elem.innertext || gettext( elem ) ).indexof( text ) > -1;
};
}),
// "whether an element is represented by a :lang() selector
// is based solely on the element's language value
// being equal to the identifier c,
// or beginning with the identifier c immediately followed by "-".
// the matching of c against the element's language value is performed case-insensitively.
// the identifier c does not have to be a valid language name."
// http://www.w3.org/tr/selectors/#lang-pseudo
"lang": markfunction( function( lang ) {
// lang value must be a valid identifier
if ( !ridentifier.test(lang || "") ) {
sizzle.error( "unsupported lang: " + lang );
}
lang = lang.replace( runescape, funescape ).tolowercase();
return function( elem ) {
var elemlang;
do {
if ( (elemlang = documentishtml ?
elem.lang :
elem.getattribute("xml:lang") || elem.getattribute("lang")) ) {
elemlang = elemlang.tolowercase();
return elemlang === lang || elemlang.indexof( lang + "-" ) === 0;
}
} while ( (elem = elem.parentnode) && elem.nodetype === 1 );
return false;
};
}),
// miscellaneous
"target": function( elem ) {
var hash = window.location && window.location.hash;
return hash && hash.slice( 1 ) === elem.id;
},
"root": function( elem ) {
return elem === docelem;
},
"focus": function( elem ) {
return elem === document.activeelement && (!document.hasfocus || document.hasfocus()) && !!(elem.type || elem.href || ~elem.tabindex);
},
// boolean properties
"enabled": function( elem ) {
return elem.disabled === false;
},
"disabled": function( elem ) {
return elem.disabled === true;
},
"checked": function( elem ) {
// in css3, :checked should return both checked and selected elements
// http://www.w3.org/tr/2011/rec-css3-selectors-20110929/#checked
var nodename = elem.nodename.tolowercase();
return (nodename === "input" && !!elem.checked) || (nodename === "option" && !!elem.selected);
},
"selected": function( elem ) {
// accessing this property makes selected-by-default
// options in safari work properly
if ( elem.parentnode ) {
elem.parentnode.selectedindex;
}
return elem.selected === true;
},
// contents
"empty": function( elem ) {
// http://www.w3.org/tr/selectors/#empty-pseudo
// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
// but not by others (comment: 8; processing instruction: 7; etc.)
// nodetype < 6 works because attributes (2) do not appear as children
for ( elem = elem.firstchild; elem; elem = elem.nextsibling ) {
if ( elem.nodetype < 6 ) {
return false;
}
}
return true;
},
"parent": function( elem ) {
return !expr.pseudos["empty"]( elem );
},
// element/input types
"header": function( elem ) {
return rheader.test( elem.nodename );
},
"input": function( elem ) {
return rinputs.test( elem.nodename );
},
"button": function( elem ) {
var name = elem.nodename.tolowercase();
return name === "input" && elem.type === "button" || name === "button";
},
"text": function( elem ) {
var attr;
return elem.nodename.tolowercase() === "input" &&
elem.type === "text" &&
// support: ie<8
// new html5 attribute values (e.g., "search") appear with elem.type === "text"
( (attr = elem.getattribute("type")) == null || attr.tolowercase() === "text" );
},
// position-in-collection
"first": createpositionalpseudo(function() {
return [ 0 ];
}),
"last": createpositionalpseudo(function( matchindexes, length ) {
return [ length - 1 ];
}),
"eq": createpositionalpseudo(function( matchindexes, length, argument ) {
return [ argument < 0 ? argument + length : argument ];
}),
"even": createpositionalpseudo(function( matchindexes, length ) {
var i = 0;
for ( ; i < length; i += 2 ) {
matchindexes.push( i );
}
return matchindexes;
}),
"odd": createpositionalpseudo(function( matchindexes, length ) {
var i = 1;
for ( ; i < length; i += 2 ) {
matchindexes.push( i );
}
return matchindexes;
}),
"lt": createpositionalpseudo(function( matchindexes, length, argument ) {
var i = argument < 0 ? argument + length : argument;
for ( ; --i >= 0; ) {
matchindexes.push( i );
}
return matchindexes;
}),
"gt": createpositionalpseudo(function( matchindexes, length, argument ) {
var i = argument < 0 ? argument + length : argument;
for ( ; ++i < length; ) {
matchindexes.push( i );
}
return matchindexes;
})
}
};
expr.pseudos["nth"] = expr.pseudos["eq"];
// add button/input type pseudos
for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
expr.pseudos[ i ] = createinputpseudo( i );
}
for ( i in { submit: true, reset: true } ) {
expr.pseudos[ i ] = createbuttonpseudo( i );
}
// easy api for creating new setfilters
function setfilters() {}
setfilters.prototype = expr.filters = expr.pseudos;
expr.setfilters = new setfilters();
tokenize = sizzle.tokenize = function( selector, parseonly ) {
var matched, match, tokens, type,
sofar, groups, prefilters,
cached = tokencache[ selector + " " ];
if ( cached ) {
return parseonly ? 0 : cached.slice( 0 );
}
sofar = selector;
groups = [];
prefilters = expr.prefilter;
while ( sofar ) {
// comma and first run
if ( !matched || (match = rcomma.exec( sofar )) ) {
if ( match ) {
// don't consume trailing commas as valid
sofar = sofar.slice( match[0].length ) || sofar;
}
groups.push( (tokens = []) );
}
matched = false;
// combinators
if ( (match = rcombinators.exec( sofar )) ) {
matched = match.shift();
tokens.push({
value: matched,
// cast descendant combinators to space
type: match[0].replace( rtrim, " " )
});
sofar = sofar.slice( matched.length );
}
// filters
for ( type in expr.filter ) {
if ( (match = matchexpr[ type ].exec( sofar )) && (!prefilters[ type ] ||
(match = prefilters[ type ]( match ))) ) {
matched = match.shift();
tokens.push({
value: matched,
type: type,
matches: match
});
sofar = sofar.slice( matched.length );
}
}
if ( !matched ) {
break;
}
}
// return the length of the invalid excess
// if we're just parsing
// otherwise, throw an error or return tokens
return parseonly ?
sofar.length :
sofar ?
sizzle.error( selector ) :
// cache the tokens
tokencache( selector, groups ).slice( 0 );
};
function toselector( tokens ) {
var i = 0,
len = tokens.length,
selector = "";
for ( ; i < len; i++ ) {
selector += tokens[i].value;
}
return selector;
}
function addcombinator( matcher, combinator, base ) {
var dir = combinator.dir,
checknonelements = base && dir === "parentnode",
donename = done++;
return combinator.first ?
// check against closest ancestor/preceding element
function( elem, context, xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodetype === 1 || checknonelements ) {
return matcher( elem, context, xml );
}
}
} :
// check against all ancestor/preceding elements
function( elem, context, xml ) {
var oldcache, uniquecache, outercache,
newcache = [ dirruns, donename ];
// we can't set arbitrary data on xml nodes, so they don't benefit from combinator caching
if ( xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodetype === 1 || checknonelements ) {
if ( matcher( elem, context, xml ) ) {
return true;
}
}
}
} else {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodetype === 1 || checknonelements ) {
outercache = elem[ expando ] || (elem[ expando ] = {});
// support: ie <9 only
// defend against cloned attroperties (jquery gh-1709)
uniquecache = outercache[ elem.uniqueid ] || (outercache[ elem.uniqueid ] = {});
if ( (oldcache = uniquecache[ dir ]) &&
oldcache[ 0 ] === dirruns && oldcache[ 1 ] === donename ) {
// assign to newcache so results back-propagate to previous elements
return (newcache[ 2 ] = oldcache[ 2 ]);
} else {
// reuse newcache so results back-propagate to previous elements
uniquecache[ dir ] = newcache;
// a match means we're done; a fail means we have to keep checking
if ( (newcache[ 2 ] = matcher( elem, context, xml )) ) {
return true;
}
}
}
}
}
};
}
function elementmatcher( matchers ) {
return matchers.length > 1 ?
function( elem, context, xml ) {
var i = matchers.length;
while ( i-- ) {
if ( !matchers[i]( elem, context, xml ) ) {
return false;
}
}
return true;
} :
matchers[0];
}
function multiplecontexts( selector, contexts, results ) {
var i = 0,
len = contexts.length;
for ( ; i < len; i++ ) {
sizzle( selector, contexts[i], results );
}
return results;
}
function condense( unmatched, map, filter, context, xml ) {
var elem,
newunmatched = [],
i = 0,
len = unmatched.length,
mapped = map != null;
for ( ; i < len; i++ ) {
if ( (elem = unmatched[i]) ) {
if ( !filter || filter( elem, context, xml ) ) {
newunmatched.push( elem );
if ( mapped ) {
map.push( i );
}
}
}
}
return newunmatched;
}
function setmatcher( prefilter, selector, matcher, postfilter, postfinder, postselector ) {
if ( postfilter && !postfilter[ expando ] ) {
postfilter = setmatcher( postfilter );
}
if ( postfinder && !postfinder[ expando ] ) {
postfinder = setmatcher( postfinder, postselector );
}
return markfunction(function( seed, results, context, xml ) {
var temp, i, elem,
premap = [],
postmap = [],
preexisting = results.length,
// get initial elements from seed or context
elems = seed || multiplecontexts( selector || "*", context.nodetype ? [ context ] : context, [] ),
// prefilter to get matcher input, preserving a map for seed-results synchronization
matcherin = prefilter && ( seed || !selector ) ?
condense( elems, premap, prefilter, context, xml ) :
elems,
matcherout = matcher ?
// if we have a postfinder, or filtered seed, or non-seed postfilter or preexisting results,
postfinder || ( seed ? prefilter : preexisting || postfilter ) ?
// ...intermediate processing is necessary
[] :
// ...otherwise use results directly
results :
matcherin;
// find primary matches
if ( matcher ) {
matcher( matcherin, matcherout, context, xml );
}
// apply postfilter
if ( postfilter ) {
temp = condense( matcherout, postmap );
postfilter( temp, [], context, xml );
// un-match failing elements by moving them back to matcherin
i = temp.length;
while ( i-- ) {
if ( (elem = temp[i]) ) {
matcherout[ postmap[i] ] = !(matcherin[ postmap[i] ] = elem);
}
}
}
if ( seed ) {
if ( postfinder || prefilter ) {
if ( postfinder ) {
// get the final matcherout by condensing this intermediate into postfinder contexts
temp = [];
i = matcherout.length;
while ( i-- ) {
if ( (elem = matcherout[i]) ) {
// restore matcherin since elem is not yet a final match
temp.push( (matcherin[i] = elem) );
}
}
postfinder( null, (matcherout = []), temp, xml );
}
// move matched elements from seed to results to keep them synchronized
i = matcherout.length;
while ( i-- ) {
if ( (elem = matcherout[i]) &&
(temp = postfinder ? indexof( seed, elem ) : premap[i]) > -1 ) {
seed[temp] = !(results[temp] = elem);
}
}
}
// add elements to results, through postfinder if defined
} else {
matcherout = condense(
matcherout === results ?
matcherout.splice( preexisting, matcherout.length ) :
matcherout
);
if ( postfinder ) {
postfinder( null, results, matcherout, xml );
} else {
push.apply( results, matcherout );
}
}
});
}
function matcherfromtokens( tokens ) {
var checkcontext, matcher, j,
len = tokens.length,
leadingrelative = expr.relative[ tokens[0].type ],
implicitrelative = leadingrelative || expr.relative[" "],
i = leadingrelative ? 1 : 0,
// the foundational matcher ensures that elements are reachable from top-level context(s)
matchcontext = addcombinator( function( elem ) {
return elem === checkcontext;
}, implicitrelative, true ),
matchanycontext = addcombinator( function( elem ) {
return indexof( checkcontext, elem ) > -1;
}, implicitrelative, true ),
matchers = [ function( elem, context, xml ) {
var ret = ( !leadingrelative && ( xml || context !== outermostcontext ) ) || (
(checkcontext = context).nodetype ?
matchcontext( elem, context, xml ) :
matchanycontext( elem, context, xml ) );
// avoid hanging onto element (issue #299)
checkcontext = null;
return ret;
} ];
for ( ; i < len; i++ ) {
if ( (matcher = expr.relative[ tokens[i].type ]) ) {
matchers = [ addcombinator(elementmatcher( matchers ), matcher) ];
} else {
matcher = expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
// return special upon seeing a positional matcher
if ( matcher[ expando ] ) {
// find the next relative operator (if any) for proper handling
j = ++i;
for ( ; j < len; j++ ) {
if ( expr.relative[ tokens[j].type ] ) {
break;
}
}
return setmatcher(
i > 1 && elementmatcher( matchers ),
i > 1 && toselector(
// if the preceding token was a descendant combinator, insert an implicit any-element `*`
tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
).replace( rtrim, "$1" ),
matcher,
i < j && matcherfromtokens( tokens.slice( i, j ) ),
j < len && matcherfromtokens( (tokens = tokens.slice( j )) ),
j < len && toselector( tokens )
);
}
matchers.push( matcher );
}
}
return elementmatcher( matchers );
}
function matcherfromgroupmatchers( elementmatchers, setmatchers ) {
var byset = setmatchers.length > 0,
byelement = elementmatchers.length > 0,
supermatcher = function( seed, context, xml, results, outermost ) {
var elem, j, matcher,
matchedcount = 0,
i = "0",
unmatched = seed && [],
setmatched = [],
contextbackup = outermostcontext,
// we must always have either seed elements or outermost context
elems = seed || byelement && expr.find["tag"]( "*", outermost ),
// use integer dirruns iff this is the outermost matcher
dirrunsunique = (dirruns += contextbackup == null ? 1 : math.random() || 0.1),
len = elems.length;
if ( outermost ) {
outermostcontext = context === document || context || outermost;
}
// add elements passing elementmatchers directly to results
// support: ie<9, safari
// tolerate nodelist properties (ie: "length"; safari: ) matching elements by id
for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
if ( byelement && elem ) {
j = 0;
if ( !context && elem.ownerdocument !== document ) {
setdocument( elem );
xml = !documentishtml;
}
while ( (matcher = elementmatchers[j++]) ) {
if ( matcher( elem, context || document, xml) ) {
results.push( elem );
break;
}
}
if ( outermost ) {
dirruns = dirrunsunique;
}
}
// track unmatched elements for set filters
if ( byset ) {
// they will have gone through all possible matchers
if ( (elem = !matcher && elem) ) {
matchedcount--;
}
// lengthen the array for every element, matched or not
if ( seed ) {
unmatched.push( elem );
}
}
}
// `i` is now the count of elements visited above, and adding it to `matchedcount`
// makes the latter nonnegative.
matchedcount += i;
// apply set filters to unmatched elements
// note: this can be skipped if there are no unmatched elements (i.e., `matchedcount`
// equals `i`), unless we didn't visit _any_ elements in the above loop because we have
// no element matchers and no seed.
// incrementing an initially-string "0" `i` allows `i` to remain a string only in that
// case, which will result in a "00" `matchedcount` that differs from `i` but is also
// numerically zero.
if ( byset && i !== matchedcount ) {
j = 0;
while ( (matcher = setmatchers[j++]) ) {
matcher( unmatched, setmatched, context, xml );
}
if ( seed ) {
// reintegrate element matches to eliminate the need for sorting
if ( matchedcount > 0 ) {
while ( i-- ) {
if ( !(unmatched[i] || setmatched[i]) ) {
setmatched[i] = pop.call( results );
}
}
}
// discard index placeholder values to get only actual matches
setmatched = condense( setmatched );
}
// add matches to results
push.apply( results, setmatched );
// seedless set matches succeeding multiple successful matchers stipulate sorting
if ( outermost && !seed && setmatched.length > 0 &&
( matchedcount + setmatchers.length ) > 1 ) {
sizzle.uniquesort( results );
}
}
// override manipulation of globals by nested matchers
if ( outermost ) {
dirruns = dirrunsunique;
outermostcontext = contextbackup;
}
return unmatched;
};
return byset ?
markfunction( supermatcher ) :
supermatcher;
}
compile = sizzle.compile = function( selector, match /* internal use only */ ) {
var i,
setmatchers = [],
elementmatchers = [],
cached = compilercache[ selector + " " ];
if ( !cached ) {
// generate a function of recursive functions that can be used to check each element
if ( !match ) {
match = tokenize( selector );
}
i = match.length;
while ( i-- ) {
cached = matcherfromtokens( match[i] );
if ( cached[ expando ] ) {
setmatchers.push( cached );
} else {
elementmatchers.push( cached );
}
}
// cache the compiled function
cached = compilercache( selector, matcherfromgroupmatchers( elementmatchers, setmatchers ) );
// save selector and tokenization
cached.selector = selector;
}
return cached;
};
/**
* a low-level selection function that works with sizzle's compiled
* selector functions
* @param {string|function} selector a selector or a pre-compiled
* selector function built with sizzle.compile
* @param {element} context
* @param {array} [results]
* @param {array} [seed] a set of elements to match against
*/
select = sizzle.select = function( selector, context, results, seed ) {
var i, tokens, token, type, find,
compiled = typeof selector === "function" && selector,
match = !seed && tokenize( (selector = compiled.selector || selector) );
results = results || [];
// try to minimize operations if there is only one selector in the list and no seed
// (the latter of which guarantees us context)
if ( match.length === 1 ) {
// reduce context if the leading compound selector is an id
tokens = match[0] = match[0].slice( 0 );
if ( tokens.length > 2 && (token = tokens[0]).type === "id" &&
support.getbyid && context.nodetype === 9 && documentishtml &&
expr.relative[ tokens[1].type ] ) {
context = ( expr.find["id"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
if ( !context ) {
return results;
// precompiled matchers will still verify ancestry, so step up a level
} else if ( compiled ) {
context = context.parentnode;
}
selector = selector.slice( tokens.shift().value.length );
}
// fetch a seed set for right-to-left matching
i = matchexpr["needscontext"].test( selector ) ? 0 : tokens.length;
while ( i-- ) {
token = tokens[i];
// abort if we hit a combinator
if ( expr.relative[ (type = token.type) ] ) {
break;
}
if ( (find = expr.find[ type ]) ) {
// search, expanding context for leading sibling combinators
if ( (seed = find(
token.matches[0].replace( runescape, funescape ),
rsibling.test( tokens[0].type ) && testcontext( context.parentnode ) || context
)) ) {
// if seed is empty or no tokens remain, we can return early
tokens.splice( i, 1 );
selector = seed.length && toselector( tokens );
if ( !selector ) {
push.apply( results, seed );
return results;
}
break;
}
}
}
}
// compile and execute a filtering function if one is not provided
// provide `match` to avoid retokenization if we modified the selector above
( compiled || compile( selector, match ) )(
seed,
context,
!documentishtml,
results,
!context || rsibling.test( selector ) && testcontext( context.parentnode ) || context
);
return results;
};
// one-time assignments
// sort stability
support.sortstable = expando.split("").sort( sortorder ).join("") === expando;
// support: chrome 14-35+
// always assume duplicates if they aren't passed to the comparison function
support.detectduplicates = !!hasduplicate;
// initialize against the default document
setdocument();
// support: webkit<537.32 - safari 6.0.3/chrome 25 (fixed in chrome 27)
// detached nodes confoundingly follow *each other*
support.sortdetached = assert(function( div1 ) {
// should return 1, but returns 4 (following)
return div1.comparedocumentposition( document.createelement("div") ) & 1;
});
// support: ie<8
// prevent attribute/property "interpolation"
// http://msdn.microsoft.com/en-us/library/ms536429%28vs.85%29.aspx
if ( !assert(function( div ) {
div.innerhtml = "";
return div.firstchild.getattribute("href") === "#" ;
}) ) {
addhandle( "type|href|height|width", function( elem, name, isxml ) {
if ( !isxml ) {
return elem.getattribute( name, name.tolowercase() === "type" ? 1 : 2 );
}
});
}
// support: ie<9
// use defaultvalue in place of getattribute("value")
if ( !support.attributes || !assert(function( div ) {
div.innerhtml = "";
div.firstchild.setattribute( "value", "" );
return div.firstchild.getattribute( "value" ) === "";
}) ) {
addhandle( "value", function( elem, name, isxml ) {
if ( !isxml && elem.nodename.tolowercase() === "input" ) {
return elem.defaultvalue;
}
});
}
// support: ie<9
// use getattributenode to fetch booleans when getattribute lies
if ( !assert(function( div ) {
return div.getattribute("disabled") == null;
}) ) {
addhandle( booleans, function( elem, name, isxml ) {
var val;
if ( !isxml ) {
return elem[ name ] === true ? name.tolowercase() :
(val = elem.getattributenode( name )) && val.specified ?
val.value :
null;
}
});
}
return sizzle;
})( window );
jquery.find = sizzle;
jquery.expr = sizzle.selectors;
jquery.expr[ ":" ] = jquery.expr.pseudos;
jquery.uniquesort = jquery.unique = sizzle.uniquesort;
jquery.text = sizzle.gettext;
jquery.isxmldoc = sizzle.isxml;
jquery.contains = sizzle.contains;
var dir = function( elem, dir, until ) {
var matched = [],
truncate = until !== undefined;
while ( ( elem = elem[ dir ] ) && elem.nodetype !== 9 ) {
if ( elem.nodetype === 1 ) {
if ( truncate && jquery( elem ).is( until ) ) {
break;
}
matched.push( elem );
}
}
return matched;
};
var siblings = function( n, elem ) {
var matched = [];
for ( ; n; n = n.nextsibling ) {
if ( n.nodetype === 1 && n !== elem ) {
matched.push( n );
}
}
return matched;
};
var rneedscontext = jquery.expr.match.needscontext;
var rsingletag = ( /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ );
var rissimple = /^.[^:#\[\.,]*$/;
// implement the identical functionality for filter and not
function winnow( elements, qualifier, not ) {
if ( jquery.isfunction( qualifier ) ) {
return jquery.grep( elements, function( elem, i ) {
/* jshint -w018 */
return !!qualifier.call( elem, i, elem ) !== not;
} );
}
if ( qualifier.nodetype ) {
return jquery.grep( elements, function( elem ) {
return ( elem === qualifier ) !== not;
} );
}
if ( typeof qualifier === "string" ) {
if ( rissimple.test( qualifier ) ) {
return jquery.filter( qualifier, elements, not );
}
qualifier = jquery.filter( qualifier, elements );
}
return jquery.grep( elements, function( elem ) {
return ( indexof.call( qualifier, elem ) > -1 ) !== not;
} );
}
jquery.filter = function( expr, elems, not ) {
var elem = elems[ 0 ];
if ( not ) {
expr = ":not(" + expr + ")";
}
return elems.length === 1 && elem.nodetype === 1 ?
jquery.find.matchesselector( elem, expr ) ? [ elem ] : [] :
jquery.find.matches( expr, jquery.grep( elems, function( elem ) {
return elem.nodetype === 1;
} ) );
};
jquery.fn.extend( {
find: function( selector ) {
var i,
len = this.length,
ret = [],
self = this;
if ( typeof selector !== "string" ) {
return this.pushstack( jquery( selector ).filter( function() {
for ( i = 0; i < len; i++ ) {
if ( jquery.contains( self[ i ], this ) ) {
return true;
}
}
} ) );
}
for ( i = 0; i < len; i++ ) {
jquery.find( selector, self[ i ], ret );
}
// needed because $( selector, context ) becomes $( context ).find( selector )
ret = this.pushstack( len > 1 ? jquery.unique( ret ) : ret );
ret.selector = this.selector ? this.selector + " " + selector : selector;
return ret;
},
filter: function( selector ) {
return this.pushstack( winnow( this, selector || [], false ) );
},
not: function( selector ) {
return this.pushstack( winnow( this, selector || [], true ) );
},
is: function( selector ) {
return !!winnow(
this,
// if this is a positional/relative selector, check membership in the returned set
// so $("p:first").is("p:last") won't return true for a doc with two "p".
typeof selector === "string" && rneedscontext.test( selector ) ?
jquery( selector ) :
selector || [],
false
).length;
}
} );
// initialize a jquery object
// a central reference to the root jquery(document)
var rootjquery,
// a simple way to check for html strings
// prioritize #id over to avoid xss via location.hash (#9521)
// strict html recognition (#11290: must start with <)
rquickexpr = /^(?:\s*(<[\w\w]+>)[^>]*|#([\w-]*))$/,
init = jquery.fn.init = function( selector, context, root ) {
var match, elem;
// handle: $(""), $(null), $(undefined), $(false)
if ( !selector ) {
return this;
}
// method init() accepts an alternate rootjquery
// so migrate can support jquery.sub (gh-2101)
root = root || rootjquery;
// handle html strings
if ( typeof selector === "string" ) {
if ( selector[ 0 ] === "<" &&
selector[ selector.length - 1 ] === ">" &&
selector.length >= 3 ) {
// assume that strings that start and end with <> are html and skip the regex check
match = [ null, selector, null ];
} else {
match = rquickexpr.exec( selector );
}
// match html or make sure no context is specified for #id
if ( match && ( match[ 1 ] || !context ) ) {
// handle: $(html) -> $(array)
if ( match[ 1 ] ) {
context = context instanceof jquery ? context[ 0 ] : context;
// option to run scripts is true for back-compat
// intentionally let the error be thrown if parsehtml is not present
jquery.merge( this, jquery.parsehtml(
match[ 1 ],
context && context.nodetype ? context.ownerdocument || context : document,
true
) );
// handle: $(html, props)
if ( rsingletag.test( match[ 1 ] ) && jquery.isplainobject( context ) ) {
for ( match in context ) {
// properties of context are called as methods if possible
if ( jquery.isfunction( this[ match ] ) ) {
this[ match ]( context[ match ] );
// ...and otherwise set as attributes
} else {
this.attr( match, context[ match ] );
}
}
}
return this;
// handle: $(#id)
} else {
elem = document.getelementbyid( match[ 2 ] );
// support: blackberry 4.6
// gebid returns nodes no longer in the document (#6963)
if ( elem && elem.parentnode ) {
// inject the element directly into the jquery object
this.length = 1;
this[ 0 ] = elem;
}
this.context = document;
this.selector = selector;
return this;
}
// handle: $(expr, $(...))
} else if ( !context || context.jquery ) {
return ( context || root ).find( selector );
// handle: $(expr, context)
// (which is just equivalent to: $(context).find(expr)
} else {
return this.constructor( context ).find( selector );
}
// handle: $(domelement)
} else if ( selector.nodetype ) {
this.context = this[ 0 ] = selector;
this.length = 1;
return this;
// handle: $(function)
// shortcut for document ready
} else if ( jquery.isfunction( selector ) ) {
return root.ready !== undefined ?
root.ready( selector ) :
// execute immediately if ready is not present
selector( jquery );
}
if ( selector.selector !== undefined ) {
this.selector = selector.selector;
this.context = selector.context;
}
return jquery.makearray( selector, this );
};
// give the init function the jquery prototype for later instantiation
init.prototype = jquery.fn;
// initialize central reference
rootjquery = jquery( document );
var rparentsprev = /^(?:parents|prev(?:until|all))/,
// methods guaranteed to produce a unique set when starting from a unique set
guaranteedunique = {
children: true,
contents: true,
next: true,
prev: true
};
jquery.fn.extend( {
has: function( target ) {
var targets = jquery( target, this ),
l = targets.length;
return this.filter( function() {
var i = 0;
for ( ; i < l; i++ ) {
if ( jquery.contains( this, targets[ i ] ) ) {
return true;
}
}
} );
},
closest: function( selectors, context ) {
var cur,
i = 0,
l = this.length,
matched = [],
pos = rneedscontext.test( selectors ) || typeof selectors !== "string" ?
jquery( selectors, context || this.context ) :
0;
for ( ; i < l; i++ ) {
for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentnode ) {
// always skip document fragments
if ( cur.nodetype < 11 && ( pos ?
pos.index( cur ) > -1 :
// don't pass non-elements to sizzle
cur.nodetype === 1 &&
jquery.find.matchesselector( cur, selectors ) ) ) {
matched.push( cur );
break;
}
}
}
return this.pushstack( matched.length > 1 ? jquery.uniquesort( matched ) : matched );
},
// determine the position of an element within the set
index: function( elem ) {
// no argument, return index in parent
if ( !elem ) {
return ( this[ 0 ] && this[ 0 ].parentnode ) ? this.first().prevall().length : -1;
}
// index in selector
if ( typeof elem === "string" ) {
return indexof.call( jquery( elem ), this[ 0 ] );
}
// locate the position of the desired element
return indexof.call( this,
// if it receives a jquery object, the first element is used
elem.jquery ? elem[ 0 ] : elem
);
},
add: function( selector, context ) {
return this.pushstack(
jquery.uniquesort(
jquery.merge( this.get(), jquery( selector, context ) )
)
);
},
addback: function( selector ) {
return this.add( selector == null ?
this.prevobject : this.prevobject.filter( selector )
);
}
} );
function sibling( cur, dir ) {
while ( ( cur = cur[ dir ] ) && cur.nodetype !== 1 ) {}
return cur;
}
jquery.each( {
parent: function( elem ) {
var parent = elem.parentnode;
return parent && parent.nodetype !== 11 ? parent : null;
},
parents: function( elem ) {
return dir( elem, "parentnode" );
},
parentsuntil: function( elem, i, until ) {
return dir( elem, "parentnode", until );
},
next: function( elem ) {
return sibling( elem, "nextsibling" );
},
prev: function( elem ) {
return sibling( elem, "previoussibling" );
},
nextall: function( elem ) {
return dir( elem, "nextsibling" );
},
prevall: function( elem ) {
return dir( elem, "previoussibling" );
},
nextuntil: function( elem, i, until ) {
return dir( elem, "nextsibling", until );
},
prevuntil: function( elem, i, until ) {
return dir( elem, "previoussibling", until );
},
siblings: function( elem ) {
return siblings( ( elem.parentnode || {} ).firstchild, elem );
},
children: function( elem ) {
return siblings( elem.firstchild );
},
contents: function( elem ) {
return elem.contentdocument || jquery.merge( [], elem.childnodes );
}
}, function( name, fn ) {
jquery.fn[ name ] = function( until, selector ) {
var matched = jquery.map( this, fn, until );
if ( name.slice( -5 ) !== "until" ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
matched = jquery.filter( selector, matched );
}
if ( this.length > 1 ) {
// remove duplicates
if ( !guaranteedunique[ name ] ) {
jquery.uniquesort( matched );
}
// reverse order for parents* and prev-derivatives
if ( rparentsprev.test( name ) ) {
matched.reverse();
}
}
return this.pushstack( matched );
};
} );
var rnotwhite = ( /\s+/g );
// convert string-formatted options into object-formatted ones
function createoptions( options ) {
var object = {};
jquery.each( options.match( rnotwhite ) || [], function( _, flag ) {
object[ flag ] = true;
} );
return object;
}
/*
* create a callback list using the following parameters:
*
* options: an optional list of space-separated options that will change how
* the callback list behaves or a more traditional option object
*
* by default a callback list will act like an event callback list and can be
* "fired" multiple times.
*
* possible options:
*
* once: will ensure the callback list can only be fired once (like a deferred)
*
* memory: will keep track of previous values and will call any callback added
* after the list has been fired right away with the latest "memorized"
* values (like a deferred)
*
* unique: will ensure a callback can only be added once (no duplicate in the list)
*
* stoponfalse: interrupt callings when a callback returns false
*
*/
jquery.callbacks = function( options ) {
// convert options from string-formatted to object-formatted if needed
// (we check in cache first)
options = typeof options === "string" ?
createoptions( options ) :
jquery.extend( {}, options );
var // flag to know if list is currently firing
firing,
// last fire value for non-forgettable lists
memory,
// flag to know if list was already fired
fired,
// flag to prevent firing
locked,
// actual callback list
list = [],
// queue of execution data for repeatable lists
queue = [],
// index of currently firing callback (modified by add/remove as needed)
firingindex = -1,
// fire callbacks
fire = function() {
// enforce single-firing
locked = options.once;
// execute callbacks for all pending executions,
// respecting firingindex overrides and runtime changes
fired = firing = true;
for ( ; queue.length; firingindex = -1 ) {
memory = queue.shift();
while ( ++firingindex < list.length ) {
// run callback and check for early termination
if ( list[ firingindex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
options.stoponfalse ) {
// jump to end and forget the data so .add doesn't re-fire
firingindex = list.length;
memory = false;
}
}
}
// forget the data if we're done with it
if ( !options.memory ) {
memory = false;
}
firing = false;
// clean up if we're done firing for good
if ( locked ) {
// keep an empty list if we have data for future add calls
if ( memory ) {
list = [];
// otherwise, this object is spent
} else {
list = "";
}
}
},
// actual callbacks object
self = {
// add a callback or a collection of callbacks to the list
add: function() {
if ( list ) {
// if we have memory from a past run, we should fire after adding
if ( memory && !firing ) {
firingindex = list.length - 1;
queue.push( memory );
}
( function add( args ) {
jquery.each( args, function( _, arg ) {
if ( jquery.isfunction( arg ) ) {
if ( !options.unique || !self.has( arg ) ) {
list.push( arg );
}
} else if ( arg && arg.length && jquery.type( arg ) !== "string" ) {
// inspect recursively
add( arg );
}
} );
} )( arguments );
if ( memory && !firing ) {
fire();
}
}
return this;
},
// remove a callback from the list
remove: function() {
jquery.each( arguments, function( _, arg ) {
var index;
while ( ( index = jquery.inarray( arg, list, index ) ) > -1 ) {
list.splice( index, 1 );
// handle firing indexes
if ( index <= firingindex ) {
firingindex--;
}
}
} );
return this;
},
// check if a given callback is in the list.
// if no argument is given, return whether or not list has callbacks attached.
has: function( fn ) {
return fn ?
jquery.inarray( fn, list ) > -1 :
list.length > 0;
},
// remove all callbacks from the list
empty: function() {
if ( list ) {
list = [];
}
return this;
},
// disable .fire and .add
// abort any current/pending executions
// clear all callbacks and values
disable: function() {
locked = queue = [];
list = memory = "";
return this;
},
disabled: function() {
return !list;
},
// disable .fire
// also disable .add unless we have memory (since it would have no effect)
// abort any pending executions
lock: function() {
locked = queue = [];
if ( !memory ) {
list = memory = "";
}
return this;
},
locked: function() {
return !!locked;
},
// call all callbacks with the given context and arguments
firewith: function( context, args ) {
if ( !locked ) {
args = args || [];
args = [ context, args.slice ? args.slice() : args ];
queue.push( args );
if ( !firing ) {
fire();
}
}
return this;
},
// call all the callbacks with the given arguments
fire: function() {
self.firewith( this, arguments );
return this;
},
// to know if the callbacks have already been called at least once
fired: function() {
return !!fired;
}
};
return self;
};
jquery.extend( {
deferred: function( func ) {
var tuples = [
// action, add listener, listener list, final state
[ "resolve", "done", jquery.callbacks( "once memory" ), "resolved" ],
[ "reject", "fail", jquery.callbacks( "once memory" ), "rejected" ],
[ "notify", "progress", jquery.callbacks( "memory" ) ]
],
state = "pending",
promise = {
state: function() {
return state;
},
always: function() {
deferred.done( arguments ).fail( arguments );
return this;
},
then: function( /* fndone, fnfail, fnprogress */ ) {
var fns = arguments;
return jquery.deferred( function( newdefer ) {
jquery.each( tuples, function( i, tuple ) {
var fn = jquery.isfunction( fns[ i ] ) && fns[ i ];
// deferred[ done | fail | progress ] for forwarding actions to newdefer
deferred[ tuple[ 1 ] ]( function() {
var returned = fn && fn.apply( this, arguments );
if ( returned && jquery.isfunction( returned.promise ) ) {
returned.promise()
.progress( newdefer.notify )
.done( newdefer.resolve )
.fail( newdefer.reject );
} else {
newdefer[ tuple[ 0 ] + "with" ](
this === promise ? newdefer.promise() : this,
fn ? [ returned ] : arguments
);
}
} );
} );
fns = null;
} ).promise();
},
// get a promise for this deferred
// if obj is provided, the promise aspect is added to the object
promise: function( obj ) {
return obj != null ? jquery.extend( obj, promise ) : promise;
}
},
deferred = {};
// keep pipe for back-compat
promise.pipe = promise.then;
// add list-specific methods
jquery.each( tuples, function( i, tuple ) {
var list = tuple[ 2 ],
statestring = tuple[ 3 ];
// promise[ done | fail | progress ] = list.add
promise[ tuple[ 1 ] ] = list.add;
// handle state
if ( statestring ) {
list.add( function() {
// state = [ resolved | rejected ]
state = statestring;
// [ reject_list | resolve_list ].disable; progress_list.lock
}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
}
// deferred[ resolve | reject | notify ]
deferred[ tuple[ 0 ] ] = function() {
deferred[ tuple[ 0 ] + "with" ]( this === deferred ? promise : this, arguments );
return this;
};
deferred[ tuple[ 0 ] + "with" ] = list.firewith;
} );
// make the deferred a promise
promise.promise( deferred );
// call given func if any
if ( func ) {
func.call( deferred, deferred );
}
// all done!
return deferred;
},
// deferred helper
when: function( subordinate /* , ..., subordinaten */ ) {
var i = 0,
resolvevalues = slice.call( arguments ),
length = resolvevalues.length,
// the count of uncompleted subordinates
remaining = length !== 1 ||
( subordinate && jquery.isfunction( subordinate.promise ) ) ? length : 0,
// the master deferred.
// if resolvevalues consist of only a single deferred, just use that.
deferred = remaining === 1 ? subordinate : jquery.deferred(),
// update function for both resolve and progress values
updatefunc = function( i, contexts, values ) {
return function( value ) {
contexts[ i ] = this;
values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
if ( values === progressvalues ) {
deferred.notifywith( contexts, values );
} else if ( !( --remaining ) ) {
deferred.resolvewith( contexts, values );
}
};
},
progressvalues, progresscontexts, resolvecontexts;
// add listeners to deferred subordinates; treat others as resolved
if ( length > 1 ) {
progressvalues = new array( length );
progresscontexts = new array( length );
resolvecontexts = new array( length );
for ( ; i < length; i++ ) {
if ( resolvevalues[ i ] && jquery.isfunction( resolvevalues[ i ].promise ) ) {
resolvevalues[ i ].promise()
.progress( updatefunc( i, progresscontexts, progressvalues ) )
.done( updatefunc( i, resolvecontexts, resolvevalues ) )
.fail( deferred.reject );
} else {
--remaining;
}
}
}
// if we're not waiting on anything, resolve the master
if ( !remaining ) {
deferred.resolvewith( resolvecontexts, resolvevalues );
}
return deferred.promise();
}
} );
// the deferred used on dom ready
var readylist;
jquery.fn.ready = function( fn ) {
// add the callback
jquery.ready.promise().done( fn );
return this;
};
jquery.extend( {
// is the dom ready to be used? set to true once it occurs.
isready: false,
// a counter to track how many items to wait for before
// the ready event fires. see #6781
readywait: 1,
// hold (or release) the ready event
holdready: function( hold ) {
if ( hold ) {
jquery.readywait++;
} else {
jquery.ready( true );
}
},
// handle when the dom is ready
ready: function( wait ) {
// abort if there are pending holds or we're already ready
if ( wait === true ? --jquery.readywait : jquery.isready ) {
return;
}
// remember that the dom is ready
jquery.isready = true;
// if a normal dom ready event fired, decrement, and wait if need be
if ( wait !== true && --jquery.readywait > 0 ) {
return;
}
// if there are functions bound, to execute
readylist.resolvewith( document, [ jquery ] );
// trigger any bound ready events
if ( jquery.fn.triggerhandler ) {
jquery( document ).triggerhandler( "ready" );
jquery( document ).off( "ready" );
}
}
} );
/**
* the ready event handler and self cleanup method
*/
function completed() {
document.removeeventlistener( "domcontentloaded", completed );
window.removeeventlistener( "load", completed );
jquery.ready();
}
jquery.ready.promise = function( obj ) {
if ( !readylist ) {
readylist = jquery.deferred();
// catch cases where $(document).ready() is called
// after the browser event has already occurred.
// support: ie9-10 only
// older ie sometimes signals "interactive" too soon
if ( document.readystate === "complete" ||
( document.readystate !== "loading" && !document.documentelement.doscroll ) ) {
// handle it asynchronously to allow scripts the opportunity to delay ready
window.settimeout( jquery.ready );
} else {
// use the handy event callback
document.addeventlistener( "domcontentloaded", completed );
// a fallback to window.onload, that will always work
window.addeventlistener( "load", completed );
}
}
return readylist.promise( obj );
};
// kick off the dom ready check even if the user does not
jquery.ready.promise();
// multifunctional method to get and set values of a collection
// the value/s can optionally be executed if it's a function
var access = function( elems, fn, key, value, chainable, emptyget, raw ) {
var i = 0,
len = elems.length,
bulk = key == null;
// sets many values
if ( jquery.type( key ) === "object" ) {
chainable = true;
for ( i in key ) {
access( elems, fn, i, key[ i ], true, emptyget, raw );
}
// sets one value
} else if ( value !== undefined ) {
chainable = true;
if ( !jquery.isfunction( value ) ) {
raw = true;
}
if ( bulk ) {
// bulk operations run against the entire set
if ( raw ) {
fn.call( elems, value );
fn = null;
// ...except when executing function values
} else {
bulk = fn;
fn = function( elem, key, value ) {
return bulk.call( jquery( elem ), value );
};
}
}
if ( fn ) {
for ( ; i < len; i++ ) {
fn(
elems[ i ], key, raw ?
value :
value.call( elems[ i ], i, fn( elems[ i ], key ) )
);
}
}
}
return chainable ?
elems :
// gets
bulk ?
fn.call( elems ) :
len ? fn( elems[ 0 ], key ) : emptyget;
};
var acceptdata = function( owner ) {
// accepts only:
// - node
// - node.element_node
// - node.document_node
// - object
// - any
/* jshint -w018 */
return owner.nodetype === 1 || owner.nodetype === 9 || !( +owner.nodetype );
};
function data() {
this.expando = jquery.expando + data.uid++;
}
data.uid = 1;
data.prototype = {
register: function( owner, initial ) {
var value = initial || {};
// if it is a node unlikely to be stringify-ed or looped over
// use plain assignment
if ( owner.nodetype ) {
owner[ this.expando ] = value;
// otherwise secure it in a non-enumerable, non-writable property
// configurability must be true to allow the property to be
// deleted with the delete operator
} else {
object.defineproperty( owner, this.expando, {
value: value,
writable: true,
configurable: true
} );
}
return owner[ this.expando ];
},
cache: function( owner ) {
// we can accept data for non-element nodes in modern browsers,
// but we should not, see #8335.
// always return an empty object.
if ( !acceptdata( owner ) ) {
return {};
}
// check if the owner object already has a cache
var value = owner[ this.expando ];
// if not, create one
if ( !value ) {
value = {};
// we can accept data for non-element nodes in modern browsers,
// but we should not, see #8335.
// always return an empty object.
if ( acceptdata( owner ) ) {
// if it is a node unlikely to be stringify-ed or looped over
// use plain assignment
if ( owner.nodetype ) {
owner[ this.expando ] = value;
// otherwise secure it in a non-enumerable property
// configurable must be true to allow the property to be
// deleted when data is removed
} else {
object.defineproperty( owner, this.expando, {
value: value,
configurable: true
} );
}
}
}
return value;
},
set: function( owner, data, value ) {
var prop,
cache = this.cache( owner );
// handle: [ owner, key, value ] args
if ( typeof data === "string" ) {
cache[ data ] = value;
// handle: [ owner, { properties } ] args
} else {
// copy the properties one-by-one to the cache object
for ( prop in data ) {
cache[ prop ] = data[ prop ];
}
}
return cache;
},
get: function( owner, key ) {
return key === undefined ?
this.cache( owner ) :
owner[ this.expando ] && owner[ this.expando ][ key ];
},
access: function( owner, key, value ) {
var stored;
// in cases where either:
//
// 1. no key was specified
// 2. a string key was specified, but no value provided
//
// take the "read" path and allow the get method to determine
// which value to return, respectively either:
//
// 1. the entire cache object
// 2. the data stored at the key
//
if ( key === undefined ||
( ( key && typeof key === "string" ) && value === undefined ) ) {
stored = this.get( owner, key );
return stored !== undefined ?
stored : this.get( owner, jquery.camelcase( key ) );
}
// when the key is not a string, or both a key and value
// are specified, set or extend (existing objects) with either:
//
// 1. an object of properties
// 2. a key and value
//
this.set( owner, key, value );
// since the "set" path can have two possible entry points
// return the expected data based on which path was taken[*]
return value !== undefined ? value : key;
},
remove: function( owner, key ) {
var i, name, camel,
cache = owner[ this.expando ];
if ( cache === undefined ) {
return;
}
if ( key === undefined ) {
this.register( owner );
} else {
// support array or space separated string of keys
if ( jquery.isarray( key ) ) {
// if "name" is an array of keys...
// when data is initially created, via ("key", "val") signature,
// keys will be converted to camelcase.
// since there is no way to tell _how_ a key was added, remove
// both plain key and camelcase key. #12786
// this will only penalize the array argument path.
name = key.concat( key.map( jquery.camelcase ) );
} else {
camel = jquery.camelcase( key );
// try the string as a key before any manipulation
if ( key in cache ) {
name = [ key, camel ];
} else {
// if a key with the spaces exists, use it.
// otherwise, create an array by matching non-whitespace
name = camel;
name = name in cache ?
[ name ] : ( name.match( rnotwhite ) || [] );
}
}
i = name.length;
while ( i-- ) {
delete cache[ name[ i ] ];
}
}
// remove the expando if there's no more data
if ( key === undefined || jquery.isemptyobject( cache ) ) {
// support: chrome <= 35-45+
// webkit & blink performance suffers when deleting properties
// from dom nodes, so set to undefined instead
// https://code.google.com/p/chromium/issues/detail?id=378607
if ( owner.nodetype ) {
owner[ this.expando ] = undefined;
} else {
delete owner[ this.expando ];
}
}
},
hasdata: function( owner ) {
var cache = owner[ this.expando ];
return cache !== undefined && !jquery.isemptyobject( cache );
}
};
var datapriv = new data();
var datauser = new data();
// implementation summary
//
// 1. enforce api surface and semantic compatibility with 1.9.x branch
// 2. improve the module's maintainability by reducing the storage
// paths to a single mechanism.
// 3. use the same single mechanism to support "private" and "user" data.
// 4. _never_ expose "private" data to user code (todo: drop _data, _removedata)
// 5. avoid exposing implementation details on user objects (eg. expando properties)
// 6. provide a clear path for implementation upgrade to weakmap in 2014
var rbrace = /^(?:\{[\w\w]*\}|\[[\w\w]*\])$/,
rmultidash = /[a-z]/g;
function dataattr( elem, key, data ) {
var name;
// if nothing was found internally, try to fetch any
// data from the html5 data-* attribute
if ( data === undefined && elem.nodetype === 1 ) {
name = "data-" + key.replace( rmultidash, "-$&" ).tolowercase();
data = elem.getattribute( name );
if ( typeof data === "string" ) {
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
// only convert to a number if it doesn't change the string
+data + "" === data ? +data :
rbrace.test( data ) ? jquery.parsejson( data ) :
data;
} catch ( e ) {}
// make sure we set the data so it isn't changed later
datauser.set( elem, key, data );
} else {
data = undefined;
}
}
return data;
}
jquery.extend( {
hasdata: function( elem ) {
return datauser.hasdata( elem ) || datapriv.hasdata( elem );
},
data: function( elem, name, data ) {
return datauser.access( elem, name, data );
},
removedata: function( elem, name ) {
datauser.remove( elem, name );
},
// todo: now that all calls to _data and _removedata have been replaced
// with direct calls to datapriv methods, these can be deprecated.
_data: function( elem, name, data ) {
return datapriv.access( elem, name, data );
},
_removedata: function( elem, name ) {
datapriv.remove( elem, name );
}
} );
jquery.fn.extend( {
data: function( key, value ) {
var i, name, data,
elem = this[ 0 ],
attrs = elem && elem.attributes;
// gets all values
if ( key === undefined ) {
if ( this.length ) {
data = datauser.get( elem );
if ( elem.nodetype === 1 && !datapriv.get( elem, "hasdataattrs" ) ) {
i = attrs.length;
while ( i-- ) {
// support: ie11+
// the attrs elements can be null (#14894)
if ( attrs[ i ] ) {
name = attrs[ i ].name;
if ( name.indexof( "data-" ) === 0 ) {
name = jquery.camelcase( name.slice( 5 ) );
dataattr( elem, name, data[ name ] );
}
}
}
datapriv.set( elem, "hasdataattrs", true );
}
}
return data;
}
// sets multiple values
if ( typeof key === "object" ) {
return this.each( function() {
datauser.set( this, key );
} );
}
return access( this, function( value ) {
var data, camelkey;
// the calling jquery object (element matches) is not empty
// (and therefore has an element appears at this[ 0 ]) and the
// `value` parameter was not undefined. an empty jquery object
// will result in `undefined` for elem = this[ 0 ] which will
// throw an exception if an attempt to read a data cache is made.
if ( elem && value === undefined ) {
// attempt to get data from the cache
// with the key as-is
data = datauser.get( elem, key ) ||
// try to find dashed key if it exists (gh-2779)
// this is for 2.2.x only
datauser.get( elem, key.replace( rmultidash, "-$&" ).tolowercase() );
if ( data !== undefined ) {
return data;
}
camelkey = jquery.camelcase( key );
// attempt to get data from the cache
// with the key camelized
data = datauser.get( elem, camelkey );
if ( data !== undefined ) {
return data;
}
// attempt to "discover" the data in
// html5 custom data-* attrs
data = dataattr( elem, camelkey, undefined );
if ( data !== undefined ) {
return data;
}
// we tried really hard, but the data doesn't exist.
return;
}
// set the data...
camelkey = jquery.camelcase( key );
this.each( function() {
// first, attempt to store a copy or reference of any
// data that might've been store with a camelcased key.
var data = datauser.get( this, camelkey );
// for html5 data-* attribute interop, we have to
// store property names with dashes in a camelcase form.
// this might not apply to all properties...*
datauser.set( this, camelkey, value );
// *... in the case of properties that might _actually_
// have dashes, we need to also store a copy of that
// unchanged property.
if ( key.indexof( "-" ) > -1 && data !== undefined ) {
datauser.set( this, key, value );
}
} );
}, null, value, arguments.length > 1, null, true );
},
removedata: function( key ) {
return this.each( function() {
datauser.remove( this, key );
} );
}
} );
jquery.extend( {
queue: function( elem, type, data ) {
var queue;
if ( elem ) {
type = ( type || "fx" ) + "queue";
queue = datapriv.get( elem, type );
// speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !queue || jquery.isarray( data ) ) {
queue = datapriv.access( elem, type, jquery.makearray( data ) );
} else {
queue.push( data );
}
}
return queue || [];
}
},
dequeue: function( elem, type ) {
type = type || "fx";
var queue = jquery.queue( elem, type ),
startlength = queue.length,
fn = queue.shift(),
hooks = jquery._queuehooks( elem, type ),
next = function() {
jquery.dequeue( elem, type );
};
// if the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
fn = queue.shift();
startlength--;
}
if ( fn ) {
// add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if ( type === "fx" ) {
queue.unshift( "inprogress" );
}
// clear up the last queue stop function
delete hooks.stop;
fn.call( elem, next, hooks );
}
if ( !startlength && hooks ) {
hooks.empty.fire();
}
},
// not public - generate a queuehooks object, or return the current one
_queuehooks: function( elem, type ) {
var key = type + "queuehooks";
return datapriv.get( elem, key ) || datapriv.access( elem, key, {
empty: jquery.callbacks( "once memory" ).add( function() {
datapriv.remove( elem, [ type + "queue", key ] );
} )
} );
}
} );
jquery.fn.extend( {
queue: function( type, data ) {
var setter = 2;
if ( typeof type !== "string" ) {
data = type;
type = "fx";
setter--;
}
if ( arguments.length < setter ) {
return jquery.queue( this[ 0 ], type );
}
return data === undefined ?
this :
this.each( function() {
var queue = jquery.queue( this, type, data );
// ensure a hooks for this queue
jquery._queuehooks( this, type );
if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
jquery.dequeue( this, type );
}
} );
},
dequeue: function( type ) {
return this.each( function() {
jquery.dequeue( this, type );
} );
},
clearqueue: function( type ) {
return this.queue( type || "fx", [] );
},
// get a promise resolved when queues of a certain type
// are emptied (fx is the type by default)
promise: function( type, obj ) {
var tmp,
count = 1,
defer = jquery.deferred(),
elements = this,
i = this.length,
resolve = function() {
if ( !( --count ) ) {
defer.resolvewith( elements, [ elements ] );
}
};
if ( typeof type !== "string" ) {
obj = type;
type = undefined;
}
type = type || "fx";
while ( i-- ) {
tmp = datapriv.get( elements[ i ], type + "queuehooks" );
if ( tmp && tmp.empty ) {
count++;
tmp.empty.add( resolve );
}
}
resolve();
return defer.promise( obj );
}
} );
var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[ee][+-]?\d+|)/ ).source;
var rcssnum = new regexp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
var cssexpand = [ "top", "right", "bottom", "left" ];
var ishidden = function( elem, el ) {
// ishidden might be called from jquery#filter function;
// in that case, element will be second argument
elem = el || elem;
return jquery.css( elem, "display" ) === "none" ||
!jquery.contains( elem.ownerdocument, elem );
};
function adjustcss( elem, prop, valueparts, tween ) {
var adjusted,
scale = 1,
maxiterations = 20,
currentvalue = tween ?
function() { return tween.cur(); } :
function() { return jquery.css( elem, prop, "" ); },
initial = currentvalue(),
unit = valueparts && valueparts[ 3 ] || ( jquery.cssnumber[ prop ] ? "" : "px" ),
// starting value computation is required for potential unit mismatches
initialinunit = ( jquery.cssnumber[ prop ] || unit !== "px" && +initial ) &&
rcssnum.exec( jquery.css( elem, prop ) );
if ( initialinunit && initialinunit[ 3 ] !== unit ) {
// trust units reported by jquery.css
unit = unit || initialinunit[ 3 ];
// make sure we update the tween properties later on
valueparts = valueparts || [];
// iteratively approximate from a nonzero starting point
initialinunit = +initial || 1;
do {
// if previous iteration zeroed out, double until we get *something*.
// use string for doubling so we don't accidentally see scale as unchanged below
scale = scale || ".5";
// adjust and apply
initialinunit = initialinunit / scale;
jquery.style( elem, prop, initialinunit + unit );
// update scale, tolerating zero or nan from tween.cur()
// break the loop if scale is unchanged or perfect, or if we've just had enough.
} while (
scale !== ( scale = currentvalue() / initial ) && scale !== 1 && --maxiterations
);
}
if ( valueparts ) {
initialinunit = +initialinunit || +initial || 0;
// apply relative offset (+=/-=) if specified
adjusted = valueparts[ 1 ] ?
initialinunit + ( valueparts[ 1 ] + 1 ) * valueparts[ 2 ] :
+valueparts[ 2 ];
if ( tween ) {
tween.unit = unit;
tween.start = initialinunit;
tween.end = adjusted;
}
}
return adjusted;
}
var rcheckabletype = ( /^(?:checkbox|radio)$/i );
var rtagname = ( /<([\w:-]+)/ );
var rscripttype = ( /^$|\/(?:java|ecma)script/i );
// we have to close these tags to support xhtml (#13200)
var wrapmap = {
// support: ie9
option: [ 1, "" ],
// xhtml parsers do not magically insert elements in the
// same way that tag soup parsers do. so we cannot shorten
// this by omitting or other required elements.
thead: [ 1, "" ],
col: [ 2, "" ],
tr: [ 2, "" ],
td: [ 3, "" ],
_default: [ 0, "", "" ]
};
// support: ie9
wrapmap.optgroup = wrapmap.option;
wrapmap.tbody = wrapmap.tfoot = wrapmap.colgroup = wrapmap.caption = wrapmap.thead;
wrapmap.th = wrapmap.td;
function getall( context, tag ) {
// support: ie9-11+
// use typeof to avoid zero-argument method invocation on host objects (#15151)
var ret = typeof context.getelementsbytagname !== "undefined" ?
context.getelementsbytagname( tag || "*" ) :
typeof context.queryselectorall !== "undefined" ?
context.queryselectorall( tag || "*" ) :
[];
return tag === undefined || tag && jquery.nodename( context, tag ) ?
jquery.merge( [ context ], ret ) :
ret;
}
// mark scripts as having already been evaluated
function setglobaleval( elems, refelements ) {
var i = 0,
l = elems.length;
for ( ; i < l; i++ ) {
datapriv.set(
elems[ i ],
"globaleval",
!refelements || datapriv.get( refelements[ i ], "globaleval" )
);
}
}
var rhtml = /<|?\w+;/;
function buildfragment( elems, context, scripts, selection, ignored ) {
var elem, tmp, tag, wrap, contains, j,
fragment = context.createdocumentfragment(),
nodes = [],
i = 0,
l = elems.length;
for ( ; i < l; i++ ) {
elem = elems[ i ];
if ( elem || elem === 0 ) {
// add nodes directly
if ( jquery.type( elem ) === "object" ) {
// support: android<4.1, phantomjs<2
// push.apply(_, arraylike) throws on ancient webkit
jquery.merge( nodes, elem.nodetype ? [ elem ] : elem );
// convert non-html into a text node
} else if ( !rhtml.test( elem ) ) {
nodes.push( context.createtextnode( elem ) );
// convert html into dom nodes
} else {
tmp = tmp || fragment.appendchild( context.createelement( "div" ) );
// deserialize a standard representation
tag = ( rtagname.exec( elem ) || [ "", "" ] )[ 1 ].tolowercase();
wrap = wrapmap[ tag ] || wrapmap._default;
tmp.innerhtml = wrap[ 1 ] + jquery.htmlprefilter( elem ) + wrap[ 2 ];
// descend through wrappers to the right content
j = wrap[ 0 ];
while ( j-- ) {
tmp = tmp.lastchild;
}
// support: android<4.1, phantomjs<2
// push.apply(_, arraylike) throws on ancient webkit
jquery.merge( nodes, tmp.childnodes );
// remember the top-level container
tmp = fragment.firstchild;
// ensure the created nodes are orphaned (#12392)
tmp.textcontent = "";
}
}
}
// remove wrapper from fragment
fragment.textcontent = "";
i = 0;
while ( ( elem = nodes[ i++ ] ) ) {
// skip elements already in the context collection (trac-4087)
if ( selection && jquery.inarray( elem, selection ) > -1 ) {
if ( ignored ) {
ignored.push( elem );
}
continue;
}
contains = jquery.contains( elem.ownerdocument, elem );
// append to fragment
tmp = getall( fragment.appendchild( elem ), "script" );
// preserve script evaluation history
if ( contains ) {
setglobaleval( tmp );
}
// capture executables
if ( scripts ) {
j = 0;
while ( ( elem = tmp[ j++ ] ) ) {
if ( rscripttype.test( elem.type || "" ) ) {
scripts.push( elem );
}
}
}
}
return fragment;
}
( function() {
var fragment = document.createdocumentfragment(),
div = fragment.appendchild( document.createelement( "div" ) ),
input = document.createelement( "input" );
// support: android 4.0-4.3, safari<=5.1
// check state lost if the name is set (#11217)
// support: windows web apps (wwa)
// `name` and `type` must use .setattribute for wwa (#14901)
input.setattribute( "type", "radio" );
input.setattribute( "checked", "checked" );
input.setattribute( "name", "t" );
div.appendchild( input );
// support: safari<=5.1, android<4.2
// older webkit doesn't clone checked state correctly in fragments
support.checkclone = div.clonenode( true ).clonenode( true ).lastchild.checked;
// support: ie<=11+
// make sure textarea (and checkbox) defaultvalue is properly cloned
div.innerhtml = "";
support.noclonechecked = !!div.clonenode( true ).lastchild.defaultvalue;
} )();
var
rkeyevent = /^key/,
rmouseevent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
function returntrue() {
return true;
}
function returnfalse() {
return false;
}
// support: ie9
// see #13393 for more info
function safeactiveelement() {
try {
return document.activeelement;
} catch ( err ) { }
}
function on( elem, types, selector, data, fn, one ) {
var origfn, type;
// types can be a map of types/handlers
if ( typeof types === "object" ) {
// ( types-object, selector, data )
if ( typeof selector !== "string" ) {
// ( types-object, data )
data = data || selector;
selector = undefined;
}
for ( type in types ) {
on( elem, type, selector, data, types[ type ], one );
}
return elem;
}
if ( data == null && fn == null ) {
// ( types, fn )
fn = selector;
data = selector = undefined;
} else if ( fn == null ) {
if ( typeof selector === "string" ) {
// ( types, selector, fn )
fn = data;
data = undefined;
} else {
// ( types, data, fn )
fn = data;
data = selector;
selector = undefined;
}
}
if ( fn === false ) {
fn = returnfalse;
} else if ( !fn ) {
return this;
}
if ( one === 1 ) {
origfn = fn;
fn = function( event ) {
// can use an empty set, since event contains the info
jquery().off( event );
return origfn.apply( this, arguments );
};
// use same guid so caller can remove using origfn
fn.guid = origfn.guid || ( origfn.guid = jquery.guid++ );
}
return elem.each( function() {
jquery.event.add( this, types, fn, data, selector );
} );
}
/*
* helper functions for managing events -- not part of the public interface.
* props to dean edwards' addevent library for many of the ideas.
*/
jquery.event = {
global: {},
add: function( elem, types, handler, data, selector ) {
var handleobjin, eventhandle, tmp,
events, t, handleobj,
special, handlers, type, namespaces, origtype,
elemdata = datapriv.get( elem );
// don't attach events to nodata or text/comment nodes (but allow plain objects)
if ( !elemdata ) {
return;
}
// caller can pass in an object of custom data in lieu of the handler
if ( handler.handler ) {
handleobjin = handler;
handler = handleobjin.handler;
selector = handleobjin.selector;
}
// make sure that the handler has a unique id, used to find/remove it later
if ( !handler.guid ) {
handler.guid = jquery.guid++;
}
// init the element's event structure and main handler, if this is the first
if ( !( events = elemdata.events ) ) {
events = elemdata.events = {};
}
if ( !( eventhandle = elemdata.handle ) ) {
eventhandle = elemdata.handle = function( e ) {
// discard the second event of a jquery.event.trigger() and
// when an event is called after a page has unloaded
return typeof jquery !== "undefined" && jquery.event.triggered !== e.type ?
jquery.event.dispatch.apply( elem, arguments ) : undefined;
};
}
// handle multiple events separated by a space
types = ( types || "" ).match( rnotwhite ) || [ "" ];
t = types.length;
while ( t-- ) {
tmp = rtypenamespace.exec( types[ t ] ) || [];
type = origtype = tmp[ 1 ];
namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
// there *must* be a type, no attaching namespace-only handlers
if ( !type ) {
continue;
}
// if event changes its type, use the special event handlers for the changed type
special = jquery.event.special[ type ] || {};
// if selector defined, determine special event api type, otherwise given type
type = ( selector ? special.delegatetype : special.bindtype ) || type;
// update special based on newly reset type
special = jquery.event.special[ type ] || {};
// handleobj is passed to all event handlers
handleobj = jquery.extend( {
type: type,
origtype: origtype,
data: data,
handler: handler,
guid: handler.guid,
selector: selector,
needscontext: selector && jquery.expr.match.needscontext.test( selector ),
namespace: namespaces.join( "." )
}, handleobjin );
// init the event handler queue if we're the first
if ( !( handlers = events[ type ] ) ) {
handlers = events[ type ] = [];
handlers.delegatecount = 0;
// only use addeventlistener if the special events handler returns false
if ( !special.setup ||
special.setup.call( elem, data, namespaces, eventhandle ) === false ) {
if ( elem.addeventlistener ) {
elem.addeventlistener( type, eventhandle );
}
}
}
if ( special.add ) {
special.add.call( elem, handleobj );
if ( !handleobj.handler.guid ) {
handleobj.handler.guid = handler.guid;
}
}
// add to the element's handler list, delegates in front
if ( selector ) {
handlers.splice( handlers.delegatecount++, 0, handleobj );
} else {
handlers.push( handleobj );
}
// keep track of which events have ever been used, for event optimization
jquery.event.global[ type ] = true;
}
},
// detach an event or set of events from an element
remove: function( elem, types, handler, selector, mappedtypes ) {
var j, origcount, tmp,
events, t, handleobj,
special, handlers, type, namespaces, origtype,
elemdata = datapriv.hasdata( elem ) && datapriv.get( elem );
if ( !elemdata || !( events = elemdata.events ) ) {
return;
}
// once for each type.namespace in types; type may be omitted
types = ( types || "" ).match( rnotwhite ) || [ "" ];
t = types.length;
while ( t-- ) {
tmp = rtypenamespace.exec( types[ t ] ) || [];
type = origtype = tmp[ 1 ];
namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
// unbind all events (on this namespace, if provided) for the element
if ( !type ) {
for ( type in events ) {
jquery.event.remove( elem, type + types[ t ], handler, selector, true );
}
continue;
}
special = jquery.event.special[ type ] || {};
type = ( selector ? special.delegatetype : special.bindtype ) || type;
handlers = events[ type ] || [];
tmp = tmp[ 2 ] &&
new regexp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
// remove matching events
origcount = j = handlers.length;
while ( j-- ) {
handleobj = handlers[ j ];
if ( ( mappedtypes || origtype === handleobj.origtype ) &&
( !handler || handler.guid === handleobj.guid ) &&
( !tmp || tmp.test( handleobj.namespace ) ) &&
( !selector || selector === handleobj.selector ||
selector === "**" && handleobj.selector ) ) {
handlers.splice( j, 1 );
if ( handleobj.selector ) {
handlers.delegatecount--;
}
if ( special.remove ) {
special.remove.call( elem, handleobj );
}
}
}
// remove generic event handler if we removed something and no more handlers exist
// (avoids potential for endless recursion during removal of special event handlers)
if ( origcount && !handlers.length ) {
if ( !special.teardown ||
special.teardown.call( elem, namespaces, elemdata.handle ) === false ) {
jquery.removeevent( elem, type, elemdata.handle );
}
delete events[ type ];
}
}
// remove data and the expando if it's no longer used
if ( jquery.isemptyobject( events ) ) {
datapriv.remove( elem, "handle events" );
}
},
dispatch: function( event ) {
// make a writable jquery.event from the native event object
event = jquery.event.fix( event );
var i, j, ret, matched, handleobj,
handlerqueue = [],
args = slice.call( arguments ),
handlers = ( datapriv.get( this, "events" ) || {} )[ event.type ] || [],
special = jquery.event.special[ event.type ] || {};
// use the fix-ed jquery.event rather than the (read-only) native event
args[ 0 ] = event;
event.delegatetarget = this;
// call the predispatch hook for the mapped type, and let it bail if desired
if ( special.predispatch && special.predispatch.call( this, event ) === false ) {
return;
}
// determine handlers
handlerqueue = jquery.event.handlers.call( this, event, handlers );
// run delegates first; they may want to stop propagation beneath us
i = 0;
while ( ( matched = handlerqueue[ i++ ] ) && !event.ispropagationstopped() ) {
event.currenttarget = matched.elem;
j = 0;
while ( ( handleobj = matched.handlers[ j++ ] ) &&
!event.isimmediatepropagationstopped() ) {
// triggered event must either 1) have no namespace, or 2) have namespace(s)
// a subset or equal to those in the bound event (both can have no namespace).
if ( !event.rnamespace || event.rnamespace.test( handleobj.namespace ) ) {
event.handleobj = handleobj;
event.data = handleobj.data;
ret = ( ( jquery.event.special[ handleobj.origtype ] || {} ).handle ||
handleobj.handler ).apply( matched.elem, args );
if ( ret !== undefined ) {
if ( ( event.result = ret ) === false ) {
event.preventdefault();
event.stoppropagation();
}
}
}
}
}
// call the postdispatch hook for the mapped type
if ( special.postdispatch ) {
special.postdispatch.call( this, event );
}
return event.result;
},
handlers: function( event, handlers ) {
var i, matches, sel, handleobj,
handlerqueue = [],
delegatecount = handlers.delegatecount,
cur = event.target;
// support (at least): chrome, ie9
// find delegate handlers
// black-hole svg