/*! * jquery javascript library v1.12.4 * http://jquery.com/ * * includes sizzle.js * http://sizzlejs.com/ * * copyright jquery foundation and other contributors * released under the mit license * http://jquery.org/license * * date: 2016-05-20t17:17z */ (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 have a `window` with a `document` // (such as node.js), expose a 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) { // support: firefox 18+ // can't be in strict mode, several libs including asp.net trace // the stack via arguments.caller.callee and firefox dies if // you try to trace through "use strict" call chains. (#13335) //"use strict"; var deletedids = []; var document = window.document; 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.12.4", // 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. each: function (callback) { return jquery.each(this, callback); }, map: function (callback) { return this.pushstack(jquery.map(this, function (elem, i) { return callback.call(elem, i, elem); })); }, slice: function () { return this.pushstack(slice.apply(this, arguments)); }, first: function () { return this.eq(0); }, last: function () { return this.eq(-1); }, eq: function (i) { var len = this.length, j = +i + (i < 0 ? len : 0); return this.pushstack(j >= 0 && j < len ? [this[j]] : []); }, end: function () { return this.prevobject || this.constructor(); }, // for internal use only. // behaves like an array's method, not like a jquery method. push: push, sort: 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 // adding 1 corrects loss of precision from parsefloat (#15100) var realstringobj = obj && obj.tostring(); return !jquery.isarray(obj) && (realstringobj - parsefloat(realstringobj) + 1) >= 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.ownfirst) { 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; }, // 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); // jscs:ignore requiredotnotation })(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(); }, each: function (obj, callback) { var length, i = 0; if (isarraylike(obj)) { length = obj.length; for (; i < length; i++) { if (callback.call(obj[i], i, obj[i]) === false) { break; } } } else { for (i in obj) { if (callback.call(obj[i], i, obj[i]) === false) { break; } } } return obj; }, // support: android<4.1, 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 length, value, i = 0, ret = []; // go through the array, translating each of the items to their new values if (isarraylike(elems)) { length = elems.length; for (; i < length; i++) { value = callback(elems[i], i, arg); if (value != null) { ret.push(value); } } // go through every key on the object, } else { for (i in elems) { value = callback(elems[i], i, arg); if (value != null) { ret.push(value); } } } // flatten any nested arrays return concat.apply([], ret); }, // a global guid counter for objects guid: 1, // bind a function to a context, optionally partially applying any // arguments. proxy: function (fn, context) { var 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 }); // jshint would error on this code due to the symbol not being defined in es5. // defining this global in .jshintrc would create a danger of using the global // unguarded in another place, it seems safer to just disable jshint for these // three lines. /* jshint ignore: start */ if (typeof symbol === "function") { jquery.fn[symbol.iterator] = deletedids[symbol.iterator]; } /* jshint ignore: end */ // populate the class2type map jquery.each("boolean number string function array date regexp object error symbol".split(" "), function (i, name) { class2type["[object " + name + "]"] = name.tolowercase(); }); function isarraylike(obj) { // support: ios 8.2 (not reproducible in simulator) // `in` check used to prevent jit error (gh-2145) // hasown isn't used here due to false negatives // regarding nodelist length in ie var length = !!obj && "length" in obj && obj.length, type = jquery.type(obj); if (type === "function" || jquery.iswindow(obj)) { return false; } return type === "array" || length === 0 || typeof length === "number" && length > 0 && (length - 1) in obj; } var sizzle = /*! * sizzle css selector engine v2.2.1 * http://sizzlejs.com/ * * copyright jquery foundation and other contributors * released under the mit license * http://jquery.org/license * * date: 2015-10-17 */ (function (window) { var i, support, expr, gettext, isxml, tokenize, compile, select, outermostcontext, sortinput, hasduplicate, // local document vars setdocument, document, docelem, documentishtml, rbuggyqsa, rbuggymatches, matches, contains, // instance-specific data expando = "sizzle" + 1 * new date(), preferreddoc = window.document, dirruns = 0, done = 0, classcache = createcache(), tokencache = createcache(), compilercache = createcache(), sortorder = function (a, b) { if (a === b) { hasduplicate = true; } return 0; }, // general-purpose constants max_negative = 1 << 31, // instance methods hasown = ({}).hasownproperty, arr = [], pop = arr.pop, push_native = arr.push, push = arr.push, slice = arr.slice, // use a stripped-down indexof as it's faster than native // http://jsperf.com/thor-indexof-vs-for/5 indexof = function (list, elem) { var i = 0, len = list.length; for (; i < len; i++) { if (list[i] === elem) { return i; } } return -1; }, booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", // regular expressions // http://www.w3.org/tr/css3-selectors/#whitespace whitespace = "[\\x20\\t\\r\\n\\f]", // http://www.w3.org/tr/css21/syndata.html#value-def-identifier identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", // attribute selectors: http://www.w3.org/tr/selectors/#attribute-selectors attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + // operator (capture 2) "*([*^$|!~]?=)" + whitespace + // "attribute values must be css identifiers [capture 5] or strings [capture 3 or capture 4]" "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]", pseudos = ":(" + identifier + ")(?:\\((" + // to reduce the number of selectors needing tokenize in the prefilter, prefer arguments: // 1. quoted (capture 3; capture 4 or capture 5) "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + // 2. simple (capture 6) "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + // 3. anything else (capture 2) ".*" + ")\\)|)", // leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter rwhitespace = new regexp(whitespace + "+", "g"), rtrim = new regexp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"), rcomma = new regexp("^" + whitespace + "*," + whitespace + "*"), rcombinators = new regexp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"), rattributequotes = new regexp("=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g"), rpseudo = new regexp(pseudos), ridentifier = new regexp("^" + identifier + "$"), matchexpr = { "id": new regexp("^#(" + identifier + ")"), "class": new regexp("^\\.(" + identifier + ")"), "tag": new regexp("^(" + identifier + "|[*])"), "attr": new regexp("^" + attributes), "pseudo": new regexp("^" + pseudos), "child": new regexp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"), "bool": new regexp("^(?:" + booleans + ")$", "i"), // for use in libraries implementing .is() // we use this for pos matching in `select` "needscontext": new regexp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i") }, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rnative = /^[^{]+\{\s*\[native \w/, // easily-parseable/retrievable id or tag or class selectors rquickexpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, rescape = /'|\\/g, // css escapes http://www.w3.org/tr/css21/syndata.html#escaped-characters runescape = new regexp("\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig"), funescape = function (_, escaped, escapedwhitespace) { var high = "0x" + escaped - 0x10000; // nan means non-codepoint // support: firefox<24 // workaround erroneous numeric interpretation of +"0x" return high !== high || escapedwhitespace ? escaped : high < 0 ? // bmp codepoint string.fromcharcode(high + 0x10000) : // supplemental plane codepoint (surrogate pair) string.fromcharcode(high >> 10 | 0xd800, high & 0x3ff | 0xdc00); }, // used for iframes // see setdocument() // removing the function wrapper causes a "permission denied" // error in ie unloadhandler = function () { setdocument(); }; // optimize for push.apply( _, nodelist ) try { push.apply( (arr = slice.call(preferreddoc.childnodes)), preferreddoc.childnodes ); // support: android<4.0 // detect silently failing push.apply arr[preferreddoc.childnodes.length].nodetype; } catch (e) { push = { apply: arr.length ? // leverage slice if possible function (target, els) { push_native.apply(target, slice.call(els)); } : // support: ie<9 // otherwise append directly function (target, els) { var j = target.length, i = 0; // can't trust nodelist.length while ((target[j++] = els[i++])) { } target.length = j - 1; } }; } function sizzle(selector, context, results, seed) { var m, i, elem, nid, nidselect, match, groups, newselector, newcontext = context && context.ownerdocument, // nodetype defaults to 9, since context defaults to document nodetype = context ? context.nodetype : 9; results = results || []; // return early from calls with invalid selector or context if (typeof selector !== "string" || !selector || nodetype !== 1 && nodetype !== 9 && nodetype !== 11) { return results; } // try to shortcut find operations (as opposed to filters) in html documents if (!seed) { if ((context ? context.ownerdocument || context : preferreddoc) !== document) { setdocument(context); } context = context || document; if (documentishtml) { // if the selector is sufficiently simple, try using a "get*by*" dom method // (excepting documentfragment context, where the methods don't exist) if (nodetype !== 11 && (match = rquickexpr.exec(selector))) { // id selector if ((m = match[1])) { // document context if (nodetype === 9) { if ((elem = context.getelementbyid(m))) { // support: ie, opera, webkit // todo: identify versions // getelementbyid can match elements by name instead of id if (elem.id === m) { results.push(elem); return results; } } else { return results; } // element context } else { // support: ie, opera, webkit // todo: identify versions // getelementbyid can match elements by name instead of id if (newcontext && (elem = newcontext.getelementbyid(m)) && contains(context, elem) && elem.id === m) { results.push(elem); return results; } } // type selector } else if (match[2]) { push.apply(results, context.getelementsbytagname(selector)); return results; // class selector } else if ((m = match[3]) && support.getelementsbyclassname && context.getelementsbyclassname) { push.apply(results, context.getelementsbyclassname(m)); return results; } } // take advantage of queryselectorall if (support.qsa && !compilercache[selector + " "] && (!rbuggyqsa || !rbuggyqsa.test(selector))) { if (nodetype !== 1) { newcontext = context; newselector = selector; // qsa looks outside element context, which is not what we want // thanks to andrew dupont for this workaround technique // support: ie <=8 // exclude object elements } else if (context.nodename.tolowercase() !== "object") { // capture the context id, setting it first if necessary if ((nid = context.getattribute("id"))) { nid = nid.replace(rescape, "\\$&"); } else { context.setattribute("id", (nid = expando)); } // prefix every selector in the list groups = tokenize(selector); i = groups.length; nidselect = ridentifier.test(nid) ? "#" + nid : "[id='" + nid + "']"; while (i--) { groups[i] = nidselect + " " + toselector(groups[i]); } newselector = groups.join(","); // expand context for sibling selectors newcontext = rsibling.test(selector) && testcontext(context.parentnode) || context; } if (newselector) { try { push.apply(results, newcontext.queryselectorall(newselector) ); return results; } catch (qsaerror) { } finally { if (nid === expando) { context.removeattribute("id"); } } } } } } // all others return select(selector.replace(rtrim, "$1"), context, results, seed); } /** * create key-value caches of limited size * @returns {function(string, object)} returns the object data after storing it on itself with * property name the (space-suffixed) string and (if the cache is larger than expr.cachelength) * deleting the oldest entry */ function createcache() { var keys = []; function cache(key, value) { // use (key + " ") to avoid collision with native prototype properties (see issue #157) if (keys.push(key + " ") > expr.cachelength) { // only keep the most recent entries delete cache[keys.shift()]; } return (cache[key + " "] = value); } return cache; } /** * mark a function for special use by sizzle * @param {function} fn the function to mark */ function markfunction(fn) { fn[expando] = true; return fn; } /** * support testing using an element * @param {function} fn passed the created div and expects a boolean result */ function assert(fn) { var div = document.createelement("div"); try { return !!fn(div); } catch (e) { return false; } finally { // remove from its parent by default if (div.parentnode) { div.parentnode.removechild(div); } // release memory in ie div = null; } } /** * adds the same handler for all of the specified attrs * @param {string} attrs pipe-separated list of attributes * @param {function} handler the method that will be applied */ function addhandle(attrs, handler) { var arr = attrs.split("|"), i = arr.length; while (i--) { expr.attrhandle[arr[i]] = handler; } } /** * checks document order of two siblings * @param {element} a * @param {element} b * @returns {number} returns less than 0 if a precedes b, greater than 0 if a follows b */ function siblingcheck(a, b) { var cur = b && a, diff = cur && a.nodetype === 1 && b.nodetype === 1 && (~b.sourceindex || max_negative) - (~a.sourceindex || max_negative); // use ie sourceindex if available on both nodes if (diff) { return diff; } // check if b follows a if (cur) { while ((cur = cur.nextsibling)) { if (cur === b) { return -1; } } } return a ? 1 : -1; } /** * returns a function to use in pseudos for input types * @param {string} type */ function createinputpseudo(type) { return function (elem) { var name = elem.nodename.tolowercase(); return name === "input" && elem.type === type; }; } /** * returns a function to use in pseudos for buttons * @param {string} type */ function createbuttonpseudo(type) { return function (elem) { var name = elem.nodename.tolowercase(); return (name === "input" || name === "button") && elem.type === type; }; } /** * returns a function to use in pseudos for positionals * @param {function} fn */ function createpositionalpseudo(fn) { return markfunction(function (argument) { argument = +argument; return markfunction(function (seed, matches) { var j, matchindexes = fn([], seed.length, argument), i = matchindexes.length; // match elements found at the specified indexes while (i--) { if (seed[(j = matchindexes[i])]) { seed[j] = !(matches[j] = seed[j]); } } }); }); } /** * checks a node for validity as a sizzle context * @param {element|object=} context * @returns {element|object|boolean} the input node if acceptable, otherwise a falsy value */ function testcontext(context) { return context && typeof context.getelementsbytagname !== "undefined" && context; } // expose support vars for convenience support = sizzle.support = {}; /** * detects xml nodes * @param {element|object} elem an element or a document * @returns {boolean} true iff elem is a non-html xml node */ isxml = sizzle.isxml = function (elem) { // documentelement is verified for cases where it doesn't yet exist // (such as loading iframes in ie - #4833) var documentelement = elem && (elem.ownerdocument || elem).documentelement; return documentelement ? documentelement.nodename !== "html" : false; }; /** * sets document-related variables once based on the current document * @param {element|object} [doc] an element or document object to use to set the document * @returns {object} returns the current document */ setdocument = sizzle.setdocument = function (node) { var hascompare, parent, doc = node ? node.ownerdocument || node : preferreddoc; // return early if doc is invalid or already selected if (doc === document || doc.nodetype !== 9 || !doc.documentelement) { return document; } // update global variables document = doc; docelem = document.documentelement; documentishtml = !isxml(document); // support: ie 9-11, edge // accessing iframe documents after unload throws "permission denied" errors (jquery #13936) if ((parent = document.defaultview) && parent.top !== parent) { // support: ie 11 if (parent.addeventlistener) { parent.addeventlistener("unload", unloadhandler, false); // support: ie 9 - 10 only } else if (parent.attachevent) { parent.attachevent("onunload", unloadhandler); } } /* attributes ---------------------------------------------------------------------- */ // support: ie<8 // verify that getattribute really returns attributes and not properties // (excepting ie8 booleans) support.attributes = assert(function (div) { div.classname = "i"; return !div.getattribute("classname"); }); /* getelement(s)by* ---------------------------------------------------------------------- */ // check if getelementsbytagname("*") returns only elements support.getelementsbytagname = assert(function (div) { div.appendchild(document.createcomment("")); return !div.getelementsbytagname("*").length; }); // support: ie<9 support.getelementsbyclassname = rnative.test(document.getelementsbyclassname); // support: ie<10 // check if getelementbyid returns elements by name // the broken getelementbyid methods don't pick up programatically-set names, // so use a roundabout getelementsbyname test support.getbyid = assert(function (div) { docelem.appendchild(div).id = expando; return !document.getelementsbyname || !document.getelementsbyname(expando).length; }); // id find and filter if (support.getbyid) { expr.find["id"] = function (id, context) { if (typeof context.getelementbyid !== "undefined" && documentishtml) { var m = context.getelementbyid(id); return m ? [m] : []; } }; expr.filter["id"] = function (id) { var attrid = id.replace(runescape, funescape); return function (elem) { return elem.getattribute("id") === attrid; }; }; } else { // support: ie6/7 // getelementbyid is not reliable as a find shortcut delete expr.find["id"]; expr.filter["id"] = function (id) { var attrid = id.replace(runescape, funescape); return function (elem) { var node = typeof elem.getattributenode !== "undefined" && elem.getattributenode("id"); return node && node.value === attrid; }; }; } // tag expr.find["tag"] = support.getelementsbytagname ? function (tag, context) { if (typeof context.getelementsbytagname !== "undefined") { return context.getelementsbytagname(tag); // documentfragment nodes don't have gebtn } else if (support.qsa) { return context.queryselectorall(tag); } } : function (tag, context) { var elem, tmp = [], i = 0, // by happy coincidence, a (broken) gebtn appears on documentfragment nodes too results = context.getelementsbytagname(tag); // filter out possible comments if (tag === "*") { while ((elem = results[i++])) { if (elem.nodetype === 1) { tmp.push(elem); } } return tmp; } return results; }; // class expr.find["class"] = support.getelementsbyclassname && function (classname, context) { if (typeof context.getelementsbyclassname !== "undefined" && documentishtml) { return context.getelementsbyclassname(classname); } }; /* qsa/matchesselector ---------------------------------------------------------------------- */ // qsa and matchesselector support // matchesselector(:active) reports false when true (ie9/opera 11.5) rbuggymatches = []; // qsa(:focus) reports false when true (chrome 21) // we allow this because of a bug in ie8/9 that throws an error // whenever `document.activeelement` is accessed on an iframe // so, we allow :focus to pass through qsa all the time to avoid the ie error // see http://bugs.jquery.com/ticket/13378 rbuggyqsa = []; if ((support.qsa = rnative.test(document.queryselectorall))) { // build qsa regex // regex strategy adopted from diego perini assert(function (div) { // select is set to empty string on purpose // this is to test ie's treatment of not explicitly // setting a boolean content attribute, // since its presence should be enough // http://bugs.jquery.com/ticket/12359 docelem.appendchild(div).innerhtml = "" + ""; // support: ie8, opera 11-12.16 // nothing should be selected when empty strings follow ^= or $= or *= // the test attribute must be unknown in opera but "safe" for winrt // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section if (div.queryselectorall("[msallowcapture^='']").length) { rbuggyqsa.push("[*^$]=" + whitespace + "*(?:''|\"\")"); } // support: ie8 // boolean attributes and "value" are not treated correctly if (!div.queryselectorall("[selected]").length) { rbuggyqsa.push("\\[" + whitespace + "*(?:value|" + booleans + ")"); } // support: chrome<29, android<4.4, safari<7.0+, ios<7.0+, phantomjs<1.9.8+ if (!div.queryselectorall("[id~=" + expando + "-]").length) { rbuggyqsa.push("~="); } // webkit/opera - :checked should return selected option elements // http://www.w3.org/tr/2011/rec-css3-selectors-20110929/#checked // ie8 throws error here and will not see later tests if (!div.queryselectorall(":checked").length) { rbuggyqsa.push(":checked"); } // support: safari 8+, ios 8+ // https://bugs.webkit.org/show_bug.cgi?id=136851 // in-page `selector#id sibing-combinator selector` fails if (!div.queryselectorall("a#" + expando + "+*").length) { rbuggyqsa.push(".#.+[+~]"); } }); assert(function (div) { // support: windows 8 native apps // the type and name attributes are restricted during .innerhtml assignment var input = document.createelement("input"); input.setattribute("type", "hidden"); div.appendchild(input).setattribute("name", "d"); // support: ie8 // enforce case-sensitivity of name attribute if (div.queryselectorall("[name=d]").length) { rbuggyqsa.push("name" + whitespace + "*[*^$|!~]?="); } // ff 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) // ie8 throws error here and will not see later tests if (!div.queryselectorall(":enabled").length) { rbuggyqsa.push(":enabled", ":disabled"); } // opera 10-11 does not throw on post-comma invalid pseudos div.queryselectorall("*,:x"); rbuggyqsa.push(",.*:"); }); } if ((support.matchesselector = rnative.test((matches = docelem.matches || docelem.webkitmatchesselector || docelem.mozmatchesselector || docelem.omatchesselector || docelem.msmatchesselector)))) { assert(function (div) { // check to see if it's possible to do matchesselector // on a disconnected node (ie 9) support.disconnectedmatch = matches.call(div, "div"); // this should fail with an exception // gecko does not error, returns false instead matches.call(div, "[s!='']:x"); rbuggymatches.push("!=", pseudos); }); } rbuggyqsa = rbuggyqsa.length && new regexp(rbuggyqsa.join("|")); rbuggymatches = rbuggymatches.length && new regexp(rbuggymatches.join("|")); /* contains ---------------------------------------------------------------------- */ hascompare = rnative.test(docelem.comparedocumentposition); // element contains another // purposefully self-exclusive // as in, an element does not contain itself contains = hascompare || rnative.test(docelem.contains) ? function (a, b) { var adown = a.nodetype === 9 ? a.documentelement : a, bup = b && b.parentnode; return a === bup || !!(bup && bup.nodetype === 1 && ( adown.contains ? adown.contains(bup) : a.comparedocumentposition && a.comparedocumentposition(bup) & 16 )); } : function (a, b) { if (b) { while ((b = b.parentnode)) { if (b === a) { return true; } } } return false; }; /* sorting ---------------------------------------------------------------------- */ // document order sorting sortorder = hascompare ? function (a, b) { // flag for duplicate removal if (a === b) { hasduplicate = true; return 0; } // sort on method existence if only one input has comparedocumentposition var compare = !a.comparedocumentposition - !b.comparedocumentposition; if (compare) { return compare; } // calculate position if both inputs belong to the same document compare = (a.ownerdocument || a) === (b.ownerdocument || b) ? a.comparedocumentposition(b) : // otherwise we know they are disconnected 1; // disconnected nodes if (compare & 1 || (!support.sortdetached && b.comparedocumentposition(a) === compare)) { // choose the first element that is related to our preferred document if (a === document || a.ownerdocument === preferreddoc && contains(preferreddoc, a)) { return -1; } if (b === document || b.ownerdocument === preferreddoc && contains(preferreddoc, b)) { return 1; } // maintain original order return sortinput ? (indexof(sortinput, a) - indexof(sortinput, b)) : 0; } return compare & 4 ? -1 : 1; } : function (a, b) { // exit early if the nodes are identical if (a === b) { hasduplicate = true; return 0; } var cur, i = 0, aup = a.parentnode, bup = b.parentnode, ap = [a], bp = [b]; // parentless nodes are either documents or disconnected if (!aup || !bup) { return a === document ? -1 : b === document ? 1 : aup ? -1 : bup ? 1 : sortinput ? (indexof(sortinput, a) - indexof(sortinput, b)) : 0; // if the nodes are siblings, we can do a quick check } else if (aup === bup) { return siblingcheck(a, b); } // otherwise we need full lists of their ancestors for comparison cur = a; while ((cur = cur.parentnode)) { ap.unshift(cur); } cur = b; while ((cur = cur.parentnode)) { bp.unshift(cur); } // walk down the tree looking for a discrepancy while (ap[i] === bp[i]) { i++; } return i ? // do a sibling check if the nodes have a common ancestor siblingcheck(ap[i], bp[i]) : // otherwise nodes in our document sort first ap[i] === preferreddoc ? -1 : bp[i] === preferreddoc ? 1 : 0; }; return document; }; sizzle.matches = function (expr, elements) { return sizzle(expr, null, null, elements); }; sizzle.matchesselector = function (elem, expr) { // set document vars if needed if ((elem.ownerdocument || elem) !== document) { setdocument(elem); } // make sure that attribute selectors are quoted expr = expr.replace(rattributequotes, "='$1']"); if (support.matchesselector && documentishtml && !compilercache[expr + " "] && (!rbuggymatches || !rbuggymatches.test(expr)) && (!rbuggyqsa || !rbuggyqsa.test(expr))) { try { var ret = matches.call(elem, expr); // ie 9's matchesselector returns false on disconnected nodes if (ret || support.disconnectedmatch || // as well, disconnected nodes are said to be in a document // fragment in ie 9 elem.document && elem.document.nodetype !== 11) { return ret; } } catch (e) { } } return sizzle(expr, document, null, [elem]).length > 0; }; sizzle.contains = function (context, elem) { // set document vars if needed if ((context.ownerdocument || context) !== document) { setdocument(context); } return contains(context, elem); }; sizzle.attr = function (elem, name) { // set document vars if needed if ((elem.ownerdocument || elem) !== document) { setdocument(elem); } var fn = expr.attrhandle[name.tolowercase()], // don't get fooled by object.prototype properties (jquery #13807) val = fn && hasown.call(expr.attrhandle, name.tolowercase()) ? fn(elem, name, !documentishtml) : undefined; return val !== undefined ? val : support.attributes || !documentishtml ? elem.getattribute(name) : (val = elem.getattributenode(name)) && val.specified ? val.value : null; }; sizzle.error = function (msg) { throw new error("syntax error, unrecognized expression: " + msg); }; /** * document sorting and removing duplicates * @param {arraylike} results */ sizzle.uniquesort = function (results) { var elem, duplicates = [], j = 0, i = 0; // unless we *know* we can detect duplicates, assume their presence hasduplicate = !support.detectduplicates; sortinput = !support.sortstable && results.slice(0); results.sort(sortorder); if (hasduplicate) { while ((elem = results[i++])) { if (elem === results[i]) { j = duplicates.push(i); } } while (j--) { results.splice(duplicates[j], 1); } } // clear input after sorting to release objects // see https://github.com/jquery/sizzle/pull/225 sortinput = null; return results; }; /** * utility function for retrieving the text value of an array of dom nodes * @param {array|element} elem */ gettext = sizzle.gettext = function (elem) { var node, ret = "", i = 0, nodetype = elem.nodetype; if (!nodetype) { // if no nodetype, this is expected to be an array while ((node = elem[i++])) { // do not traverse comment nodes ret += gettext(node); } } else if (nodetype === 1 || nodetype === 9 || nodetype === 11) { // use textcontent for elements // innertext usage removed for consistency of new lines (jquery #11153) if (typeof elem.textcontent === "string") { return elem.textcontent; } else { // traverse its children for (elem = elem.firstchild; elem; elem = elem.nextsibling) { ret += gettext(elem); } } } else if (nodetype === 3 || nodetype === 4) { return elem.nodevalue; } // do not include comment or processing instruction nodes return ret; }; expr = sizzle.selectors = { // can be adjusted by the user cachelength: 50, createpseudo: markfunction, match: matchexpr, attrhandle: {}, find: {}, relative: { ">": { dir: "parentnode", first: true }, " ": { dir: "parentnode" }, "+": { dir: "previoussibling", first: true }, "~": { dir: "previoussibling" } }, prefilter: { "attr": function (match) { match[1] = match[1].replace(runescape, funescape); // move the given value to match[3] whether quoted or unquoted match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape); if (match[2] === "~=") { match[3] = " " + match[3] + " "; } return match.slice(0, 4); }, "child": function (match) { /* matches from matchexpr["child"] 1 type (only|nth|...) 2 what (child|of-type) 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 4 xn-component of xn+y argument ([+-]?\d*n|) 5 sign of xn-component 6 x of xn-component 7 sign of y-component 8 y of y-component */ match[1] = match[1].tolowercase(); if (match[1].slice(0, 3) === "nth") { // nth-* requires argument if (!match[3]) { sizzle.error(match[0]); } // numeric x and y parameters for expr.filter.child // remember that false/true cast respectively to 0/1 match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd")); match[5] = +((match[7] + match[8]) || match[3] === "odd"); // other types prohibit arguments } else if (match[3]) { sizzle.error(match[0]); } return match; }, "pseudo": function (match) { var excess, unquoted = !match[6] && match[2]; if (matchexpr["child"].test(match[0])) { return null; } // accept quoted arguments as-is if (match[3]) { match[2] = match[4] || match[5] || ""; // strip excess characters from unquoted arguments } else if (unquoted && rpseudo.test(unquoted) && // get excess from tokenize (recursively) (excess = tokenize(unquoted, true)) && // advance to the next closing parenthesis (excess = unquoted.indexof(")", unquoted.length - excess) - unquoted.length)) { // excess is a negative index match[0] = match[0].slice(0, excess); match[2] = unquoted.slice(0, excess); } // return only captures needed by the pseudo filter method (type and argument) return match.slice(0, 3); } }, filter: { "tag": function (nodenameselector) { var nodename = nodenameselector.replace(runescape, funescape).tolowercase(); return nodenameselector === "*" ? function () { return true; } : function (elem) { return elem.nodename && elem.nodename.tolowercase() === nodename; }; }, "class": function (classname) { var pattern = classcache[classname + " "]; return pattern || (pattern = new regexp("(^|" + whitespace + ")" + classname + "(" + whitespace + "|$)")) && classcache(classname, function (elem) { return pattern.test(typeof elem.classname === "string" && elem.classname || typeof elem.getattribute !== "undefined" && elem.getattribute("class") || ""); }); }, "attr": function (name, operator, check) { return function (elem) { var result = sizzle.attr(elem, name); if (result == null) { return operator === "!="; } if (!operator) { return true; } result += ""; return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexof(check) === 0 : operator === "*=" ? check && result.indexof(check) > -1 : operator === "$=" ? check && result.slice(-check.length) === check : operator === "~=" ? (" " + result.replace(rwhitespace, " ") + " ").indexof(check) > -1 : operator === "|=" ? result === check || result.slice(0, check.length + 1) === check + "-" : false; }; }, "child": function (type, what, argument, first, last) { var simple = type.slice(0, 3) !== "nth", forward = type.slice(-4) !== "last", oftype = what === "of-type"; return first === 1 && last === 0 ? // shortcut for :nth-*(n) function (elem) { return !!elem.parentnode; } : function (elem, context, xml) { var cache, uniquecache, outercache, node, nodeindex, start, dir = simple !== forward ? "nextsibling" : "previoussibling", parent = elem.parentnode, name = oftype && elem.nodename.tolowercase(), usecache = !xml && !oftype, diff = false; if (parent) { // :(first|last|only)-(child|of-type) if (simple) { while (dir) { node = elem; while ((node = node[dir])) { if (oftype ? node.nodename.tolowercase() === name : node.nodetype === 1) { return false; } } // reverse direction for :only-* (if we haven't yet done so) start = dir = type === "only" && !start && "nextsibling"; } return true; } start = [forward ? parent.firstchild : parent.lastchild]; // non-xml :nth-child(...) stores cache data on `parent` if (forward && usecache) { // seek `elem` from a previously-cached index // ...in a gzip-friendly way node = parent; outercache = node[expando] || (node[expando] = {}); // support: ie <9 only // defend against cloned attroperties (jquery gh-1709) uniquecache = outercache[node.uniqueid] || (outercache[node.uniqueid] = {}); cache = uniquecache[type] || []; nodeindex = cache[0] === dirruns && cache[1]; diff = nodeindex && cache[2]; node = nodeindex && parent.childnodes[nodeindex]; while ((node = ++nodeindex && node && node[dir] || // fallback to seeking `elem` from the start (diff = nodeindex = 0) || start.pop())) { // when found, cache indexes on `parent` and break if (node.nodetype === 1 && ++diff && node === elem) { uniquecache[type] = [dirruns, nodeindex, diff]; break; } } } else { // use previously-cached element index if available if (usecache) { // ...in a gzip-friendly way node = elem; outercache = node[expando] || (node[expando] = {}); // support: ie <9 only // defend against cloned attroperties (jquery gh-1709) uniquecache = outercache[node.uniqueid] || (outercache[node.uniqueid] = {}); cache = uniquecache[type] || []; nodeindex = cache[0] === dirruns && cache[1]; diff = nodeindex; } // xml :nth-child(...) // or :nth-last-child(...) or :nth(-last)?-of-type(...) if (diff === false) { // use the same loop as above to seek `elem` from the start while ((node = ++nodeindex && node && node[dir] || (diff = nodeindex = 0) || start.pop())) { if ((oftype ? node.nodename.tolowercase() === name : node.nodetype === 1) && ++diff) { // cache the index of each encountered element if (usecache) { outercache = node[expando] || (node[expando] = {}); // support: ie <9 only // defend against cloned attroperties (jquery gh-1709) uniquecache = outercache[node.uniqueid] || (outercache[node.uniqueid] = {}); uniquecache[type] = [dirruns, diff]; } if (node === elem) { break; } } } } } // incorporate the offset, then check against cycle size diff -= last; return diff === first || (diff % first === 0 && diff / first >= 0); } }; }, "pseudo": function (pseudo, argument) { // pseudo-class names are case-insensitive // http://www.w3.org/tr/selectors/#pseudo-classes // prioritize by case sensitivity in case custom pseudos are added with uppercase letters // remember that setfilters inherits from pseudos var args, fn = expr.pseudos[pseudo] || expr.setfilters[pseudo.tolowercase()] || sizzle.error("unsupported pseudo: " + pseudo); // the user may use createpseudo to indicate that // arguments are needed to create the filter function // just as sizzle does if (fn[expando]) { return fn(argument); } // but maintain support for old signatures if (fn.length > 1) { args = [pseudo, pseudo, "", argument]; return expr.setfilters.hasownproperty(pseudo.tolowercase()) ? markfunction(function (seed, matches) { var idx, matched = fn(seed, argument), i = matched.length; while (i--) { idx = indexof(seed, matched[i]); seed[idx] = !(matches[idx] = matched[i]); } }) : function (elem) { return fn(elem, 0, args); }; } return fn; } }, pseudos: { // potentially complex pseudos "not": markfunction(function (selector) { // trim the selector passed to compile // to avoid treating leading and trailing // spaces as combinators var input = [], results = [], matcher = compile(selector.replace(rtrim, "$1")); return matcher[expando] ? markfunction(function (seed, matches, context, xml) { var elem, unmatched = matcher(seed, null, xml, []), i = seed.length; // match elements unmatched by `matcher` while (i--) { if ((elem = unmatched[i])) { seed[i] = !(matches[i] = elem); } } }) : function (elem, context, xml) { input[0] = elem; matcher(input, null, xml, results); // don't keep the element (issue #299) input[0] = null; return !results.pop(); }; }), "has": markfunction(function (selector) { return function (elem) { return sizzle(selector, elem).length > 0; }; }), "contains": markfunction(function (text) { text = text.replace(runescape, funescape); return function (elem) { return (elem.textcontent || elem.innertext || gettext(elem)).indexof(text) > -1; }; }), // "whether an element is represented by a :lang() selector // is based solely on the element's language value // being equal to the identifier c, // or beginning with the identifier c immediately followed by "-". // the matching of c against the element's language value is performed case-insensitively. // the identifier c does not have to be a valid language name." // http://www.w3.org/tr/selectors/#lang-pseudo "lang": markfunction(function (lang) { // lang value must be a valid identifier if (!ridentifier.test(lang || "")) { sizzle.error("unsupported lang: " + lang); } lang = lang.replace(runescape, funescape).tolowercase(); return function (elem) { var elemlang; do { if ((elemlang = documentishtml ? elem.lang : elem.getattribute("xml:lang") || elem.getattribute("lang"))) { elemlang = elemlang.tolowercase(); return elemlang === lang || elemlang.indexof(lang + "-") === 0; } } while ((elem = elem.parentnode) && elem.nodetype === 1); return false; }; }), // miscellaneous "target": function (elem) { var hash = window.location && window.location.hash; return hash && hash.slice(1) === elem.id; }, "root": function (elem) { return elem === docelem; }, "focus": function (elem) { return elem === document.activeelement && (!document.hasfocus || document.hasfocus()) && !!(elem.type || elem.href || ~elem.tabindex); }, // boolean properties "enabled": function (elem) { return elem.disabled === false; }, "disabled": function (elem) { return elem.disabled === true; }, "checked": function (elem) { // in css3, :checked should return both checked and selected elements // http://www.w3.org/tr/2011/rec-css3-selectors-20110929/#checked var nodename = elem.nodename.tolowercase(); return (nodename === "input" && !!elem.checked) || (nodename === "option" && !!elem.selected); }, "selected": function (elem) { // accessing this property makes selected-by-default // options in safari work properly if (elem.parentnode) { elem.parentnode.selectedindex; } return elem.selected === true; }, // contents "empty": function (elem) { // http://www.w3.org/tr/selectors/#empty-pseudo // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), // but not by others (comment: 8; processing instruction: 7; etc.) // nodetype < 6 works because attributes (2) do not appear as children for (elem = elem.firstchild; elem; elem = elem.nextsibling) { if (elem.nodetype < 6) { return false; } } return true; }, "parent": function (elem) { return !expr.pseudos["empty"](elem); }, // element/input types "header": function (elem) { return rheader.test(elem.nodename); }, "input": function (elem) { return rinputs.test(elem.nodename); }, "button": function (elem) { var name = elem.nodename.tolowercase(); return name === "input" && elem.type === "button" || name === "button"; }, "text": function (elem) { var attr; return elem.nodename.tolowercase() === "input" && elem.type === "text" && // support: ie<8 // new html5 attribute values (e.g., "search") appear with elem.type === "text" ((attr = elem.getattribute("type")) == null || attr.tolowercase() === "text"); }, // position-in-collection "first": createpositionalpseudo(function () { return [0]; }), "last": createpositionalpseudo(function (matchindexes, length) { return [length - 1]; }), "eq": createpositionalpseudo(function (matchindexes, length, argument) { return [argument < 0 ? argument + length : argument]; }), "even": createpositionalpseudo(function (matchindexes, length) { var i = 0; for (; i < length; i += 2) { matchindexes.push(i); } return matchindexes; }), "odd": createpositionalpseudo(function (matchindexes, length) { var i = 1; for (; i < length; i += 2) { matchindexes.push(i); } return matchindexes; }), "lt": createpositionalpseudo(function (matchindexes, length, argument) { var i = argument < 0 ? argument + length : argument; for (; --i >= 0;) { matchindexes.push(i); } return matchindexes; }), "gt": createpositionalpseudo(function (matchindexes, length, argument) { var i = argument < 0 ? argument + length : argument; for (; ++i < length;) { matchindexes.push(i); } return matchindexes; }) } }; expr.pseudos["nth"] = expr.pseudos["eq"]; // add button/input type pseudos for (i in { radio: true, checkbox: true, file: true, password: true, image: true }) { expr.pseudos[i] = createinputpseudo(i); } for (i in { submit: true, reset: true }) { expr.pseudos[i] = createbuttonpseudo(i); } // easy api for creating new setfilters function setfilters() {} setfilters.prototype = expr.filters = expr.pseudos; expr.setfilters = new setfilters(); tokenize = sizzle.tokenize = function (selector, parseonly) { var matched, match, tokens, type, sofar, groups, prefilters, cached = tokencache[selector + " "]; if (cached) { return parseonly ? 0 : cached.slice(0); } sofar = selector; groups = []; prefilters = expr.prefilter; while (sofar) { // comma and first run if (!matched || (match = rcomma.exec(sofar))) { if (match) { // don't consume trailing commas as valid sofar = sofar.slice(match[0].length) || sofar; } groups.push((tokens = [])); } matched = false; // combinators if ((match = rcombinators.exec(sofar))) { matched = match.shift(); tokens.push({ value: matched, // cast descendant combinators to space type: match[0].replace(rtrim, " ") }); sofar = sofar.slice(matched.length); } // filters for (type in expr.filter) { if ((match = matchexpr[type].exec(sofar)) && (!prefilters[type] || (match = prefilters[type](match)))) { matched = match.shift(); tokens.push({ value: matched, type: type, matches: match }); sofar = sofar.slice(matched.length); } } if (!matched) { break; } } // return the length of the invalid excess // if we're just parsing // otherwise, throw an error or return tokens return parseonly ? sofar.length : sofar ? sizzle.error(selector) : // cache the tokens tokencache(selector, groups).slice(0); }; function toselector(tokens) { var i = 0, len = tokens.length, selector = ""; for (; i < len; i++) { selector += tokens[i].value; } return selector; } function addcombinator(matcher, combinator, base) { var dir = combinator.dir, checknonelements = base && dir === "parentnode", donename = done++; return combinator.first ? // check against closest ancestor/preceding element function (elem, context, xml) { while ((elem = elem[dir])) { if (elem.nodetype === 1 || checknonelements) { return matcher(elem, context, xml); } } } : // check against all ancestor/preceding elements function (elem, context, xml) { var oldcache, uniquecache, outercache, newcache = [dirruns, donename]; // we can't set arbitrary data on xml nodes, so they don't benefit from combinator caching if (xml) { while ((elem = elem[dir])) { if (elem.nodetype === 1 || checknonelements) { if (matcher(elem, context, xml)) { return true; } } } } else { while ((elem = elem[dir])) { if (elem.nodetype === 1 || checknonelements) { outercache = elem[expando] || (elem[expando] = {}); // support: ie <9 only // defend against cloned attroperties (jquery gh-1709) uniquecache = outercache[elem.uniqueid] || (outercache[elem.uniqueid] = {}); if ((oldcache = uniquecache[dir]) && oldcache[0] === dirruns && oldcache[1] === donename) { // assign to newcache so results back-propagate to previous elements return (newcache[2] = oldcache[2]); } else { // reuse newcache so results back-propagate to previous elements uniquecache[dir] = newcache; // a match means we're done; a fail means we have to keep checking if ((newcache[2] = matcher(elem, context, xml))) { return true; } } } } } }; } function elementmatcher(matchers) { return matchers.length > 1 ? function (elem, context, xml) { var i = matchers.length; while (i--) { if (!matchers[i](elem, context, xml)) { return false; } } return true; } : matchers[0]; } function multiplecontexts(selector, contexts, results) { var i = 0, len = contexts.length; for (; i < len; i++) { sizzle(selector, contexts[i], results); } return results; } function condense(unmatched, map, filter, context, xml) { var elem, newunmatched = [], i = 0, len = unmatched.length, mapped = map != null; for (; i < len; i++) { if ((elem = unmatched[i])) { if (!filter || filter(elem, context, xml)) { newunmatched.push(elem); if (mapped) { map.push(i); } } } } return newunmatched; } function setmatcher(prefilter, selector, matcher, postfilter, postfinder, postselector) { if (postfilter && !postfilter[expando]) { postfilter = setmatcher(postfilter); } if (postfinder && !postfinder[expando]) { postfinder = setmatcher(postfinder, postselector); } return markfunction(function (seed, results, context, xml) { var temp, i, elem, premap = [], postmap = [], preexisting = results.length, // get initial elements from seed or context elems = seed || multiplecontexts(selector || "*", context.nodetype ? [context] : context, []), // prefilter to get matcher input, preserving a map for seed-results synchronization matcherin = prefilter && (seed || !selector) ? condense(elems, premap, prefilter, context, xml) : elems, matcherout = matcher ? // if we have a postfinder, or filtered seed, or non-seed postfilter or preexisting results, postfinder || (seed ? prefilter : preexisting || postfilter) ? // ...intermediate processing is necessary [] : // ...otherwise use results directly results : matcherin; // find primary matches if (matcher) { matcher(matcherin, matcherout, context, xml); } // apply postfilter if (postfilter) { temp = condense(matcherout, postmap); postfilter(temp, [], context, xml); // un-match failing elements by moving them back to matcherin i = temp.length; while (i--) { if ((elem = temp[i])) { matcherout[postmap[i]] = !(matcherin[postmap[i]] = elem); } } } if (seed) { if (postfinder || prefilter) { if (postfinder) { // get the final matcherout by condensing this intermediate into postfinder contexts temp = []; i = matcherout.length; while (i--) { if ((elem = matcherout[i])) { // restore matcherin since elem is not yet a final match temp.push((matcherin[i] = elem)); } } postfinder(null, (matcherout = []), temp, xml); } // move matched elements from seed to results to keep them synchronized i = matcherout.length; while (i--) { if ((elem = matcherout[i]) && (temp = postfinder ? indexof(seed, elem) : premap[i]) > -1) { seed[temp] = !(results[temp] = elem); } } } // add elements to results, through postfinder if defined } else { matcherout = condense( matcherout === results ? matcherout.splice(preexisting, matcherout.length) : matcherout ); if (postfinder) { postfinder(null, results, matcherout, xml); } else { push.apply(results, matcherout); } } }); } function matcherfromtokens(tokens) { var checkcontext, matcher, j, len = tokens.length, leadingrelative = expr.relative[tokens[0].type], implicitrelative = leadingrelative || expr.relative[" "], i = leadingrelative ? 1 : 0, // the foundational matcher ensures that elements are reachable from top-level context(s) matchcontext = addcombinator(function (elem) { return elem === checkcontext; }, implicitrelative, true), matchanycontext = addcombinator(function (elem) { return indexof(checkcontext, elem) > -1; }, implicitrelative, true), matchers = [ function (elem, context, xml) { var ret = (!leadingrelative && (xml || context !== outermostcontext)) || ( (checkcontext = context).nodetype ? matchcontext(elem, context, xml) : matchanycontext(elem, context, xml)); // avoid hanging onto element (issue #299) checkcontext = null; return ret; } ]; for (; i < len; i++) { if ((matcher = expr.relative[tokens[i].type])) { matchers = [addcombinator(elementmatcher(matchers), matcher)]; } else { matcher = expr.filter[tokens[i].type].apply(null, tokens[i].matches); // return special upon seeing a positional matcher if (matcher[expando]) { // find the next relative operator (if any) for proper handling j = ++i; for (; j < len; j++) { if (expr.relative[tokens[j].type]) { break; } } return setmatcher( i > 1 && elementmatcher(matchers), i > 1 && toselector( // if the preceding token was a descendant combinator, insert an implicit any-element `*` tokens.slice(0, i - 1).concat({ value: tokens[i - 2].type === " " ? "*" : "" }) ).replace(rtrim, "$1"), matcher, i < j && matcherfromtokens(tokens.slice(i, j)), j < len && matcherfromtokens((tokens = tokens.slice(j))), j < len && toselector(tokens) ); } matchers.push(matcher); } } return elementmatcher(matchers); } function matcherfromgroupmatchers(elementmatchers, setmatchers) { var byset = setmatchers.length > 0, byelement = elementmatchers.length > 0, supermatcher = function (seed, context, xml, results, outermost) { var elem, j, matcher, matchedcount = 0, i = "0", unmatched = seed && [], setmatched = [], contextbackup = outermostcontext, // we must always have either seed elements or outermost context elems = seed || byelement && expr.find["tag"]("*", outermost), // use integer dirruns iff this is the outermost matcher dirrunsunique = (dirruns += contextbackup == null ? 1 : math.random() || 0.1), len = elems.length; if (outermost) { outermostcontext = context === document || context || outermost; } // add elements passing elementmatchers directly to results // support: ie<9, safari // tolerate nodelist properties (ie: "length"; safari: ) matching elements by id for (; i !== len && (elem = elems[i]) != null; i++) { if (byelement && elem) { j = 0; if (!context && elem.ownerdocument !== document) { setdocument(elem); xml = !documentishtml; } while ((matcher = elementmatchers[j++])) { if (matcher(elem, context || document, xml)) { results.push(elem); break; } } if (outermost) { dirruns = dirrunsunique; } } // track unmatched elements for set filters if (byset) { // they will have gone through all possible matchers if ((elem = !matcher && elem)) { matchedcount--; } // lengthen the array for every element, matched or not if (seed) { unmatched.push(elem); } } } // `i` is now the count of elements visited above, and adding it to `matchedcount` // makes the latter nonnegative. matchedcount += i; // apply set filters to unmatched elements // note: this can be skipped if there are no unmatched elements (i.e., `matchedcount` // equals `i`), unless we didn't visit _any_ elements in the above loop because we have // no element matchers and no seed. // incrementing an initially-string "0" `i` allows `i` to remain a string only in that // case, which will result in a "00" `matchedcount` that differs from `i` but is also // numerically zero. if (byset && i !== matchedcount) { j = 0; while ((matcher = setmatchers[j++])) { matcher(unmatched, setmatched, context, xml); } if (seed) { // reintegrate element matches to eliminate the need for sorting if (matchedcount > 0) { while (i--) { if (!(unmatched[i] || setmatched[i])) { setmatched[i] = pop.call(results); } } } // discard index placeholder values to get only actual matches setmatched = condense(setmatched); } // add matches to results push.apply(results, setmatched); // seedless set matches succeeding multiple successful matchers stipulate sorting if (outermost && !seed && setmatched.length > 0 && (matchedcount + setmatchers.length) > 1) { sizzle.uniquesort(results); } } // override manipulation of globals by nested matchers if (outermost) { dirruns = dirrunsunique; outermostcontext = contextbackup; } return unmatched; }; return byset ? markfunction(supermatcher) : supermatcher; } compile = sizzle.compile = function (selector, match /* internal use only */) { var i, setmatchers = [], elementmatchers = [], cached = compilercache[selector + " "]; if (!cached) { // generate a function of recursive functions that can be used to check each element if (!match) { match = tokenize(selector); } i = match.length; while (i--) { cached = matcherfromtokens(match[i]); if (cached[expando]) { setmatchers.push(cached); } else { elementmatchers.push(cached); } } // cache the compiled function cached = compilercache(selector, matcherfromgroupmatchers(elementmatchers, setmatchers)); // save selector and tokenization cached.selector = selector; } return cached; }; /** * a low-level selection function that works with sizzle's compiled * selector functions * @param {string|function} selector a selector or a pre-compiled * selector function built with sizzle.compile * @param {element} context * @param {array} [results] * @param {array} [seed] a set of elements to match against */ select = sizzle.select = function (selector, context, results, seed) { var i, tokens, token, type, find, compiled = typeof selector === "function" && selector, match = !seed && tokenize((selector = compiled.selector || selector)); results = results || []; // try to minimize operations if there is only one selector in the list and no seed // (the latter of which guarantees us context) if (match.length === 1) { // reduce context if the leading compound selector is an id tokens = match[0] = match[0].slice(0); if (tokens.length > 2 && (token = tokens[0]).type === "id" && support.getbyid && context.nodetype === 9 && documentishtml && expr.relative[tokens[1].type]) { context = (expr.find["id"](token.matches[0].replace(runescape, funescape), context) || [])[0]; if (!context) { return results; // precompiled matchers will still verify ancestry, so step up a level } else if (compiled) { context = context.parentnode; } selector = selector.slice(tokens.shift().value.length); } // fetch a seed set for right-to-left matching i = matchexpr["needscontext"].test(selector) ? 0 : tokens.length; while (i--) { token = tokens[i]; // abort if we hit a combinator if (expr.relative[(type = token.type)]) { break; } if ((find = expr.find[type])) { // search, expanding context for leading sibling combinators if ((seed = find( token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testcontext(context.parentnode) || context ))) { // if seed is empty or no tokens remain, we can return early tokens.splice(i, 1); selector = seed.length && toselector(tokens); if (!selector) { push.apply(results, seed); return results; } break; } } } } // compile and execute a filtering function if one is not provided // provide `match` to avoid retokenization if we modified the selector above (compiled || compile(selector, match))( seed, context, !documentishtml, results, !context || rsibling.test(selector) && testcontext(context.parentnode) || context ); return results; }; // one-time assignments // sort stability support.sortstable = expando.split("").sort(sortorder).join("") === expando; // support: chrome 14-35+ // always assume duplicates if they aren't passed to the comparison function support.detectduplicates = !!hasduplicate; // initialize against the default document setdocument(); // support: webkit<537.32 - safari 6.0.3/chrome 25 (fixed in chrome 27) // detached nodes confoundingly follow *each other* support.sortdetached = assert(function (div1) { // should return 1, but returns 4 (following) return div1.comparedocumentposition(document.createelement("div")) & 1; }); // support: ie<8 // prevent attribute/property "interpolation" // http://msdn.microsoft.com/en-us/library/ms536429%28vs.85%29.aspx if (!assert(function (div) { div.innerhtml = ""; return div.firstchild.getattribute("href") === "#"; })) { addhandle("type|href|height|width", function (elem, name, isxml) { if (!isxml) { return elem.getattribute(name, name.tolowercase() === "type" ? 1 : 2); } }); } // support: ie<9 // use defaultvalue in place of getattribute("value") if (!support.attributes || !assert(function (div) { div.innerhtml = ""; div.firstchild.setattribute("value", ""); return div.firstchild.getattribute("value") === ""; })) { addhandle("value", function (elem, name, isxml) { if (!isxml && elem.nodename.tolowercase() === "input") { return elem.defaultvalue; } }); } // support: ie<9 // use getattributenode to fetch booleans when getattribute lies if (!assert(function (div) { return div.getattribute("disabled") == null; })) { addhandle(booleans, function (elem, name, isxml) { var val; if (!isxml) { return elem[name] === true ? name.tolowercase() : (val = elem.getattributenode(name)) && val.specified ? val.value : null; } }); } return sizzle; })(window); jquery.find = sizzle; jquery.expr = sizzle.selectors; jquery.expr[":"] = jquery.expr.pseudos; jquery.uniquesort = jquery.unique = sizzle.uniquesort; jquery.text = sizzle.gettext; jquery.isxmldoc = sizzle.isxml; jquery.contains = sizzle.contains; var dir = function (elem, dir, until) { var matched = [], truncate = until !== undefined; while ((elem = elem[dir]) && elem.nodetype !== 9) { if (elem.nodetype === 1) { if (truncate && jquery(elem).is(until)) { break; } matched.push(elem); } } return matched; }; var siblings = function (n, elem) { var matched = []; for (; n; n = n.nextsibling) { if (n.nodetype === 1 && n !== elem) { matched.push(n); } } return matched; }; var rneedscontext = jquery.expr.match.needscontext; var rsingletag = (/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/); var rissimple = /^.[^:#\[\.,]*$/; // implement the identical functionality for filter and not function winnow(elements, qualifier, not) { if (jquery.isfunction(qualifier)) { return jquery.grep(elements, function (elem, i) { /* jshint -w018 */ return !!qualifier.call(elem, i, elem) !== not; }); } if (qualifier.nodetype) { return jquery.grep(elements, function (elem) { return (elem === qualifier) !== not; }); } if (typeof qualifier === "string") { if (rissimple.test(qualifier)) { return jquery.filter(qualifier, elements, not); } qualifier = jquery.filter(qualifier, elements); } return jquery.grep(elements, function (elem) { return (jquery.inarray(elem, qualifier) > -1) !== not; }); } jquery.filter = function (expr, elems, not) { var elem = elems[0]; if (not) { expr = ":not(" + expr + ")"; } return elems.length === 1 && elem.nodetype === 1 ? jquery.find.matchesselector(elem, expr) ? [elem] : [] : jquery.find.matches(expr, jquery.grep(elems, function (elem) { return elem.nodetype === 1; })); }; jquery.fn.extend({ find: function (selector) { var i, 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, // a simple way to check for html strings // prioritize #id over to avoid xss via location.hash (#9521) // strict html recognition (#11290: must start with <) rquickexpr = /^(?:\s*(<[\w\w]+>)[^>]*|#([\w-]*))$/, init = jquery.fn.init = function (selector, context, root) { var match, elem; // handle: $(""), $(null), $(undefined), $(false) if (!selector) { return this; } // init accepts an alternate rootjquery // so migrate can support jquery.sub (gh-2101) root = root || rootjquery; // handle html strings if (typeof selector === "string") { if (selector.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 || root).find(selector); // handle: $(expr, context) // (which is just equivalent to: $(context).find(expr) } else { return this.constructor(context).find(selector); } // handle: $(domelement) } else if (selector.nodetype) { this.context = this[0] = selector; this.length = 1; return this; // handle: $(function) // shortcut for document ready } else if (jquery.isfunction(selector)) { return typeof root.ready !== "undefined" ? root.ready(selector) : // execute immediately if ready is not present selector(jquery); } if (selector.selector !== undefined) { this.selector = selector.selector; this.context = selector.context; } return jquery.makearray(selector, this); }; // give the init function the jquery prototype for later instantiation init.prototype = jquery.fn; // initialize central reference rootjquery = jquery(document); var rparentsprev = /^(?:parents|prev(?:until|all))/, // methods guaranteed to produce a unique set when starting from a unique set guaranteedunique = { children: true, contents: true, next: true, prev: true }; jquery.fn.extend({ has: function (target) { var 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.uniquesort(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.uniquesort( jquery.merge(this.get(), jquery(selector, context)) ) ); }, addback: function (selector) { return this.add(selector == null ? this.prevobject : this.prevobject.filter(selector) ); } }); function sibling(cur, dir) { 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 dir(elem, "parentnode"); }, parentsuntil: function (elem, i, until) { return dir(elem, "parentnode", until); }, next: function (elem) { return sibling(elem, "nextsibling"); }, prev: function (elem) { return sibling(elem, "previoussibling"); }, nextall: function (elem) { return dir(elem, "nextsibling"); }, prevall: function (elem) { return dir(elem, "previoussibling"); }, nextuntil: function (elem, i, until) { return dir(elem, "nextsibling", until); }, prevuntil: function (elem, i, until) { return dir(elem, "previoussibling", until); }, siblings: function (elem) { return siblings((elem.parentnode || {}).firstchild, elem); }, children: function (elem) { return siblings(elem.firstchild); }, contents: function (elem) { return 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.uniquesort(ret); } // reverse order for parents* and prev-derivatives if (rparentsprev.test(name)) { ret = ret.reverse(); } } return this.pushstack(ret); }; }); var rnotwhite = (/\s+/g); // convert string-formatted options into object-formatted ones function createoptions(options) { var object = {}; jquery.each(options.match(rnotwhite) || [], function (_, flag) { object[flag] = true; }); return object; } /* * create a callback list using the following parameters: * * options: an optional list of space-separated options that will change how * the callback list behaves or a more traditional option object * * by default a callback list will act like an event callback list and can be * "fired" multiple times. * * possible options: * * once: will ensure the callback list can only be fired once (like a deferred) * * memory: will keep track of previous values and will call any callback added * after the list has been fired right away with the latest "memorized" * values (like a deferred) * * unique: will ensure a callback can only be added once (no duplicate in the list) * * stoponfalse: interrupt callings when a callback returns false * */ jquery.callbacks = function (options) { // convert options from string-formatted to object-formatted if needed // (we check in cache first) options = typeof options === "string" ? createoptions(options) : jquery.extend({}, options); var // flag to know if list is currently firing firing, // last fire value for non-forgettable lists memory, // flag to know if list was already fired fired, // flag to prevent firing locked, // actual callback list list = [], // queue of execution data for repeatable lists queue = [], // index of currently firing callback (modified by add/remove as needed) firingindex = -1, // fire callbacks fire = function () { // enforce single-firing locked = options.once; // execute callbacks for all pending executions, // respecting firingindex overrides and runtime changes fired = firing = true; for (; queue.length; firingindex = -1) { memory = queue.shift(); while (++firingindex < list.length) { // run callback and check for early termination if (list[firingindex].apply(memory[0], memory[1]) === false && options.stoponfalse) { // jump to end and forget the data so .add doesn't re-fire firingindex = list.length; memory = false; } } } // forget the data if we're done with it if (!options.memory) { memory = false; } firing = false; // clean up if we're done firing for good if (locked) { // keep an empty list if we have data for future add calls if (memory) { list = []; // otherwise, this object is spent } else { list = ""; } } }, // actual callbacks object self = { // add a callback or a collection of callbacks to the list add: function () { if (list) { // if we have memory from a past run, we should fire after adding if (memory && !firing) { firingindex = list.length - 1; queue.push(memory); } (function add(args) { jquery.each(args, function (_, arg) { if (jquery.isfunction(arg)) { if (!options.unique || !self.has(arg)) { list.push(arg); } } else if (arg && arg.length && jquery.type(arg) !== "string") { // inspect recursively add(arg); } }); })(arguments); if (memory && !firing) { fire(); } } return this; }, // remove a callback from the list remove: function () { jquery.each(arguments, function (_, arg) { var index; while ((index = jquery.inarray(arg, list, index)) > -1) { list.splice(index, 1); // handle firing indexes if (index <= firingindex) { firingindex--; } } }); return this; }, // check if a given callback is in the list. // if no argument is given, return whether or not list has callbacks attached. has: function (fn) { return fn ? jquery.inarray(fn, list) > -1 : list.length > 0; }, // remove all callbacks from the list empty: function () { if (list) { list = []; } return this; }, // disable .fire and .add // abort any current/pending executions // clear all callbacks and values disable: function () { locked = queue = []; list = memory = ""; return this; }, disabled: function () { return !list; }, // disable .fire // also disable .add unless we have memory (since it would have no effect) // abort any pending executions lock: function () { locked = true; if (!memory) { self.disable(); } return this; }, locked: function () { return !!locked; }, // call all callbacks with the given context and arguments firewith: function (context, args) { if (!locked) { args = args || []; args = [context, args.slice ? args.slice() : args]; queue.push(args); if (!firing) { fire(); } } return this; }, // call all the callbacks with the given arguments fire: function () { self.firewith(this, arguments); return this; }, // to know if the callbacks have already been called at least once fired: function () { return !!fired; } }; return self; }; jquery.extend({ deferred: function (func) { var tuples = [ // action, add listener, listener list, final state ["resolve", "done", jquery.callbacks("once memory"), "resolved"], ["reject", "fail", jquery.callbacks("once memory"), "rejected"], ["notify", "progress", jquery.callbacks("memory")] ], state = "pending", promise = { state: function () { return state; }, always: function () { deferred.done(arguments).fail(arguments); return this; }, then: function (/* fndone, fnfail, fnprogress */ ) { var fns = arguments; return jquery.deferred(function (newdefer) { jquery.each(tuples, function (i, tuple) { var fn = jquery.isfunction(fns[i]) && fns[i]; // deferred[ done | fail | progress ] for forwarding actions to newdefer deferred[tuple[1]](function () { var returned = fn && fn.apply(this, arguments); if (returned && jquery.isfunction(returned.promise)) { returned.promise() .progress(newdefer.notify) .done(newdefer.resolve) .fail(newdefer.reject); } else { newdefer[tuple[0] + "with"]( this === promise ? newdefer.promise() : this, fn ? [returned] : arguments ); } }); }); fns = null; }).promise(); }, // get a promise for this deferred // if obj is provided, the promise aspect is added to the object promise: function (obj) { return obj != null ? jquery.extend(obj, promise) : promise; } }, deferred = {}; // keep pipe for back-compat promise.pipe = promise.then; // add list-specific methods jquery.each(tuples, function (i, tuple) { var list = tuple[2], statestring = tuple[3]; // promise[ done | fail | progress ] = list.add promise[tuple[1]] = list.add; // handle state if (statestring) { list.add(function () { // state = [ resolved | rejected ] state = statestring; // [ reject_list | resolve_list ].disable; progress_list.lock }, tuples[i ^ 1][2].disable, tuples[2][2].lock); } // deferred[ resolve | reject | notify ] deferred[tuple[0]] = function () { deferred[tuple[0] + "with"](this === deferred ? promise : this, arguments); return this; }; deferred[tuple[0] + "with"] = list.firewith; }); // make the deferred a promise promise.promise(deferred); // call given func if any if (func) { func.call(deferred, deferred); } // all done! return deferred; }, // deferred helper when: function (subordinate /* , ..., subordinaten */) { var i = 0, resolvevalues = slice.call(arguments), length = resolvevalues.length, // the count of uncompleted subordinates remaining = length !== 1 || (subordinate && jquery.isfunction(subordinate.promise)) ? length : 0, // the master deferred. // if resolvevalues consist of only a single deferred, just use that. deferred = remaining === 1 ? subordinate : jquery.deferred(), // update function for both resolve and progress values updatefunc = function (i, contexts, values) { return function (value) { contexts[i] = this; values[i] = arguments.length > 1 ? slice.call(arguments) : value; if (values === progressvalues) { deferred.notifywith(contexts, values); } else if (!(--remaining)) { deferred.resolvewith(contexts, values); } }; }, progressvalues, progresscontexts, resolvecontexts; // add listeners to deferred subordinates; treat others as resolved if (length > 1) { progressvalues = new array(length); progresscontexts = new array(length); resolvecontexts = new array(length); for (; i < length; i++) { if (resolvevalues[i] && jquery.isfunction(resolvevalues[i].promise)) { resolvevalues[i].promise() .progress(updatefunc(i, progresscontexts, progressvalues)) .done(updatefunc(i, resolvecontexts, resolvevalues)) .fail(deferred.reject); } else { --remaining; } } } // if we're not waiting on anything, resolve the master if (!remaining) { deferred.resolvewith(resolvecontexts, resolvevalues); } return deferred.promise(); } }); // the deferred used on dom ready var readylist; jquery.fn.ready = function (fn) { // add the callback jquery.ready.promise().done(fn); return this; }; jquery.extend({ // is the dom ready to be used? set to true once it occurs. isready: false, // a counter to track how many items to wait for before // the ready event fires. see #6781 readywait: 1, // hold (or release) the ready event holdready: function (hold) { if (hold) { jquery.readywait++; } else { jquery.ready(true); } }, // handle when the dom is ready ready: function (wait) { // abort if there are pending holds or we're already ready if (wait === true ? --jquery.readywait : jquery.isready) { return; } // remember that the dom is ready jquery.isready = true; // if a normal dom ready event fired, decrement, and wait if need be if (wait !== true && --jquery.readywait > 0) { return; } // if there are functions bound, to execute readylist.resolvewith(document, [jquery]); // trigger any bound ready events if (jquery.fn.triggerhandler) { jquery(document).triggerhandler("ready"); jquery(document).off("ready"); } } }); /** * clean-up method for dom ready events */ function detach() { if (document.addeventlistener) { document.removeeventlistener("domcontentloaded", completed); window.removeeventlistener("load", completed); } 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 || window.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. // support: ie6-10 // older ie sometimes signals "interactive" too soon if (document.readystate === "complete" || (document.readystate !== "loading" && !document.documentelement.doscroll)) { // handle it asynchronously to allow scripts the opportunity to delay ready window.settimeout(jquery.ready); // standards-based browsers support domcontentloaded } else if (document.addeventlistener) { // use the handy event callback document.addeventlistener("domcontentloaded", completed); // a fallback to window.onload, that will always work window.addeventlistener("load", completed); // 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 window.settimeout(doscrollcheck, 50); } // detach all dom ready events detach(); // and execute any waiting functions jquery.ready(); } })(); } } } return readylist.promise(obj); }; // kick off the dom ready check even if the user does not jquery.ready.promise(); // support: ie<9 // iteration over object's inherited properties before its own var i; for (i in jquery(support)) { break; } support.ownfirst = 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 !== "undefined") { // 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"); // support: ie<9 support.deleteexpando = true; try { delete div.test; } catch (e) { support.deleteexpando = false; } // null elements to avoid leaks in ie. div = null; })(); var 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 (!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 (!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, undefined } else { cache[id] = undefined; } } 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); } }); (function () { var shrinkwrapblocksval; support.shrinkwrapblocks = function () { if (shrinkwrapblocksval != null) { return shrinkwrapblocksval; } // will be changed later if needed. shrinkwrapblocksval = false; // minified: var b,c,d var div, body, container; body = document.getelementsbytagname("body")[0]; if (!body || !body.style) { // test fired too early or in an unsupported environment, exit. 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); // support: ie6 // check if elements with layout shrink-wrap their children if (typeof div.style.zoom !== "undefined") { // reset css: box-sizing; display; margin; border div.style.csstext = // support: firefox<29, android 2.3 // vendor-prefix box-sizing "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + "box-sizing:content-box;display:block;margin:0;border:0;" + "padding:1px;width:1px;zoom:1"; div.appendchild(document.createelement("div")).style.width = "5px"; shrinkwrapblocksval = div.offsetwidth !== 3; } body.removechild(container); return shrinkwrapblocksval; }; })(); var pnum = (/[+-]?(?:\d*\.|)\d+(?:[ee][+-]?\d+|)/).source; var rcssnum = new regexp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i"); var cssexpand = ["top", "right", "bottom", "left"]; var ishidden = function (elem, el) { // ishidden might be called from jquery#filter function; // in that case, element will be second argument elem = el || elem; return jquery.css(elem, "display") === "none" || !jquery.contains(elem.ownerdocument, elem); }; function adjustcss(elem, prop, valueparts, tween) { var adjusted, scale = 1, maxiterations = 20, currentvalue = tween ? function () { return tween.cur(); } : function () { return jquery.css(elem, prop, ""); }, initial = currentvalue(), unit = valueparts && valueparts[3] || (jquery.cssnumber[prop] ? "" : "px"), // starting value computation is required for potential unit mismatches initialinunit = (jquery.cssnumber[prop] || unit !== "px" && +initial) && rcssnum.exec(jquery.css(elem, prop)); if (initialinunit && initialinunit[3] !== unit) { // trust units reported by jquery.css unit = unit || initialinunit[3]; // make sure we update the tween properties later on valueparts = valueparts || []; // iteratively approximate from a nonzero starting point initialinunit = +initial || 1; do { // if previous iteration zeroed out, double until we get *something*. // use string for doubling so we don't accidentally see scale as unchanged below scale = scale || ".5"; // adjust and apply initialinunit = initialinunit / scale; jquery.style(elem, prop, initialinunit + unit); // update scale, tolerating zero or nan from tween.cur() // break the loop if scale is unchanged or perfect, or if we've just had enough. } while ( scale !== (scale = currentvalue() / initial) && scale !== 1 && --maxiterations ); } if (valueparts) { initialinunit = +initialinunit || +initial || 0; // apply relative offset (+=/-=) if specified adjusted = valueparts[1] ? initialinunit + (valueparts[1] + 1) * valueparts[2] : +valueparts[2]; if (tween) { tween.unit = unit; tween.start = initialinunit; tween.end = adjusted; } } return adjusted; } // multifunctional method to get and set values of a collection // the value/s can optionally be executed if it's a function var access = function (elems, fn, key, value, chainable, emptyget, raw) { var i = 0, length = elems.length, bulk = key == null; // sets many values if (jquery.type(key) === "object") { chainable = true; for (i in key) { access(elems, fn, i, key[i], true, emptyget, raw); } // sets one value } else if (value !== undefined) { chainable = true; if (!jquery.isfunction(value)) { raw = true; } if (bulk) { // bulk operations run against the entire set if (raw) { fn.call(elems, value); fn = null; // ...except when executing function values } else { bulk = fn; fn = function (elem, key, value) { return bulk.call(jquery(elem), value); }; } } if (fn) { for (; i < 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); var rtagname = (/<([\w:-]+)/); var rscripttype = (/^$|\/(?:java|ecma)script/i); var rleadingwhitespace = (/^\s+/); var nodenames = "abbr|article|aside|audio|bdi|canvas|data|datalist|" + "details|dialog|figcaption|figure|footer|header|hgroup|main|" + "mark|meter|nav|output|picture|progress|section|summary|template|time|video"; function createsafefragment(document) { var list = nodenames.split("|"), safefrag = document.createdocumentfragment(); if (safefrag.createelement) { while (list.length) { safefrag.createelement( list.pop() ); } } return safefrag; } (function () { var div = document.createelement("div"), fragment = document.createdocumentfragment(), input = document.createelement("input"); // 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); // support: windows web apps (wwa) // `name` and `type` must use .setattribute for wwa (#14901) input = document.createelement("input"); input.setattribute("type", "radio"); input.setattribute("checked", "checked"); input.setattribute("name", "t"); div.appendchild(input); // 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 // cloned elements keep attachevent handlers, we use addeventlistener on ie9+ support.nocloneevent = !!div.addeventlistener; // support: ie<9 // since attributes and properties are the same in ie, // cleandata must set properties to undefined rather than use removeattribute div[jquery.expando] = 1; support.attributes = !div.getattribute(jquery.expando); })(); // we have to close these tags to support xhtml (#13200) var wrapmap = { option: [1, ""], legend: [1, "
", "
"], area: [1, "", ""], // support: ie8 param: [1, "", ""], thead: [1, "", "
"], tr: [2, "", "
"], col: [2, "", "
"], td: [3, "", "
"], // ie6-8 can't serialize link, script, style, or any html5 (noscope) tags, // unless wrapped in a div with non-breaking characters in front of it. _default: support.htmlserialize ? [0, "", ""] : [1, "x
", "
"] }; // support: ie8-ie9 wrapmap.optgroup = wrapmap.option; wrapmap.tbody = wrapmap.tfoot = wrapmap.colgroup = wrapmap.caption = wrapmap.thead; wrapmap.th = wrapmap.td; function getall(context, tag) { var elems, elem, i = 0, found = typeof context.getelementsbytagname !== "undefined" ? context.getelementsbytagname(tag || "*") : typeof context.queryselectorall !== "undefined" ? context.queryselectorall(tag || "*") : undefined; if (!found) { for (found = [], elems = context.childnodes || context; (elem = elems[i]) != null; i++ ) { if (!tag || jquery.nodename(elem, tag)) { found.push(elem); } else { jquery.merge(found, getall(elem, tag)); } } } return tag === undefined || tag && jquery.nodename(context, tag) ? jquery.merge([context], found) : found; } // mark scripts as having already been evaluated function setglobaleval(elems, refelements) { var elem, i = 0; for (; (elem = elems[i]) != null; i++) { jquery._data( elem, "globaleval", !refelements || jquery._data(refelements[i], "globaleval") ); } } var rhtml = /<|&#?\w+;/, rtbody = / from table fragments if (!support.tbody) { // string was a , *may* have spurious elem = tag === "table" && !rtbody.test(elem) ? tmp.firstchild : // string was a bare or wrap[1] === "
" && !rtbody.test(elem) ? tmp : 0; j = elem && elem.childnodes.length; while (j--) { if (jquery.nodename((tbody = elem.childnodes[j]), "tbody") && !tbody.childnodes.length) { elem.removechild(tbody); } } } jquery.merge(nodes, tmp.childnodes); // fix #12392 for webkit and ie > 9 tmp.textcontent = ""; // fix #12392 for oldie while (tmp.firstchild) { tmp.removechild(tmp.firstchild); } // remember the top-level container for proper cleanup tmp = safe.lastchild; } } } // fix #11356: clear elements from fragment if (tmp) { safe.removechild(tmp); } // reset defaultchecked for any radios and checkboxes // about to be appended to the dom in ie 6/7 (#8060) if (!support.appendchecked) { jquery.grep(getall(nodes, "input"), fixdefaultchecked); } i = 0; while ((elem = nodes[i++])) { // skip elements already in the context collection (trac-4087) if (selection && jquery.inarray(elem, selection) > -1) { if (ignored) { ignored.push(elem); } continue; } contains = jquery.contains(elem.ownerdocument, elem); // append to fragment tmp = getall(safe.appendchild(elem), "script"); // preserve script evaluation history if (contains) { setglobaleval(tmp); } // capture executables if (scripts) { j = 0; while ((elem = tmp[j++])) { if (rscripttype.test(elem.type || "")) { scripts.push(elem); } } } } tmp = null; return safe; } (function () { var i, eventname, div = document.createelement("div"); // support: ie<9 (lack submit/change bubble), firefox (lack focus(in | out) events) for (i in { submit: true, change: true, focusin: true }) { eventname = "on" + i; if (!(support[i] = eventname in window)) { // beware of csp restrictions (https://developer.mozilla.org/en/security/csp) div.setattribute(eventname, "t"); support[i] = 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|drag|drop)|click/, rfocusmorph = /^(?:focusinfocus|focusoutblur)$/, rtypenamespace = /^([^.]*)(?:\.(.+)|)/; function returntrue() { return true; } function returnfalse() { return false; } // support: ie9 // see #13393 for more info function safeactiveelement() { try { return document.activeelement; } catch (err) { } } function on(elem, types, selector, data, fn, one) { var origfn, type; // types can be a map of types/handlers if (typeof types === "object") { // ( types-object, selector, data ) if (typeof selector !== "string") { // ( types-object, data ) data = data || selector; selector = undefined; } for (type in types) { on(elem, type, selector, data, types[type], one); } return elem; } if (data == null && fn == null) { // ( types, fn ) fn = selector; data = selector = undefined; } else if (fn == null) { if (typeof selector === "string") { // ( types, selector, fn ) fn = data; data = undefined; } else { // ( types, data, fn ) fn = data; data = selector; selector = undefined; } } if (fn === false) { fn = returnfalse; } else if (!fn) { return elem; } if (one === 1) { origfn = fn; fn = function (event) { // can use an empty set, since event contains the info jquery().off(event); return origfn.apply(this, arguments); }; // use same guid so caller can remove using origfn fn.guid = origfn.guid || (origfn.guid = jquery.guid++); } return elem.each(function () { jquery.event.add(this, types, fn, data, selector); }); } /* * helper functions for managing events -- not part of the public interface. * props to dean edwards' addevent library for many of the ideas. */ jquery.event = { global: {}, add: function (elem, types, handler, data, selector) { var 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 !== "undefined" && (!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(".") > -1) { // 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.rnamespace = 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 && 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 ) && 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, j, ret, matched, handleobj, 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.rnamespace || event.rnamespace.test(handleobj.namespace)) { event.handleobj = handleobj; event.data = handleobj.data; ret = ((jquery.event.special[handleobj.origtype] || {}).handle || handleobj.handler).apply(matched.elem, args); if (ret !== undefined) { if ((event.result = ret) === false) { event.preventdefault(); event.stoppropagation(); } } } } } // call the postdispatch hook for the mapped type if (special.postdispatch) { special.postdispatch.call(this, event); } return event.result; }, handlers: function (event, handlers) { var i, matches, sel, handleobj, handlerqueue = [], delegatecount = handlers.delegatecount, cur = event.target; // support (at least): chrome, ie9 // find delegate handlers // black-hole svg instance trees (#13180) // // support: firefox<=42+ // avoid non-left-click in ff but don't block ie radio events (#3861, gh-2343) if (delegatecount && cur.nodetype && (event.type !== "click" || isnan(event.button) || event.button < 1)) { /* jshint eqeqeq: false */ for (; cur != this; cur = cur.parentnode || this) { /* jshint eqeqeq: true */ // don't check non-elements (#13208) // don't process clicks on disabled elements (#6911, #8165, #11382, #11764) if (cur.nodetype === 1 && (cur.disabled !== true || event.type !== "click")) { matches = []; for (i = 0; i < delegatecount; i++) { handleobj = handlers[i]; // don't conflict with object.prototype properties (#13203) sel = handleobj.selector + " "; if (matches[sel] === undefined) { matches[sel] = handleobj.needscontext ? jquery(sel, this).index(cur) > -1 : jquery.find(sel, this, null, [cur]).length; } if (matches[sel]) { matches.push(handleobj); } } if (matches.length) { handlerqueue.push({ elem: cur, handlers: matches }); } } } } // add the remaining (directly-bound) handlers if (delegatecount < handlers.length) { handlerqueue.push({ elem: this, handlers: handlers.slice(delegatecount) }); } return handlerqueue; }, fix: function (event) { if (event[jquery.expando]) { return event; } // create a writable copy of the event object and normalize some properties var i, prop, copy, type = event.type, originalevent = event, fixhook = this.fixhooks[type]; if (!fixhook) { this.fixhooks[type] = fixhook = rmouseevent.test(type) ? this.mousehooks : rkeyevent.test(type) ? this.keyhooks : {}; } copy = fixhook.props ? this.props.concat(fixhook.props) : this.props; event = new jquery.event(originalevent); i = copy.length; while (i--) { prop = copy[i]; event[prop] = originalevent[prop]; } // support: ie<9 // fix target property (#1925) if (!event.target) { event.target = originalevent.srcelement || document; } // support: safari 6-8+ // target should not be a text node (#504, #13143) if (event.target.nodetype === 3) { event.target = event.target.parentnode; } // support: ie<9 // for mouse/key events, metakey==false if it's undefined (#3368, #11328) event.metakey = !!event.metakey; return fixhook.filter ? fixhook.filter(event, originalevent) : event; }, // includes some event props shared by keyevent and mouseevent props: ("altkey bubbles cancelable ctrlkey currenttarget detail eventphase " + "metakey relatedtarget shiftkey target timestamp view which").split(" "), fixhooks: {}, keyhooks: { props: "char charcode key keycode".split(" "), filter: function (event, original) { // add which for key events if (event.which == null) { event.which = original.charcode != null ? original.charcode : original.keycode; } return event; } }, mousehooks: { props: ("button buttons clientx clienty fromelement offsetx offsety " + "pagex pagey screenx screeny toelement").split(" "), filter: function (event, original) { var body, eventdoc, doc, button = original.button, fromelement = original.fromelement; // calculate pagex/y if missing and clientx/y available if (event.pagex == null && original.clientx != null) { eventdoc = event.target.ownerdocument || document; doc = eventdoc.documentelement; body = eventdoc.body; event.pagex = original.clientx + (doc && doc.scrollleft || body && body.scrollleft || 0) - (doc && doc.clientleft || body && body.clientleft || 0); event.pagey = original.clienty + (doc && doc.scrolltop || body && body.scrolltop || 0) - (doc && doc.clienttop || body && body.clienttop || 0); } // add relatedtarget, if necessary if (!event.relatedtarget && fromelement) { event.relatedtarget = fromelement === event.target ? original.toelement : fromelement; } // add which for click: 1 === left; 2 === middle; 3 === right // note: button is not normalized, so don't use it if (!event.which && button !== undefined) { event.which = (button & 1 ? 1 : (button & 2 ? 3 : (button & 4 ? 2 : 0))); } return event; } }, special: { load: { // prevent triggered image.load events from bubbling to window.load nobubble: true }, focus: { // fire native event if possible so blur/focus sequence is correct trigger: function () { if (this !== safeactiveelement() && this.focus) { try { this.focus(); return false; } catch (e) { // support: ie<9 // if we error on focus to hidden element (#1486, #12518), // let .trigger() run the handlers } } }, delegatetype: "focusin" }, blur: { trigger: function () { if (this === safeactiveelement() && this.blur) { this.blur(); return false; } }, delegatetype: "focusout" }, click: { // for checkbox, fire native event so checked state will be right trigger: function () { if (jquery.nodename(this, "input") && this.type === "checkbox" && this.click) { this.click(); return false; } }, // for cross-browser consistency, don't fire native .click() on links _default: function (event) { return jquery.nodename(event.target, "a"); } }, beforeunload: { postdispatch: function (event) { // support: firefox 20+ // firefox doesn't alert if the returnvalue field is not set. if (event.result !== undefined && event.originalevent) { event.originalevent.returnvalue = event.result; } } } }, // piggyback on a donor event to simulate a different one simulate: function (type, elem, event) { var e = jquery.extend( new jquery.event(), event, { type: type, issimulated: true // previously, `originalevent: {}` was set here, so stoppropagation call // would not be triggered on donor event, since in our own // jquery.event.stoppropagation function we had a check for existence of // originalevent.stoppropagation method, so, consequently it would be a noop. // // guard for simulated events was moved to jquery.event.stoppropagation function // since `originalevent` should point to the original event for the // constancy with other events and for more focused logic } ); jquery.event.trigger(e, null, elem); if (e.isdefaultprevented()) { event.preventdefault(); } } }; jquery.removeevent = document.removeeventlistener ? function (elem, type, handle) { // this "if" is needed for plain objects if (elem.removeeventlistener) { elem.removeeventlistener(type, handle); } } : function (elem, type, handle) { var name = "on" + type; if (elem.detachevent) { // #8545, #7054, preventing memory leaks for custom events in ie6-8 // detachevent needed property on element, by name of that event, // to properly expose it to gc if (typeof elem[name] === "undefined") { elem[name] = null; } elem.detachevent(name, handle); } }; jquery.event = function (src, props) { // allow instantiation without the 'new' keyword if (!(this instanceof jquery.event)) { return new jquery.event(src, props); } // event object if (src && src.type) { this.originalevent = src; this.type = src.type; // events bubbling up the document may have been marked as prevented // by a handler lower down the tree; reflect the correct value. this.isdefaultprevented = src.defaultprevented || src.defaultprevented === undefined && // support: ie < 9, android < 4.0 src.returnvalue === false ? returntrue : returnfalse; // event type } else { this.type = src; } // put explicitly provided properties onto the event object if (props) { jquery.extend(this, props); } // create a timestamp if incoming event doesn't have one this.timestamp = src && src.timestamp || jquery.now(); // mark it as fixed this[jquery.expando] = true; }; // jquery.event is based on dom3 events as specified by the ecmascript language binding // http://www.w3.org/tr/2003/wd-dom-level-3-events-20030331/ecma-script-binding.html jquery.event.prototype = { constructor: jquery.event, isdefaultprevented: returnfalse, ispropagationstopped: returnfalse, isimmediatepropagationstopped: returnfalse, preventdefault: function () { var e = this.originalevent; this.isdefaultprevented = returntrue; if (!e) { return; } // if preventdefault exists, run it on the original event if (e.preventdefault) { e.preventdefault(); // support: ie // otherwise set the returnvalue property of the original event to false } else { e.returnvalue = false; } }, stoppropagation: function () { var e = this.originalevent; this.ispropagationstopped = returntrue; if (!e || this.issimulated) { return; } // if stoppropagation exists, run it on the original event if (e.stoppropagation) { e.stoppropagation(); } // support: ie // set the cancelbubble property of the original event to true e.cancelbubble = true; }, stopimmediatepropagation: function () { var e = this.originalevent; this.isimmediatepropagationstopped = returntrue; if (e && e.stopimmediatepropagation) { e.stopimmediatepropagation(); } this.stoppropagation(); } }; // create mouseenter/leave events using mouseover/out and event-time checks // so that event delegation works in jquery. // do the same for pointerenter/pointerleave and pointerover/pointerout // // support: safari 7 only // safari sends mouseenter too often; see: // https://code.google.com/p/chromium/issues/detail?id=470258 // for the description of the bug (it existed in older chrome versions as well). jquery.each({ mouseenter: "mouseover", mouseleave: "mouseout", pointerenter: "pointerover", pointerleave: "pointerout" }, function (orig, fix) { jquery.event.special[orig] = { delegatetype: fix, bindtype: fix, handle: function (event) { var ret, target = this, related = event.relatedtarget, handleobj = event.handleobj; // for mouseenter/leave call the handler if related is outside the target. // nb: no relatedtarget if the mouse left/entered the browser window if (!related || (related !== target && !jquery.contains(target, related))) { event.type = handleobj.origtype; ret = handleobj.handler.apply(this, arguments); event.type = fix; } return ret; } }; }); // ie submit delegation if (!support.submit) { jquery.event.special.submit = { setup: function () { // only need this for delegated form submit events if (jquery.nodename(this, "form")) { return false; } // lazy-add a submit handler when a descendant form may potentially be submitted jquery.event.add(this, "click._submit keypress._submit", function (e) { // node name check avoids a vml-related crash in ie (#9807) var elem = e.target, form = jquery.nodename(elem, "input") || jquery.nodename(elem, "button") ? // support: ie <=8 // we use jquery.prop instead of elem.form // to allow fixing the ie8 delegated submit issue (gh-2332) // by 3rd party polyfills/workarounds. jquery.prop(elem, "form") : undefined; if (form && !jquery._data(form, "submit")) { jquery.event.add(form, "submit._submit", function (event) { event._submitbubble = true; }); jquery._data(form, "submit", true); } }); // return undefined since we don't need an event listener }, postdispatch: function (event) { // if form was submitted by the user, bubble the event up the tree if (event._submitbubble) { delete event._submitbubble; if (this.parentnode && !event.istrigger) { jquery.event.simulate("submit", this.parentnode, event); } } }, teardown: function () { // only need this for delegated form submit events if (jquery.nodename(this, "form")) { return false; } // remove delegated handlers; cleandata eventually reaps submit handlers attached above jquery.event.remove(this, "._submit"); } }; } // ie change delegation and checkbox/radio fix if (!support.change) { jquery.event.special.change = { setup: function () { if (rformelems.test(this.nodename)) { // ie doesn't fire change on a check/radio until blur; trigger it on click // after a propertychange. eat the blur-change in special.change.handle. // this still fires onchange a second time for check/radio after blur. if (this.type === "checkbox" || this.type === "radio") { jquery.event.add(this, "propertychange._change", function (event) { if (event.originalevent.propertyname === "checked") { this._justchanged = true; } }); jquery.event.add(this, "click._change", function (event) { if (this._justchanged && !event.istrigger) { this._justchanged = false; } // allow triggered, simulated change events (#11500) jquery.event.simulate("change", this, event); }); } return false; } // delegated event; lazy-add a change handler on descendant inputs jquery.event.add(this, "beforeactivate._change", function (e) { var elem = e.target; if (rformelems.test(elem.nodename) && !jquery._data(elem, "change")) { jquery.event.add(elem, "change._change", function (event) { if (this.parentnode && !event.issimulated && !event.istrigger) { jquery.event.simulate("change", this.parentnode, event); } }); jquery._data(elem, "change", true); } }); }, handle: function (event) { var elem = event.target; // swallow native change events from checkbox/radio, we already triggered them above if (this !== elem || event.issimulated || event.istrigger || (elem.type !== "radio" && elem.type !== "checkbox")) { return event.handleobj.handler.apply(this, arguments); } }, teardown: function () { jquery.event.remove(this, "._change"); return !rformelems.test(this.nodename); } }; } // support: firefox // firefox doesn't have focus(in | out) events // related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 // // support: chrome, safari // focus(in | out) events fire after focus & blur events, // which is spec violation - http://www.w3.org/tr/dom-level-3-events/#events-focusevent-event-order // related ticket - https://code.google.com/p/chromium/issues/detail?id=449857 if (!support.focusin) { jquery.each({ focus: "focusin", blur: "focusout" }, function (orig, fix) { // attach a single capturing handler on the document while someone wants focusin/focusout var handler = function (event) { jquery.event.simulate(fix, event.target, jquery.event.fix(event)); }; jquery.event.special[fix] = { setup: function () { var doc = this.ownerdocument || this, attaches = jquery._data(doc, fix); if (!attaches) { doc.addeventlistener(orig, handler, true); } jquery._data(doc, fix, (attaches || 0) + 1); }, teardown: function () { var doc = this.ownerdocument || this, attaches = jquery._data(doc, fix) - 1; if (!attaches) { doc.removeeventlistener(orig, handler, true); jquery._removedata(doc, fix); } else { jquery._data(doc, fix, attaches); } } }; }); } jquery.fn.extend({ on: function (types, selector, data, fn) { return on(this, types, selector, data, fn); }, one: function (types, selector, data, fn) { return on(this, types, selector, data, fn, 1); }, off: function (types, selector, fn) { var handleobj, type; if (types && types.preventdefault && types.handleobj) { // ( event ) dispatched jquery.event handleobj = types.handleobj; jquery(types.delegatetarget).off( handleobj.namespace ? handleobj.origtype + "." + handleobj.namespace : handleobj.origtype, handleobj.selector, handleobj.handler ); return this; } if (typeof types === "object") { // ( types-object [, selector] ) for (type in types) { this.off(type, selector, types[type]); } return this; } if (selector === false || typeof selector === "function") { // ( types [, fn] ) fn = selector; selector = undefined; } if (fn === false) { fn = returnfalse; } return this.each(function () { jquery.event.remove(this, types, fn, selector); }); }, trigger: function (type, data) { return this.each(function () { jquery.event.trigger(type, data, this); }); }, triggerhandler: function (type, data) { var elem = this[0]; if (elem) { return jquery.event.trigger(type, data, elem, true); } } }); var rinlinejquery = / jquery\d+="(?:null|\d+)"/g, rnoshimcache = new regexp("<(?:" + nodenames + ")[\\s/>]", "i"), rxhtmltag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi, // support: ie 10-11, edge 10240+ // in ie/edge using regex groups here causes severe slowdowns. // see https://connect.microsoft.com/ie/feedback/details/1736512/ rnoinnerhtml = /\s*$/g, safefragment = createsafefragment(document), fragmentdiv = safefragment.appendchild(document.createelement("div")); // support: ie<8 // manipulating tables requires a tbody function manipulationtarget(elem, content) { return jquery.nodename(elem, "table") && jquery.nodename(content.nodetype !== 11 ? content : content.firstchild, "tr") ? elem.getelementsbytagname("tbody")[0] || elem.appendchild(elem.ownerdocument.createelement("tbody")) : elem; } // replace/restore the type attribute of script elements for safe dom manipulation function disablescript(elem) { elem.type = (jquery.find.attr(elem, "type") !== null) + "/" + elem.type; return elem; } function restorescript(elem) { var match = rscripttypemasked.exec(elem.type); if (match) { elem.type = match[1]; } else { elem.removeattribute("type"); } return elem; } function clonecopyevent(src, dest) { if (dest.nodetype !== 1 || !jquery.hasdata(src)) { return; } var type, i, l, olddata = jquery._data(src), curdata = jquery._data(dest, olddata), events = olddata.events; if (events) { delete curdata.handle; curdata.events = {}; for (type in events) { for (i = 0, l = events[type].length; i < l; i++) { jquery.event.add(dest, type, events[type][i]); } } } // make the cloned public data object a copy from the original if (curdata.data) { curdata.data = jquery.extend({}, curdata.data); } } function fixclonenodeissues(src, dest) { var nodename, e, data; // we do not need to do anything for non-elements if (dest.nodetype !== 1) { return; } nodename = dest.nodename.tolowercase(); // ie6-8 copies events bound via attachevent when using clonenode. if (!support.nocloneevent && dest[jquery.expando]) { data = jquery._data(dest); for (e in data.events) { jquery.removeevent(dest, e, data.handle); } // event data gets referenced instead of copied if the expando gets copied too dest.removeattribute(jquery.expando); } // ie blanks contents when cloning scripts, and tries to evaluate newly-set text if (nodename === "script" && dest.text !== src.text) { disablescript(dest).text = src.text; restorescript(dest); // ie6-10 improperly clones children of object elements using classid. // ie10 throws nomodificationallowederror if parent is null, #12132. } else if (nodename === "object") { if (dest.parentnode) { dest.outerhtml = src.outerhtml; } // this path appears unavoidable for ie9. when cloning an object // element in ie9, the outerhtml strategy above is not sufficient. // if the src has innerhtml and the destination does not, // copy the src.innerhtml into the dest.innerhtml. #10324 if (support.html5clone && (src.innerhtml && !jquery.trim(dest.innerhtml))) { dest.innerhtml = src.innerhtml; } } else if (nodename === "input" && rcheckabletype.test(src.type)) { // ie6-8 fails to persist the checked state of a cloned checkbox // or radio button. worse, ie6-7 fail to give the cloned element // a checked appearance if the defaultchecked value isn't also set dest.defaultchecked = dest.checked = src.checked; // ie6-7 get confused and end up setting the value of a cloned // checkbox/radio button to an empty string instead of "on" if (dest.value !== src.value) { dest.value = src.value; } // ie6-8 fails to return the selected option to the default selected // state when cloning options } else if (nodename === "option") { dest.defaultselected = dest.selected = src.defaultselected; // ie6-8 fails to set the defaultvalue to the correct value when // cloning other types of input fields } else if (nodename === "input" || nodename === "textarea") { dest.defaultvalue = src.defaultvalue; } } function dommanip(collection, args, callback, ignored) { // flatten any nested arrays args = concat.apply([], args); var first, node, hasscripts, scripts, doc, fragment, i = 0, l = collection.length, inoclone = l - 1, value = args[0], isfunction = jquery.isfunction(value); // we can't clonenode fragments that contain checked, in webkit if (isfunction || (l > 1 && typeof value === "string" && !support.checkclone && rchecked.test(value))) { return collection.each(function (index) { var self = collection.eq(index); if (isfunction) { args[0] = value.call(this, index, self.html()); } dommanip(self, args, callback, ignored); }); } if (l) { fragment = buildfragment(args, collection[0].ownerdocument, false, collection, ignored); first = fragment.firstchild; if (fragment.childnodes.length === 1) { fragment = first; } // require either new content or an interest in ignored elements to invoke the callback if (first || ignored) { scripts = jquery.map(getall(fragment, "script"), disablescript); hasscripts = scripts.length; // use the original fragment for the last item // instead of the first because it can end up // being emptied incorrectly in certain situations (#8070). for (; i < l; i++) { node = fragment; if (i !== inoclone) { node = jquery.clone(node, true, true); // keep references to cloned scripts for later restoration if (hasscripts) { // support: android<4.1, phantomjs<2 // push.apply(_, arraylike) throws on ancient webkit jquery.merge(scripts, getall(node, "script")); } } callback.call(collection[i], node, i); } if (hasscripts) { doc = scripts[scripts.length - 1].ownerdocument; // reenable scripts jquery.map(scripts, restorescript); // evaluate executable scripts on first document insertion for (i = 0; i < hasscripts; i++) { node = scripts[i]; if (rscripttype.test(node.type || "") && !jquery._data(node, "globaleval") && jquery.contains(doc, node)) { if (node.src) { // optional ajax dependency, but won't run scripts if not present if (jquery._evalurl) { jquery._evalurl(node.src); } } else { jquery.globaleval( (node.text || node.textcontent || node.innerhtml || "") .replace(rcleanscript, "") ); } } } } // fix #11809: avoid leaking memory fragment = first = null; } } return collection; } function remove(elem, selector, keepdata) { var node, elems = selector ? jquery.filter(selector, elem) : elem, i = 0; for (; (node = elems[i]) != null; i++) { if (!keepdata && node.nodetype === 1) { jquery.cleandata(getall(node)); } if (node.parentnode) { if (keepdata && jquery.contains(node.ownerdocument, node)) { setglobaleval(getall(node, "script")); } node.parentnode.removechild(node); } } return elem; } jquery.extend({ htmlprefilter: function (html) { return html.replace(rxhtmltag, "<$1>"); }, clone: function (elem, dataandevents, deepdataandevents) { var destelements, node, clone, i, srcelements, inpage = jquery.contains(elem.ownerdocument, elem); if (support.html5clone || jquery.isxmldoc(elem) || !rnoshimcache.test("<" + elem.nodename + ">")) { clone = elem.clonenode(true); // ie<=8 does not properly clone detached, unknown element nodes } else { fragmentdiv.innerhtml = elem.outerhtml; fragmentdiv.removechild(clone = fragmentdiv.firstchild); } if ((!support.nocloneevent || !support.noclonechecked) && (elem.nodetype === 1 || elem.nodetype === 11) && !jquery.isxmldoc(elem)) { // we eschew sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 destelements = getall(clone); srcelements = getall(elem); // fix all ie cloning issues for (i = 0; (node = srcelements[i]) != null; ++i) { // ensure that the destination node is not null; fixes #9587 if (destelements[i]) { fixclonenodeissues(node, destelements[i]); } } } // copy the events from the original to the clone if (dataandevents) { if (deepdataandevents) { srcelements = srcelements || getall(elem); destelements = destelements || getall(clone); for (i = 0; (node = srcelements[i]) != null; i++) { clonecopyevent(node, destelements[i]); } } else { clonecopyevent(elem, clone); } } // preserve script evaluation history destelements = getall(clone, "script"); if (destelements.length > 0) { setglobaleval(destelements, !inpage && getall(elem, "script")); } destelements = srcelements = node = null; // return the cloned set return clone; }, cleandata: function (elems, /* internal */ forceacceptdata) { var elem, type, id, data, i = 0, internalkey = jquery.expando, cache = jquery.cache, attributes = support.attributes, special = jquery.event.special; for (; (elem = elems[i]) != null; i++) { if (forceacceptdata || acceptdata(elem)) { id = elem[internalkey]; data = id && cache[id]; if (data) { if (data.events) { for (type in data.events) { if (special[type]) { jquery.event.remove(elem, type); // this is a shortcut to avoid jquery.event.remove's overhead } else { jquery.removeevent(elem, type, data.handle); } } } // remove cache only if it was not already removed by jquery.event.remove if (cache[id]) { delete cache[id]; // support: ie<9 // ie does not allow us to delete expando properties from nodes // ie creates expando attributes along with the property // ie does not have a removeattribute function on document nodes if (!attributes && typeof elem.removeattribute !== "undefined") { elem.removeattribute(internalkey); // webkit & blink performance suffers when deleting properties // from dom nodes, so set to undefined instead // https://code.google.com/p/chromium/issues/detail?id=378607 } else { elem[internalkey] = undefined; } deletedids.push(id); } } } } } }); jquery.fn.extend({ // keep dommanip exposed until 3.0 (gh-2225) dommanip: dommanip, detach: function (selector) { return remove(this, selector, true); }, remove: function (selector) { return remove(this, selector); }, text: function (value) { return access(this, function (value) { return value === undefined ? jquery.text(this) : this.empty().append( (this[0] && this[0].ownerdocument || document).createtextnode(value) ); }, null, value, arguments.length); }, append: function () { return dommanip(this, arguments, function (elem) { if (this.nodetype === 1 || this.nodetype === 11 || this.nodetype === 9) { var target = manipulationtarget(this, elem); target.appendchild(elem); } }); }, prepend: function () { return dommanip(this, arguments, function (elem) { if (this.nodetype === 1 || this.nodetype === 11 || this.nodetype === 9) { var target = manipulationtarget(this, elem); target.insertbefore(elem, target.firstchild); } }); }, before: function () { return dommanip(this, arguments, function (elem) { if (this.parentnode) { this.parentnode.insertbefore(elem, this); } }); }, after: function () { return dommanip(this, arguments, function (elem) { if (this.parentnode) { this.parentnode.insertbefore(elem, this.nextsibling); } }); }, empty: function () { var elem, i = 0; for (; (elem = this[i]) != null; i++) { // remove element nodes and prevent memory leaks if (elem.nodetype === 1) { jquery.cleandata(getall(elem, false)); } // remove any remaining nodes while (elem.firstchild) { elem.removechild(elem.firstchild); } // if this is a select, ensure that it displays empty (#12336) // support: ie<9 if (elem.options && jquery.nodename(elem, "select")) { elem.options.length = 0; } } return this; }, clone: function (dataandevents, deepdataandevents) { dataandevents = dataandevents == null ? false : dataandevents; deepdataandevents = deepdataandevents == null ? dataandevents : deepdataandevents; return this.map(function () { return jquery.clone(this, dataandevents, deepdataandevents); }); }, html: function (value) { return access(this, function (value) { var elem = this[0] || {}, i = 0, l = this.length; if (value === undefined) { return elem.nodetype === 1 ? elem.innerhtml.replace(rinlinejquery, "") : undefined; } // see if we can take a shortcut and just use innerhtml if (typeof value === "string" && !rnoinnerhtml.test(value) && (support.htmlserialize || !rnoshimcache.test(value)) && (support.leadingwhitespace || !rleadingwhitespace.test(value)) && !wrapmap[(rtagname.exec(value) || ["", ""])[1].tolowercase()]) { value = jquery.htmlprefilter(value); try { for (; i < l; i++) { // remove element nodes and prevent memory leaks elem = this[i] || {}; if (elem.nodetype === 1) { jquery.cleandata(getall(elem, false)); elem.innerhtml = value; } } elem = 0; // if using innerhtml throws an exception, use the fallback method } catch (e) { } } if (elem) { this.empty().append(value); } }, null, value, arguments.length); }, replacewith: function () { var ignored = []; // make the changes, replacing each non-ignored context element with the new content return dommanip(this, arguments, function (elem) { var parent = this.parentnode; if (jquery.inarray(this, ignored) < 0) { jquery.cleandata(getall(this)); if (parent) { parent.replacechild(elem, this); } } // force callback invocation }, ignored); } }); jquery.each({ appendto: "append", prependto: "prepend", insertbefore: "before", insertafter: "after", replaceall: "replacewith" }, function (name, original) { jquery.fn[name] = function (selector) { var elems, i = 0, ret = [], insert = jquery(selector), last = insert.length - 1; for (; i <= last; i++) { elems = i === last ? this : this.clone(true); jquery(insert[i])[original](elems); // modern browsers can apply jquery collections as arrays, but oldie needs a .get() push.apply(ret, elems.get()); } return this.pushstack(ret); }; }); var iframe, elemdisplay = { // support: firefox // we have to pre-define these values for ff (#10227) html: "block", body: "block" }; /** * retrieve the actual display of a element * @param {string} name nodename of the element * @param {object} doc document object */ // called only from within defaultdisplay function actualdisplay(name, doc) { var elem = jquery(doc.createelement(name)).appendto(doc.body), display = jquery.css(elem[0], "display"); // we don't have any data stored on the element, // so use "detach" method as fast way to get rid of the element elem.detach(); return display; } /** * try to determine the default display value of an element * @param {string} nodename */ function defaultdisplay(nodename) { var doc = document, display = elemdisplay[nodename]; if (!display) { display = actualdisplay(nodename, doc); // if the simple way fails, read from inside an iframe if (display === "none" || !display) { // use the already-created iframe if possible iframe = (iframe || jquery("