(function( global, factory ) {
if ( typeof module === "object" && typeof module.exports === "object" ) {
// for commonjs and commonjs-like environments where a proper window is present,
// execute the factory and get jquery
// for environments that do not inherently posses a window with a document
// (such as node.js), expose a jquery-making factory as module.exports
// this accentuates the need for the creation of a real window
// e.g. var jquery = require("jquery")(window);
// see ticket #14549 for more info
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 ) {
// can't do this because several apps including asp.net trace
// the stack via arguments.caller.callee and firefox dies if
// you try to trace through "use strict" call chains. (#13335)
// support: firefox 18+
//
var deletedids = [];
var slice = deletedids.slice;
var concat = deletedids.concat;
var push = deletedids.push;
var indexof = deletedids.indexof;
var class2type = {};
var tostring = class2type.tostring;
var hasown = class2type.hasownproperty;
var support = {};
var
version = "1.11.1",
// 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, ie<9
// 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.
// (you can seed the arguments with an array of args, but this is
// only used internally.)
each: function( callback, args ) {
return jquery.each( this, callback, args );
},
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(null);
},
// for internal use only.
// behaves like an array's method, not like a jquery method.
push: push,
sort: deletedids.sort,
splice: deletedids.splice
};
jquery.extend = jquery.fn.extend = function() {
var src, copyisarray, copy, name, options, 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() {},
// see test/unit/core.js for details concerning isfunction.
// since version 1.3, dom methods and functions like alert
// aren't supported. they return false on ie (#2968).
isfunction: function( obj ) {
return jquery.type(obj) === "function";
},
isarray: array.isarray || function( obj ) {
return jquery.type(obj) === "array";
},
iswindow: function( obj ) {
/* jshint eqeqeq: false */
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
return !jquery.isarray( obj ) && obj - parsefloat( obj ) >= 0;
},
isemptyobject: function( obj ) {
var name;
for ( name in obj ) {
return false;
}
return true;
},
isplainobject: function( obj ) {
var key;
// must be an object.
// because of ie, we also have to check the presence of the constructor property.
// make sure that dom nodes and window objects don't pass through, as well
if ( !obj || jquery.type(obj) !== "object" || obj.nodetype || jquery.iswindow( obj ) ) {
return false;
}
try {
// not own constructor property must be object
if ( obj.constructor &&
!hasown.call(obj, "constructor") &&
!hasown.call(obj.constructor.prototype, "isprototypeof") ) {
return false;
}
} catch ( e ) {
// ie8,9 will throw exceptions on certain host objects #9897
return false;
}
// support: ie<9
// handle iteration over inherited properties before own properties.
if ( support.ownlast ) {
for ( key in obj ) {
return hasown.call( obj, key );
}
}
// own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
for ( key in obj ) {}
return key === undefined || hasown.call( obj, key );
},
type: function( obj ) {
if ( obj == null ) {
return obj + "";
}
return typeof obj === "object" || typeof obj === "function" ?
class2type[ tostring.call(obj) ] || "object" :
typeof obj;
},
// evaluates a script in a global context
// workarounds based on findings by jim driscoll
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
globaleval: function( data ) {
if ( data && jquery.trim( data ) ) {
// we use execscript on internet explorer
// we use an anonymous function so that context is window
// rather than jquery in firefox
( window.execscript || function( data ) {
window[ "eval" ].call( window, data );
} )( data );
}
},
// convert dashed to camelcase; used by the css and data modules
// 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();
},
// args is for internal usage only
each: function( obj, callback, args ) {
var value,
i = 0,
length = obj.length,
isarray = isarraylike( obj );
if ( args ) {
if ( isarray ) {
for ( ; i < length; i++ ) {
value = callback.apply( obj[ i ], args );
if ( value === false ) {
break;
}
}
} else {
for ( i in obj ) {
value = callback.apply( obj[ i ], args );
if ( value === false ) {
break;
}
}
}
// a special, fast, case for the most common use of each
} else {
if ( isarray ) {
for ( ; i < length; i++ ) {
value = callback.call( obj[ i ], i, obj[ i ] );
if ( value === false ) {
break;
}
}
} else {
for ( i in obj ) {
value = callback.call( obj[ i ], i, obj[ i ] );
if ( value === false ) {
break;
}
}
}
}
return obj;
},
// support: android<4.1, ie<9
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 ) {
var len;
if ( arr ) {
if ( indexof ) {
return indexof.call( arr, elem, i );
}
len = arr.length;
i = i ? i < 0 ? math.max( 0, len + i ) : i : 0;
for ( ; i < len; i++ ) {
// skip accessing in sparse arrays
if ( i in arr && arr[ i ] === elem ) {
return i;
}
}
}
return -1;
},
merge: function( first, second ) {
var len = +second.length,
j = 0,
i = first.length;
while ( j < len ) {
first[ i++ ] = second[ j++ ];
}
// support: ie<9
// workaround casting of .length to nan on otherwise arraylike objects (e.g., nodelists)
if ( len !== len ) {
while ( second[j] !== undefined ) {
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 value,
i = 0,
length = elems.length,
isarray = isarraylike( elems ),
ret = [];
// go through the array, translating each of the items to their new values
if ( isarray ) {
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 args, proxy, tmp;
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: function() {
return +( new date() );
},
// jquery.support is not used in core but other projects attach their
// properties to it so it needs to exist.
support: support
});
// populate the class2type map
jquery.each("boolean number string function array date regexp object error".split(" "), function(i, name) {
class2type[ "[object " + name + "]" ] = name.tolowercase();
});
function isarraylike( obj ) {
var length = obj.length,
type = jquery.type( obj );
if ( type === "function" || jquery.iswindow( obj ) ) {
return false;
}
if ( obj.nodetype === 1 && length ) {
return true;
}
return type === "array" || length === 0 ||
typeof length === "number" && length > 0 && ( length - 1 ) in obj;
}
var sizzle =
/*!
* sizzle css selector engine v1.10.19
* http://sizzlejs.com/
*
* copyright 2013 jquery foundation, inc. and other contributors
* released under the mit license
* http://jquery.org/license
*
* date: 2014-04-18
*/
(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" + -(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
strundefined = typeof undefined,
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 if we can't use a native one
indexof = arr.indexof || function( elem ) {
var i = 0,
len = this.length;
for ( ; i < len; i++ ) {
if ( this[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
// whitespace characters http://www.w3.org/tr/css3-selectors/#whitespace
whitespace = "[\\x20\\t\\r\\n\\f]",
// http://www.w3.org/tr/css3-syntax/#characters
characterencoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
// loosely modeled on css identifier characters
// an unquoted value should be a css identifier http://www.w3.org/tr/css3-selectors/#attribute-selectors
// proper syntax: http://www.w3.org/tr/css21/syndata.html#value-def-identifier
identifier = characterencoding.replace( "w", "w#" ),
// attribute selectors: http://www.w3.org/tr/selectors/#attribute-selectors
attributes = "\\[" + whitespace + "*(" + characterencoding + ")(?:" + whitespace +
// operator (capture 2)
"*([*^$|!~]?=)" + whitespace +
// "attribute values must be css identifiers [capture 5] or strings [capture 3 or capture 4]"
"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
"*\\]",
pseudos = ":(" + characterencoding + ")(?:\\((" +
// 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
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( "^#(" + characterencoding + ")" ),
"class": new regexp( "^\\.(" + characterencoding + ")" ),
"tag": new regexp( "^(" + characterencoding.replace( "w", "w*" ) + ")" ),
"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 );
};
// 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 match, elem, m, nodetype,
// qsa vars
i, groups, old, nid, newcontext, newselector;
if ( ( context ? context.ownerdocument || context : preferreddoc ) !== document ) {
setdocument( context );
}
context = context || document;
results = results || [];
if ( !selector || typeof selector !== "string" ) {
return results;
}
if ( (nodetype = context.nodetype) !== 1 && nodetype !== 9 ) {
return [];
}
if ( documentishtml && !seed ) {
// shortcuts
if ( (match = rquickexpr.exec( selector )) ) {
// speed-up: sizzle("#id")
if ( (m = match[1]) ) {
if ( nodetype === 9 ) {
elem = context.getelementbyid( m );
// check parentnode to catch when blackberry 4.6 returns
// nodes that are no longer in the document (jquery #6963)
if ( elem && elem.parentnode ) {
// handle the case where ie, opera, and webkit return items
// by name instead of id
if ( elem.id === m ) {
results.push( elem );
return results;
}
} else {
return results;
}
} else {
// context is not a document
if ( context.ownerdocument && (elem = context.ownerdocument.getelementbyid( m )) &&
contains( context, elem ) && elem.id === m ) {
results.push( elem );
return results;
}
}
// speed-up: sizzle("tag")
} else if ( match[2] ) {
push.apply( results, context.getelementsbytagname( selector ) );
return results;
// speed-up: sizzle(".class")
} else if ( (m = match[3]) && support.getelementsbyclassname && context.getelementsbyclassname ) {
push.apply( results, context.getelementsbyclassname( m ) );
return results;
}
}
// qsa path
if ( support.qsa && (!rbuggyqsa || !rbuggyqsa.test( selector )) ) {
nid = old = expando;
newcontext = context;
newselector = nodetype === 9 && selector;
// qsa works strangely on element-rooted queries
// we can work around this by specifying an extra id on the root
// and working up from there (thanks to andrew dupont for the technique)
// ie 8 doesn't work on object elements
if ( nodetype === 1 && context.nodename.tolowercase() !== "object" ) {
groups = tokenize( selector );
if ( (old = context.getattribute("id")) ) {
nid = old.replace( rescape, "\\$&" );
} else {
context.setattribute( "id", nid );
}
nid = "[id='" + nid + "'] ";
i = groups.length;
while ( i-- ) {
groups[i] = nid + toselector( groups[i] );
}
newcontext = rsibling.test( selector ) && testcontext( context.parentnode ) || context;
newselector = groups.join(",");
}
if ( newselector ) {
try {
push.apply( results,
newcontext.queryselectorall( newselector )
);
return results;
} catch(qsaerror) {
} finally {
if ( !old ) {
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 = attrs.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 !== strundefined && 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,
doc = node ? node.ownerdocument || node : preferreddoc,
parent = doc.defaultview;
// if no document and documentelement is available, return
if ( doc === document || doc.nodetype !== 9 || !doc.documentelement ) {
return document;
}
// set our document
document = doc;
docelem = doc.documentelement;
// support tests
documentishtml = !isxml( doc );
// support: ie>8
// if iframe document is assigned to "document" variable and if iframe has been reloaded,
// ie will throw "permission denied" error when accessing "document" variable, see jquery #13936
// ie6-8 do not support the defaultview property so parent will be undefined
if ( parent && parent !== parent.top ) {
// ie11 does not have attachevent, so all must suffer
if ( parent.addeventlistener ) {
parent.addeventlistener( "unload", function() {
setdocument();
}, false );
} else if ( parent.attachevent ) {
parent.attachevent( "onunload", function() {
setdocument();
});
}
}
/* 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( doc.createcomment("") );
return !div.getelementsbytagname("*").length;
});
// check if getelementsbyclassname can be trusted
support.getelementsbyclassname = rnative.test( doc.getelementsbyclassname ) && assert(function( div ) {
div.innerhtml = "
";
// support: safari<4
// catch class over-caching
div.firstchild.classname = "i";
// support: opera<10
// catch gebcn failure to find non-leading classes
return div.getelementsbyclassname("i").length === 2;
});
// 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 !doc.getelementsbyname || !doc.getelementsbyname( expando ).length;
});
// id find and filter
if ( support.getbyid ) {
expr.find["id"] = function( id, context ) {
if ( typeof context.getelementbyid !== strundefined && documentishtml ) {
var m = context.getelementbyid( id );
// check parentnode to catch when blackberry 4.6 returns
// nodes that are no longer in the document #6963
return m && m.parentnode ? [ 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 !== strundefined && elem.getattributenode("id");
return node && node.value === attrid;
};
};
}
// tag
expr.find["tag"] = support.getelementsbytagname ?
function( tag, context ) {
if ( typeof context.getelementsbytagname !== strundefined ) {
return context.getelementsbytagname( tag );
}
} :
function( tag, context ) {
var elem,
tmp = [],
i = 0,
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 !== strundefined && 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( doc.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
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("[msallowclip^='']").length ) {
rbuggyqsa.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
}
// support: ie8
// boolean attributes and "value" are not treated correctly
if ( !div.queryselectorall("[selected]").length ) {
rbuggyqsa.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
}
// 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");
}
});
assert(function( div ) {
// support: windows 8 native apps
// the type and name attributes are restricted during .innerhtml assignment
var input = doc.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 does not implement inclusive descendent
// 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 === doc || a.ownerdocument === preferreddoc && contains(preferreddoc, a) ) {
return -1;
}
if ( b === doc || b.ownerdocument === preferreddoc && contains(preferreddoc, b) ) {
return 1;
}
// maintain original order
return sortinput ?
( indexof.call( sortinput, a ) - indexof.call( 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 === doc ? -1 :
b === doc ? 1 :
aup ? -1 :
bup ? 1 :
sortinput ?
( indexof.call( sortinput, a ) - indexof.call( 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 doc;
};
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 &&
( !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 !== strundefined && 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 + " " ).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, outercache, node, diff, nodeindex, start,
dir = simple !== forward ? "nextsibling" : "previoussibling",
parent = elem.parentnode,
name = oftype && elem.nodename.tolowercase(),
usecache = !xml && !oftype;
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
outercache = parent[ expando ] || (parent[ expando ] = {});
cache = outercache[ type ] || [];
nodeindex = cache[0] === dirruns && cache[1];
diff = cache[0] === dirruns && 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 ) {
outercache[ type ] = [ dirruns, nodeindex, diff ];
break;
}
}
// use previously-cached element index if available
} else if ( usecache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
diff = cache[1];
// xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
} else {
// 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 ) {
(node[ expando ] || (node[ expando ] = {}))[ 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.call( 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 );
return !results.pop();
};
}),
"has": markfunction(function( selector ) {
return function( elem ) {
return sizzle( selector, elem ).length > 0;
};
}),
"contains": markfunction(function( text ) {
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, outercache,
newcache = [ dirruns, donename ];
// we can't set arbitrary data on xml nodes, so they don't benefit from dir 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 ] = {});
if ( (oldcache = outercache[ 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
outercache[ 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.call( 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.call( checkcontext, elem ) > -1;
}, implicitrelative, true ),
matchers = [ function( elem, context, xml ) {
return ( !leadingrelative && ( xml || context !== outermostcontext ) ) || (
(checkcontext = context).nodetype ?
matchcontext( elem, context, xml ) :
matchanycontext( elem, context, xml ) );
} ];
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;
}
// add elements passing elementmatchers directly to results
// keep `i` a string if there are no elements so `matchedcount` will be "00" below
// 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;
while ( (matcher = elementmatchers[j++]) ) {
if ( matcher( elem, context, 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 );
}
}
}
// apply set filters to unmatched elements
matchedcount += i;
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 no seed and only one group
if ( match.length === 1 ) {
// take a shortcut and set the context if the root 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,
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
// 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.unique = sizzle.uniquesort;
jquery.text = sizzle.gettext;
jquery.isxmldoc = sizzle.isxml;
jquery.contains = sizzle.contains;
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 ( jquery.inarray( elem, qualifier ) >= 0 ) !== 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,
ret = [],
self = this,
len = self.length;
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,
// use the correct document accordingly with window argument (sandbox)
document = window.document,
// 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 ) {
var match, elem;
// handle: $(""), $(null), $(undefined), $(false)
if ( !selector ) {
return this;
}
// handle html strings
if ( typeof selector === "string" ) {
if ( selector.charat(0) === "<" && selector.charat( 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;
// 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] );
// check parentnode to catch when blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentnode ) {
// handle the case where ie and opera return items
// by name instead of id
if ( elem.id !== match[2] ) {
return rootjquery.find( selector );
}
// otherwise, we 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 || rootjquery ).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 typeof rootjquery.ready !== "undefined" ?
rootjquery.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.extend({
dir: function( elem, dir, until ) {
var matched = [],
cur = elem[ dir ];
while ( cur && cur.nodetype !== 9 && (until === undefined || cur.nodetype !== 1 || !jquery( cur ).is( until )) ) {
if ( cur.nodetype === 1 ) {
matched.push( cur );
}
cur = cur[dir];
}
return matched;
},
sibling: function( n, elem ) {
var r = [];
for ( ; n; n = n.nextsibling ) {
if ( n.nodetype === 1 && n !== elem ) {
r.push( n );
}
}
return r;
}
});
jquery.fn.extend({
has: function( target ) {
var i,
targets = jquery( target, this ),
len = targets.length;
return this.filter(function() {
for ( i = 0; i < len; 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.unique( matched ) : matched );
},
// determine the position of an element within
// the matched set of elements
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 jquery.inarray( this[0], jquery( elem ) );
}
// locate the position of the desired element
return jquery.inarray(
// if it receives a jquery object, the first element is used
elem.jquery ? elem[0] : elem, this );
},
add: function( selector, context ) {
return this.pushstack(
jquery.unique(
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 ) {
do {
cur = cur[ dir ];
} while ( cur && 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 jquery.dir( elem, "parentnode" );
},
parentsuntil: function( elem, i, until ) {
return jquery.dir( elem, "parentnode", until );
},
next: function( elem ) {
return sibling( elem, "nextsibling" );
},
prev: function( elem ) {
return sibling( elem, "previoussibling" );
},
nextall: function( elem ) {
return jquery.dir( elem, "nextsibling" );
},
prevall: function( elem ) {
return jquery.dir( elem, "previoussibling" );
},
nextuntil: function( elem, i, until ) {
return jquery.dir( elem, "nextsibling", until );
},
prevuntil: function( elem, i, until ) {
return jquery.dir( elem, "previoussibling", until );
},
siblings: function( elem ) {
return jquery.sibling( ( elem.parentnode || {} ).firstchild, elem );
},
children: function( elem ) {
return jquery.sibling( elem.firstchild );
},
contents: function( elem ) {
return jquery.nodename( elem, "iframe" ) ?
elem.contentdocument || elem.contentwindow.document :
jquery.merge( [], elem.childnodes );
}
}, function( name, fn ) {
jquery.fn[ name ] = function( until, selector ) {
var ret = jquery.map( this, fn, until );
if ( name.slice( -5 ) !== "until" ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jquery.filter( selector, ret );
}
if ( this.length > 1 ) {
// remove duplicates
if ( !guaranteedunique[ name ] ) {
ret = jquery.unique( ret );
}
// reverse order for parents* and prev-derivatives
if ( rparentsprev.test( name ) ) {
ret = ret.reverse();
}
}
return this.pushstack( ret );
};
});
var rnotwhite = (/\s+/g);
// string to object options format cache
var optionscache = {};
// convert string-formatted options into object-formatted ones and store in cache
function createoptions( options ) {
var object = optionscache[ options ] = {};
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" ?
( optionscache[ options ] || 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,
// end of the loop when firing
firinglength,
// index of currently firing callback (modified by remove if needed)
firingindex,
// first callback to fire (used internally by add and firewith)
firingstart,
// actual callback list
list = [],
// stack of fire calls for repeatable lists
stack = !options.once && [],
// fire callbacks
fire = function( data ) {
memory = options.memory && data;
fired = true;
firingindex = firingstart || 0;
firingstart = 0;
firinglength = list.length;
firing = true;
for ( ; list && firingindex < firinglength; firingindex++ ) {
if ( list[ firingindex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stoponfalse ) {
memory = false; // to prevent further calls using add
break;
}
}
firing = false;
if ( list ) {
if ( stack ) {
if ( stack.length ) {
fire( stack.shift() );
}
} else if ( memory ) {
list = [];
} else {
self.disable();
}
}
},
// actual callbacks object
self = {
// add a callback or a collection of callbacks to the list
add: function() {
if ( list ) {
// first, we save the current length
var start = list.length;
(function add( args ) {
jquery.each( args, function( _, arg ) {
var type = jquery.type( arg );
if ( type === "function" ) {
if ( !options.unique || !self.has( arg ) ) {
list.push( arg );
}
} else if ( arg && arg.length && type !== "string" ) {
// inspect recursively
add( arg );
}
});
})( arguments );
// do we need to add the callbacks to the
// current firing batch?
if ( firing ) {
firinglength = list.length;
// with memory, if we're not firing then
// we should call right away
} else if ( memory ) {
firingstart = start;
fire( memory );
}
}
return this;
},
// remove a callback from the list
remove: function() {
if ( list ) {
jquery.each( arguments, function( _, arg ) {
var index;
while ( ( index = jquery.inarray( arg, list, index ) ) > -1 ) {
list.splice( index, 1 );
// handle firing indexes
if ( firing ) {
if ( index <= firinglength ) {
firinglength--;
}
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 && list.length );
},
// remove all callbacks from the list
empty: function() {
list = [];
firinglength = 0;
return this;
},
// have the list do nothing anymore
disable: function() {
list = stack = memory = undefined;
return this;
},
// is it disabled?
disabled: function() {
return !list;
},
// lock the list in its current state
lock: function() {
stack = undefined;
if ( !memory ) {
self.disable();
}
return this;
},
// is it locked?
locked: function() {
return !stack;
},
// call all callbacks with the given context and arguments
firewith: function( context, args ) {
if ( list && ( !fired || stack ) ) {
args = args || [];
args = [ context, args.slice ? args.slice() : args ];
if ( firing ) {
stack.push( args );
} else {
fire( args );
}
}
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()
.done( newdefer.resolve )
.fail( newdefer.reject )
.progress( newdefer.notify );
} 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()
.done( updatefunc( i, resolvecontexts, resolvevalues ) )
.fail( deferred.reject )
.progress( updatefunc( i, progresscontexts, progressvalues ) );
} 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;
}
// make sure body exists, at least, in case ie gets a little overzealous (ticket #5443).
if ( !document.body ) {
return settimeout( jquery.ready );
}
// 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" );
}
}
});
/**
* clean-up method for dom ready events
*/
function detach() {
if ( document.addeventlistener ) {
document.removeeventlistener( "domcontentloaded", completed, false );
window.removeeventlistener( "load", completed, false );
} else {
document.detachevent( "onreadystatechange", completed );
window.detachevent( "onload", completed );
}
}
/**
* the ready event handler and self cleanup method
*/
function completed() {
// readystate === "complete" is good enough for us to call the dom ready in oldie
if ( document.addeventlistener || event.type === "load" || document.readystate === "complete" ) {
detach();
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.
// we once tried to use readystate "interactive" here, but it caused issues like the one
// discovered by chriss here: http://bugs.jquery.com/ticket/12282#comment:15
if ( document.readystate === "complete" ) {
// handle it asynchronously to allow scripts the opportunity to delay ready
settimeout( jquery.ready );
// standards-based browsers support domcontentloaded
} else if ( document.addeventlistener ) {
// use the handy event callback
document.addeventlistener( "domcontentloaded", completed, false );
// a fallback to window.onload, that will always work
window.addeventlistener( "load", completed, false );
// if ie event model is used
} else {
// ensure firing before onload, maybe late but safe also for iframes
document.attachevent( "onreadystatechange", completed );
// a fallback to window.onload, that will always work
window.attachevent( "onload", completed );
// if ie and not a frame
// continually check to see if the document is ready
var top = false;
try {
top = window.frameelement == null && document.documentelement;
} catch(e) {}
if ( top && top.doscroll ) {
(function doscrollcheck() {
if ( !jquery.isready ) {
try {
// use the trick by diego perini
// http://javascript.nwbox.com/iecontentloaded/
top.doscroll("left");
} catch(e) {
return settimeout( doscrollcheck, 50 );
}
// detach all dom ready events
detach();
// and execute any waiting functions
jquery.ready();
}
})();
}
}
}
return readylist.promise( obj );
};
var strundefined = typeof undefined;
// support: ie<9
// iteration over object's inherited properties before its own
var i;
for ( i in jquery( support ) ) {
break;
}
support.ownlast = i !== "0";
// note: most support tests are defined in their respective modules.
// false until the test is run
support.inlineblockneedslayout = false;
// execute asap in case we need to set body.style.zoom
jquery(function() {
// minified: var a,b,c,d
var val, div, body, container;
body = document.getelementsbytagname( "body" )[ 0 ];
if ( !body || !body.style ) {
// return for frameset docs that don't have a body
return;
}
// setup
div = document.createelement( "div" );
container = document.createelement( "div" );
container.style.csstext = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
body.appendchild( container ).appendchild( div );
if ( typeof div.style.zoom !== strundefined ) {
// support: ie<8
// check if natively block-level elements act like inline-block
// elements when setting their display to 'inline' and giving
// them layout
div.style.csstext = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1";
support.inlineblockneedslayout = val = div.offsetwidth === 3;
if ( val ) {
// prevent ie 6 from affecting layout for positioned elements #11048
// prevent ie from shrinking the body in ie 7 mode #12869
// support: ie<8
body.style.zoom = 1;
}
}
body.removechild( container );
});
(function() {
var div = document.createelement( "div" );
// execute the test only if not already executed in another module.
if (support.deleteexpando == null) {
// support: ie<9
support.deleteexpando = true;
try {
delete div.test;
} catch( e ) {
support.deleteexpando = false;
}
}
// null elements to avoid leaks in ie.
div = null;
})();
/**
* determines whether an object can have data
*/
jquery.acceptdata = function( elem ) {
var nodata = jquery.nodata[ (elem.nodename + " ").tolowercase() ],
nodetype = +elem.nodetype || 1;
// do not set data on non-element dom nodes because it will not be cleared (#8335).
return nodetype !== 1 && nodetype !== 9 ?
false :
// nodes accept data unless otherwise specified; rejection can be conditional
!nodata || nodata !== true && elem.getattribute("classid") === nodata;
};
var rbrace = /^(?:\{[\w\w]*\}|\[[\w\w]*\])$/,
rmultidash = /([a-z])/g;
function dataattr( elem, key, data ) {
// if nothing was found internally, try to fetch any
// data from the html5 data-* attribute
if ( data === undefined && elem.nodetype === 1 ) {
var name = "data-" + key.replace( rmultidash, "-$1" ).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
jquery.data( elem, key, data );
} else {
data = undefined;
}
}
return data;
}
// checks a cache object for emptiness
function isemptydataobject( obj ) {
var name;
for ( name in obj ) {
// if the public data object is empty, the private is still empty
if ( name === "data" && jquery.isemptyobject( obj[name] ) ) {
continue;
}
if ( name !== "tojson" ) {
return false;
}
}
return true;
}
function internaldata( elem, name, data, pvt /* internal use only */ ) {
if ( !jquery.acceptdata( elem ) ) {
return;
}
var ret, thiscache,
internalkey = jquery.expando,
// we have to handle dom nodes and js objects differently because ie6-7
// can't gc object references properly across the dom-js boundary
isnode = elem.nodetype,
// only dom nodes need the global jquery cache; js object data is
// attached directly to the object so gc can occur automatically
cache = isnode ? jquery.cache : elem,
// only defining an id for js objects if its cache already exists allows
// the code to shortcut on the same path as a dom node with no cache
id = isnode ? elem[ internalkey ] : elem[ internalkey ] && internalkey;
// avoid doing any more work than we need to when trying to get data on an
// object that has no data at all
if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) {
return;
}
if ( !id ) {
// only dom nodes need a new unique id for each element since their data
// ends up in the global cache
if ( isnode ) {
id = elem[ internalkey ] = deletedids.pop() || jquery.guid++;
} else {
id = internalkey;
}
}
if ( !cache[ id ] ) {
// avoid exposing jquery metadata on plain js objects when the object
// is serialized using json.stringify
cache[ id ] = isnode ? {} : { tojson: jquery.noop };
}
// an object can be passed to jquery.data instead of a key/value pair; this gets
// shallow copied over onto the existing cache
if ( typeof name === "object" || typeof name === "function" ) {
if ( pvt ) {
cache[ id ] = jquery.extend( cache[ id ], name );
} else {
cache[ id ].data = jquery.extend( cache[ id ].data, name );
}
}
thiscache = cache[ id ];
// jquery data() is stored in a separate object inside the object's internal data
// cache in order to avoid key collisions between internal data and user-defined
// data.
if ( !pvt ) {
if ( !thiscache.data ) {
thiscache.data = {};
}
thiscache = thiscache.data;
}
if ( data !== undefined ) {
thiscache[ jquery.camelcase( name ) ] = data;
}
// check for both converted-to-camel and non-converted data property names
// if a data property was specified
if ( typeof name === "string" ) {
// first try to find as-is property data
ret = thiscache[ name ];
// test for null|undefined property data
if ( ret == null ) {
// try to find the camelcased property
ret = thiscache[ jquery.camelcase( name ) ];
}
} else {
ret = thiscache;
}
return ret;
}
function internalremovedata( elem, name, pvt ) {
if ( !jquery.acceptdata( elem ) ) {
return;
}
var thiscache, i,
isnode = elem.nodetype,
// see jquery.data for more information
cache = isnode ? jquery.cache : elem,
id = isnode ? elem[ jquery.expando ] : jquery.expando;
// if there is already no cache entry for this object, there is no
// purpose in continuing
if ( !cache[ id ] ) {
return;
}
if ( name ) {
thiscache = pvt ? cache[ id ] : cache[ id ].data;
if ( thiscache ) {
// support array or space separated string names for data keys
if ( !jquery.isarray( name ) ) {
// try the string as a key before any manipulation
if ( name in thiscache ) {
name = [ name ];
} else {
// split the camel cased version by spaces unless a key with the spaces exists
name = jquery.camelcase( name );
if ( name in thiscache ) {
name = [ name ];
} else {
name = name.split(" ");
}
}
} else {
// 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 = name.concat( jquery.map( name, jquery.camelcase ) );
}
i = name.length;
while ( i-- ) {
delete thiscache[ name[i] ];
}
// if there is no data left in the cache, we want to continue
// and let the cache object itself get destroyed
if ( pvt ? !isemptydataobject(thiscache) : !jquery.isemptyobject(thiscache) ) {
return;
}
}
}
// see jquery.data for more information
if ( !pvt ) {
delete cache[ id ].data;
// don't destroy the parent cache unless the internal data object
// had been the only thing left in it
if ( !isemptydataobject( cache[ id ] ) ) {
return;
}
}
// destroy the cache
if ( isnode ) {
jquery.cleandata( [ elem ], true );
// use delete when supported for expandos or `cache` is not a window per iswindow (#10080)
/* jshint eqeqeq: false */
} else if ( support.deleteexpando || cache != cache.window ) {
/* jshint eqeqeq: true */
delete cache[ id ];
// when all else fails, null
} else {
cache[ id ] = null;
}
}
jquery.extend({
cache: {},
// the following elements (space-suffixed to avoid object.prototype collisions)
// throw uncatchable exceptions if you attempt to set expando properties
nodata: {
"applet ": true,
"embed ": true,
// ...but flash objects (which have this classid) *can* handle expandos
"object ": "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
},
hasdata: function( elem ) {
elem = elem.nodetype ? jquery.cache[ elem[jquery.expando] ] : elem[ jquery.expando ];
return !!elem && !isemptydataobject( elem );
},
data: function( elem, name, data ) {
return internaldata( elem, name, data );
},
removedata: function( elem, name ) {
return internalremovedata( elem, name );
},
// for internal use only.
_data: function( elem, name, data ) {
return internaldata( elem, name, data, true );
},
_removedata: function( elem, name ) {
return internalremovedata( elem, name, true );
}
});
jquery.fn.extend({
data: function( key, value ) {
var i, name, data,
elem = this[0],
attrs = elem && elem.attributes;
// special expections of .data basically thwart jquery.access,
// so implement the relevant behavior ourselves
// gets all values
if ( key === undefined ) {
if ( this.length ) {
data = jquery.data( elem );
if ( elem.nodetype === 1 && !jquery._data( elem, "parsedattrs" ) ) {
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 ] );
}
}
}
jquery._data( elem, "parsedattrs", true );
}
}
return data;
}
// sets multiple values
if ( typeof key === "object" ) {
return this.each(function() {
jquery.data( this, key );
});
}
return arguments.length > 1 ?
// sets one value
this.each(function() {
jquery.data( this, key, value );
}) :
// gets one value
// try to fetch any internally stored data first
elem ? dataattr( elem, key, jquery.data( elem, key ) ) : undefined;
},
removedata: function( key ) {
return this.each(function() {
jquery.removedata( this, key );
});
}
});
jquery.extend({
queue: function( elem, type, data ) {
var queue;
if ( elem ) {
type = ( type || "fx" ) + "queue";
queue = jquery._data( elem, type );
// speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !queue || jquery.isarray(data) ) {
queue = jquery._data( 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 intended for public consumption - generates a queuehooks object, or returns the current one
_queuehooks: function( elem, type ) {
var key = type + "queuehooks";
return jquery._data( elem, key ) || jquery._data( elem, key, {
empty: jquery.callbacks("once memory").add(function() {
jquery._removedata( elem, type + "queue" );
jquery._removedata( elem, 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 = jquery._data( 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 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 );
};
// multifunctional method to get and set values of a collection
// the value/s can optionally be executed if it's a function
var access = jquery.access = function( elems, fn, key, value, chainable, emptyget, raw ) {
var i = 0,
length = elems.length,
bulk = key == null;
// sets many values
if ( jquery.type( key ) === "object" ) {
chainable = true;
for ( i in key ) {
jquery.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 < length; i++ ) {
fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
}
}
}
return chainable ?
elems :
// gets
bulk ?
fn.call( elems ) :
length ? fn( elems[0], key ) : emptyget;
};
var rcheckabletype = (/^(?:checkbox|radio)$/i);
(function() {
// minified: var a,b,c
var input = document.createelement( "input" ),
div = document.createelement( "div" ),
fragment = document.createdocumentfragment();
// setup
div.innerhtml = "
a";
// ie strips leading whitespace when .innerhtml is used
support.leadingwhitespace = div.firstchild.nodetype === 3;
// make sure that tbody elements aren't automatically inserted
// ie will insert them into empty tables
support.tbody = !div.getelementsbytagname( "tbody" ).length;
// make sure that link elements get serialized correctly by innerhtml
// this requires a wrapper element in ie
support.htmlserialize = !!div.getelementsbytagname( "link" ).length;
// makes sure cloning an html5 element does not cause problems
// where outerhtml is undefined, this still works
support.html5clone =
document.createelement( "nav" ).clonenode( true ).outerhtml !== "<:nav>";
// check if a disconnected checkbox will retain its checked
// value of true after appended to the dom (ie6/7)
input.type = "checkbox";
input.checked = true;
fragment.appendchild( input );
support.appendchecked = input.checked;
// make sure textarea (and checkbox) defaultvalue is properly cloned
// support: ie6-ie11+
div.innerhtml = "";
support.noclonechecked = !!div.clonenode( true ).lastchild.defaultvalue;
// #11217 - webkit loses check when the name is after the checked attribute
fragment.appendchild( div );
div.innerhtml = "";
// support: safari 5.1, ios 5.1, android 4.x, android 2.3
// old webkit doesn't clone checked state correctly in fragments
support.checkclone = div.clonenode( true ).clonenode( true ).lastchild.checked;
// support: ie<9
// opera does not clone events (and typeof div.attachevent === undefined).
// ie9-10 clones events bound via attachevent, but they don't trigger with .click()
support.nocloneevent = true;
if ( div.attachevent ) {
div.attachevent( "onclick", function() {
support.nocloneevent = false;
});
div.clonenode( true ).click();
}
// execute the test only if not already executed in another module.
if (support.deleteexpando == null) {
// support: ie<9
support.deleteexpando = true;
try {
delete div.test;
} catch( e ) {
support.deleteexpando = false;
}
}
})();
(function() {
var i, eventname,
div = document.createelement( "div" );
// support: ie<9 (lack submit/change bubble), firefox 23+ (lack focusin event)
for ( i in { submit: true, change: true, focusin: true }) {
eventname = "on" + i;
if ( !(support[ i + "bubbles" ] = eventname in window) ) {
// beware of csp restrictions (https://developer.mozilla.org/en/security/csp)
div.setattribute( eventname, "t" );
support[ i + "bubbles" ] = div.attributes[ eventname ].expando === false;
}
}
// null elements to avoid leaks in ie.
div = null;
})();
var rformelems = /^(?:input|select|textarea)$/i,
rkeyevent = /^key/,
rmouseevent = /^(?:mouse|pointer|contextmenu)|click/,
rfocusmorph = /^(?:focusinfocus|focusoutblur)$/,
rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
function returntrue() {
return true;
}
function returnfalse() {
return false;
}
function safeactiveelement() {
try {
return document.activeelement;
} catch ( err ) { }
}
/*
* 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 tmp, events, t, handleobjin,
special, eventhandle, handleobj,
handlers, type, namespaces, origtype,
elemdata = jquery._data( 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 !== strundefined && (!e || jquery.event.triggered !== e.type) ?
jquery.event.dispatch.apply( eventhandle.elem, arguments ) :
undefined;
};
// add elem as a property of the handle fn to prevent a memory leak with ie non-native events
eventhandle.elem = elem;
}
// 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/attachevent if the special events handler returns false
if ( !special.setup || special.setup.call( elem, data, namespaces, eventhandle ) === false ) {
// bind the global event handler to the element
if ( elem.addeventlistener ) {
elem.addeventlistener( type, eventhandle, false );
} else if ( elem.attachevent ) {
elem.attachevent( "on" + 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;
}
// nullify elem to prevent memory leaks in ie
elem = null;
},
// detach an event or set of events from an element
remove: function( elem, types, handler, selector, mappedtypes ) {
var j, handleobj, tmp,
origcount, t, events,
special, handlers, type,
namespaces, origtype,
elemdata = jquery.hasdata( elem ) && jquery._data( 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 the expando if it's no longer used
if ( jquery.isemptyobject( events ) ) {
delete elemdata.handle;
// removedata also checks for emptiness and clears the expando if empty
// so use it instead of delete
jquery._removedata( elem, "events" );
}
},
trigger: function( event, data, elem, onlyhandlers ) {
var handle, ontype, cur,
bubbletype, special, tmp, i,
eventpath = [ elem || document ],
type = hasown.call( event, "type" ) ? event.type : event,
namespaces = hasown.call( event, "namespace" ) ? event.namespace.split(".") : [];
cur = tmp = elem = elem || document;
// don't do events on text and comment nodes
if ( elem.nodetype === 3 || elem.nodetype === 8 ) {
return;
}
// focus/blur morphs to focusin/out; ensure we're not firing them right now
if ( rfocusmorph.test( type + jquery.event.triggered ) ) {
return;
}
if ( type.indexof(".") >= 0 ) {
// namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split(".");
type = namespaces.shift();
namespaces.sort();
}
ontype = type.indexof(":") < 0 && "on" + type;
// caller can pass in a jquery.event object, object, or just an event type string
event = event[ jquery.expando ] ?
event :
new jquery.event( type, typeof event === "object" && event );
// trigger bitmask: & 1 for native handlers; & 2 for jquery (always true)
event.istrigger = onlyhandlers ? 2 : 3;
event.namespace = namespaces.join(".");
event.namespace_re = event.namespace ?
new regexp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
null;
// clean up the event in case it is being reused
event.result = undefined;
if ( !event.target ) {
event.target = elem;
}
// clone any incoming data and prepend the event, creating the handler arg list
data = data == null ?
[ event ] :
jquery.makearray( data, [ event ] );
// allow special events to draw outside the lines
special = jquery.event.special[ type ] || {};
if ( !onlyhandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
return;
}
// determine event propagation path in advance, per w3c events spec (#9951)
// bubble up to document, then to window; watch for a global ownerdocument var (#9724)
if ( !onlyhandlers && !special.nobubble && !jquery.iswindow( elem ) ) {
bubbletype = special.delegatetype || type;
if ( !rfocusmorph.test( bubbletype + type ) ) {
cur = cur.parentnode;
}
for ( ; cur; cur = cur.parentnode ) {
eventpath.push( cur );
tmp = cur;
}
// only add window if we got to document (e.g., not plain obj or detached dom)
if ( tmp === (elem.ownerdocument || document) ) {
eventpath.push( tmp.defaultview || tmp.parentwindow || window );
}
}
// fire handlers on the event path
i = 0;
while ( (cur = eventpath[i++]) && !event.ispropagationstopped() ) {
event.type = i > 1 ?
bubbletype :
special.bindtype || type;
// jquery handler
handle = ( jquery._data( cur, "events" ) || {} )[ event.type ] && jquery._data( cur, "handle" );
if ( handle ) {
handle.apply( cur, data );
}
// native handler
handle = ontype && cur[ ontype ];
if ( handle && handle.apply && jquery.acceptdata( cur ) ) {
event.result = handle.apply( cur, data );
if ( event.result === false ) {
event.preventdefault();
}
}
}
event.type = type;
// if nobody prevented the default action, do it now
if ( !onlyhandlers && !event.isdefaultprevented() ) {
if ( (!special._default || special._default.apply( eventpath.pop(), data ) === false) &&
jquery.acceptdata( elem ) ) {
// call a native dom method on the target with the same name name as the event.
// can't use an .isfunction() check here because ie6/7 fails that test.
// don't do default actions on window, that's where global variables be (#6170)
if ( ontype && elem[ type ] && !jquery.iswindow( elem ) ) {
// don't re-trigger an onfoo event when we call its foo() method
tmp = elem[ ontype ];
if ( tmp ) {
elem[ ontype ] = null;
}
// prevent re-triggering of the same event, since we already bubbled it above
jquery.event.triggered = type;
try {
elem[ type ]();
} catch ( e ) {
// ie<9 dies on focus/blur to hidden element (#1486,#12518)
// only reproducible on winxp ie8 native, not ie9 in ie8 mode
}
jquery.event.triggered = undefined;
if ( tmp ) {
elem[ ontype ] = tmp;
}
}
}
}
return event.result;
},
dispatch: function( event ) {
// make a writable jquery.event from the native event object
event = jquery.event.fix( event );
var i, ret, handleobj, matched, j,
handlerqueue = [],
args = slice.call( arguments ),
handlers = ( jquery._data( 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.namespace_re || event.namespace_re.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 sel, handleobj, matches, i,
handlerqueue = [],
delegatecount = handlers.delegatecount,
cur = event.target;
// find delegate handlers
// black-hole svg