1 /*! jQuery v1.7.1 jquery.com | jquery.org/license */ |
1 /*! |
2 (function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function cb(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function ca(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bE.test(a)?d(a,e):ca(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)ca(a+"["+e+"]",b[e],c,d);else d(a,b)}function b_(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function b$(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bT,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=b$(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=b$(a,c,d,e,"*",g));return l}function bZ(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bP),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bC(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bx:by,g=0,h=e.length;if(d>0){if(c!=="border")for(;g<h;g++)c||(d-=parseFloat(f.css(a,"padding"+e[g]))||0),c==="margin"?d+=parseFloat(f.css(a,c+e[g]))||0:d-=parseFloat(f.css(a,"border"+e[g]+"Width"))||0;return d+"px"}d=bz(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0;if(c)for(;g<h;g++)d+=parseFloat(f.css(a,"padding"+e[g]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+e[g]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+e[g]))||0);return d+"px"}function bp(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c+(i[c][d].namespace?".":"")+i[c][d].namespace,i[c][d],i[c][d].data)}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?m(g):h==="function"&&(!a.unique||!o.has(g))&&c.push(g)},n=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,l=j||0,j=0,k=c.length;for(;c&&l<k;l++)if(c[l].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}i=!1,c&&(a.once?e===!0?o.disable():c=[]:d&&d.length&&(e=d.shift(),o.fireWith(e[0],e[1])))},o={add:function(){if(c){var a=c.length;m(arguments),i?k=c.length:e&&e!==!0&&(j=a,n(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){i&&f<=k&&(k--,f<=l&&l--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&o.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(i?a.once||d.push([b,c]):(!a.once||!e)&&n(b,c));return this},fire:function(){o.fireWith(this,arguments);return this},fired:function(){return!!e}};return o};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p,q=c.createElement("div"),r=c.documentElement;q.setAttribute("className","t"),q.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="<div "+n+"><div></div></div>"+"<table "+n+" cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="<div style='width:4px;'></div>",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h=null;if(typeof a=="undefined"){if(this.length){h=f.data(this[0]);if(this[0].nodeType===1&&!f._data(this[0],"parsedAttrs")){e=this[0].attributes;for(var i=0,j=e.length;i<j;i++)g=e[i].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),l(this[0],g,h[g]));f._data(this[0],"parsedAttrs",!0)}}return h}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split("."),d[1]=d[1]?"."+d[1]:"";if(c===b){h=this.triggerHandler("getData"+d[1]+"!",[d[0]]),h===b&&this.length&&(h=f.data(this[0],a),h=l(this[0],a,h));return h===b&&d[1]?this.data(d[0]):h}return this.each(function(){var b=f(this),e=[d[0],c];b.triggerHandler("setData"+d[1]+"!",e),f.data(this,a,c),b.triggerHandler("changeData"+d[1]+"!",e)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise()}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h<g;h++)e=d[h],e&&(c=f.propFix[e]||e,f.attr(a,e,""),a.removeAttribute(v?e:c),u.test(e)&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")}; |
2 * jQuery JavaScript Library v3.6.3 |
3 f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,quick:G(g),namespace:n.join(".")},p),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var g=f.hasData(a)&&f._data(a),h,i,j,k,l,m,n,o,p,q,r,s;if(!!g&&!!(o=g.events)){b=f.trim(I(b||"")).split(" ");for(h=0;h<b.length;h++){i=A.exec(b[h])||[],j=k=i[1],l=i[2];if(!j){for(j in o)f.event.remove(a,j+b[h],c,d,!0);continue}p=f.event.special[j]||{},j=(d?p.delegateType:p.bindType)||j,r=o[j]||[],m=r.length,l=l?new RegExp("(^|\\.)"+l.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(n=0;n<r.length;n++)s=r[n],(e||k===s.origType)&&(!c||c.guid===s.guid)&&(!l||l.test(s.namespace))&&(!d||d===s.selector||d==="**"&&s.selector)&&(r.splice(n--,1),s.selector&&r.delegateCount--,p.remove&&p.remove.call(a,s));r.length===0&&m!==r.length&&((!p.teardown||p.teardown.call(a,l)===!1)&&f.removeEvent(a,j,g.handle),delete o[j])}f.isEmptyObject(o)&&(q=g.handle,q&&(q.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;if(E.test(h+f.event.triggered))return;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length&&!c.isPropagationStopped();l++)m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d)===!1&&c.preventDefault();c.type=h,!g&&!c.isDefaultPrevented()&&(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=[],j,k,l,m,n,o,p,q,r,s,t;g[0]=c,c.delegateTarget=this;if(e&&!c.target.disabled&&(!c.button||c.type!=="click")){m=f(this),m.context=this.ownerDocument||this;for(l=c.target;l!=this;l=l.parentNode||this){o={},q=[],m[0]=l;for(j=0;j<e;j++)r=d[j],s=r.selector,o[s]===b&&(o[s]=r.quick?H(l,r.quick):m.is(s)),o[s]&&q.push(r);q.length&&i.push({elem:l,matches:q})}}d.length>e&&i.push({elem:this,matches:d.slice(e)});for(j=0;j<i.length&&!c.isPropagationStopped();j++){p=i[j],c.currentTarget=p.elem;for(k=0;k<p.matches.length&&!c.isImmediatePropagationStopped();k++){r=p.matches[k];if(h||!c.namespace&&!r.namespace||c.namespace_re&&c.namespace_re.test(r.namespace))c.data=r.data,c.handleObj=r,n=((f.event.special[r.origType]||{}).handle||r.handler).apply(p.elem,g),n!==b&&(c.result=n,n===!1&&(c.preventDefault(),c.stopPropagation()))}}return c.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,d){var e,f,g,h=d.button,i=d.fromElement;a.pageX==null&&d.clientX!=null&&(e=a.target.ownerDocument||c,f=e.documentElement,g=e.body,a.pageX=d.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=d.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?d.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0);return a}},fix:function(a){if(a[f.expando])return a;var d,e,g=a,h=f.event.fixHooks[a.type]||{},i=h.props?this.props.concat(h.props):this.props;a=f.Event(g);for(d=i.length;d;)e=i[--d],a[e]=g[e];a.target||(a.target=g.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey);return h.filter?h.filter(a,g):a},special:{ready:{setup:f.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=f.extend(new f.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?f.event.trigger(e,null,b):f.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},f.event.handle=f.event.dispatch,f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!(this instanceof f.Event))return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?K:J):this.type=a,b&&f.extend(this,b),this.timeStamp=a&&a.timeStamp||f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=K;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=K;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=K,this.stopPropagation()},isDefaultPrevented:J,isPropagationStopped:J,isImmediatePropagationStopped:J},f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=this,d=a.relatedTarget,e=a.handleObj,g=e.selector,h;if(!d||d!==c&&!f.contains(c,d))a.type=e.origType,h=e.handler.apply(this,arguments),a.type=b;return h}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(){if(f.nodeName(this,"form"))return!1;f.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=f.nodeName(c,"input")||f.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(f.event.add(d,"submit._submit",function(a){this.parentNode&&!a.isTrigger&&f.event.simulate("submit",this.parentNode,a,!0)}),d._submit_attached=!0)})},teardown:function(){if(f.nodeName(this,"form"))return!1;f.event.remove(this,"._submit")}}),f.support.changeBubbles||(f.event.special.change={setup:function(){if(z.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")f.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),f.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,f.event.simulate("change",this,a,!0))});return!1}f.event.add(this,"beforeactivate._change",function(a){var b=a.target;z.test(b.nodeName)&&!b._change_attached&&(f.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&f.event.simulate("change",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){f.event.remove(this,"._change");return z.test(this.nodeName)}}),f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){f.event.simulate(b,a.target,f.event.fix(a),!0)};f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a=="object"){typeof c!="string"&&(d=c,c=b);for(i in a)this.on(i,c,d,a[i],g);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=J;else if(!e)return this;g===1&&(h=e,e=function(a){f().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=f.guid++));return this.each(function(){f.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on.call(this,a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;f(a.delegateTarget).off(e.namespace?e.type+"."+e.namespace:e.type,e.selector,e.handler);return this}if(typeof a=="object"){for(var g in a)this.off(g,c,a[g]);return this}if(c===!1||typeof c=="function")d=c,c=b;d===!1&&(d=J);return this.each(function(){f.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){f(this.context).on(a,this.selector,b,c);return this},die:function(a,b){f(this.context).off(a,this.selector||"**",b);return this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f._data(this,"lastToggle"+a.guid)||0)%d;f._data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}if(j.nodeType===1){g||(j[d]=c,j.sizset=h);if(typeof b!="string"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}j.nodeType===1&&!g&&(j[d]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}e[h]=k}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(j,""),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)==="\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFilter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],"");if(!g)return[];break}}if(a===q)if(g==null)m.error(a);else break;q=a}return s},m.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)};var n=m.getText=function(a){var b,c,d=a.nodeType,e="";if(d){if(d===1||d===9){if(typeof a.textContent=="string")return a.textContent;if(typeof a.innerText=="string")return a.innerText.replace(k,"");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&m.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(j,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,e,f,g,h,i,j,k=b[1],l=a;switch(k){case"only":case"first":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k==="first")return!0;l=a;case"last":while(l=l.nextSibling)if(l.nodeType===1)return!1;return!0;case"nth":c=b[2],e=b[3];if(c===1&&e===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[d]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[d]=f}j=a.nodeIndex-e;return c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;c.documentElement.compareDocumentPosition?u=function(a,b){if(a===b){h=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b){h=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=f.attr,m.selectors.attrMap={},f.find=m,f.expr=m.selectors,f.expr[":"]=f.expr.filters,f.unique=m.uniqueSort,f.text=m.getText,f.isXMLDoc=m.isXML,f.contains=m.contains}();var L=/Until$/,M=/^(?:parents|prevUntil|prevAll)/,N=/,/,O=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,Q=f.expr.match.POS,R={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(T(this,a,!1),"not",a)},filter:function(a){return this.pushStack(T(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?Q.test(a)?f(a,this.context).index(this[0])>=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d<a.length;d++)f(g).is(a[d])&&c.push({selector:a[d],elem:g,level:h});g=g.parentNode,h++}return c}var i=Q.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(i?i.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|style)/i,bb=/<(?:script|object|embed|option|style)/i,bc=new RegExp("<(?:"+V+")","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*<!(?:\[CDATA\[|\-\-)/,bg={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function() |
3 * https://jquery.com/ |
4 {for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bi(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bp)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!bb.test(j)&&(f.support.checkClone||!bd.test(j))&&(f.support.html5Clone||!bc.test(j))&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1></$2>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bn(k[i]);else bn(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||be.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.event.special,g=f.support.deleteExpando;for(var h=0,i;(i=a[h])!=null;h++){if(i.nodeName&&f.noData[i.nodeName.toLowerCase()])continue;c=i[f.expando];if(c){b=d[c];if(b&&b.events){for(var j in b.events)e[j]?f.event.remove(i,j):f.removeEvent(i,j,b.handle);b.handle&&(b.handle.elem=null)}g?delete i[f.expando]:i.removeAttribute&&i.removeAttribute(f.expando),delete d[c]}}}});var bq=/alpha\([^)]*\)/i,br=/opacity=([^)]*)/,bs=/([A-Z]|^ms)/g,bt=/^-?\d+(?:px)?$/i,bu=/^-?\d/,bv=/^([\-+])=([\-+.\de]+)/,bw={position:"absolute",visibility:"hidden",display:"block"},bx=["Left","Right"],by=["Top","Bottom"],bz,bA,bB;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bz(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bv.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bz)return bz(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return bC(a,b,d);f.swap(a,bw,function(){e=bC(a,b,d)});return e}},set:function(a,b){if(!bt.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cv(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cu("hide",3),a,b,c);var d,e,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(e=f.css(d,"display"),e!=="none"&&!f._data(d,"olddisplay")&&f._data(d,"olddisplay",e));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cu("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){function g(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(!f.support.inlineBlockNeedsLayout||cv(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)j=new f.fx(this,b,i),h=a[i],cn.test(h)?(o=f._data(this,"toggle"+i)||(h==="toggle"?d?"show":"hide":0),o?(f._data(this,"toggle"+i,o==="show"?"hide":"show"),j[o]()):j[h]()):(k=co.exec(h),l=j.cur(),k?(m=parseFloat(k[2]),n=k[3]||(f.cssNumber[i]?"":"px"),n!=="px"&&(f.style(this,i,(m||1)+n),l=(m||1)/j.cur()*l,f.style(this,i,l+n)),k[1]&&(m=(k[1]==="-="?-1:1)*m+l),j.custom(l,m,n)):j.custom(l,h,""));return!0}var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return e.queue===!1?this.each(g):this.queue(e.queue,g)},stop:function(a,c,d){typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]);return this.each(function(){function h(a,b,c){var e=b[c];f.removeData(a,c,!0),e.stop(d)}var b,c=!1,e=f.timers,g=f._data(this);d||f._unmark(!0,this);if(a==null)for(b in g)g[b]&&g[b].stop&&b.indexOf(".run")===b.length-4&&h(this,g,b);else g[b=a+".run"]&&g[b].stop&&h(this,g,b);for(b=e.length;b--;)e[b].elem===this&&(a==null||e[b].queue===a)&&(d?e[b](!0):e[b].saveState(),c=!0,e.splice(b,1));(!d||!c)&&f.dequeue(this,a)})}}),f.each({slideDown:cu("show",1),slideUp:cu("hide",1),slideToggle:cu("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue?f.dequeue(this,d.queue):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,c,d){function h(a){return e.step(a)}var e=this,g=f.fx;this.startTime=cr||cs(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(f.cssNumber[this.prop]?"":"px"),h.queue=this.options.queue,h.elem=this.elem,h.saveState=function(){e.options.hide&&f._data(e.elem,"fxshow"+e.prop)===b&&f._data(e.elem,"fxshow"+e.prop,e.start)},h()&&f.timers.push(h)&&!cp&&(cp=setInterval(g.tick,g.interval))},show:function(){var a=f._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||f.style(this.elem,this.prop),this.options.show=!0,a!==b?this.custom(this.cur(),a):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f._data(this.elem,"fxshow"+this.prop)||f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b,c,d,e=cr||cs(),g=!0,h=this.elem,i=this.options;if(a||e>=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cp),cp=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}}),f.each(["width","height"],function(a,b){f.fx.step[b]=function(a){f.style(a.elem,b,Math.max(0,a.now)+a.unit)}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cw=/^t(?:able|d|h)$/i,cx=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cy(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.support.fixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.support.doesNotAddBorder&&(!f.support.doesAddBorderForTableAndCells||!cw.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.support.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.support.fixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); |
4 * |
|
5 * Includes Sizzle.js |
|
6 * https://sizzlejs.com/ |
|
7 * |
|
8 * Copyright OpenJS Foundation and other contributors |
|
9 * Released under the MIT license |
|
10 * https://jquery.org/license |
|
11 * |
|
12 * Date: 2022-12-20T21:28Z |
|
13 */ |
|
14 ( function( global, factory ) { |
|
15 |
|
16 "use strict"; |
|
17 |
|
18 if ( typeof module === "object" && typeof module.exports === "object" ) { |
|
19 |
|
20 // For CommonJS and CommonJS-like environments where a proper `window` |
|
21 // is present, execute the factory and get jQuery. |
|
22 // For environments that do not have a `window` with a `document` |
|
23 // (such as Node.js), expose a factory as module.exports. |
|
24 // This accentuates the need for the creation of a real `window`. |
|
25 // e.g. var jQuery = require("jquery")(window); |
|
26 // See ticket trac-14549 for more info. |
|
27 module.exports = global.document ? |
|
28 factory( global, true ) : |
|
29 function( w ) { |
|
30 if ( !w.document ) { |
|
31 throw new Error( "jQuery requires a window with a document" ); |
|
32 } |
|
33 return factory( w ); |
|
34 }; |
|
35 } else { |
|
36 factory( global ); |
|
37 } |
|
38 |
|
39 // Pass this if window is not defined yet |
|
40 } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { |
|
41 |
|
42 // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 |
|
43 // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode |
|
44 // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common |
|
45 // enough that all such attempts are guarded in a try block. |
|
46 "use strict"; |
|
47 |
|
48 var arr = []; |
|
49 |
|
50 var getProto = Object.getPrototypeOf; |
|
51 |
|
52 var slice = arr.slice; |
|
53 |
|
54 var flat = arr.flat ? function( array ) { |
|
55 return arr.flat.call( array ); |
|
56 } : function( array ) { |
|
57 return arr.concat.apply( [], array ); |
|
58 }; |
|
59 |
|
60 |
|
61 var push = arr.push; |
|
62 |
|
63 var indexOf = arr.indexOf; |
|
64 |
|
65 var class2type = {}; |
|
66 |
|
67 var toString = class2type.toString; |
|
68 |
|
69 var hasOwn = class2type.hasOwnProperty; |
|
70 |
|
71 var fnToString = hasOwn.toString; |
|
72 |
|
73 var ObjectFunctionString = fnToString.call( Object ); |
|
74 |
|
75 var support = {}; |
|
76 |
|
77 var isFunction = function isFunction( obj ) { |
|
78 |
|
79 // Support: Chrome <=57, Firefox <=52 |
|
80 // In some browsers, typeof returns "function" for HTML <object> elements |
|
81 // (i.e., `typeof document.createElement( "object" ) === "function"`). |
|
82 // We don't want to classify *any* DOM node as a function. |
|
83 // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5 |
|
84 // Plus for old WebKit, typeof returns "function" for HTML collections |
|
85 // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756) |
|
86 return typeof obj === "function" && typeof obj.nodeType !== "number" && |
|
87 typeof obj.item !== "function"; |
|
88 }; |
|
89 |
|
90 |
|
91 var isWindow = function isWindow( obj ) { |
|
92 return obj != null && obj === obj.window; |
|
93 }; |
|
94 |
|
95 |
|
96 var document = window.document; |
|
97 |
|
98 |
|
99 |
|
100 var preservedScriptAttributes = { |
|
101 type: true, |
|
102 src: true, |
|
103 nonce: true, |
|
104 noModule: true |
|
105 }; |
|
106 |
|
107 function DOMEval( code, node, doc ) { |
|
108 doc = doc || document; |
|
109 |
|
110 var i, val, |
|
111 script = doc.createElement( "script" ); |
|
112 |
|
113 script.text = code; |
|
114 if ( node ) { |
|
115 for ( i in preservedScriptAttributes ) { |
|
116 |
|
117 // Support: Firefox 64+, Edge 18+ |
|
118 // Some browsers don't support the "nonce" property on scripts. |
|
119 // On the other hand, just using `getAttribute` is not enough as |
|
120 // the `nonce` attribute is reset to an empty string whenever it |
|
121 // becomes browsing-context connected. |
|
122 // See https://github.com/whatwg/html/issues/2369 |
|
123 // See https://html.spec.whatwg.org/#nonce-attributes |
|
124 // The `node.getAttribute` check was added for the sake of |
|
125 // `jQuery.globalEval` so that it can fake a nonce-containing node |
|
126 // via an object. |
|
127 val = node[ i ] || node.getAttribute && node.getAttribute( i ); |
|
128 if ( val ) { |
|
129 script.setAttribute( i, val ); |
|
130 } |
|
131 } |
|
132 } |
|
133 doc.head.appendChild( script ).parentNode.removeChild( script ); |
|
134 } |
|
135 |
|
136 |
|
137 function toType( obj ) { |
|
138 if ( obj == null ) { |
|
139 return obj + ""; |
|
140 } |
|
141 |
|
142 // Support: Android <=2.3 only (functionish RegExp) |
|
143 return typeof obj === "object" || typeof obj === "function" ? |
|
144 class2type[ toString.call( obj ) ] || "object" : |
|
145 typeof obj; |
|
146 } |
|
147 /* global Symbol */ |
|
148 // Defining this global in .eslintrc.json would create a danger of using the global |
|
149 // unguarded in another place, it seems safer to define global only for this module |
|
150 |
|
151 |
|
152 |
|
153 var |
|
154 version = "3.6.3", |
|
155 |
|
156 // Define a local copy of jQuery |
|
157 jQuery = function( selector, context ) { |
|
158 |
|
159 // The jQuery object is actually just the init constructor 'enhanced' |
|
160 // Need init if jQuery is called (just allow error to be thrown if not included) |
|
161 return new jQuery.fn.init( selector, context ); |
|
162 }; |
|
163 |
|
164 jQuery.fn = jQuery.prototype = { |
|
165 |
|
166 // The current version of jQuery being used |
|
167 jquery: version, |
|
168 |
|
169 constructor: jQuery, |
|
170 |
|
171 // The default length of a jQuery object is 0 |
|
172 length: 0, |
|
173 |
|
174 toArray: function() { |
|
175 return slice.call( this ); |
|
176 }, |
|
177 |
|
178 // Get the Nth element in the matched element set OR |
|
179 // Get the whole matched element set as a clean array |
|
180 get: function( num ) { |
|
181 |
|
182 // Return all the elements in a clean array |
|
183 if ( num == null ) { |
|
184 return slice.call( this ); |
|
185 } |
|
186 |
|
187 // Return just the one element from the set |
|
188 return num < 0 ? this[ num + this.length ] : this[ num ]; |
|
189 }, |
|
190 |
|
191 // Take an array of elements and push it onto the stack |
|
192 // (returning the new matched element set) |
|
193 pushStack: function( elems ) { |
|
194 |
|
195 // Build a new jQuery matched element set |
|
196 var ret = jQuery.merge( this.constructor(), elems ); |
|
197 |
|
198 // Add the old object onto the stack (as a reference) |
|
199 ret.prevObject = this; |
|
200 |
|
201 // Return the newly-formed element set |
|
202 return ret; |
|
203 }, |
|
204 |
|
205 // Execute a callback for every element in the matched set. |
|
206 each: function( callback ) { |
|
207 return jQuery.each( this, callback ); |
|
208 }, |
|
209 |
|
210 map: function( callback ) { |
|
211 return this.pushStack( jQuery.map( this, function( elem, i ) { |
|
212 return callback.call( elem, i, elem ); |
|
213 } ) ); |
|
214 }, |
|
215 |
|
216 slice: function() { |
|
217 return this.pushStack( slice.apply( this, arguments ) ); |
|
218 }, |
|
219 |
|
220 first: function() { |
|
221 return this.eq( 0 ); |
|
222 }, |
|
223 |
|
224 last: function() { |
|
225 return this.eq( -1 ); |
|
226 }, |
|
227 |
|
228 even: function() { |
|
229 return this.pushStack( jQuery.grep( this, function( _elem, i ) { |
|
230 return ( i + 1 ) % 2; |
|
231 } ) ); |
|
232 }, |
|
233 |
|
234 odd: function() { |
|
235 return this.pushStack( jQuery.grep( this, function( _elem, i ) { |
|
236 return i % 2; |
|
237 } ) ); |
|
238 }, |
|
239 |
|
240 eq: function( i ) { |
|
241 var len = this.length, |
|
242 j = +i + ( i < 0 ? len : 0 ); |
|
243 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); |
|
244 }, |
|
245 |
|
246 end: function() { |
|
247 return this.prevObject || this.constructor(); |
|
248 }, |
|
249 |
|
250 // For internal use only. |
|
251 // Behaves like an Array's method, not like a jQuery method. |
|
252 push: push, |
|
253 sort: arr.sort, |
|
254 splice: arr.splice |
|
255 }; |
|
256 |
|
257 jQuery.extend = jQuery.fn.extend = function() { |
|
258 var options, name, src, copy, copyIsArray, clone, |
|
259 target = arguments[ 0 ] || {}, |
|
260 i = 1, |
|
261 length = arguments.length, |
|
262 deep = false; |
|
263 |
|
264 // Handle a deep copy situation |
|
265 if ( typeof target === "boolean" ) { |
|
266 deep = target; |
|
267 |
|
268 // Skip the boolean and the target |
|
269 target = arguments[ i ] || {}; |
|
270 i++; |
|
271 } |
|
272 |
|
273 // Handle case when target is a string or something (possible in deep copy) |
|
274 if ( typeof target !== "object" && !isFunction( target ) ) { |
|
275 target = {}; |
|
276 } |
|
277 |
|
278 // Extend jQuery itself if only one argument is passed |
|
279 if ( i === length ) { |
|
280 target = this; |
|
281 i--; |
|
282 } |
|
283 |
|
284 for ( ; i < length; i++ ) { |
|
285 |
|
286 // Only deal with non-null/undefined values |
|
287 if ( ( options = arguments[ i ] ) != null ) { |
|
288 |
|
289 // Extend the base object |
|
290 for ( name in options ) { |
|
291 copy = options[ name ]; |
|
292 |
|
293 // Prevent Object.prototype pollution |
|
294 // Prevent never-ending loop |
|
295 if ( name === "__proto__" || target === copy ) { |
|
296 continue; |
|
297 } |
|
298 |
|
299 // Recurse if we're merging plain objects or arrays |
|
300 if ( deep && copy && ( jQuery.isPlainObject( copy ) || |
|
301 ( copyIsArray = Array.isArray( copy ) ) ) ) { |
|
302 src = target[ name ]; |
|
303 |
|
304 // Ensure proper type for the source value |
|
305 if ( copyIsArray && !Array.isArray( src ) ) { |
|
306 clone = []; |
|
307 } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { |
|
308 clone = {}; |
|
309 } else { |
|
310 clone = src; |
|
311 } |
|
312 copyIsArray = false; |
|
313 |
|
314 // Never move original objects, clone them |
|
315 target[ name ] = jQuery.extend( deep, clone, copy ); |
|
316 |
|
317 // Don't bring in undefined values |
|
318 } else if ( copy !== undefined ) { |
|
319 target[ name ] = copy; |
|
320 } |
|
321 } |
|
322 } |
|
323 } |
|
324 |
|
325 // Return the modified object |
|
326 return target; |
|
327 }; |
|
328 |
|
329 jQuery.extend( { |
|
330 |
|
331 // Unique for each copy of jQuery on the page |
|
332 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), |
|
333 |
|
334 // Assume jQuery is ready without the ready module |
|
335 isReady: true, |
|
336 |
|
337 error: function( msg ) { |
|
338 throw new Error( msg ); |
|
339 }, |
|
340 |
|
341 noop: function() {}, |
|
342 |
|
343 isPlainObject: function( obj ) { |
|
344 var proto, Ctor; |
|
345 |
|
346 // Detect obvious negatives |
|
347 // Use toString instead of jQuery.type to catch host objects |
|
348 if ( !obj || toString.call( obj ) !== "[object Object]" ) { |
|
349 return false; |
|
350 } |
|
351 |
|
352 proto = getProto( obj ); |
|
353 |
|
354 // Objects with no prototype (e.g., `Object.create( null )`) are plain |
|
355 if ( !proto ) { |
|
356 return true; |
|
357 } |
|
358 |
|
359 // Objects with prototype are plain iff they were constructed by a global Object function |
|
360 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; |
|
361 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; |
|
362 }, |
|
363 |
|
364 isEmptyObject: function( obj ) { |
|
365 var name; |
|
366 |
|
367 for ( name in obj ) { |
|
368 return false; |
|
369 } |
|
370 return true; |
|
371 }, |
|
372 |
|
373 // Evaluates a script in a provided context; falls back to the global one |
|
374 // if not specified. |
|
375 globalEval: function( code, options, doc ) { |
|
376 DOMEval( code, { nonce: options && options.nonce }, doc ); |
|
377 }, |
|
378 |
|
379 each: function( obj, callback ) { |
|
380 var length, i = 0; |
|
381 |
|
382 if ( isArrayLike( obj ) ) { |
|
383 length = obj.length; |
|
384 for ( ; i < length; i++ ) { |
|
385 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { |
|
386 break; |
|
387 } |
|
388 } |
|
389 } else { |
|
390 for ( i in obj ) { |
|
391 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { |
|
392 break; |
|
393 } |
|
394 } |
|
395 } |
|
396 |
|
397 return obj; |
|
398 }, |
|
399 |
|
400 // results is for internal usage only |
|
401 makeArray: function( arr, results ) { |
|
402 var ret = results || []; |
|
403 |
|
404 if ( arr != null ) { |
|
405 if ( isArrayLike( Object( arr ) ) ) { |
|
406 jQuery.merge( ret, |
|
407 typeof arr === "string" ? |
|
408 [ arr ] : arr |
|
409 ); |
|
410 } else { |
|
411 push.call( ret, arr ); |
|
412 } |
|
413 } |
|
414 |
|
415 return ret; |
|
416 }, |
|
417 |
|
418 inArray: function( elem, arr, i ) { |
|
419 return arr == null ? -1 : indexOf.call( arr, elem, i ); |
|
420 }, |
|
421 |
|
422 // Support: Android <=4.0 only, PhantomJS 1 only |
|
423 // push.apply(_, arraylike) throws on ancient WebKit |
|
424 merge: function( first, second ) { |
|
425 var len = +second.length, |
|
426 j = 0, |
|
427 i = first.length; |
|
428 |
|
429 for ( ; j < len; j++ ) { |
|
430 first[ i++ ] = second[ j ]; |
|
431 } |
|
432 |
|
433 first.length = i; |
|
434 |
|
435 return first; |
|
436 }, |
|
437 |
|
438 grep: function( elems, callback, invert ) { |
|
439 var callbackInverse, |
|
440 matches = [], |
|
441 i = 0, |
|
442 length = elems.length, |
|
443 callbackExpect = !invert; |
|
444 |
|
445 // Go through the array, only saving the items |
|
446 // that pass the validator function |
|
447 for ( ; i < length; i++ ) { |
|
448 callbackInverse = !callback( elems[ i ], i ); |
|
449 if ( callbackInverse !== callbackExpect ) { |
|
450 matches.push( elems[ i ] ); |
|
451 } |
|
452 } |
|
453 |
|
454 return matches; |
|
455 }, |
|
456 |
|
457 // arg is for internal usage only |
|
458 map: function( elems, callback, arg ) { |
|
459 var length, value, |
|
460 i = 0, |
|
461 ret = []; |
|
462 |
|
463 // Go through the array, translating each of the items to their new values |
|
464 if ( isArrayLike( elems ) ) { |
|
465 length = elems.length; |
|
466 for ( ; i < length; i++ ) { |
|
467 value = callback( elems[ i ], i, arg ); |
|
468 |
|
469 if ( value != null ) { |
|
470 ret.push( value ); |
|
471 } |
|
472 } |
|
473 |
|
474 // Go through every key on the object, |
|
475 } else { |
|
476 for ( i in elems ) { |
|
477 value = callback( elems[ i ], i, arg ); |
|
478 |
|
479 if ( value != null ) { |
|
480 ret.push( value ); |
|
481 } |
|
482 } |
|
483 } |
|
484 |
|
485 // Flatten any nested arrays |
|
486 return flat( ret ); |
|
487 }, |
|
488 |
|
489 // A global GUID counter for objects |
|
490 guid: 1, |
|
491 |
|
492 // jQuery.support is not used in Core but other projects attach their |
|
493 // properties to it so it needs to exist. |
|
494 support: support |
|
495 } ); |
|
496 |
|
497 if ( typeof Symbol === "function" ) { |
|
498 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; |
|
499 } |
|
500 |
|
501 // Populate the class2type map |
|
502 jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), |
|
503 function( _i, name ) { |
|
504 class2type[ "[object " + name + "]" ] = name.toLowerCase(); |
|
505 } ); |
|
506 |
|
507 function isArrayLike( obj ) { |
|
508 |
|
509 // Support: real iOS 8.2 only (not reproducible in simulator) |
|
510 // `in` check used to prevent JIT error (gh-2145) |
|
511 // hasOwn isn't used here due to false negatives |
|
512 // regarding Nodelist length in IE |
|
513 var length = !!obj && "length" in obj && obj.length, |
|
514 type = toType( obj ); |
|
515 |
|
516 if ( isFunction( obj ) || isWindow( obj ) ) { |
|
517 return false; |
|
518 } |
|
519 |
|
520 return type === "array" || length === 0 || |
|
521 typeof length === "number" && length > 0 && ( length - 1 ) in obj; |
|
522 } |
|
523 var Sizzle = |
|
524 /*! |
|
525 * Sizzle CSS Selector Engine v2.3.9 |
|
526 * https://sizzlejs.com/ |
|
527 * |
|
528 * Copyright JS Foundation and other contributors |
|
529 * Released under the MIT license |
|
530 * https://js.foundation/ |
|
531 * |
|
532 * Date: 2022-12-19 |
|
533 */ |
|
534 ( function( window ) { |
|
535 var i, |
|
536 support, |
|
537 Expr, |
|
538 getText, |
|
539 isXML, |
|
540 tokenize, |
|
541 compile, |
|
542 select, |
|
543 outermostContext, |
|
544 sortInput, |
|
545 hasDuplicate, |
|
546 |
|
547 // Local document vars |
|
548 setDocument, |
|
549 document, |
|
550 docElem, |
|
551 documentIsHTML, |
|
552 rbuggyQSA, |
|
553 rbuggyMatches, |
|
554 matches, |
|
555 contains, |
|
556 |
|
557 // Instance-specific data |
|
558 expando = "sizzle" + 1 * new Date(), |
|
559 preferredDoc = window.document, |
|
560 dirruns = 0, |
|
561 done = 0, |
|
562 classCache = createCache(), |
|
563 tokenCache = createCache(), |
|
564 compilerCache = createCache(), |
|
565 nonnativeSelectorCache = createCache(), |
|
566 sortOrder = function( a, b ) { |
|
567 if ( a === b ) { |
|
568 hasDuplicate = true; |
|
569 } |
|
570 return 0; |
|
571 }, |
|
572 |
|
573 // Instance methods |
|
574 hasOwn = ( {} ).hasOwnProperty, |
|
575 arr = [], |
|
576 pop = arr.pop, |
|
577 pushNative = arr.push, |
|
578 push = arr.push, |
|
579 slice = arr.slice, |
|
580 |
|
581 // Use a stripped-down indexOf as it's faster than native |
|
582 // https://jsperf.com/thor-indexof-vs-for/5 |
|
583 indexOf = function( list, elem ) { |
|
584 var i = 0, |
|
585 len = list.length; |
|
586 for ( ; i < len; i++ ) { |
|
587 if ( list[ i ] === elem ) { |
|
588 return i; |
|
589 } |
|
590 } |
|
591 return -1; |
|
592 }, |
|
593 |
|
594 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" + |
|
595 "ismap|loop|multiple|open|readonly|required|scoped", |
|
596 |
|
597 // Regular expressions |
|
598 |
|
599 // http://www.w3.org/TR/css3-selectors/#whitespace |
|
600 whitespace = "[\\x20\\t\\r\\n\\f]", |
|
601 |
|
602 // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram |
|
603 identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + |
|
604 "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", |
|
605 |
|
606 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors |
|
607 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + |
|
608 |
|
609 // Operator (capture 2) |
|
610 "*([*^$|!~]?=)" + whitespace + |
|
611 |
|
612 // "Attribute values must be CSS identifiers [capture 5] |
|
613 // or strings [capture 3 or capture 4]" |
|
614 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + |
|
615 whitespace + "*\\]", |
|
616 |
|
617 pseudos = ":(" + identifier + ")(?:\\((" + |
|
618 |
|
619 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: |
|
620 // 1. quoted (capture 3; capture 4 or capture 5) |
|
621 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + |
|
622 |
|
623 // 2. simple (capture 6) |
|
624 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + |
|
625 |
|
626 // 3. anything else (capture 2) |
|
627 ".*" + |
|
628 ")\\)|)", |
|
629 |
|
630 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter |
|
631 rwhitespace = new RegExp( whitespace + "+", "g" ), |
|
632 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + |
|
633 whitespace + "+$", "g" ), |
|
634 |
|
635 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), |
|
636 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + |
|
637 "*" ), |
|
638 rdescend = new RegExp( whitespace + "|>" ), |
|
639 |
|
640 rpseudo = new RegExp( pseudos ), |
|
641 ridentifier = new RegExp( "^" + identifier + "$" ), |
|
642 |
|
643 matchExpr = { |
|
644 "ID": new RegExp( "^#(" + identifier + ")" ), |
|
645 "CLASS": new RegExp( "^\\.(" + identifier + ")" ), |
|
646 "TAG": new RegExp( "^(" + identifier + "|[*])" ), |
|
647 "ATTR": new RegExp( "^" + attributes ), |
|
648 "PSEUDO": new RegExp( "^" + pseudos ), |
|
649 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + |
|
650 whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + |
|
651 whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), |
|
652 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), |
|
653 |
|
654 // For use in libraries implementing .is() |
|
655 // We use this for POS matching in `select` |
|
656 "needsContext": new RegExp( "^" + whitespace + |
|
657 "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + |
|
658 "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) |
|
659 }, |
|
660 |
|
661 rhtml = /HTML$/i, |
|
662 rinputs = /^(?:input|select|textarea|button)$/i, |
|
663 rheader = /^h\d$/i, |
|
664 |
|
665 rnative = /^[^{]+\{\s*\[native \w/, |
|
666 |
|
667 // Easily-parseable/retrievable ID or TAG or CLASS selectors |
|
668 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, |
|
669 |
|
670 rsibling = /[+~]/, |
|
671 |
|
672 // CSS escapes |
|
673 // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters |
|
674 runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ), |
|
675 funescape = function( escape, nonHex ) { |
|
676 var high = "0x" + escape.slice( 1 ) - 0x10000; |
|
677 |
|
678 return nonHex ? |
|
679 |
|
680 // Strip the backslash prefix from a non-hex escape sequence |
|
681 nonHex : |
|
682 |
|
683 // Replace a hexadecimal escape sequence with the encoded Unicode code point |
|
684 // Support: IE <=11+ |
|
685 // For values outside the Basic Multilingual Plane (BMP), manually construct a |
|
686 // surrogate pair |
|
687 high < 0 ? |
|
688 String.fromCharCode( high + 0x10000 ) : |
|
689 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); |
|
690 }, |
|
691 |
|
692 // CSS string/identifier serialization |
|
693 // https://drafts.csswg.org/cssom/#common-serializing-idioms |
|
694 rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, |
|
695 fcssescape = function( ch, asCodePoint ) { |
|
696 if ( asCodePoint ) { |
|
697 |
|
698 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER |
|
699 if ( ch === "\0" ) { |
|
700 return "\uFFFD"; |
|
701 } |
|
702 |
|
703 // Control characters and (dependent upon position) numbers get escaped as code points |
|
704 return ch.slice( 0, -1 ) + "\\" + |
|
705 ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; |
|
706 } |
|
707 |
|
708 // Other potentially-special ASCII characters get backslash-escaped |
|
709 return "\\" + ch; |
|
710 }, |
|
711 |
|
712 // Used for iframes |
|
713 // See setDocument() |
|
714 // Removing the function wrapper causes a "Permission Denied" |
|
715 // error in IE |
|
716 unloadHandler = function() { |
|
717 setDocument(); |
|
718 }, |
|
719 |
|
720 inDisabledFieldset = addCombinator( |
|
721 function( elem ) { |
|
722 return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset"; |
|
723 }, |
|
724 { dir: "parentNode", next: "legend" } |
|
725 ); |
|
726 |
|
727 // Optimize for push.apply( _, NodeList ) |
|
728 try { |
|
729 push.apply( |
|
730 ( arr = slice.call( preferredDoc.childNodes ) ), |
|
731 preferredDoc.childNodes |
|
732 ); |
|
733 |
|
734 // Support: Android<4.0 |
|
735 // Detect silently failing push.apply |
|
736 // eslint-disable-next-line no-unused-expressions |
|
737 arr[ preferredDoc.childNodes.length ].nodeType; |
|
738 } catch ( e ) { |
|
739 push = { apply: arr.length ? |
|
740 |
|
741 // Leverage slice if possible |
|
742 function( target, els ) { |
|
743 pushNative.apply( target, slice.call( els ) ); |
|
744 } : |
|
745 |
|
746 // Support: IE<9 |
|
747 // Otherwise append directly |
|
748 function( target, els ) { |
|
749 var j = target.length, |
|
750 i = 0; |
|
751 |
|
752 // Can't trust NodeList.length |
|
753 while ( ( target[ j++ ] = els[ i++ ] ) ) {} |
|
754 target.length = j - 1; |
|
755 } |
|
756 }; |
|
757 } |
|
758 |
|
759 function Sizzle( selector, context, results, seed ) { |
|
760 var m, i, elem, nid, match, groups, newSelector, |
|
761 newContext = context && context.ownerDocument, |
|
762 |
|
763 // nodeType defaults to 9, since context defaults to document |
|
764 nodeType = context ? context.nodeType : 9; |
|
765 |
|
766 results = results || []; |
|
767 |
|
768 // Return early from calls with invalid selector or context |
|
769 if ( typeof selector !== "string" || !selector || |
|
770 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { |
|
771 |
|
772 return results; |
|
773 } |
|
774 |
|
775 // Try to shortcut find operations (as opposed to filters) in HTML documents |
|
776 if ( !seed ) { |
|
777 setDocument( context ); |
|
778 context = context || document; |
|
779 |
|
780 if ( documentIsHTML ) { |
|
781 |
|
782 // If the selector is sufficiently simple, try using a "get*By*" DOM method |
|
783 // (excepting DocumentFragment context, where the methods don't exist) |
|
784 if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) { |
|
785 |
|
786 // ID selector |
|
787 if ( ( m = match[ 1 ] ) ) { |
|
788 |
|
789 // Document context |
|
790 if ( nodeType === 9 ) { |
|
791 if ( ( elem = context.getElementById( m ) ) ) { |
|
792 |
|
793 // Support: IE, Opera, Webkit |
|
794 // TODO: identify versions |
|
795 // getElementById can match elements by name instead of ID |
|
796 if ( elem.id === m ) { |
|
797 results.push( elem ); |
|
798 return results; |
|
799 } |
|
800 } else { |
|
801 return results; |
|
802 } |
|
803 |
|
804 // Element context |
|
805 } else { |
|
806 |
|
807 // Support: IE, Opera, Webkit |
|
808 // TODO: identify versions |
|
809 // getElementById can match elements by name instead of ID |
|
810 if ( newContext && ( elem = newContext.getElementById( m ) ) && |
|
811 contains( context, elem ) && |
|
812 elem.id === m ) { |
|
813 |
|
814 results.push( elem ); |
|
815 return results; |
|
816 } |
|
817 } |
|
818 |
|
819 // Type selector |
|
820 } else if ( match[ 2 ] ) { |
|
821 push.apply( results, context.getElementsByTagName( selector ) ); |
|
822 return results; |
|
823 |
|
824 // Class selector |
|
825 } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName && |
|
826 context.getElementsByClassName ) { |
|
827 |
|
828 push.apply( results, context.getElementsByClassName( m ) ); |
|
829 return results; |
|
830 } |
|
831 } |
|
832 |
|
833 // Take advantage of querySelectorAll |
|
834 if ( support.qsa && |
|
835 !nonnativeSelectorCache[ selector + " " ] && |
|
836 ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) && |
|
837 |
|
838 // Support: IE 8 only |
|
839 // Exclude object elements |
|
840 ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) { |
|
841 |
|
842 newSelector = selector; |
|
843 newContext = context; |
|
844 |
|
845 // qSA considers elements outside a scoping root when evaluating child or |
|
846 // descendant combinators, which is not what we want. |
|
847 // In such cases, we work around the behavior by prefixing every selector in the |
|
848 // list with an ID selector referencing the scope context. |
|
849 // The technique has to be used as well when a leading combinator is used |
|
850 // as such selectors are not recognized by querySelectorAll. |
|
851 // Thanks to Andrew Dupont for this technique. |
|
852 if ( nodeType === 1 && |
|
853 ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) { |
|
854 |
|
855 // Expand context for sibling selectors |
|
856 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || |
|
857 context; |
|
858 |
|
859 // We can use :scope instead of the ID hack if the browser |
|
860 // supports it & if we're not changing the context. |
|
861 if ( newContext !== context || !support.scope ) { |
|
862 |
|
863 // Capture the context ID, setting it first if necessary |
|
864 if ( ( nid = context.getAttribute( "id" ) ) ) { |
|
865 nid = nid.replace( rcssescape, fcssescape ); |
|
866 } else { |
|
867 context.setAttribute( "id", ( nid = expando ) ); |
|
868 } |
|
869 } |
|
870 |
|
871 // Prefix every selector in the list |
|
872 groups = tokenize( selector ); |
|
873 i = groups.length; |
|
874 while ( i-- ) { |
|
875 groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " + |
|
876 toSelector( groups[ i ] ); |
|
877 } |
|
878 newSelector = groups.join( "," ); |
|
879 } |
|
880 |
|
881 try { |
|
882 |
|
883 // `qSA` may not throw for unrecognized parts using forgiving parsing: |
|
884 // https://drafts.csswg.org/selectors/#forgiving-selector |
|
885 // like the `:has()` pseudo-class: |
|
886 // https://drafts.csswg.org/selectors/#relational |
|
887 // `CSS.supports` is still expected to return `false` then: |
|
888 // https://drafts.csswg.org/css-conditional-4/#typedef-supports-selector-fn |
|
889 // https://drafts.csswg.org/css-conditional-4/#dfn-support-selector |
|
890 if ( support.cssSupportsSelector && |
|
891 |
|
892 // eslint-disable-next-line no-undef |
|
893 !CSS.supports( "selector(:is(" + newSelector + "))" ) ) { |
|
894 |
|
895 // Support: IE 11+ |
|
896 // Throw to get to the same code path as an error directly in qSA. |
|
897 // Note: once we only support browser supporting |
|
898 // `CSS.supports('selector(...)')`, we can most likely drop |
|
899 // the `try-catch`. IE doesn't implement the API. |
|
900 throw new Error(); |
|
901 } |
|
902 |
|
903 push.apply( results, |
|
904 newContext.querySelectorAll( newSelector ) |
|
905 ); |
|
906 return results; |
|
907 } catch ( qsaError ) { |
|
908 nonnativeSelectorCache( selector, true ); |
|
909 } finally { |
|
910 if ( nid === expando ) { |
|
911 context.removeAttribute( "id" ); |
|
912 } |
|
913 } |
|
914 } |
|
915 } |
|
916 } |
|
917 |
|
918 // All others |
|
919 return select( selector.replace( rtrim, "$1" ), context, results, seed ); |
|
920 } |
|
921 |
|
922 /** |
|
923 * Create key-value caches of limited size |
|
924 * @returns {function(string, object)} Returns the Object data after storing it on itself with |
|
925 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) |
|
926 * deleting the oldest entry |
|
927 */ |
|
928 function createCache() { |
|
929 var keys = []; |
|
930 |
|
931 function cache( key, value ) { |
|
932 |
|
933 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) |
|
934 if ( keys.push( key + " " ) > Expr.cacheLength ) { |
|
935 |
|
936 // Only keep the most recent entries |
|
937 delete cache[ keys.shift() ]; |
|
938 } |
|
939 return ( cache[ key + " " ] = value ); |
|
940 } |
|
941 return cache; |
|
942 } |
|
943 |
|
944 /** |
|
945 * Mark a function for special use by Sizzle |
|
946 * @param {Function} fn The function to mark |
|
947 */ |
|
948 function markFunction( fn ) { |
|
949 fn[ expando ] = true; |
|
950 return fn; |
|
951 } |
|
952 |
|
953 /** |
|
954 * Support testing using an element |
|
955 * @param {Function} fn Passed the created element and returns a boolean result |
|
956 */ |
|
957 function assert( fn ) { |
|
958 var el = document.createElement( "fieldset" ); |
|
959 |
|
960 try { |
|
961 return !!fn( el ); |
|
962 } catch ( e ) { |
|
963 return false; |
|
964 } finally { |
|
965 |
|
966 // Remove from its parent by default |
|
967 if ( el.parentNode ) { |
|
968 el.parentNode.removeChild( el ); |
|
969 } |
|
970 |
|
971 // release memory in IE |
|
972 el = null; |
|
973 } |
|
974 } |
|
975 |
|
976 /** |
|
977 * Adds the same handler for all of the specified attrs |
|
978 * @param {String} attrs Pipe-separated list of attributes |
|
979 * @param {Function} handler The method that will be applied |
|
980 */ |
|
981 function addHandle( attrs, handler ) { |
|
982 var arr = attrs.split( "|" ), |
|
983 i = arr.length; |
|
984 |
|
985 while ( i-- ) { |
|
986 Expr.attrHandle[ arr[ i ] ] = handler; |
|
987 } |
|
988 } |
|
989 |
|
990 /** |
|
991 * Checks document order of two siblings |
|
992 * @param {Element} a |
|
993 * @param {Element} b |
|
994 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b |
|
995 */ |
|
996 function siblingCheck( a, b ) { |
|
997 var cur = b && a, |
|
998 diff = cur && a.nodeType === 1 && b.nodeType === 1 && |
|
999 a.sourceIndex - b.sourceIndex; |
|
1000 |
|
1001 // Use IE sourceIndex if available on both nodes |
|
1002 if ( diff ) { |
|
1003 return diff; |
|
1004 } |
|
1005 |
|
1006 // Check if b follows a |
|
1007 if ( cur ) { |
|
1008 while ( ( cur = cur.nextSibling ) ) { |
|
1009 if ( cur === b ) { |
|
1010 return -1; |
|
1011 } |
|
1012 } |
|
1013 } |
|
1014 |
|
1015 return a ? 1 : -1; |
|
1016 } |
|
1017 |
|
1018 /** |
|
1019 * Returns a function to use in pseudos for input types |
|
1020 * @param {String} type |
|
1021 */ |
|
1022 function createInputPseudo( type ) { |
|
1023 return function( elem ) { |
|
1024 var name = elem.nodeName.toLowerCase(); |
|
1025 return name === "input" && elem.type === type; |
|
1026 }; |
|
1027 } |
|
1028 |
|
1029 /** |
|
1030 * Returns a function to use in pseudos for buttons |
|
1031 * @param {String} type |
|
1032 */ |
|
1033 function createButtonPseudo( type ) { |
|
1034 return function( elem ) { |
|
1035 var name = elem.nodeName.toLowerCase(); |
|
1036 return ( name === "input" || name === "button" ) && elem.type === type; |
|
1037 }; |
|
1038 } |
|
1039 |
|
1040 /** |
|
1041 * Returns a function to use in pseudos for :enabled/:disabled |
|
1042 * @param {Boolean} disabled true for :disabled; false for :enabled |
|
1043 */ |
|
1044 function createDisabledPseudo( disabled ) { |
|
1045 |
|
1046 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable |
|
1047 return function( elem ) { |
|
1048 |
|
1049 // Only certain elements can match :enabled or :disabled |
|
1050 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled |
|
1051 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled |
|
1052 if ( "form" in elem ) { |
|
1053 |
|
1054 // Check for inherited disabledness on relevant non-disabled elements: |
|
1055 // * listed form-associated elements in a disabled fieldset |
|
1056 // https://html.spec.whatwg.org/multipage/forms.html#category-listed |
|
1057 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled |
|
1058 // * option elements in a disabled optgroup |
|
1059 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled |
|
1060 // All such elements have a "form" property. |
|
1061 if ( elem.parentNode && elem.disabled === false ) { |
|
1062 |
|
1063 // Option elements defer to a parent optgroup if present |
|
1064 if ( "label" in elem ) { |
|
1065 if ( "label" in elem.parentNode ) { |
|
1066 return elem.parentNode.disabled === disabled; |
|
1067 } else { |
|
1068 return elem.disabled === disabled; |
|
1069 } |
|
1070 } |
|
1071 |
|
1072 // Support: IE 6 - 11 |
|
1073 // Use the isDisabled shortcut property to check for disabled fieldset ancestors |
|
1074 return elem.isDisabled === disabled || |
|
1075 |
|
1076 // Where there is no isDisabled, check manually |
|
1077 /* jshint -W018 */ |
|
1078 elem.isDisabled !== !disabled && |
|
1079 inDisabledFieldset( elem ) === disabled; |
|
1080 } |
|
1081 |
|
1082 return elem.disabled === disabled; |
|
1083 |
|
1084 // Try to winnow out elements that can't be disabled before trusting the disabled property. |
|
1085 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't |
|
1086 // even exist on them, let alone have a boolean value. |
|
1087 } else if ( "label" in elem ) { |
|
1088 return elem.disabled === disabled; |
|
1089 } |
|
1090 |
|
1091 // Remaining elements are neither :enabled nor :disabled |
|
1092 return false; |
|
1093 }; |
|
1094 } |
|
1095 |
|
1096 /** |
|
1097 * Returns a function to use in pseudos for positionals |
|
1098 * @param {Function} fn |
|
1099 */ |
|
1100 function createPositionalPseudo( fn ) { |
|
1101 return markFunction( function( argument ) { |
|
1102 argument = +argument; |
|
1103 return markFunction( function( seed, matches ) { |
|
1104 var j, |
|
1105 matchIndexes = fn( [], seed.length, argument ), |
|
1106 i = matchIndexes.length; |
|
1107 |
|
1108 // Match elements found at the specified indexes |
|
1109 while ( i-- ) { |
|
1110 if ( seed[ ( j = matchIndexes[ i ] ) ] ) { |
|
1111 seed[ j ] = !( matches[ j ] = seed[ j ] ); |
|
1112 } |
|
1113 } |
|
1114 } ); |
|
1115 } ); |
|
1116 } |
|
1117 |
|
1118 /** |
|
1119 * Checks a node for validity as a Sizzle context |
|
1120 * @param {Element|Object=} context |
|
1121 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value |
|
1122 */ |
|
1123 function testContext( context ) { |
|
1124 return context && typeof context.getElementsByTagName !== "undefined" && context; |
|
1125 } |
|
1126 |
|
1127 // Expose support vars for convenience |
|
1128 support = Sizzle.support = {}; |
|
1129 |
|
1130 /** |
|
1131 * Detects XML nodes |
|
1132 * @param {Element|Object} elem An element or a document |
|
1133 * @returns {Boolean} True iff elem is a non-HTML XML node |
|
1134 */ |
|
1135 isXML = Sizzle.isXML = function( elem ) { |
|
1136 var namespace = elem && elem.namespaceURI, |
|
1137 docElem = elem && ( elem.ownerDocument || elem ).documentElement; |
|
1138 |
|
1139 // Support: IE <=8 |
|
1140 // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes |
|
1141 // https://bugs.jquery.com/ticket/4833 |
|
1142 return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" ); |
|
1143 }; |
|
1144 |
|
1145 /** |
|
1146 * Sets document-related variables once based on the current document |
|
1147 * @param {Element|Object} [doc] An element or document object to use to set the document |
|
1148 * @returns {Object} Returns the current document |
|
1149 */ |
|
1150 setDocument = Sizzle.setDocument = function( node ) { |
|
1151 var hasCompare, subWindow, |
|
1152 doc = node ? node.ownerDocument || node : preferredDoc; |
|
1153 |
|
1154 // Return early if doc is invalid or already selected |
|
1155 // Support: IE 11+, Edge 17 - 18+ |
|
1156 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
|
1157 // two documents; shallow comparisons work. |
|
1158 // eslint-disable-next-line eqeqeq |
|
1159 if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) { |
|
1160 return document; |
|
1161 } |
|
1162 |
|
1163 // Update global variables |
|
1164 document = doc; |
|
1165 docElem = document.documentElement; |
|
1166 documentIsHTML = !isXML( document ); |
|
1167 |
|
1168 // Support: IE 9 - 11+, Edge 12 - 18+ |
|
1169 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) |
|
1170 // Support: IE 11+, Edge 17 - 18+ |
|
1171 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
|
1172 // two documents; shallow comparisons work. |
|
1173 // eslint-disable-next-line eqeqeq |
|
1174 if ( preferredDoc != document && |
|
1175 ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { |
|
1176 |
|
1177 // Support: IE 11, Edge |
|
1178 if ( subWindow.addEventListener ) { |
|
1179 subWindow.addEventListener( "unload", unloadHandler, false ); |
|
1180 |
|
1181 // Support: IE 9 - 10 only |
|
1182 } else if ( subWindow.attachEvent ) { |
|
1183 subWindow.attachEvent( "onunload", unloadHandler ); |
|
1184 } |
|
1185 } |
|
1186 |
|
1187 // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only, |
|
1188 // Safari 4 - 5 only, Opera <=11.6 - 12.x only |
|
1189 // IE/Edge & older browsers don't support the :scope pseudo-class. |
|
1190 // Support: Safari 6.0 only |
|
1191 // Safari 6.0 supports :scope but it's an alias of :root there. |
|
1192 support.scope = assert( function( el ) { |
|
1193 docElem.appendChild( el ).appendChild( document.createElement( "div" ) ); |
|
1194 return typeof el.querySelectorAll !== "undefined" && |
|
1195 !el.querySelectorAll( ":scope fieldset div" ).length; |
|
1196 } ); |
|
1197 |
|
1198 // Support: Chrome 105+, Firefox 104+, Safari 15.4+ |
|
1199 // Make sure forgiving mode is not used in `CSS.supports( "selector(...)" )`. |
|
1200 // |
|
1201 // `:is()` uses a forgiving selector list as an argument and is widely |
|
1202 // implemented, so it's a good one to test against. |
|
1203 support.cssSupportsSelector = assert( function() { |
|
1204 /* eslint-disable no-undef */ |
|
1205 |
|
1206 return CSS.supports( "selector(*)" ) && |
|
1207 |
|
1208 // Support: Firefox 78-81 only |
|
1209 // In old Firefox, `:is()` didn't use forgiving parsing. In that case, |
|
1210 // fail this test as there's no selector to test against that. |
|
1211 // `CSS.supports` uses unforgiving parsing |
|
1212 document.querySelectorAll( ":is(:jqfake)" ) && |
|
1213 |
|
1214 // `*` is needed as Safari & newer Chrome implemented something in between |
|
1215 // for `:has()` - it throws in `qSA` if it only contains an unsupported |
|
1216 // argument but multiple ones, one of which is supported, are fine. |
|
1217 // We want to play safe in case `:is()` gets the same treatment. |
|
1218 !CSS.supports( "selector(:is(*,:jqfake))" ); |
|
1219 |
|
1220 /* eslint-enable */ |
|
1221 } ); |
|
1222 |
|
1223 /* Attributes |
|
1224 ---------------------------------------------------------------------- */ |
|
1225 |
|
1226 // Support: IE<8 |
|
1227 // Verify that getAttribute really returns attributes and not properties |
|
1228 // (excepting IE8 booleans) |
|
1229 support.attributes = assert( function( el ) { |
|
1230 el.className = "i"; |
|
1231 return !el.getAttribute( "className" ); |
|
1232 } ); |
|
1233 |
|
1234 /* getElement(s)By* |
|
1235 ---------------------------------------------------------------------- */ |
|
1236 |
|
1237 // Check if getElementsByTagName("*") returns only elements |
|
1238 support.getElementsByTagName = assert( function( el ) { |
|
1239 el.appendChild( document.createComment( "" ) ); |
|
1240 return !el.getElementsByTagName( "*" ).length; |
|
1241 } ); |
|
1242 |
|
1243 // Support: IE<9 |
|
1244 support.getElementsByClassName = rnative.test( document.getElementsByClassName ); |
|
1245 |
|
1246 // Support: IE<10 |
|
1247 // Check if getElementById returns elements by name |
|
1248 // The broken getElementById methods don't pick up programmatically-set names, |
|
1249 // so use a roundabout getElementsByName test |
|
1250 support.getById = assert( function( el ) { |
|
1251 docElem.appendChild( el ).id = expando; |
|
1252 return !document.getElementsByName || !document.getElementsByName( expando ).length; |
|
1253 } ); |
|
1254 |
|
1255 // ID filter and find |
|
1256 if ( support.getById ) { |
|
1257 Expr.filter[ "ID" ] = function( id ) { |
|
1258 var attrId = id.replace( runescape, funescape ); |
|
1259 return function( elem ) { |
|
1260 return elem.getAttribute( "id" ) === attrId; |
|
1261 }; |
|
1262 }; |
|
1263 Expr.find[ "ID" ] = function( id, context ) { |
|
1264 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { |
|
1265 var elem = context.getElementById( id ); |
|
1266 return elem ? [ elem ] : []; |
|
1267 } |
|
1268 }; |
|
1269 } else { |
|
1270 Expr.filter[ "ID" ] = function( id ) { |
|
1271 var attrId = id.replace( runescape, funescape ); |
|
1272 return function( elem ) { |
|
1273 var node = typeof elem.getAttributeNode !== "undefined" && |
|
1274 elem.getAttributeNode( "id" ); |
|
1275 return node && node.value === attrId; |
|
1276 }; |
|
1277 }; |
|
1278 |
|
1279 // Support: IE 6 - 7 only |
|
1280 // getElementById is not reliable as a find shortcut |
|
1281 Expr.find[ "ID" ] = function( id, context ) { |
|
1282 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { |
|
1283 var node, i, elems, |
|
1284 elem = context.getElementById( id ); |
|
1285 |
|
1286 if ( elem ) { |
|
1287 |
|
1288 // Verify the id attribute |
|
1289 node = elem.getAttributeNode( "id" ); |
|
1290 if ( node && node.value === id ) { |
|
1291 return [ elem ]; |
|
1292 } |
|
1293 |
|
1294 // Fall back on getElementsByName |
|
1295 elems = context.getElementsByName( id ); |
|
1296 i = 0; |
|
1297 while ( ( elem = elems[ i++ ] ) ) { |
|
1298 node = elem.getAttributeNode( "id" ); |
|
1299 if ( node && node.value === id ) { |
|
1300 return [ elem ]; |
|
1301 } |
|
1302 } |
|
1303 } |
|
1304 |
|
1305 return []; |
|
1306 } |
|
1307 }; |
|
1308 } |
|
1309 |
|
1310 // Tag |
|
1311 Expr.find[ "TAG" ] = support.getElementsByTagName ? |
|
1312 function( tag, context ) { |
|
1313 if ( typeof context.getElementsByTagName !== "undefined" ) { |
|
1314 return context.getElementsByTagName( tag ); |
|
1315 |
|
1316 // DocumentFragment nodes don't have gEBTN |
|
1317 } else if ( support.qsa ) { |
|
1318 return context.querySelectorAll( tag ); |
|
1319 } |
|
1320 } : |
|
1321 |
|
1322 function( tag, context ) { |
|
1323 var elem, |
|
1324 tmp = [], |
|
1325 i = 0, |
|
1326 |
|
1327 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too |
|
1328 results = context.getElementsByTagName( tag ); |
|
1329 |
|
1330 // Filter out possible comments |
|
1331 if ( tag === "*" ) { |
|
1332 while ( ( elem = results[ i++ ] ) ) { |
|
1333 if ( elem.nodeType === 1 ) { |
|
1334 tmp.push( elem ); |
|
1335 } |
|
1336 } |
|
1337 |
|
1338 return tmp; |
|
1339 } |
|
1340 return results; |
|
1341 }; |
|
1342 |
|
1343 // Class |
|
1344 Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) { |
|
1345 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { |
|
1346 return context.getElementsByClassName( className ); |
|
1347 } |
|
1348 }; |
|
1349 |
|
1350 /* QSA/matchesSelector |
|
1351 ---------------------------------------------------------------------- */ |
|
1352 |
|
1353 // QSA and matchesSelector support |
|
1354 |
|
1355 // matchesSelector(:active) reports false when true (IE9/Opera 11.5) |
|
1356 rbuggyMatches = []; |
|
1357 |
|
1358 // qSa(:focus) reports false when true (Chrome 21) |
|
1359 // We allow this because of a bug in IE8/9 that throws an error |
|
1360 // whenever `document.activeElement` is accessed on an iframe |
|
1361 // So, we allow :focus to pass through QSA all the time to avoid the IE error |
|
1362 // See https://bugs.jquery.com/ticket/13378 |
|
1363 rbuggyQSA = []; |
|
1364 |
|
1365 if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) { |
|
1366 |
|
1367 // Build QSA regex |
|
1368 // Regex strategy adopted from Diego Perini |
|
1369 assert( function( el ) { |
|
1370 |
|
1371 var input; |
|
1372 |
|
1373 // Select is set to empty string on purpose |
|
1374 // This is to test IE's treatment of not explicitly |
|
1375 // setting a boolean content attribute, |
|
1376 // since its presence should be enough |
|
1377 // https://bugs.jquery.com/ticket/12359 |
|
1378 docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" + |
|
1379 "<select id='" + expando + "-\r\\' msallowcapture=''>" + |
|
1380 "<option selected=''></option></select>"; |
|
1381 |
|
1382 // Support: IE8, Opera 11-12.16 |
|
1383 // Nothing should be selected when empty strings follow ^= or $= or *= |
|
1384 // The test attribute must be unknown in Opera but "safe" for WinRT |
|
1385 // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section |
|
1386 if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) { |
|
1387 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); |
|
1388 } |
|
1389 |
|
1390 // Support: IE8 |
|
1391 // Boolean attributes and "value" are not treated correctly |
|
1392 if ( !el.querySelectorAll( "[selected]" ).length ) { |
|
1393 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); |
|
1394 } |
|
1395 |
|
1396 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ |
|
1397 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { |
|
1398 rbuggyQSA.push( "~=" ); |
|
1399 } |
|
1400 |
|
1401 // Support: IE 11+, Edge 15 - 18+ |
|
1402 // IE 11/Edge don't find elements on a `[name='']` query in some cases. |
|
1403 // Adding a temporary attribute to the document before the selection works |
|
1404 // around the issue. |
|
1405 // Interestingly, IE 10 & older don't seem to have the issue. |
|
1406 input = document.createElement( "input" ); |
|
1407 input.setAttribute( "name", "" ); |
|
1408 el.appendChild( input ); |
|
1409 if ( !el.querySelectorAll( "[name='']" ).length ) { |
|
1410 rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + |
|
1411 whitespace + "*(?:''|\"\")" ); |
|
1412 } |
|
1413 |
|
1414 // Webkit/Opera - :checked should return selected option elements |
|
1415 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked |
|
1416 // IE8 throws error here and will not see later tests |
|
1417 if ( !el.querySelectorAll( ":checked" ).length ) { |
|
1418 rbuggyQSA.push( ":checked" ); |
|
1419 } |
|
1420 |
|
1421 // Support: Safari 8+, iOS 8+ |
|
1422 // https://bugs.webkit.org/show_bug.cgi?id=136851 |
|
1423 // In-page `selector#id sibling-combinator selector` fails |
|
1424 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { |
|
1425 rbuggyQSA.push( ".#.+[+~]" ); |
|
1426 } |
|
1427 |
|
1428 // Support: Firefox <=3.6 - 5 only |
|
1429 // Old Firefox doesn't throw on a badly-escaped identifier. |
|
1430 el.querySelectorAll( "\\\f" ); |
|
1431 rbuggyQSA.push( "[\\r\\n\\f]" ); |
|
1432 } ); |
|
1433 |
|
1434 assert( function( el ) { |
|
1435 el.innerHTML = "<a href='' disabled='disabled'></a>" + |
|
1436 "<select disabled='disabled'><option/></select>"; |
|
1437 |
|
1438 // Support: Windows 8 Native Apps |
|
1439 // The type and name attributes are restricted during .innerHTML assignment |
|
1440 var input = document.createElement( "input" ); |
|
1441 input.setAttribute( "type", "hidden" ); |
|
1442 el.appendChild( input ).setAttribute( "name", "D" ); |
|
1443 |
|
1444 // Support: IE8 |
|
1445 // Enforce case-sensitivity of name attribute |
|
1446 if ( el.querySelectorAll( "[name=d]" ).length ) { |
|
1447 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); |
|
1448 } |
|
1449 |
|
1450 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) |
|
1451 // IE8 throws error here and will not see later tests |
|
1452 if ( el.querySelectorAll( ":enabled" ).length !== 2 ) { |
|
1453 rbuggyQSA.push( ":enabled", ":disabled" ); |
|
1454 } |
|
1455 |
|
1456 // Support: IE9-11+ |
|
1457 // IE's :disabled selector does not pick up the children of disabled fieldsets |
|
1458 docElem.appendChild( el ).disabled = true; |
|
1459 if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { |
|
1460 rbuggyQSA.push( ":enabled", ":disabled" ); |
|
1461 } |
|
1462 |
|
1463 // Support: Opera 10 - 11 only |
|
1464 // Opera 10-11 does not throw on post-comma invalid pseudos |
|
1465 el.querySelectorAll( "*,:x" ); |
|
1466 rbuggyQSA.push( ",.*:" ); |
|
1467 } ); |
|
1468 } |
|
1469 |
|
1470 if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches || |
|
1471 docElem.webkitMatchesSelector || |
|
1472 docElem.mozMatchesSelector || |
|
1473 docElem.oMatchesSelector || |
|
1474 docElem.msMatchesSelector ) ) ) ) { |
|
1475 |
|
1476 assert( function( el ) { |
|
1477 |
|
1478 // Check to see if it's possible to do matchesSelector |
|
1479 // on a disconnected node (IE 9) |
|
1480 support.disconnectedMatch = matches.call( el, "*" ); |
|
1481 |
|
1482 // This should fail with an exception |
|
1483 // Gecko does not error, returns false instead |
|
1484 matches.call( el, "[s!='']:x" ); |
|
1485 rbuggyMatches.push( "!=", pseudos ); |
|
1486 } ); |
|
1487 } |
|
1488 |
|
1489 if ( !support.cssSupportsSelector ) { |
|
1490 |
|
1491 // Support: Chrome 105+, Safari 15.4+ |
|
1492 // `:has()` uses a forgiving selector list as an argument so our regular |
|
1493 // `try-catch` mechanism fails to catch `:has()` with arguments not supported |
|
1494 // natively like `:has(:contains("Foo"))`. Where supported & spec-compliant, |
|
1495 // we now use `CSS.supports("selector(:is(SELECTOR_TO_BE_TESTED))")`, but |
|
1496 // outside that we mark `:has` as buggy. |
|
1497 rbuggyQSA.push( ":has" ); |
|
1498 } |
|
1499 |
|
1500 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); |
|
1501 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) ); |
|
1502 |
|
1503 /* Contains |
|
1504 ---------------------------------------------------------------------- */ |
|
1505 hasCompare = rnative.test( docElem.compareDocumentPosition ); |
|
1506 |
|
1507 // Element contains another |
|
1508 // Purposefully self-exclusive |
|
1509 // As in, an element does not contain itself |
|
1510 contains = hasCompare || rnative.test( docElem.contains ) ? |
|
1511 function( a, b ) { |
|
1512 |
|
1513 // Support: IE <9 only |
|
1514 // IE doesn't have `contains` on `document` so we need to check for |
|
1515 // `documentElement` presence. |
|
1516 // We need to fall back to `a` when `documentElement` is missing |
|
1517 // as `ownerDocument` of elements within `<template/>` may have |
|
1518 // a null one - a default behavior of all modern browsers. |
|
1519 var adown = a.nodeType === 9 && a.documentElement || a, |
|
1520 bup = b && b.parentNode; |
|
1521 return a === bup || !!( bup && bup.nodeType === 1 && ( |
|
1522 adown.contains ? |
|
1523 adown.contains( bup ) : |
|
1524 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 |
|
1525 ) ); |
|
1526 } : |
|
1527 function( a, b ) { |
|
1528 if ( b ) { |
|
1529 while ( ( b = b.parentNode ) ) { |
|
1530 if ( b === a ) { |
|
1531 return true; |
|
1532 } |
|
1533 } |
|
1534 } |
|
1535 return false; |
|
1536 }; |
|
1537 |
|
1538 /* Sorting |
|
1539 ---------------------------------------------------------------------- */ |
|
1540 |
|
1541 // Document order sorting |
|
1542 sortOrder = hasCompare ? |
|
1543 function( a, b ) { |
|
1544 |
|
1545 // Flag for duplicate removal |
|
1546 if ( a === b ) { |
|
1547 hasDuplicate = true; |
|
1548 return 0; |
|
1549 } |
|
1550 |
|
1551 // Sort on method existence if only one input has compareDocumentPosition |
|
1552 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; |
|
1553 if ( compare ) { |
|
1554 return compare; |
|
1555 } |
|
1556 |
|
1557 // Calculate position if both inputs belong to the same document |
|
1558 // Support: IE 11+, Edge 17 - 18+ |
|
1559 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
|
1560 // two documents; shallow comparisons work. |
|
1561 // eslint-disable-next-line eqeqeq |
|
1562 compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? |
|
1563 a.compareDocumentPosition( b ) : |
|
1564 |
|
1565 // Otherwise we know they are disconnected |
|
1566 1; |
|
1567 |
|
1568 // Disconnected nodes |
|
1569 if ( compare & 1 || |
|
1570 ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) { |
|
1571 |
|
1572 // Choose the first element that is related to our preferred document |
|
1573 // Support: IE 11+, Edge 17 - 18+ |
|
1574 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
|
1575 // two documents; shallow comparisons work. |
|
1576 // eslint-disable-next-line eqeqeq |
|
1577 if ( a == document || a.ownerDocument == preferredDoc && |
|
1578 contains( preferredDoc, a ) ) { |
|
1579 return -1; |
|
1580 } |
|
1581 |
|
1582 // Support: IE 11+, Edge 17 - 18+ |
|
1583 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
|
1584 // two documents; shallow comparisons work. |
|
1585 // eslint-disable-next-line eqeqeq |
|
1586 if ( b == document || b.ownerDocument == preferredDoc && |
|
1587 contains( preferredDoc, b ) ) { |
|
1588 return 1; |
|
1589 } |
|
1590 |
|
1591 // Maintain original order |
|
1592 return sortInput ? |
|
1593 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : |
|
1594 0; |
|
1595 } |
|
1596 |
|
1597 return compare & 4 ? -1 : 1; |
|
1598 } : |
|
1599 function( a, b ) { |
|
1600 |
|
1601 // Exit early if the nodes are identical |
|
1602 if ( a === b ) { |
|
1603 hasDuplicate = true; |
|
1604 return 0; |
|
1605 } |
|
1606 |
|
1607 var cur, |
|
1608 i = 0, |
|
1609 aup = a.parentNode, |
|
1610 bup = b.parentNode, |
|
1611 ap = [ a ], |
|
1612 bp = [ b ]; |
|
1613 |
|
1614 // Parentless nodes are either documents or disconnected |
|
1615 if ( !aup || !bup ) { |
|
1616 |
|
1617 // Support: IE 11+, Edge 17 - 18+ |
|
1618 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
|
1619 // two documents; shallow comparisons work. |
|
1620 /* eslint-disable eqeqeq */ |
|
1621 return a == document ? -1 : |
|
1622 b == document ? 1 : |
|
1623 /* eslint-enable eqeqeq */ |
|
1624 aup ? -1 : |
|
1625 bup ? 1 : |
|
1626 sortInput ? |
|
1627 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : |
|
1628 0; |
|
1629 |
|
1630 // If the nodes are siblings, we can do a quick check |
|
1631 } else if ( aup === bup ) { |
|
1632 return siblingCheck( a, b ); |
|
1633 } |
|
1634 |
|
1635 // Otherwise we need full lists of their ancestors for comparison |
|
1636 cur = a; |
|
1637 while ( ( cur = cur.parentNode ) ) { |
|
1638 ap.unshift( cur ); |
|
1639 } |
|
1640 cur = b; |
|
1641 while ( ( cur = cur.parentNode ) ) { |
|
1642 bp.unshift( cur ); |
|
1643 } |
|
1644 |
|
1645 // Walk down the tree looking for a discrepancy |
|
1646 while ( ap[ i ] === bp[ i ] ) { |
|
1647 i++; |
|
1648 } |
|
1649 |
|
1650 return i ? |
|
1651 |
|
1652 // Do a sibling check if the nodes have a common ancestor |
|
1653 siblingCheck( ap[ i ], bp[ i ] ) : |
|
1654 |
|
1655 // Otherwise nodes in our document sort first |
|
1656 // Support: IE 11+, Edge 17 - 18+ |
|
1657 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
|
1658 // two documents; shallow comparisons work. |
|
1659 /* eslint-disable eqeqeq */ |
|
1660 ap[ i ] == preferredDoc ? -1 : |
|
1661 bp[ i ] == preferredDoc ? 1 : |
|
1662 /* eslint-enable eqeqeq */ |
|
1663 0; |
|
1664 }; |
|
1665 |
|
1666 return document; |
|
1667 }; |
|
1668 |
|
1669 Sizzle.matches = function( expr, elements ) { |
|
1670 return Sizzle( expr, null, null, elements ); |
|
1671 }; |
|
1672 |
|
1673 Sizzle.matchesSelector = function( elem, expr ) { |
|
1674 setDocument( elem ); |
|
1675 |
|
1676 if ( support.matchesSelector && documentIsHTML && |
|
1677 !nonnativeSelectorCache[ expr + " " ] && |
|
1678 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && |
|
1679 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { |
|
1680 |
|
1681 try { |
|
1682 var ret = matches.call( elem, expr ); |
|
1683 |
|
1684 // IE 9's matchesSelector returns false on disconnected nodes |
|
1685 if ( ret || support.disconnectedMatch || |
|
1686 |
|
1687 // As well, disconnected nodes are said to be in a document |
|
1688 // fragment in IE 9 |
|
1689 elem.document && elem.document.nodeType !== 11 ) { |
|
1690 return ret; |
|
1691 } |
|
1692 } catch ( e ) { |
|
1693 nonnativeSelectorCache( expr, true ); |
|
1694 } |
|
1695 } |
|
1696 |
|
1697 return Sizzle( expr, document, null, [ elem ] ).length > 0; |
|
1698 }; |
|
1699 |
|
1700 Sizzle.contains = function( context, elem ) { |
|
1701 |
|
1702 // Set document vars if needed |
|
1703 // Support: IE 11+, Edge 17 - 18+ |
|
1704 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
|
1705 // two documents; shallow comparisons work. |
|
1706 // eslint-disable-next-line eqeqeq |
|
1707 if ( ( context.ownerDocument || context ) != document ) { |
|
1708 setDocument( context ); |
|
1709 } |
|
1710 return contains( context, elem ); |
|
1711 }; |
|
1712 |
|
1713 Sizzle.attr = function( elem, name ) { |
|
1714 |
|
1715 // Set document vars if needed |
|
1716 // Support: IE 11+, Edge 17 - 18+ |
|
1717 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
|
1718 // two documents; shallow comparisons work. |
|
1719 // eslint-disable-next-line eqeqeq |
|
1720 if ( ( elem.ownerDocument || elem ) != document ) { |
|
1721 setDocument( elem ); |
|
1722 } |
|
1723 |
|
1724 var fn = Expr.attrHandle[ name.toLowerCase() ], |
|
1725 |
|
1726 // Don't get fooled by Object.prototype properties (jQuery #13807) |
|
1727 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? |
|
1728 fn( elem, name, !documentIsHTML ) : |
|
1729 undefined; |
|
1730 |
|
1731 return val !== undefined ? |
|
1732 val : |
|
1733 support.attributes || !documentIsHTML ? |
|
1734 elem.getAttribute( name ) : |
|
1735 ( val = elem.getAttributeNode( name ) ) && val.specified ? |
|
1736 val.value : |
|
1737 null; |
|
1738 }; |
|
1739 |
|
1740 Sizzle.escape = function( sel ) { |
|
1741 return ( sel + "" ).replace( rcssescape, fcssescape ); |
|
1742 }; |
|
1743 |
|
1744 Sizzle.error = function( msg ) { |
|
1745 throw new Error( "Syntax error, unrecognized expression: " + msg ); |
|
1746 }; |
|
1747 |
|
1748 /** |
|
1749 * Document sorting and removing duplicates |
|
1750 * @param {ArrayLike} results |
|
1751 */ |
|
1752 Sizzle.uniqueSort = function( results ) { |
|
1753 var elem, |
|
1754 duplicates = [], |
|
1755 j = 0, |
|
1756 i = 0; |
|
1757 |
|
1758 // Unless we *know* we can detect duplicates, assume their presence |
|
1759 hasDuplicate = !support.detectDuplicates; |
|
1760 sortInput = !support.sortStable && results.slice( 0 ); |
|
1761 results.sort( sortOrder ); |
|
1762 |
|
1763 if ( hasDuplicate ) { |
|
1764 while ( ( elem = results[ i++ ] ) ) { |
|
1765 if ( elem === results[ i ] ) { |
|
1766 j = duplicates.push( i ); |
|
1767 } |
|
1768 } |
|
1769 while ( j-- ) { |
|
1770 results.splice( duplicates[ j ], 1 ); |
|
1771 } |
|
1772 } |
|
1773 |
|
1774 // Clear input after sorting to release objects |
|
1775 // See https://github.com/jquery/sizzle/pull/225 |
|
1776 sortInput = null; |
|
1777 |
|
1778 return results; |
|
1779 }; |
|
1780 |
|
1781 /** |
|
1782 * Utility function for retrieving the text value of an array of DOM nodes |
|
1783 * @param {Array|Element} elem |
|
1784 */ |
|
1785 getText = Sizzle.getText = function( elem ) { |
|
1786 var node, |
|
1787 ret = "", |
|
1788 i = 0, |
|
1789 nodeType = elem.nodeType; |
|
1790 |
|
1791 if ( !nodeType ) { |
|
1792 |
|
1793 // If no nodeType, this is expected to be an array |
|
1794 while ( ( node = elem[ i++ ] ) ) { |
|
1795 |
|
1796 // Do not traverse comment nodes |
|
1797 ret += getText( node ); |
|
1798 } |
|
1799 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { |
|
1800 |
|
1801 // Use textContent for elements |
|
1802 // innerText usage removed for consistency of new lines (jQuery #11153) |
|
1803 if ( typeof elem.textContent === "string" ) { |
|
1804 return elem.textContent; |
|
1805 } else { |
|
1806 |
|
1807 // Traverse its children |
|
1808 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { |
|
1809 ret += getText( elem ); |
|
1810 } |
|
1811 } |
|
1812 } else if ( nodeType === 3 || nodeType === 4 ) { |
|
1813 return elem.nodeValue; |
|
1814 } |
|
1815 |
|
1816 // Do not include comment or processing instruction nodes |
|
1817 |
|
1818 return ret; |
|
1819 }; |
|
1820 |
|
1821 Expr = Sizzle.selectors = { |
|
1822 |
|
1823 // Can be adjusted by the user |
|
1824 cacheLength: 50, |
|
1825 |
|
1826 createPseudo: markFunction, |
|
1827 |
|
1828 match: matchExpr, |
|
1829 |
|
1830 attrHandle: {}, |
|
1831 |
|
1832 find: {}, |
|
1833 |
|
1834 relative: { |
|
1835 ">": { dir: "parentNode", first: true }, |
|
1836 " ": { dir: "parentNode" }, |
|
1837 "+": { dir: "previousSibling", first: true }, |
|
1838 "~": { dir: "previousSibling" } |
|
1839 }, |
|
1840 |
|
1841 preFilter: { |
|
1842 "ATTR": function( match ) { |
|
1843 match[ 1 ] = match[ 1 ].replace( runescape, funescape ); |
|
1844 |
|
1845 // Move the given value to match[3] whether quoted or unquoted |
|
1846 match[ 3 ] = ( match[ 3 ] || match[ 4 ] || |
|
1847 match[ 5 ] || "" ).replace( runescape, funescape ); |
|
1848 |
|
1849 if ( match[ 2 ] === "~=" ) { |
|
1850 match[ 3 ] = " " + match[ 3 ] + " "; |
|
1851 } |
|
1852 |
|
1853 return match.slice( 0, 4 ); |
|
1854 }, |
|
1855 |
|
1856 "CHILD": function( match ) { |
|
1857 |
|
1858 /* matches from matchExpr["CHILD"] |
|
1859 1 type (only|nth|...) |
|
1860 2 what (child|of-type) |
|
1861 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) |
|
1862 4 xn-component of xn+y argument ([+-]?\d*n|) |
|
1863 5 sign of xn-component |
|
1864 6 x of xn-component |
|
1865 7 sign of y-component |
|
1866 8 y of y-component |
|
1867 */ |
|
1868 match[ 1 ] = match[ 1 ].toLowerCase(); |
|
1869 |
|
1870 if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { |
|
1871 |
|
1872 // nth-* requires argument |
|
1873 if ( !match[ 3 ] ) { |
|
1874 Sizzle.error( match[ 0 ] ); |
|
1875 } |
|
1876 |
|
1877 // numeric x and y parameters for Expr.filter.CHILD |
|
1878 // remember that false/true cast respectively to 0/1 |
|
1879 match[ 4 ] = +( match[ 4 ] ? |
|
1880 match[ 5 ] + ( match[ 6 ] || 1 ) : |
|
1881 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) ); |
|
1882 match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); |
|
1883 |
|
1884 // other types prohibit arguments |
|
1885 } else if ( match[ 3 ] ) { |
|
1886 Sizzle.error( match[ 0 ] ); |
|
1887 } |
|
1888 |
|
1889 return match; |
|
1890 }, |
|
1891 |
|
1892 "PSEUDO": function( match ) { |
|
1893 var excess, |
|
1894 unquoted = !match[ 6 ] && match[ 2 ]; |
|
1895 |
|
1896 if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) { |
|
1897 return null; |
|
1898 } |
|
1899 |
|
1900 // Accept quoted arguments as-is |
|
1901 if ( match[ 3 ] ) { |
|
1902 match[ 2 ] = match[ 4 ] || match[ 5 ] || ""; |
|
1903 |
|
1904 // Strip excess characters from unquoted arguments |
|
1905 } else if ( unquoted && rpseudo.test( unquoted ) && |
|
1906 |
|
1907 // Get excess from tokenize (recursively) |
|
1908 ( excess = tokenize( unquoted, true ) ) && |
|
1909 |
|
1910 // advance to the next closing parenthesis |
|
1911 ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) { |
|
1912 |
|
1913 // excess is a negative index |
|
1914 match[ 0 ] = match[ 0 ].slice( 0, excess ); |
|
1915 match[ 2 ] = unquoted.slice( 0, excess ); |
|
1916 } |
|
1917 |
|
1918 // Return only captures needed by the pseudo filter method (type and argument) |
|
1919 return match.slice( 0, 3 ); |
|
1920 } |
|
1921 }, |
|
1922 |
|
1923 filter: { |
|
1924 |
|
1925 "TAG": function( nodeNameSelector ) { |
|
1926 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); |
|
1927 return nodeNameSelector === "*" ? |
|
1928 function() { |
|
1929 return true; |
|
1930 } : |
|
1931 function( elem ) { |
|
1932 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; |
|
1933 }; |
|
1934 }, |
|
1935 |
|
1936 "CLASS": function( className ) { |
|
1937 var pattern = classCache[ className + " " ]; |
|
1938 |
|
1939 return pattern || |
|
1940 ( pattern = new RegExp( "(^|" + whitespace + |
|
1941 ")" + className + "(" + whitespace + "|$)" ) ) && classCache( |
|
1942 className, function( elem ) { |
|
1943 return pattern.test( |
|
1944 typeof elem.className === "string" && elem.className || |
|
1945 typeof elem.getAttribute !== "undefined" && |
|
1946 elem.getAttribute( "class" ) || |
|
1947 "" |
|
1948 ); |
|
1949 } ); |
|
1950 }, |
|
1951 |
|
1952 "ATTR": function( name, operator, check ) { |
|
1953 return function( elem ) { |
|
1954 var result = Sizzle.attr( elem, name ); |
|
1955 |
|
1956 if ( result == null ) { |
|
1957 return operator === "!="; |
|
1958 } |
|
1959 if ( !operator ) { |
|
1960 return true; |
|
1961 } |
|
1962 |
|
1963 result += ""; |
|
1964 |
|
1965 /* eslint-disable max-len */ |
|
1966 |
|
1967 return operator === "=" ? result === check : |
|
1968 operator === "!=" ? result !== check : |
|
1969 operator === "^=" ? check && result.indexOf( check ) === 0 : |
|
1970 operator === "*=" ? check && result.indexOf( check ) > -1 : |
|
1971 operator === "$=" ? check && result.slice( -check.length ) === check : |
|
1972 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : |
|
1973 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : |
|
1974 false; |
|
1975 /* eslint-enable max-len */ |
|
1976 |
|
1977 }; |
|
1978 }, |
|
1979 |
|
1980 "CHILD": function( type, what, _argument, first, last ) { |
|
1981 var simple = type.slice( 0, 3 ) !== "nth", |
|
1982 forward = type.slice( -4 ) !== "last", |
|
1983 ofType = what === "of-type"; |
|
1984 |
|
1985 return first === 1 && last === 0 ? |
|
1986 |
|
1987 // Shortcut for :nth-*(n) |
|
1988 function( elem ) { |
|
1989 return !!elem.parentNode; |
|
1990 } : |
|
1991 |
|
1992 function( elem, _context, xml ) { |
|
1993 var cache, uniqueCache, outerCache, node, nodeIndex, start, |
|
1994 dir = simple !== forward ? "nextSibling" : "previousSibling", |
|
1995 parent = elem.parentNode, |
|
1996 name = ofType && elem.nodeName.toLowerCase(), |
|
1997 useCache = !xml && !ofType, |
|
1998 diff = false; |
|
1999 |
|
2000 if ( parent ) { |
|
2001 |
|
2002 // :(first|last|only)-(child|of-type) |
|
2003 if ( simple ) { |
|
2004 while ( dir ) { |
|
2005 node = elem; |
|
2006 while ( ( node = node[ dir ] ) ) { |
|
2007 if ( ofType ? |
|
2008 node.nodeName.toLowerCase() === name : |
|
2009 node.nodeType === 1 ) { |
|
2010 |
|
2011 return false; |
|
2012 } |
|
2013 } |
|
2014 |
|
2015 // Reverse direction for :only-* (if we haven't yet done so) |
|
2016 start = dir = type === "only" && !start && "nextSibling"; |
|
2017 } |
|
2018 return true; |
|
2019 } |
|
2020 |
|
2021 start = [ forward ? parent.firstChild : parent.lastChild ]; |
|
2022 |
|
2023 // non-xml :nth-child(...) stores cache data on `parent` |
|
2024 if ( forward && useCache ) { |
|
2025 |
|
2026 // Seek `elem` from a previously-cached index |
|
2027 |
|
2028 // ...in a gzip-friendly way |
|
2029 node = parent; |
|
2030 outerCache = node[ expando ] || ( node[ expando ] = {} ); |
|
2031 |
|
2032 // Support: IE <9 only |
|
2033 // Defend against cloned attroperties (jQuery gh-1709) |
|
2034 uniqueCache = outerCache[ node.uniqueID ] || |
|
2035 ( outerCache[ node.uniqueID ] = {} ); |
|
2036 |
|
2037 cache = uniqueCache[ type ] || []; |
|
2038 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; |
|
2039 diff = nodeIndex && cache[ 2 ]; |
|
2040 node = nodeIndex && parent.childNodes[ nodeIndex ]; |
|
2041 |
|
2042 while ( ( node = ++nodeIndex && node && node[ dir ] || |
|
2043 |
|
2044 // Fallback to seeking `elem` from the start |
|
2045 ( diff = nodeIndex = 0 ) || start.pop() ) ) { |
|
2046 |
|
2047 // When found, cache indexes on `parent` and break |
|
2048 if ( node.nodeType === 1 && ++diff && node === elem ) { |
|
2049 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; |
|
2050 break; |
|
2051 } |
|
2052 } |
|
2053 |
|
2054 } else { |
|
2055 |
|
2056 // Use previously-cached element index if available |
|
2057 if ( useCache ) { |
|
2058 |
|
2059 // ...in a gzip-friendly way |
|
2060 node = elem; |
|
2061 outerCache = node[ expando ] || ( node[ expando ] = {} ); |
|
2062 |
|
2063 // Support: IE <9 only |
|
2064 // Defend against cloned attroperties (jQuery gh-1709) |
|
2065 uniqueCache = outerCache[ node.uniqueID ] || |
|
2066 ( outerCache[ node.uniqueID ] = {} ); |
|
2067 |
|
2068 cache = uniqueCache[ type ] || []; |
|
2069 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; |
|
2070 diff = nodeIndex; |
|
2071 } |
|
2072 |
|
2073 // xml :nth-child(...) |
|
2074 // or :nth-last-child(...) or :nth(-last)?-of-type(...) |
|
2075 if ( diff === false ) { |
|
2076 |
|
2077 // Use the same loop as above to seek `elem` from the start |
|
2078 while ( ( node = ++nodeIndex && node && node[ dir ] || |
|
2079 ( diff = nodeIndex = 0 ) || start.pop() ) ) { |
|
2080 |
|
2081 if ( ( ofType ? |
|
2082 node.nodeName.toLowerCase() === name : |
|
2083 node.nodeType === 1 ) && |
|
2084 ++diff ) { |
|
2085 |
|
2086 // Cache the index of each encountered element |
|
2087 if ( useCache ) { |
|
2088 outerCache = node[ expando ] || |
|
2089 ( node[ expando ] = {} ); |
|
2090 |
|
2091 // Support: IE <9 only |
|
2092 // Defend against cloned attroperties (jQuery gh-1709) |
|
2093 uniqueCache = outerCache[ node.uniqueID ] || |
|
2094 ( outerCache[ node.uniqueID ] = {} ); |
|
2095 |
|
2096 uniqueCache[ type ] = [ dirruns, diff ]; |
|
2097 } |
|
2098 |
|
2099 if ( node === elem ) { |
|
2100 break; |
|
2101 } |
|
2102 } |
|
2103 } |
|
2104 } |
|
2105 } |
|
2106 |
|
2107 // Incorporate the offset, then check against cycle size |
|
2108 diff -= last; |
|
2109 return diff === first || ( diff % first === 0 && diff / first >= 0 ); |
|
2110 } |
|
2111 }; |
|
2112 }, |
|
2113 |
|
2114 "PSEUDO": function( pseudo, argument ) { |
|
2115 |
|
2116 // pseudo-class names are case-insensitive |
|
2117 // http://www.w3.org/TR/selectors/#pseudo-classes |
|
2118 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters |
|
2119 // Remember that setFilters inherits from pseudos |
|
2120 var args, |
|
2121 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || |
|
2122 Sizzle.error( "unsupported pseudo: " + pseudo ); |
|
2123 |
|
2124 // The user may use createPseudo to indicate that |
|
2125 // arguments are needed to create the filter function |
|
2126 // just as Sizzle does |
|
2127 if ( fn[ expando ] ) { |
|
2128 return fn( argument ); |
|
2129 } |
|
2130 |
|
2131 // But maintain support for old signatures |
|
2132 if ( fn.length > 1 ) { |
|
2133 args = [ pseudo, pseudo, "", argument ]; |
|
2134 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? |
|
2135 markFunction( function( seed, matches ) { |
|
2136 var idx, |
|
2137 matched = fn( seed, argument ), |
|
2138 i = matched.length; |
|
2139 while ( i-- ) { |
|
2140 idx = indexOf( seed, matched[ i ] ); |
|
2141 seed[ idx ] = !( matches[ idx ] = matched[ i ] ); |
|
2142 } |
|
2143 } ) : |
|
2144 function( elem ) { |
|
2145 return fn( elem, 0, args ); |
|
2146 }; |
|
2147 } |
|
2148 |
|
2149 return fn; |
|
2150 } |
|
2151 }, |
|
2152 |
|
2153 pseudos: { |
|
2154 |
|
2155 // Potentially complex pseudos |
|
2156 "not": markFunction( function( selector ) { |
|
2157 |
|
2158 // Trim the selector passed to compile |
|
2159 // to avoid treating leading and trailing |
|
2160 // spaces as combinators |
|
2161 var input = [], |
|
2162 results = [], |
|
2163 matcher = compile( selector.replace( rtrim, "$1" ) ); |
|
2164 |
|
2165 return matcher[ expando ] ? |
|
2166 markFunction( function( seed, matches, _context, xml ) { |
|
2167 var elem, |
|
2168 unmatched = matcher( seed, null, xml, [] ), |
|
2169 i = seed.length; |
|
2170 |
|
2171 // Match elements unmatched by `matcher` |
|
2172 while ( i-- ) { |
|
2173 if ( ( elem = unmatched[ i ] ) ) { |
|
2174 seed[ i ] = !( matches[ i ] = elem ); |
|
2175 } |
|
2176 } |
|
2177 } ) : |
|
2178 function( elem, _context, xml ) { |
|
2179 input[ 0 ] = elem; |
|
2180 matcher( input, null, xml, results ); |
|
2181 |
|
2182 // Don't keep the element (issue #299) |
|
2183 input[ 0 ] = null; |
|
2184 return !results.pop(); |
|
2185 }; |
|
2186 } ), |
|
2187 |
|
2188 "has": markFunction( function( selector ) { |
|
2189 return function( elem ) { |
|
2190 return Sizzle( selector, elem ).length > 0; |
|
2191 }; |
|
2192 } ), |
|
2193 |
|
2194 "contains": markFunction( function( text ) { |
|
2195 text = text.replace( runescape, funescape ); |
|
2196 return function( elem ) { |
|
2197 return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1; |
|
2198 }; |
|
2199 } ), |
|
2200 |
|
2201 // "Whether an element is represented by a :lang() selector |
|
2202 // is based solely on the element's language value |
|
2203 // being equal to the identifier C, |
|
2204 // or beginning with the identifier C immediately followed by "-". |
|
2205 // The matching of C against the element's language value is performed case-insensitively. |
|
2206 // The identifier C does not have to be a valid language name." |
|
2207 // http://www.w3.org/TR/selectors/#lang-pseudo |
|
2208 "lang": markFunction( function( lang ) { |
|
2209 |
|
2210 // lang value must be a valid identifier |
|
2211 if ( !ridentifier.test( lang || "" ) ) { |
|
2212 Sizzle.error( "unsupported lang: " + lang ); |
|
2213 } |
|
2214 lang = lang.replace( runescape, funescape ).toLowerCase(); |
|
2215 return function( elem ) { |
|
2216 var elemLang; |
|
2217 do { |
|
2218 if ( ( elemLang = documentIsHTML ? |
|
2219 elem.lang : |
|
2220 elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) { |
|
2221 |
|
2222 elemLang = elemLang.toLowerCase(); |
|
2223 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; |
|
2224 } |
|
2225 } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 ); |
|
2226 return false; |
|
2227 }; |
|
2228 } ), |
|
2229 |
|
2230 // Miscellaneous |
|
2231 "target": function( elem ) { |
|
2232 var hash = window.location && window.location.hash; |
|
2233 return hash && hash.slice( 1 ) === elem.id; |
|
2234 }, |
|
2235 |
|
2236 "root": function( elem ) { |
|
2237 return elem === docElem; |
|
2238 }, |
|
2239 |
|
2240 "focus": function( elem ) { |
|
2241 return elem === document.activeElement && |
|
2242 ( !document.hasFocus || document.hasFocus() ) && |
|
2243 !!( elem.type || elem.href || ~elem.tabIndex ); |
|
2244 }, |
|
2245 |
|
2246 // Boolean properties |
|
2247 "enabled": createDisabledPseudo( false ), |
|
2248 "disabled": createDisabledPseudo( true ), |
|
2249 |
|
2250 "checked": function( elem ) { |
|
2251 |
|
2252 // In CSS3, :checked should return both checked and selected elements |
|
2253 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked |
|
2254 var nodeName = elem.nodeName.toLowerCase(); |
|
2255 return ( nodeName === "input" && !!elem.checked ) || |
|
2256 ( nodeName === "option" && !!elem.selected ); |
|
2257 }, |
|
2258 |
|
2259 "selected": function( elem ) { |
|
2260 |
|
2261 // Accessing this property makes selected-by-default |
|
2262 // options in Safari work properly |
|
2263 if ( elem.parentNode ) { |
|
2264 // eslint-disable-next-line no-unused-expressions |
|
2265 elem.parentNode.selectedIndex; |
|
2266 } |
|
2267 |
|
2268 return elem.selected === true; |
|
2269 }, |
|
2270 |
|
2271 // Contents |
|
2272 "empty": function( elem ) { |
|
2273 |
|
2274 // http://www.w3.org/TR/selectors/#empty-pseudo |
|
2275 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), |
|
2276 // but not by others (comment: 8; processing instruction: 7; etc.) |
|
2277 // nodeType < 6 works because attributes (2) do not appear as children |
|
2278 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { |
|
2279 if ( elem.nodeType < 6 ) { |
|
2280 return false; |
|
2281 } |
|
2282 } |
|
2283 return true; |
|
2284 }, |
|
2285 |
|
2286 "parent": function( elem ) { |
|
2287 return !Expr.pseudos[ "empty" ]( elem ); |
|
2288 }, |
|
2289 |
|
2290 // Element/input types |
|
2291 "header": function( elem ) { |
|
2292 return rheader.test( elem.nodeName ); |
|
2293 }, |
|
2294 |
|
2295 "input": function( elem ) { |
|
2296 return rinputs.test( elem.nodeName ); |
|
2297 }, |
|
2298 |
|
2299 "button": function( elem ) { |
|
2300 var name = elem.nodeName.toLowerCase(); |
|
2301 return name === "input" && elem.type === "button" || name === "button"; |
|
2302 }, |
|
2303 |
|
2304 "text": function( elem ) { |
|
2305 var attr; |
|
2306 return elem.nodeName.toLowerCase() === "input" && |
|
2307 elem.type === "text" && |
|
2308 |
|
2309 // Support: IE <10 only |
|
2310 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" |
|
2311 ( ( attr = elem.getAttribute( "type" ) ) == null || |
|
2312 attr.toLowerCase() === "text" ); |
|
2313 }, |
|
2314 |
|
2315 // Position-in-collection |
|
2316 "first": createPositionalPseudo( function() { |
|
2317 return [ 0 ]; |
|
2318 } ), |
|
2319 |
|
2320 "last": createPositionalPseudo( function( _matchIndexes, length ) { |
|
2321 return [ length - 1 ]; |
|
2322 } ), |
|
2323 |
|
2324 "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) { |
|
2325 return [ argument < 0 ? argument + length : argument ]; |
|
2326 } ), |
|
2327 |
|
2328 "even": createPositionalPseudo( function( matchIndexes, length ) { |
|
2329 var i = 0; |
|
2330 for ( ; i < length; i += 2 ) { |
|
2331 matchIndexes.push( i ); |
|
2332 } |
|
2333 return matchIndexes; |
|
2334 } ), |
|
2335 |
|
2336 "odd": createPositionalPseudo( function( matchIndexes, length ) { |
|
2337 var i = 1; |
|
2338 for ( ; i < length; i += 2 ) { |
|
2339 matchIndexes.push( i ); |
|
2340 } |
|
2341 return matchIndexes; |
|
2342 } ), |
|
2343 |
|
2344 "lt": createPositionalPseudo( function( matchIndexes, length, argument ) { |
|
2345 var i = argument < 0 ? |
|
2346 argument + length : |
|
2347 argument > length ? |
|
2348 length : |
|
2349 argument; |
|
2350 for ( ; --i >= 0; ) { |
|
2351 matchIndexes.push( i ); |
|
2352 } |
|
2353 return matchIndexes; |
|
2354 } ), |
|
2355 |
|
2356 "gt": createPositionalPseudo( function( matchIndexes, length, argument ) { |
|
2357 var i = argument < 0 ? argument + length : argument; |
|
2358 for ( ; ++i < length; ) { |
|
2359 matchIndexes.push( i ); |
|
2360 } |
|
2361 return matchIndexes; |
|
2362 } ) |
|
2363 } |
|
2364 }; |
|
2365 |
|
2366 Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ]; |
|
2367 |
|
2368 // Add button/input type pseudos |
|
2369 for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { |
|
2370 Expr.pseudos[ i ] = createInputPseudo( i ); |
|
2371 } |
|
2372 for ( i in { submit: true, reset: true } ) { |
|
2373 Expr.pseudos[ i ] = createButtonPseudo( i ); |
|
2374 } |
|
2375 |
|
2376 // Easy API for creating new setFilters |
|
2377 function setFilters() {} |
|
2378 setFilters.prototype = Expr.filters = Expr.pseudos; |
|
2379 Expr.setFilters = new setFilters(); |
|
2380 |
|
2381 tokenize = Sizzle.tokenize = function( selector, parseOnly ) { |
|
2382 var matched, match, tokens, type, |
|
2383 soFar, groups, preFilters, |
|
2384 cached = tokenCache[ selector + " " ]; |
|
2385 |
|
2386 if ( cached ) { |
|
2387 return parseOnly ? 0 : cached.slice( 0 ); |
|
2388 } |
|
2389 |
|
2390 soFar = selector; |
|
2391 groups = []; |
|
2392 preFilters = Expr.preFilter; |
|
2393 |
|
2394 while ( soFar ) { |
|
2395 |
|
2396 // Comma and first run |
|
2397 if ( !matched || ( match = rcomma.exec( soFar ) ) ) { |
|
2398 if ( match ) { |
|
2399 |
|
2400 // Don't consume trailing commas as valid |
|
2401 soFar = soFar.slice( match[ 0 ].length ) || soFar; |
|
2402 } |
|
2403 groups.push( ( tokens = [] ) ); |
|
2404 } |
|
2405 |
|
2406 matched = false; |
|
2407 |
|
2408 // Combinators |
|
2409 if ( ( match = rcombinators.exec( soFar ) ) ) { |
|
2410 matched = match.shift(); |
|
2411 tokens.push( { |
|
2412 value: matched, |
|
2413 |
|
2414 // Cast descendant combinators to space |
|
2415 type: match[ 0 ].replace( rtrim, " " ) |
|
2416 } ); |
|
2417 soFar = soFar.slice( matched.length ); |
|
2418 } |
|
2419 |
|
2420 // Filters |
|
2421 for ( type in Expr.filter ) { |
|
2422 if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || |
|
2423 ( match = preFilters[ type ]( match ) ) ) ) { |
|
2424 matched = match.shift(); |
|
2425 tokens.push( { |
|
2426 value: matched, |
|
2427 type: type, |
|
2428 matches: match |
|
2429 } ); |
|
2430 soFar = soFar.slice( matched.length ); |
|
2431 } |
|
2432 } |
|
2433 |
|
2434 if ( !matched ) { |
|
2435 break; |
|
2436 } |
|
2437 } |
|
2438 |
|
2439 // Return the length of the invalid excess |
|
2440 // if we're just parsing |
|
2441 // Otherwise, throw an error or return tokens |
|
2442 return parseOnly ? |
|
2443 soFar.length : |
|
2444 soFar ? |
|
2445 Sizzle.error( selector ) : |
|
2446 |
|
2447 // Cache the tokens |
|
2448 tokenCache( selector, groups ).slice( 0 ); |
|
2449 }; |
|
2450 |
|
2451 function toSelector( tokens ) { |
|
2452 var i = 0, |
|
2453 len = tokens.length, |
|
2454 selector = ""; |
|
2455 for ( ; i < len; i++ ) { |
|
2456 selector += tokens[ i ].value; |
|
2457 } |
|
2458 return selector; |
|
2459 } |
|
2460 |
|
2461 function addCombinator( matcher, combinator, base ) { |
|
2462 var dir = combinator.dir, |
|
2463 skip = combinator.next, |
|
2464 key = skip || dir, |
|
2465 checkNonElements = base && key === "parentNode", |
|
2466 doneName = done++; |
|
2467 |
|
2468 return combinator.first ? |
|
2469 |
|
2470 // Check against closest ancestor/preceding element |
|
2471 function( elem, context, xml ) { |
|
2472 while ( ( elem = elem[ dir ] ) ) { |
|
2473 if ( elem.nodeType === 1 || checkNonElements ) { |
|
2474 return matcher( elem, context, xml ); |
|
2475 } |
|
2476 } |
|
2477 return false; |
|
2478 } : |
|
2479 |
|
2480 // Check against all ancestor/preceding elements |
|
2481 function( elem, context, xml ) { |
|
2482 var oldCache, uniqueCache, outerCache, |
|
2483 newCache = [ dirruns, doneName ]; |
|
2484 |
|
2485 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching |
|
2486 if ( xml ) { |
|
2487 while ( ( elem = elem[ dir ] ) ) { |
|
2488 if ( elem.nodeType === 1 || checkNonElements ) { |
|
2489 if ( matcher( elem, context, xml ) ) { |
|
2490 return true; |
|
2491 } |
|
2492 } |
|
2493 } |
|
2494 } else { |
|
2495 while ( ( elem = elem[ dir ] ) ) { |
|
2496 if ( elem.nodeType === 1 || checkNonElements ) { |
|
2497 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); |
|
2498 |
|
2499 // Support: IE <9 only |
|
2500 // Defend against cloned attroperties (jQuery gh-1709) |
|
2501 uniqueCache = outerCache[ elem.uniqueID ] || |
|
2502 ( outerCache[ elem.uniqueID ] = {} ); |
|
2503 |
|
2504 if ( skip && skip === elem.nodeName.toLowerCase() ) { |
|
2505 elem = elem[ dir ] || elem; |
|
2506 } else if ( ( oldCache = uniqueCache[ key ] ) && |
|
2507 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { |
|
2508 |
|
2509 // Assign to newCache so results back-propagate to previous elements |
|
2510 return ( newCache[ 2 ] = oldCache[ 2 ] ); |
|
2511 } else { |
|
2512 |
|
2513 // Reuse newcache so results back-propagate to previous elements |
|
2514 uniqueCache[ key ] = newCache; |
|
2515 |
|
2516 // A match means we're done; a fail means we have to keep checking |
|
2517 if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { |
|
2518 return true; |
|
2519 } |
|
2520 } |
|
2521 } |
|
2522 } |
|
2523 } |
|
2524 return false; |
|
2525 }; |
|
2526 } |
|
2527 |
|
2528 function elementMatcher( matchers ) { |
|
2529 return matchers.length > 1 ? |
|
2530 function( elem, context, xml ) { |
|
2531 var i = matchers.length; |
|
2532 while ( i-- ) { |
|
2533 if ( !matchers[ i ]( elem, context, xml ) ) { |
|
2534 return false; |
|
2535 } |
|
2536 } |
|
2537 return true; |
|
2538 } : |
|
2539 matchers[ 0 ]; |
|
2540 } |
|
2541 |
|
2542 function multipleContexts( selector, contexts, results ) { |
|
2543 var i = 0, |
|
2544 len = contexts.length; |
|
2545 for ( ; i < len; i++ ) { |
|
2546 Sizzle( selector, contexts[ i ], results ); |
|
2547 } |
|
2548 return results; |
|
2549 } |
|
2550 |
|
2551 function condense( unmatched, map, filter, context, xml ) { |
|
2552 var elem, |
|
2553 newUnmatched = [], |
|
2554 i = 0, |
|
2555 len = unmatched.length, |
|
2556 mapped = map != null; |
|
2557 |
|
2558 for ( ; i < len; i++ ) { |
|
2559 if ( ( elem = unmatched[ i ] ) ) { |
|
2560 if ( !filter || filter( elem, context, xml ) ) { |
|
2561 newUnmatched.push( elem ); |
|
2562 if ( mapped ) { |
|
2563 map.push( i ); |
|
2564 } |
|
2565 } |
|
2566 } |
|
2567 } |
|
2568 |
|
2569 return newUnmatched; |
|
2570 } |
|
2571 |
|
2572 function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { |
|
2573 if ( postFilter && !postFilter[ expando ] ) { |
|
2574 postFilter = setMatcher( postFilter ); |
|
2575 } |
|
2576 if ( postFinder && !postFinder[ expando ] ) { |
|
2577 postFinder = setMatcher( postFinder, postSelector ); |
|
2578 } |
|
2579 return markFunction( function( seed, results, context, xml ) { |
|
2580 var temp, i, elem, |
|
2581 preMap = [], |
|
2582 postMap = [], |
|
2583 preexisting = results.length, |
|
2584 |
|
2585 // Get initial elements from seed or context |
|
2586 elems = seed || multipleContexts( |
|
2587 selector || "*", |
|
2588 context.nodeType ? [ context ] : context, |
|
2589 [] |
|
2590 ), |
|
2591 |
|
2592 // Prefilter to get matcher input, preserving a map for seed-results synchronization |
|
2593 matcherIn = preFilter && ( seed || !selector ) ? |
|
2594 condense( elems, preMap, preFilter, context, xml ) : |
|
2595 elems, |
|
2596 |
|
2597 matcherOut = matcher ? |
|
2598 |
|
2599 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, |
|
2600 postFinder || ( seed ? preFilter : preexisting || postFilter ) ? |
|
2601 |
|
2602 // ...intermediate processing is necessary |
|
2603 [] : |
|
2604 |
|
2605 // ...otherwise use results directly |
|
2606 results : |
|
2607 matcherIn; |
|
2608 |
|
2609 // Find primary matches |
|
2610 if ( matcher ) { |
|
2611 matcher( matcherIn, matcherOut, context, xml ); |
|
2612 } |
|
2613 |
|
2614 // Apply postFilter |
|
2615 if ( postFilter ) { |
|
2616 temp = condense( matcherOut, postMap ); |
|
2617 postFilter( temp, [], context, xml ); |
|
2618 |
|
2619 // Un-match failing elements by moving them back to matcherIn |
|
2620 i = temp.length; |
|
2621 while ( i-- ) { |
|
2622 if ( ( elem = temp[ i ] ) ) { |
|
2623 matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem ); |
|
2624 } |
|
2625 } |
|
2626 } |
|
2627 |
|
2628 if ( seed ) { |
|
2629 if ( postFinder || preFilter ) { |
|
2630 if ( postFinder ) { |
|
2631 |
|
2632 // Get the final matcherOut by condensing this intermediate into postFinder contexts |
|
2633 temp = []; |
|
2634 i = matcherOut.length; |
|
2635 while ( i-- ) { |
|
2636 if ( ( elem = matcherOut[ i ] ) ) { |
|
2637 |
|
2638 // Restore matcherIn since elem is not yet a final match |
|
2639 temp.push( ( matcherIn[ i ] = elem ) ); |
|
2640 } |
|
2641 } |
|
2642 postFinder( null, ( matcherOut = [] ), temp, xml ); |
|
2643 } |
|
2644 |
|
2645 // Move matched elements from seed to results to keep them synchronized |
|
2646 i = matcherOut.length; |
|
2647 while ( i-- ) { |
|
2648 if ( ( elem = matcherOut[ i ] ) && |
|
2649 ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) { |
|
2650 |
|
2651 seed[ temp ] = !( results[ temp ] = elem ); |
|
2652 } |
|
2653 } |
|
2654 } |
|
2655 |
|
2656 // Add elements to results, through postFinder if defined |
|
2657 } else { |
|
2658 matcherOut = condense( |
|
2659 matcherOut === results ? |
|
2660 matcherOut.splice( preexisting, matcherOut.length ) : |
|
2661 matcherOut |
|
2662 ); |
|
2663 if ( postFinder ) { |
|
2664 postFinder( null, results, matcherOut, xml ); |
|
2665 } else { |
|
2666 push.apply( results, matcherOut ); |
|
2667 } |
|
2668 } |
|
2669 } ); |
|
2670 } |
|
2671 |
|
2672 function matcherFromTokens( tokens ) { |
|
2673 var checkContext, matcher, j, |
|
2674 len = tokens.length, |
|
2675 leadingRelative = Expr.relative[ tokens[ 0 ].type ], |
|
2676 implicitRelative = leadingRelative || Expr.relative[ " " ], |
|
2677 i = leadingRelative ? 1 : 0, |
|
2678 |
|
2679 // The foundational matcher ensures that elements are reachable from top-level context(s) |
|
2680 matchContext = addCombinator( function( elem ) { |
|
2681 return elem === checkContext; |
|
2682 }, implicitRelative, true ), |
|
2683 matchAnyContext = addCombinator( function( elem ) { |
|
2684 return indexOf( checkContext, elem ) > -1; |
|
2685 }, implicitRelative, true ), |
|
2686 matchers = [ function( elem, context, xml ) { |
|
2687 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( |
|
2688 ( checkContext = context ).nodeType ? |
|
2689 matchContext( elem, context, xml ) : |
|
2690 matchAnyContext( elem, context, xml ) ); |
|
2691 |
|
2692 // Avoid hanging onto element (issue #299) |
|
2693 checkContext = null; |
|
2694 return ret; |
|
2695 } ]; |
|
2696 |
|
2697 for ( ; i < len; i++ ) { |
|
2698 if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) { |
|
2699 matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; |
|
2700 } else { |
|
2701 matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches ); |
|
2702 |
|
2703 // Return special upon seeing a positional matcher |
|
2704 if ( matcher[ expando ] ) { |
|
2705 |
|
2706 // Find the next relative operator (if any) for proper handling |
|
2707 j = ++i; |
|
2708 for ( ; j < len; j++ ) { |
|
2709 if ( Expr.relative[ tokens[ j ].type ] ) { |
|
2710 break; |
|
2711 } |
|
2712 } |
|
2713 return setMatcher( |
|
2714 i > 1 && elementMatcher( matchers ), |
|
2715 i > 1 && toSelector( |
|
2716 |
|
2717 // If the preceding token was a descendant combinator, insert an implicit any-element `*` |
|
2718 tokens |
|
2719 .slice( 0, i - 1 ) |
|
2720 .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) |
|
2721 ).replace( rtrim, "$1" ), |
|
2722 matcher, |
|
2723 i < j && matcherFromTokens( tokens.slice( i, j ) ), |
|
2724 j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), |
|
2725 j < len && toSelector( tokens ) |
|
2726 ); |
|
2727 } |
|
2728 matchers.push( matcher ); |
|
2729 } |
|
2730 } |
|
2731 |
|
2732 return elementMatcher( matchers ); |
|
2733 } |
|
2734 |
|
2735 function matcherFromGroupMatchers( elementMatchers, setMatchers ) { |
|
2736 var bySet = setMatchers.length > 0, |
|
2737 byElement = elementMatchers.length > 0, |
|
2738 superMatcher = function( seed, context, xml, results, outermost ) { |
|
2739 var elem, j, matcher, |
|
2740 matchedCount = 0, |
|
2741 i = "0", |
|
2742 unmatched = seed && [], |
|
2743 setMatched = [], |
|
2744 contextBackup = outermostContext, |
|
2745 |
|
2746 // We must always have either seed elements or outermost context |
|
2747 elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ), |
|
2748 |
|
2749 // Use integer dirruns iff this is the outermost matcher |
|
2750 dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), |
|
2751 len = elems.length; |
|
2752 |
|
2753 if ( outermost ) { |
|
2754 |
|
2755 // Support: IE 11+, Edge 17 - 18+ |
|
2756 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
|
2757 // two documents; shallow comparisons work. |
|
2758 // eslint-disable-next-line eqeqeq |
|
2759 outermostContext = context == document || context || outermost; |
|
2760 } |
|
2761 |
|
2762 // Add elements passing elementMatchers directly to results |
|
2763 // Support: IE<9, Safari |
|
2764 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id |
|
2765 for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { |
|
2766 if ( byElement && elem ) { |
|
2767 j = 0; |
|
2768 |
|
2769 // Support: IE 11+, Edge 17 - 18+ |
|
2770 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
|
2771 // two documents; shallow comparisons work. |
|
2772 // eslint-disable-next-line eqeqeq |
|
2773 if ( !context && elem.ownerDocument != document ) { |
|
2774 setDocument( elem ); |
|
2775 xml = !documentIsHTML; |
|
2776 } |
|
2777 while ( ( matcher = elementMatchers[ j++ ] ) ) { |
|
2778 if ( matcher( elem, context || document, xml ) ) { |
|
2779 results.push( elem ); |
|
2780 break; |
|
2781 } |
|
2782 } |
|
2783 if ( outermost ) { |
|
2784 dirruns = dirrunsUnique; |
|
2785 } |
|
2786 } |
|
2787 |
|
2788 // Track unmatched elements for set filters |
|
2789 if ( bySet ) { |
|
2790 |
|
2791 // They will have gone through all possible matchers |
|
2792 if ( ( elem = !matcher && elem ) ) { |
|
2793 matchedCount--; |
|
2794 } |
|
2795 |
|
2796 // Lengthen the array for every element, matched or not |
|
2797 if ( seed ) { |
|
2798 unmatched.push( elem ); |
|
2799 } |
|
2800 } |
|
2801 } |
|
2802 |
|
2803 // `i` is now the count of elements visited above, and adding it to `matchedCount` |
|
2804 // makes the latter nonnegative. |
|
2805 matchedCount += i; |
|
2806 |
|
2807 // Apply set filters to unmatched elements |
|
2808 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` |
|
2809 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have |
|
2810 // no element matchers and no seed. |
|
2811 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that |
|
2812 // case, which will result in a "00" `matchedCount` that differs from `i` but is also |
|
2813 // numerically zero. |
|
2814 if ( bySet && i !== matchedCount ) { |
|
2815 j = 0; |
|
2816 while ( ( matcher = setMatchers[ j++ ] ) ) { |
|
2817 matcher( unmatched, setMatched, context, xml ); |
|
2818 } |
|
2819 |
|
2820 if ( seed ) { |
|
2821 |
|
2822 // Reintegrate element matches to eliminate the need for sorting |
|
2823 if ( matchedCount > 0 ) { |
|
2824 while ( i-- ) { |
|
2825 if ( !( unmatched[ i ] || setMatched[ i ] ) ) { |
|
2826 setMatched[ i ] = pop.call( results ); |
|
2827 } |
|
2828 } |
|
2829 } |
|
2830 |
|
2831 // Discard index placeholder values to get only actual matches |
|
2832 setMatched = condense( setMatched ); |
|
2833 } |
|
2834 |
|
2835 // Add matches to results |
|
2836 push.apply( results, setMatched ); |
|
2837 |
|
2838 // Seedless set matches succeeding multiple successful matchers stipulate sorting |
|
2839 if ( outermost && !seed && setMatched.length > 0 && |
|
2840 ( matchedCount + setMatchers.length ) > 1 ) { |
|
2841 |
|
2842 Sizzle.uniqueSort( results ); |
|
2843 } |
|
2844 } |
|
2845 |
|
2846 // Override manipulation of globals by nested matchers |
|
2847 if ( outermost ) { |
|
2848 dirruns = dirrunsUnique; |
|
2849 outermostContext = contextBackup; |
|
2850 } |
|
2851 |
|
2852 return unmatched; |
|
2853 }; |
|
2854 |
|
2855 return bySet ? |
|
2856 markFunction( superMatcher ) : |
|
2857 superMatcher; |
|
2858 } |
|
2859 |
|
2860 compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { |
|
2861 var i, |
|
2862 setMatchers = [], |
|
2863 elementMatchers = [], |
|
2864 cached = compilerCache[ selector + " " ]; |
|
2865 |
|
2866 if ( !cached ) { |
|
2867 |
|
2868 // Generate a function of recursive functions that can be used to check each element |
|
2869 if ( !match ) { |
|
2870 match = tokenize( selector ); |
|
2871 } |
|
2872 i = match.length; |
|
2873 while ( i-- ) { |
|
2874 cached = matcherFromTokens( match[ i ] ); |
|
2875 if ( cached[ expando ] ) { |
|
2876 setMatchers.push( cached ); |
|
2877 } else { |
|
2878 elementMatchers.push( cached ); |
|
2879 } |
|
2880 } |
|
2881 |
|
2882 // Cache the compiled function |
|
2883 cached = compilerCache( |
|
2884 selector, |
|
2885 matcherFromGroupMatchers( elementMatchers, setMatchers ) |
|
2886 ); |
|
2887 |
|
2888 // Save selector and tokenization |
|
2889 cached.selector = selector; |
|
2890 } |
|
2891 return cached; |
|
2892 }; |
|
2893 |
|
2894 /** |
|
2895 * A low-level selection function that works with Sizzle's compiled |
|
2896 * selector functions |
|
2897 * @param {String|Function} selector A selector or a pre-compiled |
|
2898 * selector function built with Sizzle.compile |
|
2899 * @param {Element} context |
|
2900 * @param {Array} [results] |
|
2901 * @param {Array} [seed] A set of elements to match against |
|
2902 */ |
|
2903 select = Sizzle.select = function( selector, context, results, seed ) { |
|
2904 var i, tokens, token, type, find, |
|
2905 compiled = typeof selector === "function" && selector, |
|
2906 match = !seed && tokenize( ( selector = compiled.selector || selector ) ); |
|
2907 |
|
2908 results = results || []; |
|
2909 |
|
2910 // Try to minimize operations if there is only one selector in the list and no seed |
|
2911 // (the latter of which guarantees us context) |
|
2912 if ( match.length === 1 ) { |
|
2913 |
|
2914 // Reduce context if the leading compound selector is an ID |
|
2915 tokens = match[ 0 ] = match[ 0 ].slice( 0 ); |
|
2916 if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && |
|
2917 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { |
|
2918 |
|
2919 context = ( Expr.find[ "ID" ]( token.matches[ 0 ] |
|
2920 .replace( runescape, funescape ), context ) || [] )[ 0 ]; |
|
2921 if ( !context ) { |
|
2922 return results; |
|
2923 |
|
2924 // Precompiled matchers will still verify ancestry, so step up a level |
|
2925 } else if ( compiled ) { |
|
2926 context = context.parentNode; |
|
2927 } |
|
2928 |
|
2929 selector = selector.slice( tokens.shift().value.length ); |
|
2930 } |
|
2931 |
|
2932 // Fetch a seed set for right-to-left matching |
|
2933 i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length; |
|
2934 while ( i-- ) { |
|
2935 token = tokens[ i ]; |
|
2936 |
|
2937 // Abort if we hit a combinator |
|
2938 if ( Expr.relative[ ( type = token.type ) ] ) { |
|
2939 break; |
|
2940 } |
|
2941 if ( ( find = Expr.find[ type ] ) ) { |
|
2942 |
|
2943 // Search, expanding context for leading sibling combinators |
|
2944 if ( ( seed = find( |
|
2945 token.matches[ 0 ].replace( runescape, funescape ), |
|
2946 rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) || |
|
2947 context |
|
2948 ) ) ) { |
|
2949 |
|
2950 // If seed is empty or no tokens remain, we can return early |
|
2951 tokens.splice( i, 1 ); |
|
2952 selector = seed.length && toSelector( tokens ); |
|
2953 if ( !selector ) { |
|
2954 push.apply( results, seed ); |
|
2955 return results; |
|
2956 } |
|
2957 |
|
2958 break; |
|
2959 } |
|
2960 } |
|
2961 } |
|
2962 } |
|
2963 |
|
2964 // Compile and execute a filtering function if one is not provided |
|
2965 // Provide `match` to avoid retokenization if we modified the selector above |
|
2966 ( compiled || compile( selector, match ) )( |
|
2967 seed, |
|
2968 context, |
|
2969 !documentIsHTML, |
|
2970 results, |
|
2971 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context |
|
2972 ); |
|
2973 return results; |
|
2974 }; |
|
2975 |
|
2976 // One-time assignments |
|
2977 |
|
2978 // Sort stability |
|
2979 support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; |
|
2980 |
|
2981 // Support: Chrome 14-35+ |
|
2982 // Always assume duplicates if they aren't passed to the comparison function |
|
2983 support.detectDuplicates = !!hasDuplicate; |
|
2984 |
|
2985 // Initialize against the default document |
|
2986 setDocument(); |
|
2987 |
|
2988 // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) |
|
2989 // Detached nodes confoundingly follow *each other* |
|
2990 support.sortDetached = assert( function( el ) { |
|
2991 |
|
2992 // Should return 1, but returns 4 (following) |
|
2993 return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; |
|
2994 } ); |
|
2995 |
|
2996 // Support: IE<8 |
|
2997 // Prevent attribute/property "interpolation" |
|
2998 // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx |
|
2999 if ( !assert( function( el ) { |
|
3000 el.innerHTML = "<a href='#'></a>"; |
|
3001 return el.firstChild.getAttribute( "href" ) === "#"; |
|
3002 } ) ) { |
|
3003 addHandle( "type|href|height|width", function( elem, name, isXML ) { |
|
3004 if ( !isXML ) { |
|
3005 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); |
|
3006 } |
|
3007 } ); |
|
3008 } |
|
3009 |
|
3010 // Support: IE<9 |
|
3011 // Use defaultValue in place of getAttribute("value") |
|
3012 if ( !support.attributes || !assert( function( el ) { |
|
3013 el.innerHTML = "<input/>"; |
|
3014 el.firstChild.setAttribute( "value", "" ); |
|
3015 return el.firstChild.getAttribute( "value" ) === ""; |
|
3016 } ) ) { |
|
3017 addHandle( "value", function( elem, _name, isXML ) { |
|
3018 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { |
|
3019 return elem.defaultValue; |
|
3020 } |
|
3021 } ); |
|
3022 } |
|
3023 |
|
3024 // Support: IE<9 |
|
3025 // Use getAttributeNode to fetch booleans when getAttribute lies |
|
3026 if ( !assert( function( el ) { |
|
3027 return el.getAttribute( "disabled" ) == null; |
|
3028 } ) ) { |
|
3029 addHandle( booleans, function( elem, name, isXML ) { |
|
3030 var val; |
|
3031 if ( !isXML ) { |
|
3032 return elem[ name ] === true ? name.toLowerCase() : |
|
3033 ( val = elem.getAttributeNode( name ) ) && val.specified ? |
|
3034 val.value : |
|
3035 null; |
|
3036 } |
|
3037 } ); |
|
3038 } |
|
3039 |
|
3040 return Sizzle; |
|
3041 |
|
3042 } )( window ); |
|
3043 |
|
3044 |
|
3045 |
|
3046 jQuery.find = Sizzle; |
|
3047 jQuery.expr = Sizzle.selectors; |
|
3048 |
|
3049 // Deprecated |
|
3050 jQuery.expr[ ":" ] = jQuery.expr.pseudos; |
|
3051 jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; |
|
3052 jQuery.text = Sizzle.getText; |
|
3053 jQuery.isXMLDoc = Sizzle.isXML; |
|
3054 jQuery.contains = Sizzle.contains; |
|
3055 jQuery.escapeSelector = Sizzle.escape; |
|
3056 |
|
3057 |
|
3058 |
|
3059 |
|
3060 var dir = function( elem, dir, until ) { |
|
3061 var matched = [], |
|
3062 truncate = until !== undefined; |
|
3063 |
|
3064 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { |
|
3065 if ( elem.nodeType === 1 ) { |
|
3066 if ( truncate && jQuery( elem ).is( until ) ) { |
|
3067 break; |
|
3068 } |
|
3069 matched.push( elem ); |
|
3070 } |
|
3071 } |
|
3072 return matched; |
|
3073 }; |
|
3074 |
|
3075 |
|
3076 var siblings = function( n, elem ) { |
|
3077 var matched = []; |
|
3078 |
|
3079 for ( ; n; n = n.nextSibling ) { |
|
3080 if ( n.nodeType === 1 && n !== elem ) { |
|
3081 matched.push( n ); |
|
3082 } |
|
3083 } |
|
3084 |
|
3085 return matched; |
|
3086 }; |
|
3087 |
|
3088 |
|
3089 var rneedsContext = jQuery.expr.match.needsContext; |
|
3090 |
|
3091 |
|
3092 |
|
3093 function nodeName( elem, name ) { |
|
3094 |
|
3095 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); |
|
3096 |
|
3097 } |
|
3098 var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); |
|
3099 |
|
3100 |
|
3101 |
|
3102 // Implement the identical functionality for filter and not |
|
3103 function winnow( elements, qualifier, not ) { |
|
3104 if ( isFunction( qualifier ) ) { |
|
3105 return jQuery.grep( elements, function( elem, i ) { |
|
3106 return !!qualifier.call( elem, i, elem ) !== not; |
|
3107 } ); |
|
3108 } |
|
3109 |
|
3110 // Single element |
|
3111 if ( qualifier.nodeType ) { |
|
3112 return jQuery.grep( elements, function( elem ) { |
|
3113 return ( elem === qualifier ) !== not; |
|
3114 } ); |
|
3115 } |
|
3116 |
|
3117 // Arraylike of elements (jQuery, arguments, Array) |
|
3118 if ( typeof qualifier !== "string" ) { |
|
3119 return jQuery.grep( elements, function( elem ) { |
|
3120 return ( indexOf.call( qualifier, elem ) > -1 ) !== not; |
|
3121 } ); |
|
3122 } |
|
3123 |
|
3124 // Filtered directly for both simple and complex selectors |
|
3125 return jQuery.filter( qualifier, elements, not ); |
|
3126 } |
|
3127 |
|
3128 jQuery.filter = function( expr, elems, not ) { |
|
3129 var elem = elems[ 0 ]; |
|
3130 |
|
3131 if ( not ) { |
|
3132 expr = ":not(" + expr + ")"; |
|
3133 } |
|
3134 |
|
3135 if ( elems.length === 1 && elem.nodeType === 1 ) { |
|
3136 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; |
|
3137 } |
|
3138 |
|
3139 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { |
|
3140 return elem.nodeType === 1; |
|
3141 } ) ); |
|
3142 }; |
|
3143 |
|
3144 jQuery.fn.extend( { |
|
3145 find: function( selector ) { |
|
3146 var i, ret, |
|
3147 len = this.length, |
|
3148 self = this; |
|
3149 |
|
3150 if ( typeof selector !== "string" ) { |
|
3151 return this.pushStack( jQuery( selector ).filter( function() { |
|
3152 for ( i = 0; i < len; i++ ) { |
|
3153 if ( jQuery.contains( self[ i ], this ) ) { |
|
3154 return true; |
|
3155 } |
|
3156 } |
|
3157 } ) ); |
|
3158 } |
|
3159 |
|
3160 ret = this.pushStack( [] ); |
|
3161 |
|
3162 for ( i = 0; i < len; i++ ) { |
|
3163 jQuery.find( selector, self[ i ], ret ); |
|
3164 } |
|
3165 |
|
3166 return len > 1 ? jQuery.uniqueSort( ret ) : ret; |
|
3167 }, |
|
3168 filter: function( selector ) { |
|
3169 return this.pushStack( winnow( this, selector || [], false ) ); |
|
3170 }, |
|
3171 not: function( selector ) { |
|
3172 return this.pushStack( winnow( this, selector || [], true ) ); |
|
3173 }, |
|
3174 is: function( selector ) { |
|
3175 return !!winnow( |
|
3176 this, |
|
3177 |
|
3178 // If this is a positional/relative selector, check membership in the returned set |
|
3179 // so $("p:first").is("p:last") won't return true for a doc with two "p". |
|
3180 typeof selector === "string" && rneedsContext.test( selector ) ? |
|
3181 jQuery( selector ) : |
|
3182 selector || [], |
|
3183 false |
|
3184 ).length; |
|
3185 } |
|
3186 } ); |
|
3187 |
|
3188 |
|
3189 // Initialize a jQuery object |
|
3190 |
|
3191 |
|
3192 // A central reference to the root jQuery(document) |
|
3193 var rootjQuery, |
|
3194 |
|
3195 // A simple way to check for HTML strings |
|
3196 // Prioritize #id over <tag> to avoid XSS via location.hash (trac-9521) |
|
3197 // Strict HTML recognition (trac-11290: must start with <) |
|
3198 // Shortcut simple #id case for speed |
|
3199 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, |
|
3200 |
|
3201 init = jQuery.fn.init = function( selector, context, root ) { |
|
3202 var match, elem; |
|
3203 |
|
3204 // HANDLE: $(""), $(null), $(undefined), $(false) |
|
3205 if ( !selector ) { |
|
3206 return this; |
|
3207 } |
|
3208 |
|
3209 // Method init() accepts an alternate rootjQuery |
|
3210 // so migrate can support jQuery.sub (gh-2101) |
|
3211 root = root || rootjQuery; |
|
3212 |
|
3213 // Handle HTML strings |
|
3214 if ( typeof selector === "string" ) { |
|
3215 if ( selector[ 0 ] === "<" && |
|
3216 selector[ selector.length - 1 ] === ">" && |
|
3217 selector.length >= 3 ) { |
|
3218 |
|
3219 // Assume that strings that start and end with <> are HTML and skip the regex check |
|
3220 match = [ null, selector, null ]; |
|
3221 |
|
3222 } else { |
|
3223 match = rquickExpr.exec( selector ); |
|
3224 } |
|
3225 |
|
3226 // Match html or make sure no context is specified for #id |
|
3227 if ( match && ( match[ 1 ] || !context ) ) { |
|
3228 |
|
3229 // HANDLE: $(html) -> $(array) |
|
3230 if ( match[ 1 ] ) { |
|
3231 context = context instanceof jQuery ? context[ 0 ] : context; |
|
3232 |
|
3233 // Option to run scripts is true for back-compat |
|
3234 // Intentionally let the error be thrown if parseHTML is not present |
|
3235 jQuery.merge( this, jQuery.parseHTML( |
|
3236 match[ 1 ], |
|
3237 context && context.nodeType ? context.ownerDocument || context : document, |
|
3238 true |
|
3239 ) ); |
|
3240 |
|
3241 // HANDLE: $(html, props) |
|
3242 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { |
|
3243 for ( match in context ) { |
|
3244 |
|
3245 // Properties of context are called as methods if possible |
|
3246 if ( isFunction( this[ match ] ) ) { |
|
3247 this[ match ]( context[ match ] ); |
|
3248 |
|
3249 // ...and otherwise set as attributes |
|
3250 } else { |
|
3251 this.attr( match, context[ match ] ); |
|
3252 } |
|
3253 } |
|
3254 } |
|
3255 |
|
3256 return this; |
|
3257 |
|
3258 // HANDLE: $(#id) |
|
3259 } else { |
|
3260 elem = document.getElementById( match[ 2 ] ); |
|
3261 |
|
3262 if ( elem ) { |
|
3263 |
|
3264 // Inject the element directly into the jQuery object |
|
3265 this[ 0 ] = elem; |
|
3266 this.length = 1; |
|
3267 } |
|
3268 return this; |
|
3269 } |
|
3270 |
|
3271 // HANDLE: $(expr, $(...)) |
|
3272 } else if ( !context || context.jquery ) { |
|
3273 return ( context || root ).find( selector ); |
|
3274 |
|
3275 // HANDLE: $(expr, context) |
|
3276 // (which is just equivalent to: $(context).find(expr) |
|
3277 } else { |
|
3278 return this.constructor( context ).find( selector ); |
|
3279 } |
|
3280 |
|
3281 // HANDLE: $(DOMElement) |
|
3282 } else if ( selector.nodeType ) { |
|
3283 this[ 0 ] = selector; |
|
3284 this.length = 1; |
|
3285 return this; |
|
3286 |
|
3287 // HANDLE: $(function) |
|
3288 // Shortcut for document ready |
|
3289 } else if ( isFunction( selector ) ) { |
|
3290 return root.ready !== undefined ? |
|
3291 root.ready( selector ) : |
|
3292 |
|
3293 // Execute immediately if ready is not present |
|
3294 selector( jQuery ); |
|
3295 } |
|
3296 |
|
3297 return jQuery.makeArray( selector, this ); |
|
3298 }; |
|
3299 |
|
3300 // Give the init function the jQuery prototype for later instantiation |
|
3301 init.prototype = jQuery.fn; |
|
3302 |
|
3303 // Initialize central reference |
|
3304 rootjQuery = jQuery( document ); |
|
3305 |
|
3306 |
|
3307 var rparentsprev = /^(?:parents|prev(?:Until|All))/, |
|
3308 |
|
3309 // Methods guaranteed to produce a unique set when starting from a unique set |
|
3310 guaranteedUnique = { |
|
3311 children: true, |
|
3312 contents: true, |
|
3313 next: true, |
|
3314 prev: true |
|
3315 }; |
|
3316 |
|
3317 jQuery.fn.extend( { |
|
3318 has: function( target ) { |
|
3319 var targets = jQuery( target, this ), |
|
3320 l = targets.length; |
|
3321 |
|
3322 return this.filter( function() { |
|
3323 var i = 0; |
|
3324 for ( ; i < l; i++ ) { |
|
3325 if ( jQuery.contains( this, targets[ i ] ) ) { |
|
3326 return true; |
|
3327 } |
|
3328 } |
|
3329 } ); |
|
3330 }, |
|
3331 |
|
3332 closest: function( selectors, context ) { |
|
3333 var cur, |
|
3334 i = 0, |
|
3335 l = this.length, |
|
3336 matched = [], |
|
3337 targets = typeof selectors !== "string" && jQuery( selectors ); |
|
3338 |
|
3339 // Positional selectors never match, since there's no _selection_ context |
|
3340 if ( !rneedsContext.test( selectors ) ) { |
|
3341 for ( ; i < l; i++ ) { |
|
3342 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { |
|
3343 |
|
3344 // Always skip document fragments |
|
3345 if ( cur.nodeType < 11 && ( targets ? |
|
3346 targets.index( cur ) > -1 : |
|
3347 |
|
3348 // Don't pass non-elements to Sizzle |
|
3349 cur.nodeType === 1 && |
|
3350 jQuery.find.matchesSelector( cur, selectors ) ) ) { |
|
3351 |
|
3352 matched.push( cur ); |
|
3353 break; |
|
3354 } |
|
3355 } |
|
3356 } |
|
3357 } |
|
3358 |
|
3359 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); |
|
3360 }, |
|
3361 |
|
3362 // Determine the position of an element within the set |
|
3363 index: function( elem ) { |
|
3364 |
|
3365 // No argument, return index in parent |
|
3366 if ( !elem ) { |
|
3367 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; |
|
3368 } |
|
3369 |
|
3370 // Index in selector |
|
3371 if ( typeof elem === "string" ) { |
|
3372 return indexOf.call( jQuery( elem ), this[ 0 ] ); |
|
3373 } |
|
3374 |
|
3375 // Locate the position of the desired element |
|
3376 return indexOf.call( this, |
|
3377 |
|
3378 // If it receives a jQuery object, the first element is used |
|
3379 elem.jquery ? elem[ 0 ] : elem |
|
3380 ); |
|
3381 }, |
|
3382 |
|
3383 add: function( selector, context ) { |
|
3384 return this.pushStack( |
|
3385 jQuery.uniqueSort( |
|
3386 jQuery.merge( this.get(), jQuery( selector, context ) ) |
|
3387 ) |
|
3388 ); |
|
3389 }, |
|
3390 |
|
3391 addBack: function( selector ) { |
|
3392 return this.add( selector == null ? |
|
3393 this.prevObject : this.prevObject.filter( selector ) |
|
3394 ); |
|
3395 } |
|
3396 } ); |
|
3397 |
|
3398 function sibling( cur, dir ) { |
|
3399 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} |
|
3400 return cur; |
|
3401 } |
|
3402 |
|
3403 jQuery.each( { |
|
3404 parent: function( elem ) { |
|
3405 var parent = elem.parentNode; |
|
3406 return parent && parent.nodeType !== 11 ? parent : null; |
|
3407 }, |
|
3408 parents: function( elem ) { |
|
3409 return dir( elem, "parentNode" ); |
|
3410 }, |
|
3411 parentsUntil: function( elem, _i, until ) { |
|
3412 return dir( elem, "parentNode", until ); |
|
3413 }, |
|
3414 next: function( elem ) { |
|
3415 return sibling( elem, "nextSibling" ); |
|
3416 }, |
|
3417 prev: function( elem ) { |
|
3418 return sibling( elem, "previousSibling" ); |
|
3419 }, |
|
3420 nextAll: function( elem ) { |
|
3421 return dir( elem, "nextSibling" ); |
|
3422 }, |
|
3423 prevAll: function( elem ) { |
|
3424 return dir( elem, "previousSibling" ); |
|
3425 }, |
|
3426 nextUntil: function( elem, _i, until ) { |
|
3427 return dir( elem, "nextSibling", until ); |
|
3428 }, |
|
3429 prevUntil: function( elem, _i, until ) { |
|
3430 return dir( elem, "previousSibling", until ); |
|
3431 }, |
|
3432 siblings: function( elem ) { |
|
3433 return siblings( ( elem.parentNode || {} ).firstChild, elem ); |
|
3434 }, |
|
3435 children: function( elem ) { |
|
3436 return siblings( elem.firstChild ); |
|
3437 }, |
|
3438 contents: function( elem ) { |
|
3439 if ( elem.contentDocument != null && |
|
3440 |
|
3441 // Support: IE 11+ |
|
3442 // <object> elements with no `data` attribute has an object |
|
3443 // `contentDocument` with a `null` prototype. |
|
3444 getProto( elem.contentDocument ) ) { |
|
3445 |
|
3446 return elem.contentDocument; |
|
3447 } |
|
3448 |
|
3449 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only |
|
3450 // Treat the template element as a regular one in browsers that |
|
3451 // don't support it. |
|
3452 if ( nodeName( elem, "template" ) ) { |
|
3453 elem = elem.content || elem; |
|
3454 } |
|
3455 |
|
3456 return jQuery.merge( [], elem.childNodes ); |
|
3457 } |
|
3458 }, function( name, fn ) { |
|
3459 jQuery.fn[ name ] = function( until, selector ) { |
|
3460 var matched = jQuery.map( this, fn, until ); |
|
3461 |
|
3462 if ( name.slice( -5 ) !== "Until" ) { |
|
3463 selector = until; |
|
3464 } |
|
3465 |
|
3466 if ( selector && typeof selector === "string" ) { |
|
3467 matched = jQuery.filter( selector, matched ); |
|
3468 } |
|
3469 |
|
3470 if ( this.length > 1 ) { |
|
3471 |
|
3472 // Remove duplicates |
|
3473 if ( !guaranteedUnique[ name ] ) { |
|
3474 jQuery.uniqueSort( matched ); |
|
3475 } |
|
3476 |
|
3477 // Reverse order for parents* and prev-derivatives |
|
3478 if ( rparentsprev.test( name ) ) { |
|
3479 matched.reverse(); |
|
3480 } |
|
3481 } |
|
3482 |
|
3483 return this.pushStack( matched ); |
|
3484 }; |
|
3485 } ); |
|
3486 var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); |
|
3487 |
|
3488 |
|
3489 |
|
3490 // Convert String-formatted options into Object-formatted ones |
|
3491 function createOptions( options ) { |
|
3492 var object = {}; |
|
3493 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { |
|
3494 object[ flag ] = true; |
|
3495 } ); |
|
3496 return object; |
|
3497 } |
|
3498 |
|
3499 /* |
|
3500 * Create a callback list using the following parameters: |
|
3501 * |
|
3502 * options: an optional list of space-separated options that will change how |
|
3503 * the callback list behaves or a more traditional option object |
|
3504 * |
|
3505 * By default a callback list will act like an event callback list and can be |
|
3506 * "fired" multiple times. |
|
3507 * |
|
3508 * Possible options: |
|
3509 * |
|
3510 * once: will ensure the callback list can only be fired once (like a Deferred) |
|
3511 * |
|
3512 * memory: will keep track of previous values and will call any callback added |
|
3513 * after the list has been fired right away with the latest "memorized" |
|
3514 * values (like a Deferred) |
|
3515 * |
|
3516 * unique: will ensure a callback can only be added once (no duplicate in the list) |
|
3517 * |
|
3518 * stopOnFalse: interrupt callings when a callback returns false |
|
3519 * |
|
3520 */ |
|
3521 jQuery.Callbacks = function( options ) { |
|
3522 |
|
3523 // Convert options from String-formatted to Object-formatted if needed |
|
3524 // (we check in cache first) |
|
3525 options = typeof options === "string" ? |
|
3526 createOptions( options ) : |
|
3527 jQuery.extend( {}, options ); |
|
3528 |
|
3529 var // Flag to know if list is currently firing |
|
3530 firing, |
|
3531 |
|
3532 // Last fire value for non-forgettable lists |
|
3533 memory, |
|
3534 |
|
3535 // Flag to know if list was already fired |
|
3536 fired, |
|
3537 |
|
3538 // Flag to prevent firing |
|
3539 locked, |
|
3540 |
|
3541 // Actual callback list |
|
3542 list = [], |
|
3543 |
|
3544 // Queue of execution data for repeatable lists |
|
3545 queue = [], |
|
3546 |
|
3547 // Index of currently firing callback (modified by add/remove as needed) |
|
3548 firingIndex = -1, |
|
3549 |
|
3550 // Fire callbacks |
|
3551 fire = function() { |
|
3552 |
|
3553 // Enforce single-firing |
|
3554 locked = locked || options.once; |
|
3555 |
|
3556 // Execute callbacks for all pending executions, |
|
3557 // respecting firingIndex overrides and runtime changes |
|
3558 fired = firing = true; |
|
3559 for ( ; queue.length; firingIndex = -1 ) { |
|
3560 memory = queue.shift(); |
|
3561 while ( ++firingIndex < list.length ) { |
|
3562 |
|
3563 // Run callback and check for early termination |
|
3564 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && |
|
3565 options.stopOnFalse ) { |
|
3566 |
|
3567 // Jump to end and forget the data so .add doesn't re-fire |
|
3568 firingIndex = list.length; |
|
3569 memory = false; |
|
3570 } |
|
3571 } |
|
3572 } |
|
3573 |
|
3574 // Forget the data if we're done with it |
|
3575 if ( !options.memory ) { |
|
3576 memory = false; |
|
3577 } |
|
3578 |
|
3579 firing = false; |
|
3580 |
|
3581 // Clean up if we're done firing for good |
|
3582 if ( locked ) { |
|
3583 |
|
3584 // Keep an empty list if we have data for future add calls |
|
3585 if ( memory ) { |
|
3586 list = []; |
|
3587 |
|
3588 // Otherwise, this object is spent |
|
3589 } else { |
|
3590 list = ""; |
|
3591 } |
|
3592 } |
|
3593 }, |
|
3594 |
|
3595 // Actual Callbacks object |
|
3596 self = { |
|
3597 |
|
3598 // Add a callback or a collection of callbacks to the list |
|
3599 add: function() { |
|
3600 if ( list ) { |
|
3601 |
|
3602 // If we have memory from a past run, we should fire after adding |
|
3603 if ( memory && !firing ) { |
|
3604 firingIndex = list.length - 1; |
|
3605 queue.push( memory ); |
|
3606 } |
|
3607 |
|
3608 ( function add( args ) { |
|
3609 jQuery.each( args, function( _, arg ) { |
|
3610 if ( isFunction( arg ) ) { |
|
3611 if ( !options.unique || !self.has( arg ) ) { |
|
3612 list.push( arg ); |
|
3613 } |
|
3614 } else if ( arg && arg.length && toType( arg ) !== "string" ) { |
|
3615 |
|
3616 // Inspect recursively |
|
3617 add( arg ); |
|
3618 } |
|
3619 } ); |
|
3620 } )( arguments ); |
|
3621 |
|
3622 if ( memory && !firing ) { |
|
3623 fire(); |
|
3624 } |
|
3625 } |
|
3626 return this; |
|
3627 }, |
|
3628 |
|
3629 // Remove a callback from the list |
|
3630 remove: function() { |
|
3631 jQuery.each( arguments, function( _, arg ) { |
|
3632 var index; |
|
3633 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { |
|
3634 list.splice( index, 1 ); |
|
3635 |
|
3636 // Handle firing indexes |
|
3637 if ( index <= firingIndex ) { |
|
3638 firingIndex--; |
|
3639 } |
|
3640 } |
|
3641 } ); |
|
3642 return this; |
|
3643 }, |
|
3644 |
|
3645 // Check if a given callback is in the list. |
|
3646 // If no argument is given, return whether or not list has callbacks attached. |
|
3647 has: function( fn ) { |
|
3648 return fn ? |
|
3649 jQuery.inArray( fn, list ) > -1 : |
|
3650 list.length > 0; |
|
3651 }, |
|
3652 |
|
3653 // Remove all callbacks from the list |
|
3654 empty: function() { |
|
3655 if ( list ) { |
|
3656 list = []; |
|
3657 } |
|
3658 return this; |
|
3659 }, |
|
3660 |
|
3661 // Disable .fire and .add |
|
3662 // Abort any current/pending executions |
|
3663 // Clear all callbacks and values |
|
3664 disable: function() { |
|
3665 locked = queue = []; |
|
3666 list = memory = ""; |
|
3667 return this; |
|
3668 }, |
|
3669 disabled: function() { |
|
3670 return !list; |
|
3671 }, |
|
3672 |
|
3673 // Disable .fire |
|
3674 // Also disable .add unless we have memory (since it would have no effect) |
|
3675 // Abort any pending executions |
|
3676 lock: function() { |
|
3677 locked = queue = []; |
|
3678 if ( !memory && !firing ) { |
|
3679 list = memory = ""; |
|
3680 } |
|
3681 return this; |
|
3682 }, |
|
3683 locked: function() { |
|
3684 return !!locked; |
|
3685 }, |
|
3686 |
|
3687 // Call all callbacks with the given context and arguments |
|
3688 fireWith: function( context, args ) { |
|
3689 if ( !locked ) { |
|
3690 args = args || []; |
|
3691 args = [ context, args.slice ? args.slice() : args ]; |
|
3692 queue.push( args ); |
|
3693 if ( !firing ) { |
|
3694 fire(); |
|
3695 } |
|
3696 } |
|
3697 return this; |
|
3698 }, |
|
3699 |
|
3700 // Call all the callbacks with the given arguments |
|
3701 fire: function() { |
|
3702 self.fireWith( this, arguments ); |
|
3703 return this; |
|
3704 }, |
|
3705 |
|
3706 // To know if the callbacks have already been called at least once |
|
3707 fired: function() { |
|
3708 return !!fired; |
|
3709 } |
|
3710 }; |
|
3711 |
|
3712 return self; |
|
3713 }; |
|
3714 |
|
3715 |
|
3716 function Identity( v ) { |
|
3717 return v; |
|
3718 } |
|
3719 function Thrower( ex ) { |
|
3720 throw ex; |
|
3721 } |
|
3722 |
|
3723 function adoptValue( value, resolve, reject, noValue ) { |
|
3724 var method; |
|
3725 |
|
3726 try { |
|
3727 |
|
3728 // Check for promise aspect first to privilege synchronous behavior |
|
3729 if ( value && isFunction( ( method = value.promise ) ) ) { |
|
3730 method.call( value ).done( resolve ).fail( reject ); |
|
3731 |
|
3732 // Other thenables |
|
3733 } else if ( value && isFunction( ( method = value.then ) ) ) { |
|
3734 method.call( value, resolve, reject ); |
|
3735 |
|
3736 // Other non-thenables |
|
3737 } else { |
|
3738 |
|
3739 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: |
|
3740 // * false: [ value ].slice( 0 ) => resolve( value ) |
|
3741 // * true: [ value ].slice( 1 ) => resolve() |
|
3742 resolve.apply( undefined, [ value ].slice( noValue ) ); |
|
3743 } |
|
3744 |
|
3745 // For Promises/A+, convert exceptions into rejections |
|
3746 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in |
|
3747 // Deferred#then to conditionally suppress rejection. |
|
3748 } catch ( value ) { |
|
3749 |
|
3750 // Support: Android 4.0 only |
|
3751 // Strict mode functions invoked without .call/.apply get global-object context |
|
3752 reject.apply( undefined, [ value ] ); |
|
3753 } |
|
3754 } |
|
3755 |
|
3756 jQuery.extend( { |
|
3757 |
|
3758 Deferred: function( func ) { |
|
3759 var tuples = [ |
|
3760 |
|
3761 // action, add listener, callbacks, |
|
3762 // ... .then handlers, argument index, [final state] |
|
3763 [ "notify", "progress", jQuery.Callbacks( "memory" ), |
|
3764 jQuery.Callbacks( "memory" ), 2 ], |
|
3765 [ "resolve", "done", jQuery.Callbacks( "once memory" ), |
|
3766 jQuery.Callbacks( "once memory" ), 0, "resolved" ], |
|
3767 [ "reject", "fail", jQuery.Callbacks( "once memory" ), |
|
3768 jQuery.Callbacks( "once memory" ), 1, "rejected" ] |
|
3769 ], |
|
3770 state = "pending", |
|
3771 promise = { |
|
3772 state: function() { |
|
3773 return state; |
|
3774 }, |
|
3775 always: function() { |
|
3776 deferred.done( arguments ).fail( arguments ); |
|
3777 return this; |
|
3778 }, |
|
3779 "catch": function( fn ) { |
|
3780 return promise.then( null, fn ); |
|
3781 }, |
|
3782 |
|
3783 // Keep pipe for back-compat |
|
3784 pipe: function( /* fnDone, fnFail, fnProgress */ ) { |
|
3785 var fns = arguments; |
|
3786 |
|
3787 return jQuery.Deferred( function( newDefer ) { |
|
3788 jQuery.each( tuples, function( _i, tuple ) { |
|
3789 |
|
3790 // Map tuples (progress, done, fail) to arguments (done, fail, progress) |
|
3791 var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; |
|
3792 |
|
3793 // deferred.progress(function() { bind to newDefer or newDefer.notify }) |
|
3794 // deferred.done(function() { bind to newDefer or newDefer.resolve }) |
|
3795 // deferred.fail(function() { bind to newDefer or newDefer.reject }) |
|
3796 deferred[ tuple[ 1 ] ]( function() { |
|
3797 var returned = fn && fn.apply( this, arguments ); |
|
3798 if ( returned && isFunction( returned.promise ) ) { |
|
3799 returned.promise() |
|
3800 .progress( newDefer.notify ) |
|
3801 .done( newDefer.resolve ) |
|
3802 .fail( newDefer.reject ); |
|
3803 } else { |
|
3804 newDefer[ tuple[ 0 ] + "With" ]( |
|
3805 this, |
|
3806 fn ? [ returned ] : arguments |
|
3807 ); |
|
3808 } |
|
3809 } ); |
|
3810 } ); |
|
3811 fns = null; |
|
3812 } ).promise(); |
|
3813 }, |
|
3814 then: function( onFulfilled, onRejected, onProgress ) { |
|
3815 var maxDepth = 0; |
|
3816 function resolve( depth, deferred, handler, special ) { |
|
3817 return function() { |
|
3818 var that = this, |
|
3819 args = arguments, |
|
3820 mightThrow = function() { |
|
3821 var returned, then; |
|
3822 |
|
3823 // Support: Promises/A+ section 2.3.3.3.3 |
|
3824 // https://promisesaplus.com/#point-59 |
|
3825 // Ignore double-resolution attempts |
|
3826 if ( depth < maxDepth ) { |
|
3827 return; |
|
3828 } |
|
3829 |
|
3830 returned = handler.apply( that, args ); |
|
3831 |
|
3832 // Support: Promises/A+ section 2.3.1 |
|
3833 // https://promisesaplus.com/#point-48 |
|
3834 if ( returned === deferred.promise() ) { |
|
3835 throw new TypeError( "Thenable self-resolution" ); |
|
3836 } |
|
3837 |
|
3838 // Support: Promises/A+ sections 2.3.3.1, 3.5 |
|
3839 // https://promisesaplus.com/#point-54 |
|
3840 // https://promisesaplus.com/#point-75 |
|
3841 // Retrieve `then` only once |
|
3842 then = returned && |
|
3843 |
|
3844 // Support: Promises/A+ section 2.3.4 |
|
3845 // https://promisesaplus.com/#point-64 |
|
3846 // Only check objects and functions for thenability |
|
3847 ( typeof returned === "object" || |
|
3848 typeof returned === "function" ) && |
|
3849 returned.then; |
|
3850 |
|
3851 // Handle a returned thenable |
|
3852 if ( isFunction( then ) ) { |
|
3853 |
|
3854 // Special processors (notify) just wait for resolution |
|
3855 if ( special ) { |
|
3856 then.call( |
|
3857 returned, |
|
3858 resolve( maxDepth, deferred, Identity, special ), |
|
3859 resolve( maxDepth, deferred, Thrower, special ) |
|
3860 ); |
|
3861 |
|
3862 // Normal processors (resolve) also hook into progress |
|
3863 } else { |
|
3864 |
|
3865 // ...and disregard older resolution values |
|
3866 maxDepth++; |
|
3867 |
|
3868 then.call( |
|
3869 returned, |
|
3870 resolve( maxDepth, deferred, Identity, special ), |
|
3871 resolve( maxDepth, deferred, Thrower, special ), |
|
3872 resolve( maxDepth, deferred, Identity, |
|
3873 deferred.notifyWith ) |
|
3874 ); |
|
3875 } |
|
3876 |
|
3877 // Handle all other returned values |
|
3878 } else { |
|
3879 |
|
3880 // Only substitute handlers pass on context |
|
3881 // and multiple values (non-spec behavior) |
|
3882 if ( handler !== Identity ) { |
|
3883 that = undefined; |
|
3884 args = [ returned ]; |
|
3885 } |
|
3886 |
|
3887 // Process the value(s) |
|
3888 // Default process is resolve |
|
3889 ( special || deferred.resolveWith )( that, args ); |
|
3890 } |
|
3891 }, |
|
3892 |
|
3893 // Only normal processors (resolve) catch and reject exceptions |
|
3894 process = special ? |
|
3895 mightThrow : |
|
3896 function() { |
|
3897 try { |
|
3898 mightThrow(); |
|
3899 } catch ( e ) { |
|
3900 |
|
3901 if ( jQuery.Deferred.exceptionHook ) { |
|
3902 jQuery.Deferred.exceptionHook( e, |
|
3903 process.stackTrace ); |
|
3904 } |
|
3905 |
|
3906 // Support: Promises/A+ section 2.3.3.3.4.1 |
|
3907 // https://promisesaplus.com/#point-61 |
|
3908 // Ignore post-resolution exceptions |
|
3909 if ( depth + 1 >= maxDepth ) { |
|
3910 |
|
3911 // Only substitute handlers pass on context |
|
3912 // and multiple values (non-spec behavior) |
|
3913 if ( handler !== Thrower ) { |
|
3914 that = undefined; |
|
3915 args = [ e ]; |
|
3916 } |
|
3917 |
|
3918 deferred.rejectWith( that, args ); |
|
3919 } |
|
3920 } |
|
3921 }; |
|
3922 |
|
3923 // Support: Promises/A+ section 2.3.3.3.1 |
|
3924 // https://promisesaplus.com/#point-57 |
|
3925 // Re-resolve promises immediately to dodge false rejection from |
|
3926 // subsequent errors |
|
3927 if ( depth ) { |
|
3928 process(); |
|
3929 } else { |
|
3930 |
|
3931 // Call an optional hook to record the stack, in case of exception |
|
3932 // since it's otherwise lost when execution goes async |
|
3933 if ( jQuery.Deferred.getStackHook ) { |
|
3934 process.stackTrace = jQuery.Deferred.getStackHook(); |
|
3935 } |
|
3936 window.setTimeout( process ); |
|
3937 } |
|
3938 }; |
|
3939 } |
|
3940 |
|
3941 return jQuery.Deferred( function( newDefer ) { |
|
3942 |
|
3943 // progress_handlers.add( ... ) |
|
3944 tuples[ 0 ][ 3 ].add( |
|
3945 resolve( |
|
3946 0, |
|
3947 newDefer, |
|
3948 isFunction( onProgress ) ? |
|
3949 onProgress : |
|
3950 Identity, |
|
3951 newDefer.notifyWith |
|
3952 ) |
|
3953 ); |
|
3954 |
|
3955 // fulfilled_handlers.add( ... ) |
|
3956 tuples[ 1 ][ 3 ].add( |
|
3957 resolve( |
|
3958 0, |
|
3959 newDefer, |
|
3960 isFunction( onFulfilled ) ? |
|
3961 onFulfilled : |
|
3962 Identity |
|
3963 ) |
|
3964 ); |
|
3965 |
|
3966 // rejected_handlers.add( ... ) |
|
3967 tuples[ 2 ][ 3 ].add( |
|
3968 resolve( |
|
3969 0, |
|
3970 newDefer, |
|
3971 isFunction( onRejected ) ? |
|
3972 onRejected : |
|
3973 Thrower |
|
3974 ) |
|
3975 ); |
|
3976 } ).promise(); |
|
3977 }, |
|
3978 |
|
3979 // Get a promise for this deferred |
|
3980 // If obj is provided, the promise aspect is added to the object |
|
3981 promise: function( obj ) { |
|
3982 return obj != null ? jQuery.extend( obj, promise ) : promise; |
|
3983 } |
|
3984 }, |
|
3985 deferred = {}; |
|
3986 |
|
3987 // Add list-specific methods |
|
3988 jQuery.each( tuples, function( i, tuple ) { |
|
3989 var list = tuple[ 2 ], |
|
3990 stateString = tuple[ 5 ]; |
|
3991 |
|
3992 // promise.progress = list.add |
|
3993 // promise.done = list.add |
|
3994 // promise.fail = list.add |
|
3995 promise[ tuple[ 1 ] ] = list.add; |
|
3996 |
|
3997 // Handle state |
|
3998 if ( stateString ) { |
|
3999 list.add( |
|
4000 function() { |
|
4001 |
|
4002 // state = "resolved" (i.e., fulfilled) |
|
4003 // state = "rejected" |
|
4004 state = stateString; |
|
4005 }, |
|
4006 |
|
4007 // rejected_callbacks.disable |
|
4008 // fulfilled_callbacks.disable |
|
4009 tuples[ 3 - i ][ 2 ].disable, |
|
4010 |
|
4011 // rejected_handlers.disable |
|
4012 // fulfilled_handlers.disable |
|
4013 tuples[ 3 - i ][ 3 ].disable, |
|
4014 |
|
4015 // progress_callbacks.lock |
|
4016 tuples[ 0 ][ 2 ].lock, |
|
4017 |
|
4018 // progress_handlers.lock |
|
4019 tuples[ 0 ][ 3 ].lock |
|
4020 ); |
|
4021 } |
|
4022 |
|
4023 // progress_handlers.fire |
|
4024 // fulfilled_handlers.fire |
|
4025 // rejected_handlers.fire |
|
4026 list.add( tuple[ 3 ].fire ); |
|
4027 |
|
4028 // deferred.notify = function() { deferred.notifyWith(...) } |
|
4029 // deferred.resolve = function() { deferred.resolveWith(...) } |
|
4030 // deferred.reject = function() { deferred.rejectWith(...) } |
|
4031 deferred[ tuple[ 0 ] ] = function() { |
|
4032 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); |
|
4033 return this; |
|
4034 }; |
|
4035 |
|
4036 // deferred.notifyWith = list.fireWith |
|
4037 // deferred.resolveWith = list.fireWith |
|
4038 // deferred.rejectWith = list.fireWith |
|
4039 deferred[ tuple[ 0 ] + "With" ] = list.fireWith; |
|
4040 } ); |
|
4041 |
|
4042 // Make the deferred a promise |
|
4043 promise.promise( deferred ); |
|
4044 |
|
4045 // Call given func if any |
|
4046 if ( func ) { |
|
4047 func.call( deferred, deferred ); |
|
4048 } |
|
4049 |
|
4050 // All done! |
|
4051 return deferred; |
|
4052 }, |
|
4053 |
|
4054 // Deferred helper |
|
4055 when: function( singleValue ) { |
|
4056 var |
|
4057 |
|
4058 // count of uncompleted subordinates |
|
4059 remaining = arguments.length, |
|
4060 |
|
4061 // count of unprocessed arguments |
|
4062 i = remaining, |
|
4063 |
|
4064 // subordinate fulfillment data |
|
4065 resolveContexts = Array( i ), |
|
4066 resolveValues = slice.call( arguments ), |
|
4067 |
|
4068 // the primary Deferred |
|
4069 primary = jQuery.Deferred(), |
|
4070 |
|
4071 // subordinate callback factory |
|
4072 updateFunc = function( i ) { |
|
4073 return function( value ) { |
|
4074 resolveContexts[ i ] = this; |
|
4075 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; |
|
4076 if ( !( --remaining ) ) { |
|
4077 primary.resolveWith( resolveContexts, resolveValues ); |
|
4078 } |
|
4079 }; |
|
4080 }; |
|
4081 |
|
4082 // Single- and empty arguments are adopted like Promise.resolve |
|
4083 if ( remaining <= 1 ) { |
|
4084 adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject, |
|
4085 !remaining ); |
|
4086 |
|
4087 // Use .then() to unwrap secondary thenables (cf. gh-3000) |
|
4088 if ( primary.state() === "pending" || |
|
4089 isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { |
|
4090 |
|
4091 return primary.then(); |
|
4092 } |
|
4093 } |
|
4094 |
|
4095 // Multiple arguments are aggregated like Promise.all array elements |
|
4096 while ( i-- ) { |
|
4097 adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject ); |
|
4098 } |
|
4099 |
|
4100 return primary.promise(); |
|
4101 } |
|
4102 } ); |
|
4103 |
|
4104 |
|
4105 // These usually indicate a programmer mistake during development, |
|
4106 // warn about them ASAP rather than swallowing them by default. |
|
4107 var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; |
|
4108 |
|
4109 jQuery.Deferred.exceptionHook = function( error, stack ) { |
|
4110 |
|
4111 // Support: IE 8 - 9 only |
|
4112 // Console exists when dev tools are open, which can happen at any time |
|
4113 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { |
|
4114 window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); |
|
4115 } |
|
4116 }; |
|
4117 |
|
4118 |
|
4119 |
|
4120 |
|
4121 jQuery.readyException = function( error ) { |
|
4122 window.setTimeout( function() { |
|
4123 throw error; |
|
4124 } ); |
|
4125 }; |
|
4126 |
|
4127 |
|
4128 |
|
4129 |
|
4130 // The deferred used on DOM ready |
|
4131 var readyList = jQuery.Deferred(); |
|
4132 |
|
4133 jQuery.fn.ready = function( fn ) { |
|
4134 |
|
4135 readyList |
|
4136 .then( fn ) |
|
4137 |
|
4138 // Wrap jQuery.readyException in a function so that the lookup |
|
4139 // happens at the time of error handling instead of callback |
|
4140 // registration. |
|
4141 .catch( function( error ) { |
|
4142 jQuery.readyException( error ); |
|
4143 } ); |
|
4144 |
|
4145 return this; |
|
4146 }; |
|
4147 |
|
4148 jQuery.extend( { |
|
4149 |
|
4150 // Is the DOM ready to be used? Set to true once it occurs. |
|
4151 isReady: false, |
|
4152 |
|
4153 // A counter to track how many items to wait for before |
|
4154 // the ready event fires. See trac-6781 |
|
4155 readyWait: 1, |
|
4156 |
|
4157 // Handle when the DOM is ready |
|
4158 ready: function( wait ) { |
|
4159 |
|
4160 // Abort if there are pending holds or we're already ready |
|
4161 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { |
|
4162 return; |
|
4163 } |
|
4164 |
|
4165 // Remember that the DOM is ready |
|
4166 jQuery.isReady = true; |
|
4167 |
|
4168 // If a normal DOM Ready event fired, decrement, and wait if need be |
|
4169 if ( wait !== true && --jQuery.readyWait > 0 ) { |
|
4170 return; |
|
4171 } |
|
4172 |
|
4173 // If there are functions bound, to execute |
|
4174 readyList.resolveWith( document, [ jQuery ] ); |
|
4175 } |
|
4176 } ); |
|
4177 |
|
4178 jQuery.ready.then = readyList.then; |
|
4179 |
|
4180 // The ready event handler and self cleanup method |
|
4181 function completed() { |
|
4182 document.removeEventListener( "DOMContentLoaded", completed ); |
|
4183 window.removeEventListener( "load", completed ); |
|
4184 jQuery.ready(); |
|
4185 } |
|
4186 |
|
4187 // Catch cases where $(document).ready() is called |
|
4188 // after the browser event has already occurred. |
|
4189 // Support: IE <=9 - 10 only |
|
4190 // Older IE sometimes signals "interactive" too soon |
|
4191 if ( document.readyState === "complete" || |
|
4192 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { |
|
4193 |
|
4194 // Handle it asynchronously to allow scripts the opportunity to delay ready |
|
4195 window.setTimeout( jQuery.ready ); |
|
4196 |
|
4197 } else { |
|
4198 |
|
4199 // Use the handy event callback |
|
4200 document.addEventListener( "DOMContentLoaded", completed ); |
|
4201 |
|
4202 // A fallback to window.onload, that will always work |
|
4203 window.addEventListener( "load", completed ); |
|
4204 } |
|
4205 |
|
4206 |
|
4207 |
|
4208 |
|
4209 // Multifunctional method to get and set values of a collection |
|
4210 // The value/s can optionally be executed if it's a function |
|
4211 var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { |
|
4212 var i = 0, |
|
4213 len = elems.length, |
|
4214 bulk = key == null; |
|
4215 |
|
4216 // Sets many values |
|
4217 if ( toType( key ) === "object" ) { |
|
4218 chainable = true; |
|
4219 for ( i in key ) { |
|
4220 access( elems, fn, i, key[ i ], true, emptyGet, raw ); |
|
4221 } |
|
4222 |
|
4223 // Sets one value |
|
4224 } else if ( value !== undefined ) { |
|
4225 chainable = true; |
|
4226 |
|
4227 if ( !isFunction( value ) ) { |
|
4228 raw = true; |
|
4229 } |
|
4230 |
|
4231 if ( bulk ) { |
|
4232 |
|
4233 // Bulk operations run against the entire set |
|
4234 if ( raw ) { |
|
4235 fn.call( elems, value ); |
|
4236 fn = null; |
|
4237 |
|
4238 // ...except when executing function values |
|
4239 } else { |
|
4240 bulk = fn; |
|
4241 fn = function( elem, _key, value ) { |
|
4242 return bulk.call( jQuery( elem ), value ); |
|
4243 }; |
|
4244 } |
|
4245 } |
|
4246 |
|
4247 if ( fn ) { |
|
4248 for ( ; i < len; i++ ) { |
|
4249 fn( |
|
4250 elems[ i ], key, raw ? |
|
4251 value : |
|
4252 value.call( elems[ i ], i, fn( elems[ i ], key ) ) |
|
4253 ); |
|
4254 } |
|
4255 } |
|
4256 } |
|
4257 |
|
4258 if ( chainable ) { |
|
4259 return elems; |
|
4260 } |
|
4261 |
|
4262 // Gets |
|
4263 if ( bulk ) { |
|
4264 return fn.call( elems ); |
|
4265 } |
|
4266 |
|
4267 return len ? fn( elems[ 0 ], key ) : emptyGet; |
|
4268 }; |
|
4269 |
|
4270 |
|
4271 // Matches dashed string for camelizing |
|
4272 var rmsPrefix = /^-ms-/, |
|
4273 rdashAlpha = /-([a-z])/g; |
|
4274 |
|
4275 // Used by camelCase as callback to replace() |
|
4276 function fcamelCase( _all, letter ) { |
|
4277 return letter.toUpperCase(); |
|
4278 } |
|
4279 |
|
4280 // Convert dashed to camelCase; used by the css and data modules |
|
4281 // Support: IE <=9 - 11, Edge 12 - 15 |
|
4282 // Microsoft forgot to hump their vendor prefix (trac-9572) |
|
4283 function camelCase( string ) { |
|
4284 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); |
|
4285 } |
|
4286 var acceptData = function( owner ) { |
|
4287 |
|
4288 // Accepts only: |
|
4289 // - Node |
|
4290 // - Node.ELEMENT_NODE |
|
4291 // - Node.DOCUMENT_NODE |
|
4292 // - Object |
|
4293 // - Any |
|
4294 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); |
|
4295 }; |
|
4296 |
|
4297 |
|
4298 |
|
4299 |
|
4300 function Data() { |
|
4301 this.expando = jQuery.expando + Data.uid++; |
|
4302 } |
|
4303 |
|
4304 Data.uid = 1; |
|
4305 |
|
4306 Data.prototype = { |
|
4307 |
|
4308 cache: function( owner ) { |
|
4309 |
|
4310 // Check if the owner object already has a cache |
|
4311 var value = owner[ this.expando ]; |
|
4312 |
|
4313 // If not, create one |
|
4314 if ( !value ) { |
|
4315 value = {}; |
|
4316 |
|
4317 // We can accept data for non-element nodes in modern browsers, |
|
4318 // but we should not, see trac-8335. |
|
4319 // Always return an empty object. |
|
4320 if ( acceptData( owner ) ) { |
|
4321 |
|
4322 // If it is a node unlikely to be stringify-ed or looped over |
|
4323 // use plain assignment |
|
4324 if ( owner.nodeType ) { |
|
4325 owner[ this.expando ] = value; |
|
4326 |
|
4327 // Otherwise secure it in a non-enumerable property |
|
4328 // configurable must be true to allow the property to be |
|
4329 // deleted when data is removed |
|
4330 } else { |
|
4331 Object.defineProperty( owner, this.expando, { |
|
4332 value: value, |
|
4333 configurable: true |
|
4334 } ); |
|
4335 } |
|
4336 } |
|
4337 } |
|
4338 |
|
4339 return value; |
|
4340 }, |
|
4341 set: function( owner, data, value ) { |
|
4342 var prop, |
|
4343 cache = this.cache( owner ); |
|
4344 |
|
4345 // Handle: [ owner, key, value ] args |
|
4346 // Always use camelCase key (gh-2257) |
|
4347 if ( typeof data === "string" ) { |
|
4348 cache[ camelCase( data ) ] = value; |
|
4349 |
|
4350 // Handle: [ owner, { properties } ] args |
|
4351 } else { |
|
4352 |
|
4353 // Copy the properties one-by-one to the cache object |
|
4354 for ( prop in data ) { |
|
4355 cache[ camelCase( prop ) ] = data[ prop ]; |
|
4356 } |
|
4357 } |
|
4358 return cache; |
|
4359 }, |
|
4360 get: function( owner, key ) { |
|
4361 return key === undefined ? |
|
4362 this.cache( owner ) : |
|
4363 |
|
4364 // Always use camelCase key (gh-2257) |
|
4365 owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; |
|
4366 }, |
|
4367 access: function( owner, key, value ) { |
|
4368 |
|
4369 // In cases where either: |
|
4370 // |
|
4371 // 1. No key was specified |
|
4372 // 2. A string key was specified, but no value provided |
|
4373 // |
|
4374 // Take the "read" path and allow the get method to determine |
|
4375 // which value to return, respectively either: |
|
4376 // |
|
4377 // 1. The entire cache object |
|
4378 // 2. The data stored at the key |
|
4379 // |
|
4380 if ( key === undefined || |
|
4381 ( ( key && typeof key === "string" ) && value === undefined ) ) { |
|
4382 |
|
4383 return this.get( owner, key ); |
|
4384 } |
|
4385 |
|
4386 // When the key is not a string, or both a key and value |
|
4387 // are specified, set or extend (existing objects) with either: |
|
4388 // |
|
4389 // 1. An object of properties |
|
4390 // 2. A key and value |
|
4391 // |
|
4392 this.set( owner, key, value ); |
|
4393 |
|
4394 // Since the "set" path can have two possible entry points |
|
4395 // return the expected data based on which path was taken[*] |
|
4396 return value !== undefined ? value : key; |
|
4397 }, |
|
4398 remove: function( owner, key ) { |
|
4399 var i, |
|
4400 cache = owner[ this.expando ]; |
|
4401 |
|
4402 if ( cache === undefined ) { |
|
4403 return; |
|
4404 } |
|
4405 |
|
4406 if ( key !== undefined ) { |
|
4407 |
|
4408 // Support array or space separated string of keys |
|
4409 if ( Array.isArray( key ) ) { |
|
4410 |
|
4411 // If key is an array of keys... |
|
4412 // We always set camelCase keys, so remove that. |
|
4413 key = key.map( camelCase ); |
|
4414 } else { |
|
4415 key = camelCase( key ); |
|
4416 |
|
4417 // If a key with the spaces exists, use it. |
|
4418 // Otherwise, create an array by matching non-whitespace |
|
4419 key = key in cache ? |
|
4420 [ key ] : |
|
4421 ( key.match( rnothtmlwhite ) || [] ); |
|
4422 } |
|
4423 |
|
4424 i = key.length; |
|
4425 |
|
4426 while ( i-- ) { |
|
4427 delete cache[ key[ i ] ]; |
|
4428 } |
|
4429 } |
|
4430 |
|
4431 // Remove the expando if there's no more data |
|
4432 if ( key === undefined || jQuery.isEmptyObject( cache ) ) { |
|
4433 |
|
4434 // Support: Chrome <=35 - 45 |
|
4435 // Webkit & Blink performance suffers when deleting properties |
|
4436 // from DOM nodes, so set to undefined instead |
|
4437 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) |
|
4438 if ( owner.nodeType ) { |
|
4439 owner[ this.expando ] = undefined; |
|
4440 } else { |
|
4441 delete owner[ this.expando ]; |
|
4442 } |
|
4443 } |
|
4444 }, |
|
4445 hasData: function( owner ) { |
|
4446 var cache = owner[ this.expando ]; |
|
4447 return cache !== undefined && !jQuery.isEmptyObject( cache ); |
|
4448 } |
|
4449 }; |
|
4450 var dataPriv = new Data(); |
|
4451 |
|
4452 var dataUser = new Data(); |
|
4453 |
|
4454 |
|
4455 |
|
4456 // Implementation Summary |
|
4457 // |
|
4458 // 1. Enforce API surface and semantic compatibility with 1.9.x branch |
|
4459 // 2. Improve the module's maintainability by reducing the storage |
|
4460 // paths to a single mechanism. |
|
4461 // 3. Use the same single mechanism to support "private" and "user" data. |
|
4462 // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) |
|
4463 // 5. Avoid exposing implementation details on user objects (eg. expando properties) |
|
4464 // 6. Provide a clear path for implementation upgrade to WeakMap in 2014 |
|
4465 |
|
4466 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, |
|
4467 rmultiDash = /[A-Z]/g; |
|
4468 |
|
4469 function getData( data ) { |
|
4470 if ( data === "true" ) { |
|
4471 return true; |
|
4472 } |
|
4473 |
|
4474 if ( data === "false" ) { |
|
4475 return false; |
|
4476 } |
|
4477 |
|
4478 if ( data === "null" ) { |
|
4479 return null; |
|
4480 } |
|
4481 |
|
4482 // Only convert to a number if it doesn't change the string |
|
4483 if ( data === +data + "" ) { |
|
4484 return +data; |
|
4485 } |
|
4486 |
|
4487 if ( rbrace.test( data ) ) { |
|
4488 return JSON.parse( data ); |
|
4489 } |
|
4490 |
|
4491 return data; |
|
4492 } |
|
4493 |
|
4494 function dataAttr( elem, key, data ) { |
|
4495 var name; |
|
4496 |
|
4497 // If nothing was found internally, try to fetch any |
|
4498 // data from the HTML5 data-* attribute |
|
4499 if ( data === undefined && elem.nodeType === 1 ) { |
|
4500 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); |
|
4501 data = elem.getAttribute( name ); |
|
4502 |
|
4503 if ( typeof data === "string" ) { |
|
4504 try { |
|
4505 data = getData( data ); |
|
4506 } catch ( e ) {} |
|
4507 |
|
4508 // Make sure we set the data so it isn't changed later |
|
4509 dataUser.set( elem, key, data ); |
|
4510 } else { |
|
4511 data = undefined; |
|
4512 } |
|
4513 } |
|
4514 return data; |
|
4515 } |
|
4516 |
|
4517 jQuery.extend( { |
|
4518 hasData: function( elem ) { |
|
4519 return dataUser.hasData( elem ) || dataPriv.hasData( elem ); |
|
4520 }, |
|
4521 |
|
4522 data: function( elem, name, data ) { |
|
4523 return dataUser.access( elem, name, data ); |
|
4524 }, |
|
4525 |
|
4526 removeData: function( elem, name ) { |
|
4527 dataUser.remove( elem, name ); |
|
4528 }, |
|
4529 |
|
4530 // TODO: Now that all calls to _data and _removeData have been replaced |
|
4531 // with direct calls to dataPriv methods, these can be deprecated. |
|
4532 _data: function( elem, name, data ) { |
|
4533 return dataPriv.access( elem, name, data ); |
|
4534 }, |
|
4535 |
|
4536 _removeData: function( elem, name ) { |
|
4537 dataPriv.remove( elem, name ); |
|
4538 } |
|
4539 } ); |
|
4540 |
|
4541 jQuery.fn.extend( { |
|
4542 data: function( key, value ) { |
|
4543 var i, name, data, |
|
4544 elem = this[ 0 ], |
|
4545 attrs = elem && elem.attributes; |
|
4546 |
|
4547 // Gets all values |
|
4548 if ( key === undefined ) { |
|
4549 if ( this.length ) { |
|
4550 data = dataUser.get( elem ); |
|
4551 |
|
4552 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { |
|
4553 i = attrs.length; |
|
4554 while ( i-- ) { |
|
4555 |
|
4556 // Support: IE 11 only |
|
4557 // The attrs elements can be null (trac-14894) |
|
4558 if ( attrs[ i ] ) { |
|
4559 name = attrs[ i ].name; |
|
4560 if ( name.indexOf( "data-" ) === 0 ) { |
|
4561 name = camelCase( name.slice( 5 ) ); |
|
4562 dataAttr( elem, name, data[ name ] ); |
|
4563 } |
|
4564 } |
|
4565 } |
|
4566 dataPriv.set( elem, "hasDataAttrs", true ); |
|
4567 } |
|
4568 } |
|
4569 |
|
4570 return data; |
|
4571 } |
|
4572 |
|
4573 // Sets multiple values |
|
4574 if ( typeof key === "object" ) { |
|
4575 return this.each( function() { |
|
4576 dataUser.set( this, key ); |
|
4577 } ); |
|
4578 } |
|
4579 |
|
4580 return access( this, function( value ) { |
|
4581 var data; |
|
4582 |
|
4583 // The calling jQuery object (element matches) is not empty |
|
4584 // (and therefore has an element appears at this[ 0 ]) and the |
|
4585 // `value` parameter was not undefined. An empty jQuery object |
|
4586 // will result in `undefined` for elem = this[ 0 ] which will |
|
4587 // throw an exception if an attempt to read a data cache is made. |
|
4588 if ( elem && value === undefined ) { |
|
4589 |
|
4590 // Attempt to get data from the cache |
|
4591 // The key will always be camelCased in Data |
|
4592 data = dataUser.get( elem, key ); |
|
4593 if ( data !== undefined ) { |
|
4594 return data; |
|
4595 } |
|
4596 |
|
4597 // Attempt to "discover" the data in |
|
4598 // HTML5 custom data-* attrs |
|
4599 data = dataAttr( elem, key ); |
|
4600 if ( data !== undefined ) { |
|
4601 return data; |
|
4602 } |
|
4603 |
|
4604 // We tried really hard, but the data doesn't exist. |
|
4605 return; |
|
4606 } |
|
4607 |
|
4608 // Set the data... |
|
4609 this.each( function() { |
|
4610 |
|
4611 // We always store the camelCased key |
|
4612 dataUser.set( this, key, value ); |
|
4613 } ); |
|
4614 }, null, value, arguments.length > 1, null, true ); |
|
4615 }, |
|
4616 |
|
4617 removeData: function( key ) { |
|
4618 return this.each( function() { |
|
4619 dataUser.remove( this, key ); |
|
4620 } ); |
|
4621 } |
|
4622 } ); |
|
4623 |
|
4624 |
|
4625 jQuery.extend( { |
|
4626 queue: function( elem, type, data ) { |
|
4627 var queue; |
|
4628 |
|
4629 if ( elem ) { |
|
4630 type = ( type || "fx" ) + "queue"; |
|
4631 queue = dataPriv.get( elem, type ); |
|
4632 |
|
4633 // Speed up dequeue by getting out quickly if this is just a lookup |
|
4634 if ( data ) { |
|
4635 if ( !queue || Array.isArray( data ) ) { |
|
4636 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); |
|
4637 } else { |
|
4638 queue.push( data ); |
|
4639 } |
|
4640 } |
|
4641 return queue || []; |
|
4642 } |
|
4643 }, |
|
4644 |
|
4645 dequeue: function( elem, type ) { |
|
4646 type = type || "fx"; |
|
4647 |
|
4648 var queue = jQuery.queue( elem, type ), |
|
4649 startLength = queue.length, |
|
4650 fn = queue.shift(), |
|
4651 hooks = jQuery._queueHooks( elem, type ), |
|
4652 next = function() { |
|
4653 jQuery.dequeue( elem, type ); |
|
4654 }; |
|
4655 |
|
4656 // If the fx queue is dequeued, always remove the progress sentinel |
|
4657 if ( fn === "inprogress" ) { |
|
4658 fn = queue.shift(); |
|
4659 startLength--; |
|
4660 } |
|
4661 |
|
4662 if ( fn ) { |
|
4663 |
|
4664 // Add a progress sentinel to prevent the fx queue from being |
|
4665 // automatically dequeued |
|
4666 if ( type === "fx" ) { |
|
4667 queue.unshift( "inprogress" ); |
|
4668 } |
|
4669 |
|
4670 // Clear up the last queue stop function |
|
4671 delete hooks.stop; |
|
4672 fn.call( elem, next, hooks ); |
|
4673 } |
|
4674 |
|
4675 if ( !startLength && hooks ) { |
|
4676 hooks.empty.fire(); |
|
4677 } |
|
4678 }, |
|
4679 |
|
4680 // Not public - generate a queueHooks object, or return the current one |
|
4681 _queueHooks: function( elem, type ) { |
|
4682 var key = type + "queueHooks"; |
|
4683 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { |
|
4684 empty: jQuery.Callbacks( "once memory" ).add( function() { |
|
4685 dataPriv.remove( elem, [ type + "queue", key ] ); |
|
4686 } ) |
|
4687 } ); |
|
4688 } |
|
4689 } ); |
|
4690 |
|
4691 jQuery.fn.extend( { |
|
4692 queue: function( type, data ) { |
|
4693 var setter = 2; |
|
4694 |
|
4695 if ( typeof type !== "string" ) { |
|
4696 data = type; |
|
4697 type = "fx"; |
|
4698 setter--; |
|
4699 } |
|
4700 |
|
4701 if ( arguments.length < setter ) { |
|
4702 return jQuery.queue( this[ 0 ], type ); |
|
4703 } |
|
4704 |
|
4705 return data === undefined ? |
|
4706 this : |
|
4707 this.each( function() { |
|
4708 var queue = jQuery.queue( this, type, data ); |
|
4709 |
|
4710 // Ensure a hooks for this queue |
|
4711 jQuery._queueHooks( this, type ); |
|
4712 |
|
4713 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { |
|
4714 jQuery.dequeue( this, type ); |
|
4715 } |
|
4716 } ); |
|
4717 }, |
|
4718 dequeue: function( type ) { |
|
4719 return this.each( function() { |
|
4720 jQuery.dequeue( this, type ); |
|
4721 } ); |
|
4722 }, |
|
4723 clearQueue: function( type ) { |
|
4724 return this.queue( type || "fx", [] ); |
|
4725 }, |
|
4726 |
|
4727 // Get a promise resolved when queues of a certain type |
|
4728 // are emptied (fx is the type by default) |
|
4729 promise: function( type, obj ) { |
|
4730 var tmp, |
|
4731 count = 1, |
|
4732 defer = jQuery.Deferred(), |
|
4733 elements = this, |
|
4734 i = this.length, |
|
4735 resolve = function() { |
|
4736 if ( !( --count ) ) { |
|
4737 defer.resolveWith( elements, [ elements ] ); |
|
4738 } |
|
4739 }; |
|
4740 |
|
4741 if ( typeof type !== "string" ) { |
|
4742 obj = type; |
|
4743 type = undefined; |
|
4744 } |
|
4745 type = type || "fx"; |
|
4746 |
|
4747 while ( i-- ) { |
|
4748 tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); |
|
4749 if ( tmp && tmp.empty ) { |
|
4750 count++; |
|
4751 tmp.empty.add( resolve ); |
|
4752 } |
|
4753 } |
|
4754 resolve(); |
|
4755 return defer.promise( obj ); |
|
4756 } |
|
4757 } ); |
|
4758 var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; |
|
4759 |
|
4760 var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); |
|
4761 |
|
4762 |
|
4763 var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; |
|
4764 |
|
4765 var documentElement = document.documentElement; |
|
4766 |
|
4767 |
|
4768 |
|
4769 var isAttached = function( elem ) { |
|
4770 return jQuery.contains( elem.ownerDocument, elem ); |
|
4771 }, |
|
4772 composed = { composed: true }; |
|
4773 |
|
4774 // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only |
|
4775 // Check attachment across shadow DOM boundaries when possible (gh-3504) |
|
4776 // Support: iOS 10.0-10.2 only |
|
4777 // Early iOS 10 versions support `attachShadow` but not `getRootNode`, |
|
4778 // leading to errors. We need to check for `getRootNode`. |
|
4779 if ( documentElement.getRootNode ) { |
|
4780 isAttached = function( elem ) { |
|
4781 return jQuery.contains( elem.ownerDocument, elem ) || |
|
4782 elem.getRootNode( composed ) === elem.ownerDocument; |
|
4783 }; |
|
4784 } |
|
4785 var isHiddenWithinTree = function( elem, el ) { |
|
4786 |
|
4787 // isHiddenWithinTree might be called from jQuery#filter function; |
|
4788 // in that case, element will be second argument |
|
4789 elem = el || elem; |
|
4790 |
|
4791 // Inline style trumps all |
|
4792 return elem.style.display === "none" || |
|
4793 elem.style.display === "" && |
|
4794 |
|
4795 // Otherwise, check computed style |
|
4796 // Support: Firefox <=43 - 45 |
|
4797 // Disconnected elements can have computed display: none, so first confirm that elem is |
|
4798 // in the document. |
|
4799 isAttached( elem ) && |
|
4800 |
|
4801 jQuery.css( elem, "display" ) === "none"; |
|
4802 }; |
|
4803 |
|
4804 |
|
4805 |
|
4806 function adjustCSS( elem, prop, valueParts, tween ) { |
|
4807 var adjusted, scale, |
|
4808 maxIterations = 20, |
|
4809 currentValue = tween ? |
|
4810 function() { |
|
4811 return tween.cur(); |
|
4812 } : |
|
4813 function() { |
|
4814 return jQuery.css( elem, prop, "" ); |
|
4815 }, |
|
4816 initial = currentValue(), |
|
4817 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), |
|
4818 |
|
4819 // Starting value computation is required for potential unit mismatches |
|
4820 initialInUnit = elem.nodeType && |
|
4821 ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && |
|
4822 rcssNum.exec( jQuery.css( elem, prop ) ); |
|
4823 |
|
4824 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { |
|
4825 |
|
4826 // Support: Firefox <=54 |
|
4827 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) |
|
4828 initial = initial / 2; |
|
4829 |
|
4830 // Trust units reported by jQuery.css |
|
4831 unit = unit || initialInUnit[ 3 ]; |
|
4832 |
|
4833 // Iteratively approximate from a nonzero starting point |
|
4834 initialInUnit = +initial || 1; |
|
4835 |
|
4836 while ( maxIterations-- ) { |
|
4837 |
|
4838 // Evaluate and update our best guess (doubling guesses that zero out). |
|
4839 // Finish if the scale equals or crosses 1 (making the old*new product non-positive). |
|
4840 jQuery.style( elem, prop, initialInUnit + unit ); |
|
4841 if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { |
|
4842 maxIterations = 0; |
|
4843 } |
|
4844 initialInUnit = initialInUnit / scale; |
|
4845 |
|
4846 } |
|
4847 |
|
4848 initialInUnit = initialInUnit * 2; |
|
4849 jQuery.style( elem, prop, initialInUnit + unit ); |
|
4850 |
|
4851 // Make sure we update the tween properties later on |
|
4852 valueParts = valueParts || []; |
|
4853 } |
|
4854 |
|
4855 if ( valueParts ) { |
|
4856 initialInUnit = +initialInUnit || +initial || 0; |
|
4857 |
|
4858 // Apply relative offset (+=/-=) if specified |
|
4859 adjusted = valueParts[ 1 ] ? |
|
4860 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : |
|
4861 +valueParts[ 2 ]; |
|
4862 if ( tween ) { |
|
4863 tween.unit = unit; |
|
4864 tween.start = initialInUnit; |
|
4865 tween.end = adjusted; |
|
4866 } |
|
4867 } |
|
4868 return adjusted; |
|
4869 } |
|
4870 |
|
4871 |
|
4872 var defaultDisplayMap = {}; |
|
4873 |
|
4874 function getDefaultDisplay( elem ) { |
|
4875 var temp, |
|
4876 doc = elem.ownerDocument, |
|
4877 nodeName = elem.nodeName, |
|
4878 display = defaultDisplayMap[ nodeName ]; |
|
4879 |
|
4880 if ( display ) { |
|
4881 return display; |
|
4882 } |
|
4883 |
|
4884 temp = doc.body.appendChild( doc.createElement( nodeName ) ); |
|
4885 display = jQuery.css( temp, "display" ); |
|
4886 |
|
4887 temp.parentNode.removeChild( temp ); |
|
4888 |
|
4889 if ( display === "none" ) { |
|
4890 display = "block"; |
|
4891 } |
|
4892 defaultDisplayMap[ nodeName ] = display; |
|
4893 |
|
4894 return display; |
|
4895 } |
|
4896 |
|
4897 function showHide( elements, show ) { |
|
4898 var display, elem, |
|
4899 values = [], |
|
4900 index = 0, |
|
4901 length = elements.length; |
|
4902 |
|
4903 // Determine new display value for elements that need to change |
|
4904 for ( ; index < length; index++ ) { |
|
4905 elem = elements[ index ]; |
|
4906 if ( !elem.style ) { |
|
4907 continue; |
|
4908 } |
|
4909 |
|
4910 display = elem.style.display; |
|
4911 if ( show ) { |
|
4912 |
|
4913 // Since we force visibility upon cascade-hidden elements, an immediate (and slow) |
|
4914 // check is required in this first loop unless we have a nonempty display value (either |
|
4915 // inline or about-to-be-restored) |
|
4916 if ( display === "none" ) { |
|
4917 values[ index ] = dataPriv.get( elem, "display" ) || null; |
|
4918 if ( !values[ index ] ) { |
|
4919 elem.style.display = ""; |
|
4920 } |
|
4921 } |
|
4922 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { |
|
4923 values[ index ] = getDefaultDisplay( elem ); |
|
4924 } |
|
4925 } else { |
|
4926 if ( display !== "none" ) { |
|
4927 values[ index ] = "none"; |
|
4928 |
|
4929 // Remember what we're overwriting |
|
4930 dataPriv.set( elem, "display", display ); |
|
4931 } |
|
4932 } |
|
4933 } |
|
4934 |
|
4935 // Set the display of the elements in a second loop to avoid constant reflow |
|
4936 for ( index = 0; index < length; index++ ) { |
|
4937 if ( values[ index ] != null ) { |
|
4938 elements[ index ].style.display = values[ index ]; |
|
4939 } |
|
4940 } |
|
4941 |
|
4942 return elements; |
|
4943 } |
|
4944 |
|
4945 jQuery.fn.extend( { |
|
4946 show: function() { |
|
4947 return showHide( this, true ); |
|
4948 }, |
|
4949 hide: function() { |
|
4950 return showHide( this ); |
|
4951 }, |
|
4952 toggle: function( state ) { |
|
4953 if ( typeof state === "boolean" ) { |
|
4954 return state ? this.show() : this.hide(); |
|
4955 } |
|
4956 |
|
4957 return this.each( function() { |
|
4958 if ( isHiddenWithinTree( this ) ) { |
|
4959 jQuery( this ).show(); |
|
4960 } else { |
|
4961 jQuery( this ).hide(); |
|
4962 } |
|
4963 } ); |
|
4964 } |
|
4965 } ); |
|
4966 var rcheckableType = ( /^(?:checkbox|radio)$/i ); |
|
4967 |
|
4968 var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); |
|
4969 |
|
4970 var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); |
|
4971 |
|
4972 |
|
4973 |
|
4974 ( function() { |
|
4975 var fragment = document.createDocumentFragment(), |
|
4976 div = fragment.appendChild( document.createElement( "div" ) ), |
|
4977 input = document.createElement( "input" ); |
|
4978 |
|
4979 // Support: Android 4.0 - 4.3 only |
|
4980 // Check state lost if the name is set (trac-11217) |
|
4981 // Support: Windows Web Apps (WWA) |
|
4982 // `name` and `type` must use .setAttribute for WWA (trac-14901) |
|
4983 input.setAttribute( "type", "radio" ); |
|
4984 input.setAttribute( "checked", "checked" ); |
|
4985 input.setAttribute( "name", "t" ); |
|
4986 |
|
4987 div.appendChild( input ); |
|
4988 |
|
4989 // Support: Android <=4.1 only |
|
4990 // Older WebKit doesn't clone checked state correctly in fragments |
|
4991 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; |
|
4992 |
|
4993 // Support: IE <=11 only |
|
4994 // Make sure textarea (and checkbox) defaultValue is properly cloned |
|
4995 div.innerHTML = "<textarea>x</textarea>"; |
|
4996 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; |
|
4997 |
|
4998 // Support: IE <=9 only |
|
4999 // IE <=9 replaces <option> tags with their contents when inserted outside of |
|
5000 // the select element. |
|
5001 div.innerHTML = "<option></option>"; |
|
5002 support.option = !!div.lastChild; |
|
5003 } )(); |
|
5004 |
|
5005 |
|
5006 // We have to close these tags to support XHTML (trac-13200) |
|
5007 var wrapMap = { |
|
5008 |
|
5009 // XHTML parsers do not magically insert elements in the |
|
5010 // same way that tag soup parsers do. So we cannot shorten |
|
5011 // this by omitting <tbody> or other required elements. |
|
5012 thead: [ 1, "<table>", "</table>" ], |
|
5013 col: [ 2, "<table><colgroup>", "</colgroup></table>" ], |
|
5014 tr: [ 2, "<table><tbody>", "</tbody></table>" ], |
|
5015 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], |
|
5016 |
|
5017 _default: [ 0, "", "" ] |
|
5018 }; |
|
5019 |
|
5020 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; |
|
5021 wrapMap.th = wrapMap.td; |
|
5022 |
|
5023 // Support: IE <=9 only |
|
5024 if ( !support.option ) { |
|
5025 wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ]; |
|
5026 } |
|
5027 |
|
5028 |
|
5029 function getAll( context, tag ) { |
|
5030 |
|
5031 // Support: IE <=9 - 11 only |
|
5032 // Use typeof to avoid zero-argument method invocation on host objects (trac-15151) |
|
5033 var ret; |
|
5034 |
|
5035 if ( typeof context.getElementsByTagName !== "undefined" ) { |
|
5036 ret = context.getElementsByTagName( tag || "*" ); |
|
5037 |
|
5038 } else if ( typeof context.querySelectorAll !== "undefined" ) { |
|
5039 ret = context.querySelectorAll( tag || "*" ); |
|
5040 |
|
5041 } else { |
|
5042 ret = []; |
|
5043 } |
|
5044 |
|
5045 if ( tag === undefined || tag && nodeName( context, tag ) ) { |
|
5046 return jQuery.merge( [ context ], ret ); |
|
5047 } |
|
5048 |
|
5049 return ret; |
|
5050 } |
|
5051 |
|
5052 |
|
5053 // Mark scripts as having already been evaluated |
|
5054 function setGlobalEval( elems, refElements ) { |
|
5055 var i = 0, |
|
5056 l = elems.length; |
|
5057 |
|
5058 for ( ; i < l; i++ ) { |
|
5059 dataPriv.set( |
|
5060 elems[ i ], |
|
5061 "globalEval", |
|
5062 !refElements || dataPriv.get( refElements[ i ], "globalEval" ) |
|
5063 ); |
|
5064 } |
|
5065 } |
|
5066 |
|
5067 |
|
5068 var rhtml = /<|&#?\w+;/; |
|
5069 |
|
5070 function buildFragment( elems, context, scripts, selection, ignored ) { |
|
5071 var elem, tmp, tag, wrap, attached, j, |
|
5072 fragment = context.createDocumentFragment(), |
|
5073 nodes = [], |
|
5074 i = 0, |
|
5075 l = elems.length; |
|
5076 |
|
5077 for ( ; i < l; i++ ) { |
|
5078 elem = elems[ i ]; |
|
5079 |
|
5080 if ( elem || elem === 0 ) { |
|
5081 |
|
5082 // Add nodes directly |
|
5083 if ( toType( elem ) === "object" ) { |
|
5084 |
|
5085 // Support: Android <=4.0 only, PhantomJS 1 only |
|
5086 // push.apply(_, arraylike) throws on ancient WebKit |
|
5087 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); |
|
5088 |
|
5089 // Convert non-html into a text node |
|
5090 } else if ( !rhtml.test( elem ) ) { |
|
5091 nodes.push( context.createTextNode( elem ) ); |
|
5092 |
|
5093 // Convert html into DOM nodes |
|
5094 } else { |
|
5095 tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); |
|
5096 |
|
5097 // Deserialize a standard representation |
|
5098 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); |
|
5099 wrap = wrapMap[ tag ] || wrapMap._default; |
|
5100 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; |
|
5101 |
|
5102 // Descend through wrappers to the right content |
|
5103 j = wrap[ 0 ]; |
|
5104 while ( j-- ) { |
|
5105 tmp = tmp.lastChild; |
|
5106 } |
|
5107 |
|
5108 // Support: Android <=4.0 only, PhantomJS 1 only |
|
5109 // push.apply(_, arraylike) throws on ancient WebKit |
|
5110 jQuery.merge( nodes, tmp.childNodes ); |
|
5111 |
|
5112 // Remember the top-level container |
|
5113 tmp = fragment.firstChild; |
|
5114 |
|
5115 // Ensure the created nodes are orphaned (trac-12392) |
|
5116 tmp.textContent = ""; |
|
5117 } |
|
5118 } |
|
5119 } |
|
5120 |
|
5121 // Remove wrapper from fragment |
|
5122 fragment.textContent = ""; |
|
5123 |
|
5124 i = 0; |
|
5125 while ( ( elem = nodes[ i++ ] ) ) { |
|
5126 |
|
5127 // Skip elements already in the context collection (trac-4087) |
|
5128 if ( selection && jQuery.inArray( elem, selection ) > -1 ) { |
|
5129 if ( ignored ) { |
|
5130 ignored.push( elem ); |
|
5131 } |
|
5132 continue; |
|
5133 } |
|
5134 |
|
5135 attached = isAttached( elem ); |
|
5136 |
|
5137 // Append to fragment |
|
5138 tmp = getAll( fragment.appendChild( elem ), "script" ); |
|
5139 |
|
5140 // Preserve script evaluation history |
|
5141 if ( attached ) { |
|
5142 setGlobalEval( tmp ); |
|
5143 } |
|
5144 |
|
5145 // Capture executables |
|
5146 if ( scripts ) { |
|
5147 j = 0; |
|
5148 while ( ( elem = tmp[ j++ ] ) ) { |
|
5149 if ( rscriptType.test( elem.type || "" ) ) { |
|
5150 scripts.push( elem ); |
|
5151 } |
|
5152 } |
|
5153 } |
|
5154 } |
|
5155 |
|
5156 return fragment; |
|
5157 } |
|
5158 |
|
5159 |
|
5160 var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; |
|
5161 |
|
5162 function returnTrue() { |
|
5163 return true; |
|
5164 } |
|
5165 |
|
5166 function returnFalse() { |
|
5167 return false; |
|
5168 } |
|
5169 |
|
5170 // Support: IE <=9 - 11+ |
|
5171 // focus() and blur() are asynchronous, except when they are no-op. |
|
5172 // So expect focus to be synchronous when the element is already active, |
|
5173 // and blur to be synchronous when the element is not already active. |
|
5174 // (focus and blur are always synchronous in other supported browsers, |
|
5175 // this just defines when we can count on it). |
|
5176 function expectSync( elem, type ) { |
|
5177 return ( elem === safeActiveElement() ) === ( type === "focus" ); |
|
5178 } |
|
5179 |
|
5180 // Support: IE <=9 only |
|
5181 // Accessing document.activeElement can throw unexpectedly |
|
5182 // https://bugs.jquery.com/ticket/13393 |
|
5183 function safeActiveElement() { |
|
5184 try { |
|
5185 return document.activeElement; |
|
5186 } catch ( err ) { } |
|
5187 } |
|
5188 |
|
5189 function on( elem, types, selector, data, fn, one ) { |
|
5190 var origFn, type; |
|
5191 |
|
5192 // Types can be a map of types/handlers |
|
5193 if ( typeof types === "object" ) { |
|
5194 |
|
5195 // ( types-Object, selector, data ) |
|
5196 if ( typeof selector !== "string" ) { |
|
5197 |
|
5198 // ( types-Object, data ) |
|
5199 data = data || selector; |
|
5200 selector = undefined; |
|
5201 } |
|
5202 for ( type in types ) { |
|
5203 on( elem, type, selector, data, types[ type ], one ); |
|
5204 } |
|
5205 return elem; |
|
5206 } |
|
5207 |
|
5208 if ( data == null && fn == null ) { |
|
5209 |
|
5210 // ( types, fn ) |
|
5211 fn = selector; |
|
5212 data = selector = undefined; |
|
5213 } else if ( fn == null ) { |
|
5214 if ( typeof selector === "string" ) { |
|
5215 |
|
5216 // ( types, selector, fn ) |
|
5217 fn = data; |
|
5218 data = undefined; |
|
5219 } else { |
|
5220 |
|
5221 // ( types, data, fn ) |
|
5222 fn = data; |
|
5223 data = selector; |
|
5224 selector = undefined; |
|
5225 } |
|
5226 } |
|
5227 if ( fn === false ) { |
|
5228 fn = returnFalse; |
|
5229 } else if ( !fn ) { |
|
5230 return elem; |
|
5231 } |
|
5232 |
|
5233 if ( one === 1 ) { |
|
5234 origFn = fn; |
|
5235 fn = function( event ) { |
|
5236 |
|
5237 // Can use an empty set, since event contains the info |
|
5238 jQuery().off( event ); |
|
5239 return origFn.apply( this, arguments ); |
|
5240 }; |
|
5241 |
|
5242 // Use same guid so caller can remove using origFn |
|
5243 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); |
|
5244 } |
|
5245 return elem.each( function() { |
|
5246 jQuery.event.add( this, types, fn, data, selector ); |
|
5247 } ); |
|
5248 } |
|
5249 |
|
5250 /* |
|
5251 * Helper functions for managing events -- not part of the public interface. |
|
5252 * Props to Dean Edwards' addEvent library for many of the ideas. |
|
5253 */ |
|
5254 jQuery.event = { |
|
5255 |
|
5256 global: {}, |
|
5257 |
|
5258 add: function( elem, types, handler, data, selector ) { |
|
5259 |
|
5260 var handleObjIn, eventHandle, tmp, |
|
5261 events, t, handleObj, |
|
5262 special, handlers, type, namespaces, origType, |
|
5263 elemData = dataPriv.get( elem ); |
|
5264 |
|
5265 // Only attach events to objects that accept data |
|
5266 if ( !acceptData( elem ) ) { |
|
5267 return; |
|
5268 } |
|
5269 |
|
5270 // Caller can pass in an object of custom data in lieu of the handler |
|
5271 if ( handler.handler ) { |
|
5272 handleObjIn = handler; |
|
5273 handler = handleObjIn.handler; |
|
5274 selector = handleObjIn.selector; |
|
5275 } |
|
5276 |
|
5277 // Ensure that invalid selectors throw exceptions at attach time |
|
5278 // Evaluate against documentElement in case elem is a non-element node (e.g., document) |
|
5279 if ( selector ) { |
|
5280 jQuery.find.matchesSelector( documentElement, selector ); |
|
5281 } |
|
5282 |
|
5283 // Make sure that the handler has a unique ID, used to find/remove it later |
|
5284 if ( !handler.guid ) { |
|
5285 handler.guid = jQuery.guid++; |
|
5286 } |
|
5287 |
|
5288 // Init the element's event structure and main handler, if this is the first |
|
5289 if ( !( events = elemData.events ) ) { |
|
5290 events = elemData.events = Object.create( null ); |
|
5291 } |
|
5292 if ( !( eventHandle = elemData.handle ) ) { |
|
5293 eventHandle = elemData.handle = function( e ) { |
|
5294 |
|
5295 // Discard the second event of a jQuery.event.trigger() and |
|
5296 // when an event is called after a page has unloaded |
|
5297 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? |
|
5298 jQuery.event.dispatch.apply( elem, arguments ) : undefined; |
|
5299 }; |
|
5300 } |
|
5301 |
|
5302 // Handle multiple events separated by a space |
|
5303 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; |
|
5304 t = types.length; |
|
5305 while ( t-- ) { |
|
5306 tmp = rtypenamespace.exec( types[ t ] ) || []; |
|
5307 type = origType = tmp[ 1 ]; |
|
5308 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); |
|
5309 |
|
5310 // There *must* be a type, no attaching namespace-only handlers |
|
5311 if ( !type ) { |
|
5312 continue; |
|
5313 } |
|
5314 |
|
5315 // If event changes its type, use the special event handlers for the changed type |
|
5316 special = jQuery.event.special[ type ] || {}; |
|
5317 |
|
5318 // If selector defined, determine special event api type, otherwise given type |
|
5319 type = ( selector ? special.delegateType : special.bindType ) || type; |
|
5320 |
|
5321 // Update special based on newly reset type |
|
5322 special = jQuery.event.special[ type ] || {}; |
|
5323 |
|
5324 // handleObj is passed to all event handlers |
|
5325 handleObj = jQuery.extend( { |
|
5326 type: type, |
|
5327 origType: origType, |
|
5328 data: data, |
|
5329 handler: handler, |
|
5330 guid: handler.guid, |
|
5331 selector: selector, |
|
5332 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), |
|
5333 namespace: namespaces.join( "." ) |
|
5334 }, handleObjIn ); |
|
5335 |
|
5336 // Init the event handler queue if we're the first |
|
5337 if ( !( handlers = events[ type ] ) ) { |
|
5338 handlers = events[ type ] = []; |
|
5339 handlers.delegateCount = 0; |
|
5340 |
|
5341 // Only use addEventListener if the special events handler returns false |
|
5342 if ( !special.setup || |
|
5343 special.setup.call( elem, data, namespaces, eventHandle ) === false ) { |
|
5344 |
|
5345 if ( elem.addEventListener ) { |
|
5346 elem.addEventListener( type, eventHandle ); |
|
5347 } |
|
5348 } |
|
5349 } |
|
5350 |
|
5351 if ( special.add ) { |
|
5352 special.add.call( elem, handleObj ); |
|
5353 |
|
5354 if ( !handleObj.handler.guid ) { |
|
5355 handleObj.handler.guid = handler.guid; |
|
5356 } |
|
5357 } |
|
5358 |
|
5359 // Add to the element's handler list, delegates in front |
|
5360 if ( selector ) { |
|
5361 handlers.splice( handlers.delegateCount++, 0, handleObj ); |
|
5362 } else { |
|
5363 handlers.push( handleObj ); |
|
5364 } |
|
5365 |
|
5366 // Keep track of which events have ever been used, for event optimization |
|
5367 jQuery.event.global[ type ] = true; |
|
5368 } |
|
5369 |
|
5370 }, |
|
5371 |
|
5372 // Detach an event or set of events from an element |
|
5373 remove: function( elem, types, handler, selector, mappedTypes ) { |
|
5374 |
|
5375 var j, origCount, tmp, |
|
5376 events, t, handleObj, |
|
5377 special, handlers, type, namespaces, origType, |
|
5378 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); |
|
5379 |
|
5380 if ( !elemData || !( events = elemData.events ) ) { |
|
5381 return; |
|
5382 } |
|
5383 |
|
5384 // Once for each type.namespace in types; type may be omitted |
|
5385 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; |
|
5386 t = types.length; |
|
5387 while ( t-- ) { |
|
5388 tmp = rtypenamespace.exec( types[ t ] ) || []; |
|
5389 type = origType = tmp[ 1 ]; |
|
5390 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); |
|
5391 |
|
5392 // Unbind all events (on this namespace, if provided) for the element |
|
5393 if ( !type ) { |
|
5394 for ( type in events ) { |
|
5395 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); |
|
5396 } |
|
5397 continue; |
|
5398 } |
|
5399 |
|
5400 special = jQuery.event.special[ type ] || {}; |
|
5401 type = ( selector ? special.delegateType : special.bindType ) || type; |
|
5402 handlers = events[ type ] || []; |
|
5403 tmp = tmp[ 2 ] && |
|
5404 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); |
|
5405 |
|
5406 // Remove matching events |
|
5407 origCount = j = handlers.length; |
|
5408 while ( j-- ) { |
|
5409 handleObj = handlers[ j ]; |
|
5410 |
|
5411 if ( ( mappedTypes || origType === handleObj.origType ) && |
|
5412 ( !handler || handler.guid === handleObj.guid ) && |
|
5413 ( !tmp || tmp.test( handleObj.namespace ) ) && |
|
5414 ( !selector || selector === handleObj.selector || |
|
5415 selector === "**" && handleObj.selector ) ) { |
|
5416 handlers.splice( j, 1 ); |
|
5417 |
|
5418 if ( handleObj.selector ) { |
|
5419 handlers.delegateCount--; |
|
5420 } |
|
5421 if ( special.remove ) { |
|
5422 special.remove.call( elem, handleObj ); |
|
5423 } |
|
5424 } |
|
5425 } |
|
5426 |
|
5427 // Remove generic event handler if we removed something and no more handlers exist |
|
5428 // (avoids potential for endless recursion during removal of special event handlers) |
|
5429 if ( origCount && !handlers.length ) { |
|
5430 if ( !special.teardown || |
|
5431 special.teardown.call( elem, namespaces, elemData.handle ) === false ) { |
|
5432 |
|
5433 jQuery.removeEvent( elem, type, elemData.handle ); |
|
5434 } |
|
5435 |
|
5436 delete events[ type ]; |
|
5437 } |
|
5438 } |
|
5439 |
|
5440 // Remove data and the expando if it's no longer used |
|
5441 if ( jQuery.isEmptyObject( events ) ) { |
|
5442 dataPriv.remove( elem, "handle events" ); |
|
5443 } |
|
5444 }, |
|
5445 |
|
5446 dispatch: function( nativeEvent ) { |
|
5447 |
|
5448 var i, j, ret, matched, handleObj, handlerQueue, |
|
5449 args = new Array( arguments.length ), |
|
5450 |
|
5451 // Make a writable jQuery.Event from the native event object |
|
5452 event = jQuery.event.fix( nativeEvent ), |
|
5453 |
|
5454 handlers = ( |
|
5455 dataPriv.get( this, "events" ) || Object.create( null ) |
|
5456 )[ event.type ] || [], |
|
5457 special = jQuery.event.special[ event.type ] || {}; |
|
5458 |
|
5459 // Use the fix-ed jQuery.Event rather than the (read-only) native event |
|
5460 args[ 0 ] = event; |
|
5461 |
|
5462 for ( i = 1; i < arguments.length; i++ ) { |
|
5463 args[ i ] = arguments[ i ]; |
|
5464 } |
|
5465 |
|
5466 event.delegateTarget = this; |
|
5467 |
|
5468 // Call the preDispatch hook for the mapped type, and let it bail if desired |
|
5469 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { |
|
5470 return; |
|
5471 } |
|
5472 |
|
5473 // Determine handlers |
|
5474 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); |
|
5475 |
|
5476 // Run delegates first; they may want to stop propagation beneath us |
|
5477 i = 0; |
|
5478 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { |
|
5479 event.currentTarget = matched.elem; |
|
5480 |
|
5481 j = 0; |
|
5482 while ( ( handleObj = matched.handlers[ j++ ] ) && |
|
5483 !event.isImmediatePropagationStopped() ) { |
|
5484 |
|
5485 // If the event is namespaced, then each handler is only invoked if it is |
|
5486 // specially universal or its namespaces are a superset of the event's. |
|
5487 if ( !event.rnamespace || handleObj.namespace === false || |
|
5488 event.rnamespace.test( handleObj.namespace ) ) { |
|
5489 |
|
5490 event.handleObj = handleObj; |
|
5491 event.data = handleObj.data; |
|
5492 |
|
5493 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || |
|
5494 handleObj.handler ).apply( matched.elem, args ); |
|
5495 |
|
5496 if ( ret !== undefined ) { |
|
5497 if ( ( event.result = ret ) === false ) { |
|
5498 event.preventDefault(); |
|
5499 event.stopPropagation(); |
|
5500 } |
|
5501 } |
|
5502 } |
|
5503 } |
|
5504 } |
|
5505 |
|
5506 // Call the postDispatch hook for the mapped type |
|
5507 if ( special.postDispatch ) { |
|
5508 special.postDispatch.call( this, event ); |
|
5509 } |
|
5510 |
|
5511 return event.result; |
|
5512 }, |
|
5513 |
|
5514 handlers: function( event, handlers ) { |
|
5515 var i, handleObj, sel, matchedHandlers, matchedSelectors, |
|
5516 handlerQueue = [], |
|
5517 delegateCount = handlers.delegateCount, |
|
5518 cur = event.target; |
|
5519 |
|
5520 // Find delegate handlers |
|
5521 if ( delegateCount && |
|
5522 |
|
5523 // Support: IE <=9 |
|
5524 // Black-hole SVG <use> instance trees (trac-13180) |
|
5525 cur.nodeType && |
|
5526 |
|
5527 // Support: Firefox <=42 |
|
5528 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) |
|
5529 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click |
|
5530 // Support: IE 11 only |
|
5531 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) |
|
5532 !( event.type === "click" && event.button >= 1 ) ) { |
|
5533 |
|
5534 for ( ; cur !== this; cur = cur.parentNode || this ) { |
|
5535 |
|
5536 // Don't check non-elements (trac-13208) |
|
5537 // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764) |
|
5538 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { |
|
5539 matchedHandlers = []; |
|
5540 matchedSelectors = {}; |
|
5541 for ( i = 0; i < delegateCount; i++ ) { |
|
5542 handleObj = handlers[ i ]; |
|
5543 |
|
5544 // Don't conflict with Object.prototype properties (trac-13203) |
|
5545 sel = handleObj.selector + " "; |
|
5546 |
|
5547 if ( matchedSelectors[ sel ] === undefined ) { |
|
5548 matchedSelectors[ sel ] = handleObj.needsContext ? |
|
5549 jQuery( sel, this ).index( cur ) > -1 : |
|
5550 jQuery.find( sel, this, null, [ cur ] ).length; |
|
5551 } |
|
5552 if ( matchedSelectors[ sel ] ) { |
|
5553 matchedHandlers.push( handleObj ); |
|
5554 } |
|
5555 } |
|
5556 if ( matchedHandlers.length ) { |
|
5557 handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); |
|
5558 } |
|
5559 } |
|
5560 } |
|
5561 } |
|
5562 |
|
5563 // Add the remaining (directly-bound) handlers |
|
5564 cur = this; |
|
5565 if ( delegateCount < handlers.length ) { |
|
5566 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); |
|
5567 } |
|
5568 |
|
5569 return handlerQueue; |
|
5570 }, |
|
5571 |
|
5572 addProp: function( name, hook ) { |
|
5573 Object.defineProperty( jQuery.Event.prototype, name, { |
|
5574 enumerable: true, |
|
5575 configurable: true, |
|
5576 |
|
5577 get: isFunction( hook ) ? |
|
5578 function() { |
|
5579 if ( this.originalEvent ) { |
|
5580 return hook( this.originalEvent ); |
|
5581 } |
|
5582 } : |
|
5583 function() { |
|
5584 if ( this.originalEvent ) { |
|
5585 return this.originalEvent[ name ]; |
|
5586 } |
|
5587 }, |
|
5588 |
|
5589 set: function( value ) { |
|
5590 Object.defineProperty( this, name, { |
|
5591 enumerable: true, |
|
5592 configurable: true, |
|
5593 writable: true, |
|
5594 value: value |
|
5595 } ); |
|
5596 } |
|
5597 } ); |
|
5598 }, |
|
5599 |
|
5600 fix: function( originalEvent ) { |
|
5601 return originalEvent[ jQuery.expando ] ? |
|
5602 originalEvent : |
|
5603 new jQuery.Event( originalEvent ); |
|
5604 }, |
|
5605 |
|
5606 special: { |
|
5607 load: { |
|
5608 |
|
5609 // Prevent triggered image.load events from bubbling to window.load |
|
5610 noBubble: true |
|
5611 }, |
|
5612 click: { |
|
5613 |
|
5614 // Utilize native event to ensure correct state for checkable inputs |
|
5615 setup: function( data ) { |
|
5616 |
|
5617 // For mutual compressibility with _default, replace `this` access with a local var. |
|
5618 // `|| data` is dead code meant only to preserve the variable through minification. |
|
5619 var el = this || data; |
|
5620 |
|
5621 // Claim the first handler |
|
5622 if ( rcheckableType.test( el.type ) && |
|
5623 el.click && nodeName( el, "input" ) ) { |
|
5624 |
|
5625 // dataPriv.set( el, "click", ... ) |
|
5626 leverageNative( el, "click", returnTrue ); |
|
5627 } |
|
5628 |
|
5629 // Return false to allow normal processing in the caller |
|
5630 return false; |
|
5631 }, |
|
5632 trigger: function( data ) { |
|
5633 |
|
5634 // For mutual compressibility with _default, replace `this` access with a local var. |
|
5635 // `|| data` is dead code meant only to preserve the variable through minification. |
|
5636 var el = this || data; |
|
5637 |
|
5638 // Force setup before triggering a click |
|
5639 if ( rcheckableType.test( el.type ) && |
|
5640 el.click && nodeName( el, "input" ) ) { |
|
5641 |
|
5642 leverageNative( el, "click" ); |
|
5643 } |
|
5644 |
|
5645 // Return non-false to allow normal event-path propagation |
|
5646 return true; |
|
5647 }, |
|
5648 |
|
5649 // For cross-browser consistency, suppress native .click() on links |
|
5650 // Also prevent it if we're currently inside a leveraged native-event stack |
|
5651 _default: function( event ) { |
|
5652 var target = event.target; |
|
5653 return rcheckableType.test( target.type ) && |
|
5654 target.click && nodeName( target, "input" ) && |
|
5655 dataPriv.get( target, "click" ) || |
|
5656 nodeName( target, "a" ); |
|
5657 } |
|
5658 }, |
|
5659 |
|
5660 beforeunload: { |
|
5661 postDispatch: function( event ) { |
|
5662 |
|
5663 // Support: Firefox 20+ |
|
5664 // Firefox doesn't alert if the returnValue field is not set. |
|
5665 if ( event.result !== undefined && event.originalEvent ) { |
|
5666 event.originalEvent.returnValue = event.result; |
|
5667 } |
|
5668 } |
|
5669 } |
|
5670 } |
|
5671 }; |
|
5672 |
|
5673 // Ensure the presence of an event listener that handles manually-triggered |
|
5674 // synthetic events by interrupting progress until reinvoked in response to |
|
5675 // *native* events that it fires directly, ensuring that state changes have |
|
5676 // already occurred before other listeners are invoked. |
|
5677 function leverageNative( el, type, expectSync ) { |
|
5678 |
|
5679 // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add |
|
5680 if ( !expectSync ) { |
|
5681 if ( dataPriv.get( el, type ) === undefined ) { |
|
5682 jQuery.event.add( el, type, returnTrue ); |
|
5683 } |
|
5684 return; |
|
5685 } |
|
5686 |
|
5687 // Register the controller as a special universal handler for all event namespaces |
|
5688 dataPriv.set( el, type, false ); |
|
5689 jQuery.event.add( el, type, { |
|
5690 namespace: false, |
|
5691 handler: function( event ) { |
|
5692 var notAsync, result, |
|
5693 saved = dataPriv.get( this, type ); |
|
5694 |
|
5695 if ( ( event.isTrigger & 1 ) && this[ type ] ) { |
|
5696 |
|
5697 // Interrupt processing of the outer synthetic .trigger()ed event |
|
5698 // Saved data should be false in such cases, but might be a leftover capture object |
|
5699 // from an async native handler (gh-4350) |
|
5700 if ( !saved.length ) { |
|
5701 |
|
5702 // Store arguments for use when handling the inner native event |
|
5703 // There will always be at least one argument (an event object), so this array |
|
5704 // will not be confused with a leftover capture object. |
|
5705 saved = slice.call( arguments ); |
|
5706 dataPriv.set( this, type, saved ); |
|
5707 |
|
5708 // Trigger the native event and capture its result |
|
5709 // Support: IE <=9 - 11+ |
|
5710 // focus() and blur() are asynchronous |
|
5711 notAsync = expectSync( this, type ); |
|
5712 this[ type ](); |
|
5713 result = dataPriv.get( this, type ); |
|
5714 if ( saved !== result || notAsync ) { |
|
5715 dataPriv.set( this, type, false ); |
|
5716 } else { |
|
5717 result = {}; |
|
5718 } |
|
5719 if ( saved !== result ) { |
|
5720 |
|
5721 // Cancel the outer synthetic event |
|
5722 event.stopImmediatePropagation(); |
|
5723 event.preventDefault(); |
|
5724 |
|
5725 // Support: Chrome 86+ |
|
5726 // In Chrome, if an element having a focusout handler is blurred by |
|
5727 // clicking outside of it, it invokes the handler synchronously. If |
|
5728 // that handler calls `.remove()` on the element, the data is cleared, |
|
5729 // leaving `result` undefined. We need to guard against this. |
|
5730 return result && result.value; |
|
5731 } |
|
5732 |
|
5733 // If this is an inner synthetic event for an event with a bubbling surrogate |
|
5734 // (focus or blur), assume that the surrogate already propagated from triggering the |
|
5735 // native event and prevent that from happening again here. |
|
5736 // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the |
|
5737 // bubbling surrogate propagates *after* the non-bubbling base), but that seems |
|
5738 // less bad than duplication. |
|
5739 } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { |
|
5740 event.stopPropagation(); |
|
5741 } |
|
5742 |
|
5743 // If this is a native event triggered above, everything is now in order |
|
5744 // Fire an inner synthetic event with the original arguments |
|
5745 } else if ( saved.length ) { |
|
5746 |
|
5747 // ...and capture the result |
|
5748 dataPriv.set( this, type, { |
|
5749 value: jQuery.event.trigger( |
|
5750 |
|
5751 // Support: IE <=9 - 11+ |
|
5752 // Extend with the prototype to reset the above stopImmediatePropagation() |
|
5753 jQuery.extend( saved[ 0 ], jQuery.Event.prototype ), |
|
5754 saved.slice( 1 ), |
|
5755 this |
|
5756 ) |
|
5757 } ); |
|
5758 |
|
5759 // Abort handling of the native event |
|
5760 event.stopImmediatePropagation(); |
|
5761 } |
|
5762 } |
|
5763 } ); |
|
5764 } |
|
5765 |
|
5766 jQuery.removeEvent = function( elem, type, handle ) { |
|
5767 |
|
5768 // This "if" is needed for plain objects |
|
5769 if ( elem.removeEventListener ) { |
|
5770 elem.removeEventListener( type, handle ); |
|
5771 } |
|
5772 }; |
|
5773 |
|
5774 jQuery.Event = function( src, props ) { |
|
5775 |
|
5776 // Allow instantiation without the 'new' keyword |
|
5777 if ( !( this instanceof jQuery.Event ) ) { |
|
5778 return new jQuery.Event( src, props ); |
|
5779 } |
|
5780 |
|
5781 // Event object |
|
5782 if ( src && src.type ) { |
|
5783 this.originalEvent = src; |
|
5784 this.type = src.type; |
|
5785 |
|
5786 // Events bubbling up the document may have been marked as prevented |
|
5787 // by a handler lower down the tree; reflect the correct value. |
|
5788 this.isDefaultPrevented = src.defaultPrevented || |
|
5789 src.defaultPrevented === undefined && |
|
5790 |
|
5791 // Support: Android <=2.3 only |
|
5792 src.returnValue === false ? |
|
5793 returnTrue : |
|
5794 returnFalse; |
|
5795 |
|
5796 // Create target properties |
|
5797 // Support: Safari <=6 - 7 only |
|
5798 // Target should not be a text node (trac-504, trac-13143) |
|
5799 this.target = ( src.target && src.target.nodeType === 3 ) ? |
|
5800 src.target.parentNode : |
|
5801 src.target; |
|
5802 |
|
5803 this.currentTarget = src.currentTarget; |
|
5804 this.relatedTarget = src.relatedTarget; |
|
5805 |
|
5806 // Event type |
|
5807 } else { |
|
5808 this.type = src; |
|
5809 } |
|
5810 |
|
5811 // Put explicitly provided properties onto the event object |
|
5812 if ( props ) { |
|
5813 jQuery.extend( this, props ); |
|
5814 } |
|
5815 |
|
5816 // Create a timestamp if incoming event doesn't have one |
|
5817 this.timeStamp = src && src.timeStamp || Date.now(); |
|
5818 |
|
5819 // Mark it as fixed |
|
5820 this[ jQuery.expando ] = true; |
|
5821 }; |
|
5822 |
|
5823 // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding |
|
5824 // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html |
|
5825 jQuery.Event.prototype = { |
|
5826 constructor: jQuery.Event, |
|
5827 isDefaultPrevented: returnFalse, |
|
5828 isPropagationStopped: returnFalse, |
|
5829 isImmediatePropagationStopped: returnFalse, |
|
5830 isSimulated: false, |
|
5831 |
|
5832 preventDefault: function() { |
|
5833 var e = this.originalEvent; |
|
5834 |
|
5835 this.isDefaultPrevented = returnTrue; |
|
5836 |
|
5837 if ( e && !this.isSimulated ) { |
|
5838 e.preventDefault(); |
|
5839 } |
|
5840 }, |
|
5841 stopPropagation: function() { |
|
5842 var e = this.originalEvent; |
|
5843 |
|
5844 this.isPropagationStopped = returnTrue; |
|
5845 |
|
5846 if ( e && !this.isSimulated ) { |
|
5847 e.stopPropagation(); |
|
5848 } |
|
5849 }, |
|
5850 stopImmediatePropagation: function() { |
|
5851 var e = this.originalEvent; |
|
5852 |
|
5853 this.isImmediatePropagationStopped = returnTrue; |
|
5854 |
|
5855 if ( e && !this.isSimulated ) { |
|
5856 e.stopImmediatePropagation(); |
|
5857 } |
|
5858 |
|
5859 this.stopPropagation(); |
|
5860 } |
|
5861 }; |
|
5862 |
|
5863 // Includes all common event props including KeyEvent and MouseEvent specific props |
|
5864 jQuery.each( { |
|
5865 altKey: true, |
|
5866 bubbles: true, |
|
5867 cancelable: true, |
|
5868 changedTouches: true, |
|
5869 ctrlKey: true, |
|
5870 detail: true, |
|
5871 eventPhase: true, |
|
5872 metaKey: true, |
|
5873 pageX: true, |
|
5874 pageY: true, |
|
5875 shiftKey: true, |
|
5876 view: true, |
|
5877 "char": true, |
|
5878 code: true, |
|
5879 charCode: true, |
|
5880 key: true, |
|
5881 keyCode: true, |
|
5882 button: true, |
|
5883 buttons: true, |
|
5884 clientX: true, |
|
5885 clientY: true, |
|
5886 offsetX: true, |
|
5887 offsetY: true, |
|
5888 pointerId: true, |
|
5889 pointerType: true, |
|
5890 screenX: true, |
|
5891 screenY: true, |
|
5892 targetTouches: true, |
|
5893 toElement: true, |
|
5894 touches: true, |
|
5895 which: true |
|
5896 }, jQuery.event.addProp ); |
|
5897 |
|
5898 jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { |
|
5899 jQuery.event.special[ type ] = { |
|
5900 |
|
5901 // Utilize native event if possible so blur/focus sequence is correct |
|
5902 setup: function() { |
|
5903 |
|
5904 // Claim the first handler |
|
5905 // dataPriv.set( this, "focus", ... ) |
|
5906 // dataPriv.set( this, "blur", ... ) |
|
5907 leverageNative( this, type, expectSync ); |
|
5908 |
|
5909 // Return false to allow normal processing in the caller |
|
5910 return false; |
|
5911 }, |
|
5912 trigger: function() { |
|
5913 |
|
5914 // Force setup before trigger |
|
5915 leverageNative( this, type ); |
|
5916 |
|
5917 // Return non-false to allow normal event-path propagation |
|
5918 return true; |
|
5919 }, |
|
5920 |
|
5921 // Suppress native focus or blur if we're currently inside |
|
5922 // a leveraged native-event stack |
|
5923 _default: function( event ) { |
|
5924 return dataPriv.get( event.target, type ); |
|
5925 }, |
|
5926 |
|
5927 delegateType: delegateType |
|
5928 }; |
|
5929 } ); |
|
5930 |
|
5931 // Create mouseenter/leave events using mouseover/out and event-time checks |
|
5932 // so that event delegation works in jQuery. |
|
5933 // Do the same for pointerenter/pointerleave and pointerover/pointerout |
|
5934 // |
|
5935 // Support: Safari 7 only |
|
5936 // Safari sends mouseenter too often; see: |
|
5937 // https://bugs.chromium.org/p/chromium/issues/detail?id=470258 |
|
5938 // for the description of the bug (it existed in older Chrome versions as well). |
|
5939 jQuery.each( { |
|
5940 mouseenter: "mouseover", |
|
5941 mouseleave: "mouseout", |
|
5942 pointerenter: "pointerover", |
|
5943 pointerleave: "pointerout" |
|
5944 }, function( orig, fix ) { |
|
5945 jQuery.event.special[ orig ] = { |
|
5946 delegateType: fix, |
|
5947 bindType: fix, |
|
5948 |
|
5949 handle: function( event ) { |
|
5950 var ret, |
|
5951 target = this, |
|
5952 related = event.relatedTarget, |
|
5953 handleObj = event.handleObj; |
|
5954 |
|
5955 // For mouseenter/leave call the handler if related is outside the target. |
|
5956 // NB: No relatedTarget if the mouse left/entered the browser window |
|
5957 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { |
|
5958 event.type = handleObj.origType; |
|
5959 ret = handleObj.handler.apply( this, arguments ); |
|
5960 event.type = fix; |
|
5961 } |
|
5962 return ret; |
|
5963 } |
|
5964 }; |
|
5965 } ); |
|
5966 |
|
5967 jQuery.fn.extend( { |
|
5968 |
|
5969 on: function( types, selector, data, fn ) { |
|
5970 return on( this, types, selector, data, fn ); |
|
5971 }, |
|
5972 one: function( types, selector, data, fn ) { |
|
5973 return on( this, types, selector, data, fn, 1 ); |
|
5974 }, |
|
5975 off: function( types, selector, fn ) { |
|
5976 var handleObj, type; |
|
5977 if ( types && types.preventDefault && types.handleObj ) { |
|
5978 |
|
5979 // ( event ) dispatched jQuery.Event |
|
5980 handleObj = types.handleObj; |
|
5981 jQuery( types.delegateTarget ).off( |
|
5982 handleObj.namespace ? |
|
5983 handleObj.origType + "." + handleObj.namespace : |
|
5984 handleObj.origType, |
|
5985 handleObj.selector, |
|
5986 handleObj.handler |
|
5987 ); |
|
5988 return this; |
|
5989 } |
|
5990 if ( typeof types === "object" ) { |
|
5991 |
|
5992 // ( types-object [, selector] ) |
|
5993 for ( type in types ) { |
|
5994 this.off( type, selector, types[ type ] ); |
|
5995 } |
|
5996 return this; |
|
5997 } |
|
5998 if ( selector === false || typeof selector === "function" ) { |
|
5999 |
|
6000 // ( types [, fn] ) |
|
6001 fn = selector; |
|
6002 selector = undefined; |
|
6003 } |
|
6004 if ( fn === false ) { |
|
6005 fn = returnFalse; |
|
6006 } |
|
6007 return this.each( function() { |
|
6008 jQuery.event.remove( this, types, fn, selector ); |
|
6009 } ); |
|
6010 } |
|
6011 } ); |
|
6012 |
|
6013 |
|
6014 var |
|
6015 |
|
6016 // Support: IE <=10 - 11, Edge 12 - 13 only |
|
6017 // In IE/Edge using regex groups here causes severe slowdowns. |
|
6018 // See https://connect.microsoft.com/IE/feedback/details/1736512/ |
|
6019 rnoInnerhtml = /<script|<style|<link/i, |
|
6020 |
|
6021 // checked="checked" or checked |
|
6022 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, |
|
6023 |
|
6024 rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g; |
|
6025 |
|
6026 // Prefer a tbody over its parent table for containing new rows |
|
6027 function manipulationTarget( elem, content ) { |
|
6028 if ( nodeName( elem, "table" ) && |
|
6029 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { |
|
6030 |
|
6031 return jQuery( elem ).children( "tbody" )[ 0 ] || elem; |
|
6032 } |
|
6033 |
|
6034 return elem; |
|
6035 } |
|
6036 |
|
6037 // Replace/restore the type attribute of script elements for safe DOM manipulation |
|
6038 function disableScript( elem ) { |
|
6039 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; |
|
6040 return elem; |
|
6041 } |
|
6042 function restoreScript( elem ) { |
|
6043 if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { |
|
6044 elem.type = elem.type.slice( 5 ); |
|
6045 } else { |
|
6046 elem.removeAttribute( "type" ); |
|
6047 } |
|
6048 |
|
6049 return elem; |
|
6050 } |
|
6051 |
|
6052 function cloneCopyEvent( src, dest ) { |
|
6053 var i, l, type, pdataOld, udataOld, udataCur, events; |
|
6054 |
|
6055 if ( dest.nodeType !== 1 ) { |
|
6056 return; |
|
6057 } |
|
6058 |
|
6059 // 1. Copy private data: events, handlers, etc. |
|
6060 if ( dataPriv.hasData( src ) ) { |
|
6061 pdataOld = dataPriv.get( src ); |
|
6062 events = pdataOld.events; |
|
6063 |
|
6064 if ( events ) { |
|
6065 dataPriv.remove( dest, "handle events" ); |
|
6066 |
|
6067 for ( type in events ) { |
|
6068 for ( i = 0, l = events[ type ].length; i < l; i++ ) { |
|
6069 jQuery.event.add( dest, type, events[ type ][ i ] ); |
|
6070 } |
|
6071 } |
|
6072 } |
|
6073 } |
|
6074 |
|
6075 // 2. Copy user data |
|
6076 if ( dataUser.hasData( src ) ) { |
|
6077 udataOld = dataUser.access( src ); |
|
6078 udataCur = jQuery.extend( {}, udataOld ); |
|
6079 |
|
6080 dataUser.set( dest, udataCur ); |
|
6081 } |
|
6082 } |
|
6083 |
|
6084 // Fix IE bugs, see support tests |
|
6085 function fixInput( src, dest ) { |
|
6086 var nodeName = dest.nodeName.toLowerCase(); |
|
6087 |
|
6088 // Fails to persist the checked state of a cloned checkbox or radio button. |
|
6089 if ( nodeName === "input" && rcheckableType.test( src.type ) ) { |
|
6090 dest.checked = src.checked; |
|
6091 |
|
6092 // Fails to return the selected option to the default selected state when cloning options |
|
6093 } else if ( nodeName === "input" || nodeName === "textarea" ) { |
|
6094 dest.defaultValue = src.defaultValue; |
|
6095 } |
|
6096 } |
|
6097 |
|
6098 function domManip( collection, args, callback, ignored ) { |
|
6099 |
|
6100 // Flatten any nested arrays |
|
6101 args = flat( args ); |
|
6102 |
|
6103 var fragment, first, scripts, hasScripts, node, doc, |
|
6104 i = 0, |
|
6105 l = collection.length, |
|
6106 iNoClone = l - 1, |
|
6107 value = args[ 0 ], |
|
6108 valueIsFunction = isFunction( value ); |
|
6109 |
|
6110 // We can't cloneNode fragments that contain checked, in WebKit |
|
6111 if ( valueIsFunction || |
|
6112 ( l > 1 && typeof value === "string" && |
|
6113 !support.checkClone && rchecked.test( value ) ) ) { |
|
6114 return collection.each( function( index ) { |
|
6115 var self = collection.eq( index ); |
|
6116 if ( valueIsFunction ) { |
|
6117 args[ 0 ] = value.call( this, index, self.html() ); |
|
6118 } |
|
6119 domManip( self, args, callback, ignored ); |
|
6120 } ); |
|
6121 } |
|
6122 |
|
6123 if ( l ) { |
|
6124 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); |
|
6125 first = fragment.firstChild; |
|
6126 |
|
6127 if ( fragment.childNodes.length === 1 ) { |
|
6128 fragment = first; |
|
6129 } |
|
6130 |
|
6131 // Require either new content or an interest in ignored elements to invoke the callback |
|
6132 if ( first || ignored ) { |
|
6133 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); |
|
6134 hasScripts = scripts.length; |
|
6135 |
|
6136 // Use the original fragment for the last item |
|
6137 // instead of the first because it can end up |
|
6138 // being emptied incorrectly in certain situations (trac-8070). |
|
6139 for ( ; i < l; i++ ) { |
|
6140 node = fragment; |
|
6141 |
|
6142 if ( i !== iNoClone ) { |
|
6143 node = jQuery.clone( node, true, true ); |
|
6144 |
|
6145 // Keep references to cloned scripts for later restoration |
|
6146 if ( hasScripts ) { |
|
6147 |
|
6148 // Support: Android <=4.0 only, PhantomJS 1 only |
|
6149 // push.apply(_, arraylike) throws on ancient WebKit |
|
6150 jQuery.merge( scripts, getAll( node, "script" ) ); |
|
6151 } |
|
6152 } |
|
6153 |
|
6154 callback.call( collection[ i ], node, i ); |
|
6155 } |
|
6156 |
|
6157 if ( hasScripts ) { |
|
6158 doc = scripts[ scripts.length - 1 ].ownerDocument; |
|
6159 |
|
6160 // Reenable scripts |
|
6161 jQuery.map( scripts, restoreScript ); |
|
6162 |
|
6163 // Evaluate executable scripts on first document insertion |
|
6164 for ( i = 0; i < hasScripts; i++ ) { |
|
6165 node = scripts[ i ]; |
|
6166 if ( rscriptType.test( node.type || "" ) && |
|
6167 !dataPriv.access( node, "globalEval" ) && |
|
6168 jQuery.contains( doc, node ) ) { |
|
6169 |
|
6170 if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { |
|
6171 |
|
6172 // Optional AJAX dependency, but won't run scripts if not present |
|
6173 if ( jQuery._evalUrl && !node.noModule ) { |
|
6174 jQuery._evalUrl( node.src, { |
|
6175 nonce: node.nonce || node.getAttribute( "nonce" ) |
|
6176 }, doc ); |
|
6177 } |
|
6178 } else { |
|
6179 |
|
6180 // Unwrap a CDATA section containing script contents. This shouldn't be |
|
6181 // needed as in XML documents they're already not visible when |
|
6182 // inspecting element contents and in HTML documents they have no |
|
6183 // meaning but we're preserving that logic for backwards compatibility. |
|
6184 // This will be removed completely in 4.0. See gh-4904. |
|
6185 DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); |
|
6186 } |
|
6187 } |
|
6188 } |
|
6189 } |
|
6190 } |
|
6191 } |
|
6192 |
|
6193 return collection; |
|
6194 } |
|
6195 |
|
6196 function remove( elem, selector, keepData ) { |
|
6197 var node, |
|
6198 nodes = selector ? jQuery.filter( selector, elem ) : elem, |
|
6199 i = 0; |
|
6200 |
|
6201 for ( ; ( node = nodes[ i ] ) != null; i++ ) { |
|
6202 if ( !keepData && node.nodeType === 1 ) { |
|
6203 jQuery.cleanData( getAll( node ) ); |
|
6204 } |
|
6205 |
|
6206 if ( node.parentNode ) { |
|
6207 if ( keepData && isAttached( node ) ) { |
|
6208 setGlobalEval( getAll( node, "script" ) ); |
|
6209 } |
|
6210 node.parentNode.removeChild( node ); |
|
6211 } |
|
6212 } |
|
6213 |
|
6214 return elem; |
|
6215 } |
|
6216 |
|
6217 jQuery.extend( { |
|
6218 htmlPrefilter: function( html ) { |
|
6219 return html; |
|
6220 }, |
|
6221 |
|
6222 clone: function( elem, dataAndEvents, deepDataAndEvents ) { |
|
6223 var i, l, srcElements, destElements, |
|
6224 clone = elem.cloneNode( true ), |
|
6225 inPage = isAttached( elem ); |
|
6226 |
|
6227 // Fix IE cloning issues |
|
6228 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && |
|
6229 !jQuery.isXMLDoc( elem ) ) { |
|
6230 |
|
6231 // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 |
|
6232 destElements = getAll( clone ); |
|
6233 srcElements = getAll( elem ); |
|
6234 |
|
6235 for ( i = 0, l = srcElements.length; i < l; i++ ) { |
|
6236 fixInput( srcElements[ i ], destElements[ i ] ); |
|
6237 } |
|
6238 } |
|
6239 |
|
6240 // Copy the events from the original to the clone |
|
6241 if ( dataAndEvents ) { |
|
6242 if ( deepDataAndEvents ) { |
|
6243 srcElements = srcElements || getAll( elem ); |
|
6244 destElements = destElements || getAll( clone ); |
|
6245 |
|
6246 for ( i = 0, l = srcElements.length; i < l; i++ ) { |
|
6247 cloneCopyEvent( srcElements[ i ], destElements[ i ] ); |
|
6248 } |
|
6249 } else { |
|
6250 cloneCopyEvent( elem, clone ); |
|
6251 } |
|
6252 } |
|
6253 |
|
6254 // Preserve script evaluation history |
|
6255 destElements = getAll( clone, "script" ); |
|
6256 if ( destElements.length > 0 ) { |
|
6257 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); |
|
6258 } |
|
6259 |
|
6260 // Return the cloned set |
|
6261 return clone; |
|
6262 }, |
|
6263 |
|
6264 cleanData: function( elems ) { |
|
6265 var data, elem, type, |
|
6266 special = jQuery.event.special, |
|
6267 i = 0; |
|
6268 |
|
6269 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { |
|
6270 if ( acceptData( elem ) ) { |
|
6271 if ( ( data = elem[ dataPriv.expando ] ) ) { |
|
6272 if ( data.events ) { |
|
6273 for ( type in data.events ) { |
|
6274 if ( special[ type ] ) { |
|
6275 jQuery.event.remove( elem, type ); |
|
6276 |
|
6277 // This is a shortcut to avoid jQuery.event.remove's overhead |
|
6278 } else { |
|
6279 jQuery.removeEvent( elem, type, data.handle ); |
|
6280 } |
|
6281 } |
|
6282 } |
|
6283 |
|
6284 // Support: Chrome <=35 - 45+ |
|
6285 // Assign undefined instead of using delete, see Data#remove |
|
6286 elem[ dataPriv.expando ] = undefined; |
|
6287 } |
|
6288 if ( elem[ dataUser.expando ] ) { |
|
6289 |
|
6290 // Support: Chrome <=35 - 45+ |
|
6291 // Assign undefined instead of using delete, see Data#remove |
|
6292 elem[ dataUser.expando ] = undefined; |
|
6293 } |
|
6294 } |
|
6295 } |
|
6296 } |
|
6297 } ); |
|
6298 |
|
6299 jQuery.fn.extend( { |
|
6300 detach: function( selector ) { |
|
6301 return remove( this, selector, true ); |
|
6302 }, |
|
6303 |
|
6304 remove: function( selector ) { |
|
6305 return remove( this, selector ); |
|
6306 }, |
|
6307 |
|
6308 text: function( value ) { |
|
6309 return access( this, function( value ) { |
|
6310 return value === undefined ? |
|
6311 jQuery.text( this ) : |
|
6312 this.empty().each( function() { |
|
6313 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { |
|
6314 this.textContent = value; |
|
6315 } |
|
6316 } ); |
|
6317 }, null, value, arguments.length ); |
|
6318 }, |
|
6319 |
|
6320 append: function() { |
|
6321 return domManip( this, arguments, function( elem ) { |
|
6322 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { |
|
6323 var target = manipulationTarget( this, elem ); |
|
6324 target.appendChild( elem ); |
|
6325 } |
|
6326 } ); |
|
6327 }, |
|
6328 |
|
6329 prepend: function() { |
|
6330 return domManip( this, arguments, function( elem ) { |
|
6331 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { |
|
6332 var target = manipulationTarget( this, elem ); |
|
6333 target.insertBefore( elem, target.firstChild ); |
|
6334 } |
|
6335 } ); |
|
6336 }, |
|
6337 |
|
6338 before: function() { |
|
6339 return domManip( this, arguments, function( elem ) { |
|
6340 if ( this.parentNode ) { |
|
6341 this.parentNode.insertBefore( elem, this ); |
|
6342 } |
|
6343 } ); |
|
6344 }, |
|
6345 |
|
6346 after: function() { |
|
6347 return domManip( this, arguments, function( elem ) { |
|
6348 if ( this.parentNode ) { |
|
6349 this.parentNode.insertBefore( elem, this.nextSibling ); |
|
6350 } |
|
6351 } ); |
|
6352 }, |
|
6353 |
|
6354 empty: function() { |
|
6355 var elem, |
|
6356 i = 0; |
|
6357 |
|
6358 for ( ; ( elem = this[ i ] ) != null; i++ ) { |
|
6359 if ( elem.nodeType === 1 ) { |
|
6360 |
|
6361 // Prevent memory leaks |
|
6362 jQuery.cleanData( getAll( elem, false ) ); |
|
6363 |
|
6364 // Remove any remaining nodes |
|
6365 elem.textContent = ""; |
|
6366 } |
|
6367 } |
|
6368 |
|
6369 return this; |
|
6370 }, |
|
6371 |
|
6372 clone: function( dataAndEvents, deepDataAndEvents ) { |
|
6373 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; |
|
6374 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; |
|
6375 |
|
6376 return this.map( function() { |
|
6377 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); |
|
6378 } ); |
|
6379 }, |
|
6380 |
|
6381 html: function( value ) { |
|
6382 return access( this, function( value ) { |
|
6383 var elem = this[ 0 ] || {}, |
|
6384 i = 0, |
|
6385 l = this.length; |
|
6386 |
|
6387 if ( value === undefined && elem.nodeType === 1 ) { |
|
6388 return elem.innerHTML; |
|
6389 } |
|
6390 |
|
6391 // See if we can take a shortcut and just use innerHTML |
|
6392 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && |
|
6393 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { |
|
6394 |
|
6395 value = jQuery.htmlPrefilter( value ); |
|
6396 |
|
6397 try { |
|
6398 for ( ; i < l; i++ ) { |
|
6399 elem = this[ i ] || {}; |
|
6400 |
|
6401 // Remove element nodes and prevent memory leaks |
|
6402 if ( elem.nodeType === 1 ) { |
|
6403 jQuery.cleanData( getAll( elem, false ) ); |
|
6404 elem.innerHTML = value; |
|
6405 } |
|
6406 } |
|
6407 |
|
6408 elem = 0; |
|
6409 |
|
6410 // If using innerHTML throws an exception, use the fallback method |
|
6411 } catch ( e ) {} |
|
6412 } |
|
6413 |
|
6414 if ( elem ) { |
|
6415 this.empty().append( value ); |
|
6416 } |
|
6417 }, null, value, arguments.length ); |
|
6418 }, |
|
6419 |
|
6420 replaceWith: function() { |
|
6421 var ignored = []; |
|
6422 |
|
6423 // Make the changes, replacing each non-ignored context element with the new content |
|
6424 return domManip( this, arguments, function( elem ) { |
|
6425 var parent = this.parentNode; |
|
6426 |
|
6427 if ( jQuery.inArray( this, ignored ) < 0 ) { |
|
6428 jQuery.cleanData( getAll( this ) ); |
|
6429 if ( parent ) { |
|
6430 parent.replaceChild( elem, this ); |
|
6431 } |
|
6432 } |
|
6433 |
|
6434 // Force callback invocation |
|
6435 }, ignored ); |
|
6436 } |
|
6437 } ); |
|
6438 |
|
6439 jQuery.each( { |
|
6440 appendTo: "append", |
|
6441 prependTo: "prepend", |
|
6442 insertBefore: "before", |
|
6443 insertAfter: "after", |
|
6444 replaceAll: "replaceWith" |
|
6445 }, function( name, original ) { |
|
6446 jQuery.fn[ name ] = function( selector ) { |
|
6447 var elems, |
|
6448 ret = [], |
|
6449 insert = jQuery( selector ), |
|
6450 last = insert.length - 1, |
|
6451 i = 0; |
|
6452 |
|
6453 for ( ; i <= last; i++ ) { |
|
6454 elems = i === last ? this : this.clone( true ); |
|
6455 jQuery( insert[ i ] )[ original ]( elems ); |
|
6456 |
|
6457 // Support: Android <=4.0 only, PhantomJS 1 only |
|
6458 // .get() because push.apply(_, arraylike) throws on ancient WebKit |
|
6459 push.apply( ret, elems.get() ); |
|
6460 } |
|
6461 |
|
6462 return this.pushStack( ret ); |
|
6463 }; |
|
6464 } ); |
|
6465 var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); |
|
6466 |
|
6467 var rcustomProp = /^--/; |
|
6468 |
|
6469 |
|
6470 var getStyles = function( elem ) { |
|
6471 |
|
6472 // Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150) |
|
6473 // IE throws on elements created in popups |
|
6474 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" |
|
6475 var view = elem.ownerDocument.defaultView; |
|
6476 |
|
6477 if ( !view || !view.opener ) { |
|
6478 view = window; |
|
6479 } |
|
6480 |
|
6481 return view.getComputedStyle( elem ); |
|
6482 }; |
|
6483 |
|
6484 var swap = function( elem, options, callback ) { |
|
6485 var ret, name, |
|
6486 old = {}; |
|
6487 |
|
6488 // Remember the old values, and insert the new ones |
|
6489 for ( name in options ) { |
|
6490 old[ name ] = elem.style[ name ]; |
|
6491 elem.style[ name ] = options[ name ]; |
|
6492 } |
|
6493 |
|
6494 ret = callback.call( elem ); |
|
6495 |
|
6496 // Revert the old values |
|
6497 for ( name in options ) { |
|
6498 elem.style[ name ] = old[ name ]; |
|
6499 } |
|
6500 |
|
6501 return ret; |
|
6502 }; |
|
6503 |
|
6504 |
|
6505 var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); |
|
6506 |
|
6507 var whitespace = "[\\x20\\t\\r\\n\\f]"; |
|
6508 |
|
6509 |
|
6510 var rtrimCSS = new RegExp( |
|
6511 "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", |
|
6512 "g" |
|
6513 ); |
|
6514 |
|
6515 |
|
6516 |
|
6517 |
|
6518 ( function() { |
|
6519 |
|
6520 // Executing both pixelPosition & boxSizingReliable tests require only one layout |
|
6521 // so they're executed at the same time to save the second computation. |
|
6522 function computeStyleTests() { |
|
6523 |
|
6524 // This is a singleton, we need to execute it only once |
|
6525 if ( !div ) { |
|
6526 return; |
|
6527 } |
|
6528 |
|
6529 container.style.cssText = "position:absolute;left:-11111px;width:60px;" + |
|
6530 "margin-top:1px;padding:0;border:0"; |
|
6531 div.style.cssText = |
|
6532 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + |
|
6533 "margin:auto;border:1px;padding:1px;" + |
|
6534 "width:60%;top:1%"; |
|
6535 documentElement.appendChild( container ).appendChild( div ); |
|
6536 |
|
6537 var divStyle = window.getComputedStyle( div ); |
|
6538 pixelPositionVal = divStyle.top !== "1%"; |
|
6539 |
|
6540 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 |
|
6541 reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; |
|
6542 |
|
6543 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 |
|
6544 // Some styles come back with percentage values, even though they shouldn't |
|
6545 div.style.right = "60%"; |
|
6546 pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; |
|
6547 |
|
6548 // Support: IE 9 - 11 only |
|
6549 // Detect misreporting of content dimensions for box-sizing:border-box elements |
|
6550 boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; |
|
6551 |
|
6552 // Support: IE 9 only |
|
6553 // Detect overflow:scroll screwiness (gh-3699) |
|
6554 // Support: Chrome <=64 |
|
6555 // Don't get tricked when zoom affects offsetWidth (gh-4029) |
|
6556 div.style.position = "absolute"; |
|
6557 scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; |
|
6558 |
|
6559 documentElement.removeChild( container ); |
|
6560 |
|
6561 // Nullify the div so it wouldn't be stored in the memory and |
|
6562 // it will also be a sign that checks already performed |
|
6563 div = null; |
|
6564 } |
|
6565 |
|
6566 function roundPixelMeasures( measure ) { |
|
6567 return Math.round( parseFloat( measure ) ); |
|
6568 } |
|
6569 |
|
6570 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, |
|
6571 reliableTrDimensionsVal, reliableMarginLeftVal, |
|
6572 container = document.createElement( "div" ), |
|
6573 div = document.createElement( "div" ); |
|
6574 |
|
6575 // Finish early in limited (non-browser) environments |
|
6576 if ( !div.style ) { |
|
6577 return; |
|
6578 } |
|
6579 |
|
6580 // Support: IE <=9 - 11 only |
|
6581 // Style of cloned element affects source element cloned (trac-8908) |
|
6582 div.style.backgroundClip = "content-box"; |
|
6583 div.cloneNode( true ).style.backgroundClip = ""; |
|
6584 support.clearCloneStyle = div.style.backgroundClip === "content-box"; |
|
6585 |
|
6586 jQuery.extend( support, { |
|
6587 boxSizingReliable: function() { |
|
6588 computeStyleTests(); |
|
6589 return boxSizingReliableVal; |
|
6590 }, |
|
6591 pixelBoxStyles: function() { |
|
6592 computeStyleTests(); |
|
6593 return pixelBoxStylesVal; |
|
6594 }, |
|
6595 pixelPosition: function() { |
|
6596 computeStyleTests(); |
|
6597 return pixelPositionVal; |
|
6598 }, |
|
6599 reliableMarginLeft: function() { |
|
6600 computeStyleTests(); |
|
6601 return reliableMarginLeftVal; |
|
6602 }, |
|
6603 scrollboxSize: function() { |
|
6604 computeStyleTests(); |
|
6605 return scrollboxSizeVal; |
|
6606 }, |
|
6607 |
|
6608 // Support: IE 9 - 11+, Edge 15 - 18+ |
|
6609 // IE/Edge misreport `getComputedStyle` of table rows with width/height |
|
6610 // set in CSS while `offset*` properties report correct values. |
|
6611 // Behavior in IE 9 is more subtle than in newer versions & it passes |
|
6612 // some versions of this test; make sure not to make it pass there! |
|
6613 // |
|
6614 // Support: Firefox 70+ |
|
6615 // Only Firefox includes border widths |
|
6616 // in computed dimensions. (gh-4529) |
|
6617 reliableTrDimensions: function() { |
|
6618 var table, tr, trChild, trStyle; |
|
6619 if ( reliableTrDimensionsVal == null ) { |
|
6620 table = document.createElement( "table" ); |
|
6621 tr = document.createElement( "tr" ); |
|
6622 trChild = document.createElement( "div" ); |
|
6623 |
|
6624 table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; |
|
6625 tr.style.cssText = "border:1px solid"; |
|
6626 |
|
6627 // Support: Chrome 86+ |
|
6628 // Height set through cssText does not get applied. |
|
6629 // Computed height then comes back as 0. |
|
6630 tr.style.height = "1px"; |
|
6631 trChild.style.height = "9px"; |
|
6632 |
|
6633 // Support: Android 8 Chrome 86+ |
|
6634 // In our bodyBackground.html iframe, |
|
6635 // display for all div elements is set to "inline", |
|
6636 // which causes a problem only in Android 8 Chrome 86. |
|
6637 // Ensuring the div is display: block |
|
6638 // gets around this issue. |
|
6639 trChild.style.display = "block"; |
|
6640 |
|
6641 documentElement |
|
6642 .appendChild( table ) |
|
6643 .appendChild( tr ) |
|
6644 .appendChild( trChild ); |
|
6645 |
|
6646 trStyle = window.getComputedStyle( tr ); |
|
6647 reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) + |
|
6648 parseInt( trStyle.borderTopWidth, 10 ) + |
|
6649 parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight; |
|
6650 |
|
6651 documentElement.removeChild( table ); |
|
6652 } |
|
6653 return reliableTrDimensionsVal; |
|
6654 } |
|
6655 } ); |
|
6656 } )(); |
|
6657 |
|
6658 |
|
6659 function curCSS( elem, name, computed ) { |
|
6660 var width, minWidth, maxWidth, ret, |
|
6661 isCustomProp = rcustomProp.test( name ), |
|
6662 |
|
6663 // Support: Firefox 51+ |
|
6664 // Retrieving style before computed somehow |
|
6665 // fixes an issue with getting wrong values |
|
6666 // on detached elements |
|
6667 style = elem.style; |
|
6668 |
|
6669 computed = computed || getStyles( elem ); |
|
6670 |
|
6671 // getPropertyValue is needed for: |
|
6672 // .css('filter') (IE 9 only, trac-12537) |
|
6673 // .css('--customProperty) (gh-3144) |
|
6674 if ( computed ) { |
|
6675 |
|
6676 // Support: IE <=9 - 11+ |
|
6677 // IE only supports `"float"` in `getPropertyValue`; in computed styles |
|
6678 // it's only available as `"cssFloat"`. We no longer modify properties |
|
6679 // sent to `.css()` apart from camelCasing, so we need to check both. |
|
6680 // Normally, this would create difference in behavior: if |
|
6681 // `getPropertyValue` returns an empty string, the value returned |
|
6682 // by `.css()` would be `undefined`. This is usually the case for |
|
6683 // disconnected elements. However, in IE even disconnected elements |
|
6684 // with no styles return `"none"` for `getPropertyValue( "float" )` |
|
6685 ret = computed.getPropertyValue( name ) || computed[ name ]; |
|
6686 |
|
6687 if ( isCustomProp && ret ) { |
|
6688 |
|
6689 // Support: Firefox 105+, Chrome <=105+ |
|
6690 // Spec requires trimming whitespace for custom properties (gh-4926). |
|
6691 // Firefox only trims leading whitespace. Chrome just collapses |
|
6692 // both leading & trailing whitespace to a single space. |
|
6693 // |
|
6694 // Fall back to `undefined` if empty string returned. |
|
6695 // This collapses a missing definition with property defined |
|
6696 // and set to an empty string but there's no standard API |
|
6697 // allowing us to differentiate them without a performance penalty |
|
6698 // and returning `undefined` aligns with older jQuery. |
|
6699 // |
|
6700 // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED |
|
6701 // as whitespace while CSS does not, but this is not a problem |
|
6702 // because CSS preprocessing replaces them with U+000A LINE FEED |
|
6703 // (which *is* CSS whitespace) |
|
6704 // https://www.w3.org/TR/css-syntax-3/#input-preprocessing |
|
6705 ret = ret.replace( rtrimCSS, "$1" ) || undefined; |
|
6706 } |
|
6707 |
|
6708 if ( ret === "" && !isAttached( elem ) ) { |
|
6709 ret = jQuery.style( elem, name ); |
|
6710 } |
|
6711 |
|
6712 // A tribute to the "awesome hack by Dean Edwards" |
|
6713 // Android Browser returns percentage for some values, |
|
6714 // but width seems to be reliably pixels. |
|
6715 // This is against the CSSOM draft spec: |
|
6716 // https://drafts.csswg.org/cssom/#resolved-values |
|
6717 if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { |
|
6718 |
|
6719 // Remember the original values |
|
6720 width = style.width; |
|
6721 minWidth = style.minWidth; |
|
6722 maxWidth = style.maxWidth; |
|
6723 |
|
6724 // Put in the new values to get a computed value out |
|
6725 style.minWidth = style.maxWidth = style.width = ret; |
|
6726 ret = computed.width; |
|
6727 |
|
6728 // Revert the changed values |
|
6729 style.width = width; |
|
6730 style.minWidth = minWidth; |
|
6731 style.maxWidth = maxWidth; |
|
6732 } |
|
6733 } |
|
6734 |
|
6735 return ret !== undefined ? |
|
6736 |
|
6737 // Support: IE <=9 - 11 only |
|
6738 // IE returns zIndex value as an integer. |
|
6739 ret + "" : |
|
6740 ret; |
|
6741 } |
|
6742 |
|
6743 |
|
6744 function addGetHookIf( conditionFn, hookFn ) { |
|
6745 |
|
6746 // Define the hook, we'll check on the first run if it's really needed. |
|
6747 return { |
|
6748 get: function() { |
|
6749 if ( conditionFn() ) { |
|
6750 |
|
6751 // Hook not needed (or it's not possible to use it due |
|
6752 // to missing dependency), remove it. |
|
6753 delete this.get; |
|
6754 return; |
|
6755 } |
|
6756 |
|
6757 // Hook needed; redefine it so that the support test is not executed again. |
|
6758 return ( this.get = hookFn ).apply( this, arguments ); |
|
6759 } |
|
6760 }; |
|
6761 } |
|
6762 |
|
6763 |
|
6764 var cssPrefixes = [ "Webkit", "Moz", "ms" ], |
|
6765 emptyStyle = document.createElement( "div" ).style, |
|
6766 vendorProps = {}; |
|
6767 |
|
6768 // Return a vendor-prefixed property or undefined |
|
6769 function vendorPropName( name ) { |
|
6770 |
|
6771 // Check for vendor prefixed names |
|
6772 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), |
|
6773 i = cssPrefixes.length; |
|
6774 |
|
6775 while ( i-- ) { |
|
6776 name = cssPrefixes[ i ] + capName; |
|
6777 if ( name in emptyStyle ) { |
|
6778 return name; |
|
6779 } |
|
6780 } |
|
6781 } |
|
6782 |
|
6783 // Return a potentially-mapped jQuery.cssProps or vendor prefixed property |
|
6784 function finalPropName( name ) { |
|
6785 var final = jQuery.cssProps[ name ] || vendorProps[ name ]; |
|
6786 |
|
6787 if ( final ) { |
|
6788 return final; |
|
6789 } |
|
6790 if ( name in emptyStyle ) { |
|
6791 return name; |
|
6792 } |
|
6793 return vendorProps[ name ] = vendorPropName( name ) || name; |
|
6794 } |
|
6795 |
|
6796 |
|
6797 var |
|
6798 |
|
6799 // Swappable if display is none or starts with table |
|
6800 // except "table", "table-cell", or "table-caption" |
|
6801 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display |
|
6802 rdisplayswap = /^(none|table(?!-c[ea]).+)/, |
|
6803 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, |
|
6804 cssNormalTransform = { |
|
6805 letterSpacing: "0", |
|
6806 fontWeight: "400" |
|
6807 }; |
|
6808 |
|
6809 function setPositiveNumber( _elem, value, subtract ) { |
|
6810 |
|
6811 // Any relative (+/-) values have already been |
|
6812 // normalized at this point |
|
6813 var matches = rcssNum.exec( value ); |
|
6814 return matches ? |
|
6815 |
|
6816 // Guard against undefined "subtract", e.g., when used as in cssHooks |
|
6817 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : |
|
6818 value; |
|
6819 } |
|
6820 |
|
6821 function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { |
|
6822 var i = dimension === "width" ? 1 : 0, |
|
6823 extra = 0, |
|
6824 delta = 0; |
|
6825 |
|
6826 // Adjustment may not be necessary |
|
6827 if ( box === ( isBorderBox ? "border" : "content" ) ) { |
|
6828 return 0; |
|
6829 } |
|
6830 |
|
6831 for ( ; i < 4; i += 2 ) { |
|
6832 |
|
6833 // Both box models exclude margin |
|
6834 if ( box === "margin" ) { |
|
6835 delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); |
|
6836 } |
|
6837 |
|
6838 // If we get here with a content-box, we're seeking "padding" or "border" or "margin" |
|
6839 if ( !isBorderBox ) { |
|
6840 |
|
6841 // Add padding |
|
6842 delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); |
|
6843 |
|
6844 // For "border" or "margin", add border |
|
6845 if ( box !== "padding" ) { |
|
6846 delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); |
|
6847 |
|
6848 // But still keep track of it otherwise |
|
6849 } else { |
|
6850 extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); |
|
6851 } |
|
6852 |
|
6853 // If we get here with a border-box (content + padding + border), we're seeking "content" or |
|
6854 // "padding" or "margin" |
|
6855 } else { |
|
6856 |
|
6857 // For "content", subtract padding |
|
6858 if ( box === "content" ) { |
|
6859 delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); |
|
6860 } |
|
6861 |
|
6862 // For "content" or "padding", subtract border |
|
6863 if ( box !== "margin" ) { |
|
6864 delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); |
|
6865 } |
|
6866 } |
|
6867 } |
|
6868 |
|
6869 // Account for positive content-box scroll gutter when requested by providing computedVal |
|
6870 if ( !isBorderBox && computedVal >= 0 ) { |
|
6871 |
|
6872 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border |
|
6873 // Assuming integer scroll gutter, subtract the rest and round down |
|
6874 delta += Math.max( 0, Math.ceil( |
|
6875 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - |
|
6876 computedVal - |
|
6877 delta - |
|
6878 extra - |
|
6879 0.5 |
|
6880 |
|
6881 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter |
|
6882 // Use an explicit zero to avoid NaN (gh-3964) |
|
6883 ) ) || 0; |
|
6884 } |
|
6885 |
|
6886 return delta; |
|
6887 } |
|
6888 |
|
6889 function getWidthOrHeight( elem, dimension, extra ) { |
|
6890 |
|
6891 // Start with computed style |
|
6892 var styles = getStyles( elem ), |
|
6893 |
|
6894 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). |
|
6895 // Fake content-box until we know it's needed to know the true value. |
|
6896 boxSizingNeeded = !support.boxSizingReliable() || extra, |
|
6897 isBorderBox = boxSizingNeeded && |
|
6898 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", |
|
6899 valueIsBorderBox = isBorderBox, |
|
6900 |
|
6901 val = curCSS( elem, dimension, styles ), |
|
6902 offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); |
|
6903 |
|
6904 // Support: Firefox <=54 |
|
6905 // Return a confounding non-pixel value or feign ignorance, as appropriate. |
|
6906 if ( rnumnonpx.test( val ) ) { |
|
6907 if ( !extra ) { |
|
6908 return val; |
|
6909 } |
|
6910 val = "auto"; |
|
6911 } |
|
6912 |
|
6913 |
|
6914 // Support: IE 9 - 11 only |
|
6915 // Use offsetWidth/offsetHeight for when box sizing is unreliable. |
|
6916 // In those cases, the computed value can be trusted to be border-box. |
|
6917 if ( ( !support.boxSizingReliable() && isBorderBox || |
|
6918 |
|
6919 // Support: IE 10 - 11+, Edge 15 - 18+ |
|
6920 // IE/Edge misreport `getComputedStyle` of table rows with width/height |
|
6921 // set in CSS while `offset*` properties report correct values. |
|
6922 // Interestingly, in some cases IE 9 doesn't suffer from this issue. |
|
6923 !support.reliableTrDimensions() && nodeName( elem, "tr" ) || |
|
6924 |
|
6925 // Fall back to offsetWidth/offsetHeight when value is "auto" |
|
6926 // This happens for inline elements with no explicit setting (gh-3571) |
|
6927 val === "auto" || |
|
6928 |
|
6929 // Support: Android <=4.1 - 4.3 only |
|
6930 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) |
|
6931 !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && |
|
6932 |
|
6933 // Make sure the element is visible & connected |
|
6934 elem.getClientRects().length ) { |
|
6935 |
|
6936 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; |
|
6937 |
|
6938 // Where available, offsetWidth/offsetHeight approximate border box dimensions. |
|
6939 // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the |
|
6940 // retrieved value as a content box dimension. |
|
6941 valueIsBorderBox = offsetProp in elem; |
|
6942 if ( valueIsBorderBox ) { |
|
6943 val = elem[ offsetProp ]; |
|
6944 } |
|
6945 } |
|
6946 |
|
6947 // Normalize "" and auto |
|
6948 val = parseFloat( val ) || 0; |
|
6949 |
|
6950 // Adjust for the element's box model |
|
6951 return ( val + |
|
6952 boxModelAdjustment( |
|
6953 elem, |
|
6954 dimension, |
|
6955 extra || ( isBorderBox ? "border" : "content" ), |
|
6956 valueIsBorderBox, |
|
6957 styles, |
|
6958 |
|
6959 // Provide the current computed size to request scroll gutter calculation (gh-3589) |
|
6960 val |
|
6961 ) |
|
6962 ) + "px"; |
|
6963 } |
|
6964 |
|
6965 jQuery.extend( { |
|
6966 |
|
6967 // Add in style property hooks for overriding the default |
|
6968 // behavior of getting and setting a style property |
|
6969 cssHooks: { |
|
6970 opacity: { |
|
6971 get: function( elem, computed ) { |
|
6972 if ( computed ) { |
|
6973 |
|
6974 // We should always get a number back from opacity |
|
6975 var ret = curCSS( elem, "opacity" ); |
|
6976 return ret === "" ? "1" : ret; |
|
6977 } |
|
6978 } |
|
6979 } |
|
6980 }, |
|
6981 |
|
6982 // Don't automatically add "px" to these possibly-unitless properties |
|
6983 cssNumber: { |
|
6984 "animationIterationCount": true, |
|
6985 "columnCount": true, |
|
6986 "fillOpacity": true, |
|
6987 "flexGrow": true, |
|
6988 "flexShrink": true, |
|
6989 "fontWeight": true, |
|
6990 "gridArea": true, |
|
6991 "gridColumn": true, |
|
6992 "gridColumnEnd": true, |
|
6993 "gridColumnStart": true, |
|
6994 "gridRow": true, |
|
6995 "gridRowEnd": true, |
|
6996 "gridRowStart": true, |
|
6997 "lineHeight": true, |
|
6998 "opacity": true, |
|
6999 "order": true, |
|
7000 "orphans": true, |
|
7001 "widows": true, |
|
7002 "zIndex": true, |
|
7003 "zoom": true |
|
7004 }, |
|
7005 |
|
7006 // Add in properties whose names you wish to fix before |
|
7007 // setting or getting the value |
|
7008 cssProps: {}, |
|
7009 |
|
7010 // Get and set the style property on a DOM Node |
|
7011 style: function( elem, name, value, extra ) { |
|
7012 |
|
7013 // Don't set styles on text and comment nodes |
|
7014 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { |
|
7015 return; |
|
7016 } |
|
7017 |
|
7018 // Make sure that we're working with the right name |
|
7019 var ret, type, hooks, |
|
7020 origName = camelCase( name ), |
|
7021 isCustomProp = rcustomProp.test( name ), |
|
7022 style = elem.style; |
|
7023 |
|
7024 // Make sure that we're working with the right name. We don't |
|
7025 // want to query the value if it is a CSS custom property |
|
7026 // since they are user-defined. |
|
7027 if ( !isCustomProp ) { |
|
7028 name = finalPropName( origName ); |
|
7029 } |
|
7030 |
|
7031 // Gets hook for the prefixed version, then unprefixed version |
|
7032 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; |
|
7033 |
|
7034 // Check if we're setting a value |
|
7035 if ( value !== undefined ) { |
|
7036 type = typeof value; |
|
7037 |
|
7038 // Convert "+=" or "-=" to relative numbers (trac-7345) |
|
7039 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { |
|
7040 value = adjustCSS( elem, name, ret ); |
|
7041 |
|
7042 // Fixes bug trac-9237 |
|
7043 type = "number"; |
|
7044 } |
|
7045 |
|
7046 // Make sure that null and NaN values aren't set (trac-7116) |
|
7047 if ( value == null || value !== value ) { |
|
7048 return; |
|
7049 } |
|
7050 |
|
7051 // If a number was passed in, add the unit (except for certain CSS properties) |
|
7052 // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append |
|
7053 // "px" to a few hardcoded values. |
|
7054 if ( type === "number" && !isCustomProp ) { |
|
7055 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); |
|
7056 } |
|
7057 |
|
7058 // background-* props affect original clone's values |
|
7059 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { |
|
7060 style[ name ] = "inherit"; |
|
7061 } |
|
7062 |
|
7063 // If a hook was provided, use that value, otherwise just set the specified value |
|
7064 if ( !hooks || !( "set" in hooks ) || |
|
7065 ( value = hooks.set( elem, value, extra ) ) !== undefined ) { |
|
7066 |
|
7067 if ( isCustomProp ) { |
|
7068 style.setProperty( name, value ); |
|
7069 } else { |
|
7070 style[ name ] = value; |
|
7071 } |
|
7072 } |
|
7073 |
|
7074 } else { |
|
7075 |
|
7076 // If a hook was provided get the non-computed value from there |
|
7077 if ( hooks && "get" in hooks && |
|
7078 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { |
|
7079 |
|
7080 return ret; |
|
7081 } |
|
7082 |
|
7083 // Otherwise just get the value from the style object |
|
7084 return style[ name ]; |
|
7085 } |
|
7086 }, |
|
7087 |
|
7088 css: function( elem, name, extra, styles ) { |
|
7089 var val, num, hooks, |
|
7090 origName = camelCase( name ), |
|
7091 isCustomProp = rcustomProp.test( name ); |
|
7092 |
|
7093 // Make sure that we're working with the right name. We don't |
|
7094 // want to modify the value if it is a CSS custom property |
|
7095 // since they are user-defined. |
|
7096 if ( !isCustomProp ) { |
|
7097 name = finalPropName( origName ); |
|
7098 } |
|
7099 |
|
7100 // Try prefixed name followed by the unprefixed name |
|
7101 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; |
|
7102 |
|
7103 // If a hook was provided get the computed value from there |
|
7104 if ( hooks && "get" in hooks ) { |
|
7105 val = hooks.get( elem, true, extra ); |
|
7106 } |
|
7107 |
|
7108 // Otherwise, if a way to get the computed value exists, use that |
|
7109 if ( val === undefined ) { |
|
7110 val = curCSS( elem, name, styles ); |
|
7111 } |
|
7112 |
|
7113 // Convert "normal" to computed value |
|
7114 if ( val === "normal" && name in cssNormalTransform ) { |
|
7115 val = cssNormalTransform[ name ]; |
|
7116 } |
|
7117 |
|
7118 // Make numeric if forced or a qualifier was provided and val looks numeric |
|
7119 if ( extra === "" || extra ) { |
|
7120 num = parseFloat( val ); |
|
7121 return extra === true || isFinite( num ) ? num || 0 : val; |
|
7122 } |
|
7123 |
|
7124 return val; |
|
7125 } |
|
7126 } ); |
|
7127 |
|
7128 jQuery.each( [ "height", "width" ], function( _i, dimension ) { |
|
7129 jQuery.cssHooks[ dimension ] = { |
|
7130 get: function( elem, computed, extra ) { |
|
7131 if ( computed ) { |
|
7132 |
|
7133 // Certain elements can have dimension info if we invisibly show them |
|
7134 // but it must have a current display style that would benefit |
|
7135 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && |
|
7136 |
|
7137 // Support: Safari 8+ |
|
7138 // Table columns in Safari have non-zero offsetWidth & zero |
|
7139 // getBoundingClientRect().width unless display is changed. |
|
7140 // Support: IE <=11 only |
|
7141 // Running getBoundingClientRect on a disconnected node |
|
7142 // in IE throws an error. |
|
7143 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? |
|
7144 swap( elem, cssShow, function() { |
|
7145 return getWidthOrHeight( elem, dimension, extra ); |
|
7146 } ) : |
|
7147 getWidthOrHeight( elem, dimension, extra ); |
|
7148 } |
|
7149 }, |
|
7150 |
|
7151 set: function( elem, value, extra ) { |
|
7152 var matches, |
|
7153 styles = getStyles( elem ), |
|
7154 |
|
7155 // Only read styles.position if the test has a chance to fail |
|
7156 // to avoid forcing a reflow. |
|
7157 scrollboxSizeBuggy = !support.scrollboxSize() && |
|
7158 styles.position === "absolute", |
|
7159 |
|
7160 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) |
|
7161 boxSizingNeeded = scrollboxSizeBuggy || extra, |
|
7162 isBorderBox = boxSizingNeeded && |
|
7163 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", |
|
7164 subtract = extra ? |
|
7165 boxModelAdjustment( |
|
7166 elem, |
|
7167 dimension, |
|
7168 extra, |
|
7169 isBorderBox, |
|
7170 styles |
|
7171 ) : |
|
7172 0; |
|
7173 |
|
7174 // Account for unreliable border-box dimensions by comparing offset* to computed and |
|
7175 // faking a content-box to get border and padding (gh-3699) |
|
7176 if ( isBorderBox && scrollboxSizeBuggy ) { |
|
7177 subtract -= Math.ceil( |
|
7178 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - |
|
7179 parseFloat( styles[ dimension ] ) - |
|
7180 boxModelAdjustment( elem, dimension, "border", false, styles ) - |
|
7181 0.5 |
|
7182 ); |
|
7183 } |
|
7184 |
|
7185 // Convert to pixels if value adjustment is needed |
|
7186 if ( subtract && ( matches = rcssNum.exec( value ) ) && |
|
7187 ( matches[ 3 ] || "px" ) !== "px" ) { |
|
7188 |
|
7189 elem.style[ dimension ] = value; |
|
7190 value = jQuery.css( elem, dimension ); |
|
7191 } |
|
7192 |
|
7193 return setPositiveNumber( elem, value, subtract ); |
|
7194 } |
|
7195 }; |
|
7196 } ); |
|
7197 |
|
7198 jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, |
|
7199 function( elem, computed ) { |
|
7200 if ( computed ) { |
|
7201 return ( parseFloat( curCSS( elem, "marginLeft" ) ) || |
|
7202 elem.getBoundingClientRect().left - |
|
7203 swap( elem, { marginLeft: 0 }, function() { |
|
7204 return elem.getBoundingClientRect().left; |
|
7205 } ) |
|
7206 ) + "px"; |
|
7207 } |
|
7208 } |
|
7209 ); |
|
7210 |
|
7211 // These hooks are used by animate to expand properties |
|
7212 jQuery.each( { |
|
7213 margin: "", |
|
7214 padding: "", |
|
7215 border: "Width" |
|
7216 }, function( prefix, suffix ) { |
|
7217 jQuery.cssHooks[ prefix + suffix ] = { |
|
7218 expand: function( value ) { |
|
7219 var i = 0, |
|
7220 expanded = {}, |
|
7221 |
|
7222 // Assumes a single number if not a string |
|
7223 parts = typeof value === "string" ? value.split( " " ) : [ value ]; |
|
7224 |
|
7225 for ( ; i < 4; i++ ) { |
|
7226 expanded[ prefix + cssExpand[ i ] + suffix ] = |
|
7227 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; |
|
7228 } |
|
7229 |
|
7230 return expanded; |
|
7231 } |
|
7232 }; |
|
7233 |
|
7234 if ( prefix !== "margin" ) { |
|
7235 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; |
|
7236 } |
|
7237 } ); |
|
7238 |
|
7239 jQuery.fn.extend( { |
|
7240 css: function( name, value ) { |
|
7241 return access( this, function( elem, name, value ) { |
|
7242 var styles, len, |
|
7243 map = {}, |
|
7244 i = 0; |
|
7245 |
|
7246 if ( Array.isArray( name ) ) { |
|
7247 styles = getStyles( elem ); |
|
7248 len = name.length; |
|
7249 |
|
7250 for ( ; i < len; i++ ) { |
|
7251 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); |
|
7252 } |
|
7253 |
|
7254 return map; |
|
7255 } |
|
7256 |
|
7257 return value !== undefined ? |
|
7258 jQuery.style( elem, name, value ) : |
|
7259 jQuery.css( elem, name ); |
|
7260 }, name, value, arguments.length > 1 ); |
|
7261 } |
|
7262 } ); |
|
7263 |
|
7264 |
|
7265 function Tween( elem, options, prop, end, easing ) { |
|
7266 return new Tween.prototype.init( elem, options, prop, end, easing ); |
|
7267 } |
|
7268 jQuery.Tween = Tween; |
|
7269 |
|
7270 Tween.prototype = { |
|
7271 constructor: Tween, |
|
7272 init: function( elem, options, prop, end, easing, unit ) { |
|
7273 this.elem = elem; |
|
7274 this.prop = prop; |
|
7275 this.easing = easing || jQuery.easing._default; |
|
7276 this.options = options; |
|
7277 this.start = this.now = this.cur(); |
|
7278 this.end = end; |
|
7279 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); |
|
7280 }, |
|
7281 cur: function() { |
|
7282 var hooks = Tween.propHooks[ this.prop ]; |
|
7283 |
|
7284 return hooks && hooks.get ? |
|
7285 hooks.get( this ) : |
|
7286 Tween.propHooks._default.get( this ); |
|
7287 }, |
|
7288 run: function( percent ) { |
|
7289 var eased, |
|
7290 hooks = Tween.propHooks[ this.prop ]; |
|
7291 |
|
7292 if ( this.options.duration ) { |
|
7293 this.pos = eased = jQuery.easing[ this.easing ]( |
|
7294 percent, this.options.duration * percent, 0, 1, this.options.duration |
|
7295 ); |
|
7296 } else { |
|
7297 this.pos = eased = percent; |
|
7298 } |
|
7299 this.now = ( this.end - this.start ) * eased + this.start; |
|
7300 |
|
7301 if ( this.options.step ) { |
|
7302 this.options.step.call( this.elem, this.now, this ); |
|
7303 } |
|
7304 |
|
7305 if ( hooks && hooks.set ) { |
|
7306 hooks.set( this ); |
|
7307 } else { |
|
7308 Tween.propHooks._default.set( this ); |
|
7309 } |
|
7310 return this; |
|
7311 } |
|
7312 }; |
|
7313 |
|
7314 Tween.prototype.init.prototype = Tween.prototype; |
|
7315 |
|
7316 Tween.propHooks = { |
|
7317 _default: { |
|
7318 get: function( tween ) { |
|
7319 var result; |
|
7320 |
|
7321 // Use a property on the element directly when it is not a DOM element, |
|
7322 // or when there is no matching style property that exists. |
|
7323 if ( tween.elem.nodeType !== 1 || |
|
7324 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { |
|
7325 return tween.elem[ tween.prop ]; |
|
7326 } |
|
7327 |
|
7328 // Passing an empty string as a 3rd parameter to .css will automatically |
|
7329 // attempt a parseFloat and fallback to a string if the parse fails. |
|
7330 // Simple values such as "10px" are parsed to Float; |
|
7331 // complex values such as "rotate(1rad)" are returned as-is. |
|
7332 result = jQuery.css( tween.elem, tween.prop, "" ); |
|
7333 |
|
7334 // Empty strings, null, undefined and "auto" are converted to 0. |
|
7335 return !result || result === "auto" ? 0 : result; |
|
7336 }, |
|
7337 set: function( tween ) { |
|
7338 |
|
7339 // Use step hook for back compat. |
|
7340 // Use cssHook if its there. |
|
7341 // Use .style if available and use plain properties where available. |
|
7342 if ( jQuery.fx.step[ tween.prop ] ) { |
|
7343 jQuery.fx.step[ tween.prop ]( tween ); |
|
7344 } else if ( tween.elem.nodeType === 1 && ( |
|
7345 jQuery.cssHooks[ tween.prop ] || |
|
7346 tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { |
|
7347 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); |
|
7348 } else { |
|
7349 tween.elem[ tween.prop ] = tween.now; |
|
7350 } |
|
7351 } |
|
7352 } |
|
7353 }; |
|
7354 |
|
7355 // Support: IE <=9 only |
|
7356 // Panic based approach to setting things on disconnected nodes |
|
7357 Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { |
|
7358 set: function( tween ) { |
|
7359 if ( tween.elem.nodeType && tween.elem.parentNode ) { |
|
7360 tween.elem[ tween.prop ] = tween.now; |
|
7361 } |
|
7362 } |
|
7363 }; |
|
7364 |
|
7365 jQuery.easing = { |
|
7366 linear: function( p ) { |
|
7367 return p; |
|
7368 }, |
|
7369 swing: function( p ) { |
|
7370 return 0.5 - Math.cos( p * Math.PI ) / 2; |
|
7371 }, |
|
7372 _default: "swing" |
|
7373 }; |
|
7374 |
|
7375 jQuery.fx = Tween.prototype.init; |
|
7376 |
|
7377 // Back compat <1.8 extension point |
|
7378 jQuery.fx.step = {}; |
|
7379 |
|
7380 |
|
7381 |
|
7382 |
|
7383 var |
|
7384 fxNow, inProgress, |
|
7385 rfxtypes = /^(?:toggle|show|hide)$/, |
|
7386 rrun = /queueHooks$/; |
|
7387 |
|
7388 function schedule() { |
|
7389 if ( inProgress ) { |
|
7390 if ( document.hidden === false && window.requestAnimationFrame ) { |
|
7391 window.requestAnimationFrame( schedule ); |
|
7392 } else { |
|
7393 window.setTimeout( schedule, jQuery.fx.interval ); |
|
7394 } |
|
7395 |
|
7396 jQuery.fx.tick(); |
|
7397 } |
|
7398 } |
|
7399 |
|
7400 // Animations created synchronously will run synchronously |
|
7401 function createFxNow() { |
|
7402 window.setTimeout( function() { |
|
7403 fxNow = undefined; |
|
7404 } ); |
|
7405 return ( fxNow = Date.now() ); |
|
7406 } |
|
7407 |
|
7408 // Generate parameters to create a standard animation |
|
7409 function genFx( type, includeWidth ) { |
|
7410 var which, |
|
7411 i = 0, |
|
7412 attrs = { height: type }; |
|
7413 |
|
7414 // If we include width, step value is 1 to do all cssExpand values, |
|
7415 // otherwise step value is 2 to skip over Left and Right |
|
7416 includeWidth = includeWidth ? 1 : 0; |
|
7417 for ( ; i < 4; i += 2 - includeWidth ) { |
|
7418 which = cssExpand[ i ]; |
|
7419 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; |
|
7420 } |
|
7421 |
|
7422 if ( includeWidth ) { |
|
7423 attrs.opacity = attrs.width = type; |
|
7424 } |
|
7425 |
|
7426 return attrs; |
|
7427 } |
|
7428 |
|
7429 function createTween( value, prop, animation ) { |
|
7430 var tween, |
|
7431 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), |
|
7432 index = 0, |
|
7433 length = collection.length; |
|
7434 for ( ; index < length; index++ ) { |
|
7435 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { |
|
7436 |
|
7437 // We're done with this property |
|
7438 return tween; |
|
7439 } |
|
7440 } |
|
7441 } |
|
7442 |
|
7443 function defaultPrefilter( elem, props, opts ) { |
|
7444 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, |
|
7445 isBox = "width" in props || "height" in props, |
|
7446 anim = this, |
|
7447 orig = {}, |
|
7448 style = elem.style, |
|
7449 hidden = elem.nodeType && isHiddenWithinTree( elem ), |
|
7450 dataShow = dataPriv.get( elem, "fxshow" ); |
|
7451 |
|
7452 // Queue-skipping animations hijack the fx hooks |
|
7453 if ( !opts.queue ) { |
|
7454 hooks = jQuery._queueHooks( elem, "fx" ); |
|
7455 if ( hooks.unqueued == null ) { |
|
7456 hooks.unqueued = 0; |
|
7457 oldfire = hooks.empty.fire; |
|
7458 hooks.empty.fire = function() { |
|
7459 if ( !hooks.unqueued ) { |
|
7460 oldfire(); |
|
7461 } |
|
7462 }; |
|
7463 } |
|
7464 hooks.unqueued++; |
|
7465 |
|
7466 anim.always( function() { |
|
7467 |
|
7468 // Ensure the complete handler is called before this completes |
|
7469 anim.always( function() { |
|
7470 hooks.unqueued--; |
|
7471 if ( !jQuery.queue( elem, "fx" ).length ) { |
|
7472 hooks.empty.fire(); |
|
7473 } |
|
7474 } ); |
|
7475 } ); |
|
7476 } |
|
7477 |
|
7478 // Detect show/hide animations |
|
7479 for ( prop in props ) { |
|
7480 value = props[ prop ]; |
|
7481 if ( rfxtypes.test( value ) ) { |
|
7482 delete props[ prop ]; |
|
7483 toggle = toggle || value === "toggle"; |
|
7484 if ( value === ( hidden ? "hide" : "show" ) ) { |
|
7485 |
|
7486 // Pretend to be hidden if this is a "show" and |
|
7487 // there is still data from a stopped show/hide |
|
7488 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { |
|
7489 hidden = true; |
|
7490 |
|
7491 // Ignore all other no-op show/hide data |
|
7492 } else { |
|
7493 continue; |
|
7494 } |
|
7495 } |
|
7496 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); |
|
7497 } |
|
7498 } |
|
7499 |
|
7500 // Bail out if this is a no-op like .hide().hide() |
|
7501 propTween = !jQuery.isEmptyObject( props ); |
|
7502 if ( !propTween && jQuery.isEmptyObject( orig ) ) { |
|
7503 return; |
|
7504 } |
|
7505 |
|
7506 // Restrict "overflow" and "display" styles during box animations |
|
7507 if ( isBox && elem.nodeType === 1 ) { |
|
7508 |
|
7509 // Support: IE <=9 - 11, Edge 12 - 15 |
|
7510 // Record all 3 overflow attributes because IE does not infer the shorthand |
|
7511 // from identically-valued overflowX and overflowY and Edge just mirrors |
|
7512 // the overflowX value there. |
|
7513 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; |
|
7514 |
|
7515 // Identify a display type, preferring old show/hide data over the CSS cascade |
|
7516 restoreDisplay = dataShow && dataShow.display; |
|
7517 if ( restoreDisplay == null ) { |
|
7518 restoreDisplay = dataPriv.get( elem, "display" ); |
|
7519 } |
|
7520 display = jQuery.css( elem, "display" ); |
|
7521 if ( display === "none" ) { |
|
7522 if ( restoreDisplay ) { |
|
7523 display = restoreDisplay; |
|
7524 } else { |
|
7525 |
|
7526 // Get nonempty value(s) by temporarily forcing visibility |
|
7527 showHide( [ elem ], true ); |
|
7528 restoreDisplay = elem.style.display || restoreDisplay; |
|
7529 display = jQuery.css( elem, "display" ); |
|
7530 showHide( [ elem ] ); |
|
7531 } |
|
7532 } |
|
7533 |
|
7534 // Animate inline elements as inline-block |
|
7535 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { |
|
7536 if ( jQuery.css( elem, "float" ) === "none" ) { |
|
7537 |
|
7538 // Restore the original display value at the end of pure show/hide animations |
|
7539 if ( !propTween ) { |
|
7540 anim.done( function() { |
|
7541 style.display = restoreDisplay; |
|
7542 } ); |
|
7543 if ( restoreDisplay == null ) { |
|
7544 display = style.display; |
|
7545 restoreDisplay = display === "none" ? "" : display; |
|
7546 } |
|
7547 } |
|
7548 style.display = "inline-block"; |
|
7549 } |
|
7550 } |
|
7551 } |
|
7552 |
|
7553 if ( opts.overflow ) { |
|
7554 style.overflow = "hidden"; |
|
7555 anim.always( function() { |
|
7556 style.overflow = opts.overflow[ 0 ]; |
|
7557 style.overflowX = opts.overflow[ 1 ]; |
|
7558 style.overflowY = opts.overflow[ 2 ]; |
|
7559 } ); |
|
7560 } |
|
7561 |
|
7562 // Implement show/hide animations |
|
7563 propTween = false; |
|
7564 for ( prop in orig ) { |
|
7565 |
|
7566 // General show/hide setup for this element animation |
|
7567 if ( !propTween ) { |
|
7568 if ( dataShow ) { |
|
7569 if ( "hidden" in dataShow ) { |
|
7570 hidden = dataShow.hidden; |
|
7571 } |
|
7572 } else { |
|
7573 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); |
|
7574 } |
|
7575 |
|
7576 // Store hidden/visible for toggle so `.stop().toggle()` "reverses" |
|
7577 if ( toggle ) { |
|
7578 dataShow.hidden = !hidden; |
|
7579 } |
|
7580 |
|
7581 // Show elements before animating them |
|
7582 if ( hidden ) { |
|
7583 showHide( [ elem ], true ); |
|
7584 } |
|
7585 |
|
7586 /* eslint-disable no-loop-func */ |
|
7587 |
|
7588 anim.done( function() { |
|
7589 |
|
7590 /* eslint-enable no-loop-func */ |
|
7591 |
|
7592 // The final step of a "hide" animation is actually hiding the element |
|
7593 if ( !hidden ) { |
|
7594 showHide( [ elem ] ); |
|
7595 } |
|
7596 dataPriv.remove( elem, "fxshow" ); |
|
7597 for ( prop in orig ) { |
|
7598 jQuery.style( elem, prop, orig[ prop ] ); |
|
7599 } |
|
7600 } ); |
|
7601 } |
|
7602 |
|
7603 // Per-property setup |
|
7604 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); |
|
7605 if ( !( prop in dataShow ) ) { |
|
7606 dataShow[ prop ] = propTween.start; |
|
7607 if ( hidden ) { |
|
7608 propTween.end = propTween.start; |
|
7609 propTween.start = 0; |
|
7610 } |
|
7611 } |
|
7612 } |
|
7613 } |
|
7614 |
|
7615 function propFilter( props, specialEasing ) { |
|
7616 var index, name, easing, value, hooks; |
|
7617 |
|
7618 // camelCase, specialEasing and expand cssHook pass |
|
7619 for ( index in props ) { |
|
7620 name = camelCase( index ); |
|
7621 easing = specialEasing[ name ]; |
|
7622 value = props[ index ]; |
|
7623 if ( Array.isArray( value ) ) { |
|
7624 easing = value[ 1 ]; |
|
7625 value = props[ index ] = value[ 0 ]; |
|
7626 } |
|
7627 |
|
7628 if ( index !== name ) { |
|
7629 props[ name ] = value; |
|
7630 delete props[ index ]; |
|
7631 } |
|
7632 |
|
7633 hooks = jQuery.cssHooks[ name ]; |
|
7634 if ( hooks && "expand" in hooks ) { |
|
7635 value = hooks.expand( value ); |
|
7636 delete props[ name ]; |
|
7637 |
|
7638 // Not quite $.extend, this won't overwrite existing keys. |
|
7639 // Reusing 'index' because we have the correct "name" |
|
7640 for ( index in value ) { |
|
7641 if ( !( index in props ) ) { |
|
7642 props[ index ] = value[ index ]; |
|
7643 specialEasing[ index ] = easing; |
|
7644 } |
|
7645 } |
|
7646 } else { |
|
7647 specialEasing[ name ] = easing; |
|
7648 } |
|
7649 } |
|
7650 } |
|
7651 |
|
7652 function Animation( elem, properties, options ) { |
|
7653 var result, |
|
7654 stopped, |
|
7655 index = 0, |
|
7656 length = Animation.prefilters.length, |
|
7657 deferred = jQuery.Deferred().always( function() { |
|
7658 |
|
7659 // Don't match elem in the :animated selector |
|
7660 delete tick.elem; |
|
7661 } ), |
|
7662 tick = function() { |
|
7663 if ( stopped ) { |
|
7664 return false; |
|
7665 } |
|
7666 var currentTime = fxNow || createFxNow(), |
|
7667 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), |
|
7668 |
|
7669 // Support: Android 2.3 only |
|
7670 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (trac-12497) |
|
7671 temp = remaining / animation.duration || 0, |
|
7672 percent = 1 - temp, |
|
7673 index = 0, |
|
7674 length = animation.tweens.length; |
|
7675 |
|
7676 for ( ; index < length; index++ ) { |
|
7677 animation.tweens[ index ].run( percent ); |
|
7678 } |
|
7679 |
|
7680 deferred.notifyWith( elem, [ animation, percent, remaining ] ); |
|
7681 |
|
7682 // If there's more to do, yield |
|
7683 if ( percent < 1 && length ) { |
|
7684 return remaining; |
|
7685 } |
|
7686 |
|
7687 // If this was an empty animation, synthesize a final progress notification |
|
7688 if ( !length ) { |
|
7689 deferred.notifyWith( elem, [ animation, 1, 0 ] ); |
|
7690 } |
|
7691 |
|
7692 // Resolve the animation and report its conclusion |
|
7693 deferred.resolveWith( elem, [ animation ] ); |
|
7694 return false; |
|
7695 }, |
|
7696 animation = deferred.promise( { |
|
7697 elem: elem, |
|
7698 props: jQuery.extend( {}, properties ), |
|
7699 opts: jQuery.extend( true, { |
|
7700 specialEasing: {}, |
|
7701 easing: jQuery.easing._default |
|
7702 }, options ), |
|
7703 originalProperties: properties, |
|
7704 originalOptions: options, |
|
7705 startTime: fxNow || createFxNow(), |
|
7706 duration: options.duration, |
|
7707 tweens: [], |
|
7708 createTween: function( prop, end ) { |
|
7709 var tween = jQuery.Tween( elem, animation.opts, prop, end, |
|
7710 animation.opts.specialEasing[ prop ] || animation.opts.easing ); |
|
7711 animation.tweens.push( tween ); |
|
7712 return tween; |
|
7713 }, |
|
7714 stop: function( gotoEnd ) { |
|
7715 var index = 0, |
|
7716 |
|
7717 // If we are going to the end, we want to run all the tweens |
|
7718 // otherwise we skip this part |
|
7719 length = gotoEnd ? animation.tweens.length : 0; |
|
7720 if ( stopped ) { |
|
7721 return this; |
|
7722 } |
|
7723 stopped = true; |
|
7724 for ( ; index < length; index++ ) { |
|
7725 animation.tweens[ index ].run( 1 ); |
|
7726 } |
|
7727 |
|
7728 // Resolve when we played the last frame; otherwise, reject |
|
7729 if ( gotoEnd ) { |
|
7730 deferred.notifyWith( elem, [ animation, 1, 0 ] ); |
|
7731 deferred.resolveWith( elem, [ animation, gotoEnd ] ); |
|
7732 } else { |
|
7733 deferred.rejectWith( elem, [ animation, gotoEnd ] ); |
|
7734 } |
|
7735 return this; |
|
7736 } |
|
7737 } ), |
|
7738 props = animation.props; |
|
7739 |
|
7740 propFilter( props, animation.opts.specialEasing ); |
|
7741 |
|
7742 for ( ; index < length; index++ ) { |
|
7743 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); |
|
7744 if ( result ) { |
|
7745 if ( isFunction( result.stop ) ) { |
|
7746 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = |
|
7747 result.stop.bind( result ); |
|
7748 } |
|
7749 return result; |
|
7750 } |
|
7751 } |
|
7752 |
|
7753 jQuery.map( props, createTween, animation ); |
|
7754 |
|
7755 if ( isFunction( animation.opts.start ) ) { |
|
7756 animation.opts.start.call( elem, animation ); |
|
7757 } |
|
7758 |
|
7759 // Attach callbacks from options |
|
7760 animation |
|
7761 .progress( animation.opts.progress ) |
|
7762 .done( animation.opts.done, animation.opts.complete ) |
|
7763 .fail( animation.opts.fail ) |
|
7764 .always( animation.opts.always ); |
|
7765 |
|
7766 jQuery.fx.timer( |
|
7767 jQuery.extend( tick, { |
|
7768 elem: elem, |
|
7769 anim: animation, |
|
7770 queue: animation.opts.queue |
|
7771 } ) |
|
7772 ); |
|
7773 |
|
7774 return animation; |
|
7775 } |
|
7776 |
|
7777 jQuery.Animation = jQuery.extend( Animation, { |
|
7778 |
|
7779 tweeners: { |
|
7780 "*": [ function( prop, value ) { |
|
7781 var tween = this.createTween( prop, value ); |
|
7782 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); |
|
7783 return tween; |
|
7784 } ] |
|
7785 }, |
|
7786 |
|
7787 tweener: function( props, callback ) { |
|
7788 if ( isFunction( props ) ) { |
|
7789 callback = props; |
|
7790 props = [ "*" ]; |
|
7791 } else { |
|
7792 props = props.match( rnothtmlwhite ); |
|
7793 } |
|
7794 |
|
7795 var prop, |
|
7796 index = 0, |
|
7797 length = props.length; |
|
7798 |
|
7799 for ( ; index < length; index++ ) { |
|
7800 prop = props[ index ]; |
|
7801 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; |
|
7802 Animation.tweeners[ prop ].unshift( callback ); |
|
7803 } |
|
7804 }, |
|
7805 |
|
7806 prefilters: [ defaultPrefilter ], |
|
7807 |
|
7808 prefilter: function( callback, prepend ) { |
|
7809 if ( prepend ) { |
|
7810 Animation.prefilters.unshift( callback ); |
|
7811 } else { |
|
7812 Animation.prefilters.push( callback ); |
|
7813 } |
|
7814 } |
|
7815 } ); |
|
7816 |
|
7817 jQuery.speed = function( speed, easing, fn ) { |
|
7818 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { |
|
7819 complete: fn || !fn && easing || |
|
7820 isFunction( speed ) && speed, |
|
7821 duration: speed, |
|
7822 easing: fn && easing || easing && !isFunction( easing ) && easing |
|
7823 }; |
|
7824 |
|
7825 // Go to the end state if fx are off |
|
7826 if ( jQuery.fx.off ) { |
|
7827 opt.duration = 0; |
|
7828 |
|
7829 } else { |
|
7830 if ( typeof opt.duration !== "number" ) { |
|
7831 if ( opt.duration in jQuery.fx.speeds ) { |
|
7832 opt.duration = jQuery.fx.speeds[ opt.duration ]; |
|
7833 |
|
7834 } else { |
|
7835 opt.duration = jQuery.fx.speeds._default; |
|
7836 } |
|
7837 } |
|
7838 } |
|
7839 |
|
7840 // Normalize opt.queue - true/undefined/null -> "fx" |
|
7841 if ( opt.queue == null || opt.queue === true ) { |
|
7842 opt.queue = "fx"; |
|
7843 } |
|
7844 |
|
7845 // Queueing |
|
7846 opt.old = opt.complete; |
|
7847 |
|
7848 opt.complete = function() { |
|
7849 if ( isFunction( opt.old ) ) { |
|
7850 opt.old.call( this ); |
|
7851 } |
|
7852 |
|
7853 if ( opt.queue ) { |
|
7854 jQuery.dequeue( this, opt.queue ); |
|
7855 } |
|
7856 }; |
|
7857 |
|
7858 return opt; |
|
7859 }; |
|
7860 |
|
7861 jQuery.fn.extend( { |
|
7862 fadeTo: function( speed, to, easing, callback ) { |
|
7863 |
|
7864 // Show any hidden elements after setting opacity to 0 |
|
7865 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() |
|
7866 |
|
7867 // Animate to the value specified |
|
7868 .end().animate( { opacity: to }, speed, easing, callback ); |
|
7869 }, |
|
7870 animate: function( prop, speed, easing, callback ) { |
|
7871 var empty = jQuery.isEmptyObject( prop ), |
|
7872 optall = jQuery.speed( speed, easing, callback ), |
|
7873 doAnimation = function() { |
|
7874 |
|
7875 // Operate on a copy of prop so per-property easing won't be lost |
|
7876 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); |
|
7877 |
|
7878 // Empty animations, or finishing resolves immediately |
|
7879 if ( empty || dataPriv.get( this, "finish" ) ) { |
|
7880 anim.stop( true ); |
|
7881 } |
|
7882 }; |
|
7883 |
|
7884 doAnimation.finish = doAnimation; |
|
7885 |
|
7886 return empty || optall.queue === false ? |
|
7887 this.each( doAnimation ) : |
|
7888 this.queue( optall.queue, doAnimation ); |
|
7889 }, |
|
7890 stop: function( type, clearQueue, gotoEnd ) { |
|
7891 var stopQueue = function( hooks ) { |
|
7892 var stop = hooks.stop; |
|
7893 delete hooks.stop; |
|
7894 stop( gotoEnd ); |
|
7895 }; |
|
7896 |
|
7897 if ( typeof type !== "string" ) { |
|
7898 gotoEnd = clearQueue; |
|
7899 clearQueue = type; |
|
7900 type = undefined; |
|
7901 } |
|
7902 if ( clearQueue ) { |
|
7903 this.queue( type || "fx", [] ); |
|
7904 } |
|
7905 |
|
7906 return this.each( function() { |
|
7907 var dequeue = true, |
|
7908 index = type != null && type + "queueHooks", |
|
7909 timers = jQuery.timers, |
|
7910 data = dataPriv.get( this ); |
|
7911 |
|
7912 if ( index ) { |
|
7913 if ( data[ index ] && data[ index ].stop ) { |
|
7914 stopQueue( data[ index ] ); |
|
7915 } |
|
7916 } else { |
|
7917 for ( index in data ) { |
|
7918 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { |
|
7919 stopQueue( data[ index ] ); |
|
7920 } |
|
7921 } |
|
7922 } |
|
7923 |
|
7924 for ( index = timers.length; index--; ) { |
|
7925 if ( timers[ index ].elem === this && |
|
7926 ( type == null || timers[ index ].queue === type ) ) { |
|
7927 |
|
7928 timers[ index ].anim.stop( gotoEnd ); |
|
7929 dequeue = false; |
|
7930 timers.splice( index, 1 ); |
|
7931 } |
|
7932 } |
|
7933 |
|
7934 // Start the next in the queue if the last step wasn't forced. |
|
7935 // Timers currently will call their complete callbacks, which |
|
7936 // will dequeue but only if they were gotoEnd. |
|
7937 if ( dequeue || !gotoEnd ) { |
|
7938 jQuery.dequeue( this, type ); |
|
7939 } |
|
7940 } ); |
|
7941 }, |
|
7942 finish: function( type ) { |
|
7943 if ( type !== false ) { |
|
7944 type = type || "fx"; |
|
7945 } |
|
7946 return this.each( function() { |
|
7947 var index, |
|
7948 data = dataPriv.get( this ), |
|
7949 queue = data[ type + "queue" ], |
|
7950 hooks = data[ type + "queueHooks" ], |
|
7951 timers = jQuery.timers, |
|
7952 length = queue ? queue.length : 0; |
|
7953 |
|
7954 // Enable finishing flag on private data |
|
7955 data.finish = true; |
|
7956 |
|
7957 // Empty the queue first |
|
7958 jQuery.queue( this, type, [] ); |
|
7959 |
|
7960 if ( hooks && hooks.stop ) { |
|
7961 hooks.stop.call( this, true ); |
|
7962 } |
|
7963 |
|
7964 // Look for any active animations, and finish them |
|
7965 for ( index = timers.length; index--; ) { |
|
7966 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { |
|
7967 timers[ index ].anim.stop( true ); |
|
7968 timers.splice( index, 1 ); |
|
7969 } |
|
7970 } |
|
7971 |
|
7972 // Look for any animations in the old queue and finish them |
|
7973 for ( index = 0; index < length; index++ ) { |
|
7974 if ( queue[ index ] && queue[ index ].finish ) { |
|
7975 queue[ index ].finish.call( this ); |
|
7976 } |
|
7977 } |
|
7978 |
|
7979 // Turn off finishing flag |
|
7980 delete data.finish; |
|
7981 } ); |
|
7982 } |
|
7983 } ); |
|
7984 |
|
7985 jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) { |
|
7986 var cssFn = jQuery.fn[ name ]; |
|
7987 jQuery.fn[ name ] = function( speed, easing, callback ) { |
|
7988 return speed == null || typeof speed === "boolean" ? |
|
7989 cssFn.apply( this, arguments ) : |
|
7990 this.animate( genFx( name, true ), speed, easing, callback ); |
|
7991 }; |
|
7992 } ); |
|
7993 |
|
7994 // Generate shortcuts for custom animations |
|
7995 jQuery.each( { |
|
7996 slideDown: genFx( "show" ), |
|
7997 slideUp: genFx( "hide" ), |
|
7998 slideToggle: genFx( "toggle" ), |
|
7999 fadeIn: { opacity: "show" }, |
|
8000 fadeOut: { opacity: "hide" }, |
|
8001 fadeToggle: { opacity: "toggle" } |
|
8002 }, function( name, props ) { |
|
8003 jQuery.fn[ name ] = function( speed, easing, callback ) { |
|
8004 return this.animate( props, speed, easing, callback ); |
|
8005 }; |
|
8006 } ); |
|
8007 |
|
8008 jQuery.timers = []; |
|
8009 jQuery.fx.tick = function() { |
|
8010 var timer, |
|
8011 i = 0, |
|
8012 timers = jQuery.timers; |
|
8013 |
|
8014 fxNow = Date.now(); |
|
8015 |
|
8016 for ( ; i < timers.length; i++ ) { |
|
8017 timer = timers[ i ]; |
|
8018 |
|
8019 // Run the timer and safely remove it when done (allowing for external removal) |
|
8020 if ( !timer() && timers[ i ] === timer ) { |
|
8021 timers.splice( i--, 1 ); |
|
8022 } |
|
8023 } |
|
8024 |
|
8025 if ( !timers.length ) { |
|
8026 jQuery.fx.stop(); |
|
8027 } |
|
8028 fxNow = undefined; |
|
8029 }; |
|
8030 |
|
8031 jQuery.fx.timer = function( timer ) { |
|
8032 jQuery.timers.push( timer ); |
|
8033 jQuery.fx.start(); |
|
8034 }; |
|
8035 |
|
8036 jQuery.fx.interval = 13; |
|
8037 jQuery.fx.start = function() { |
|
8038 if ( inProgress ) { |
|
8039 return; |
|
8040 } |
|
8041 |
|
8042 inProgress = true; |
|
8043 schedule(); |
|
8044 }; |
|
8045 |
|
8046 jQuery.fx.stop = function() { |
|
8047 inProgress = null; |
|
8048 }; |
|
8049 |
|
8050 jQuery.fx.speeds = { |
|
8051 slow: 600, |
|
8052 fast: 200, |
|
8053 |
|
8054 // Default speed |
|
8055 _default: 400 |
|
8056 }; |
|
8057 |
|
8058 |
|
8059 // Based off of the plugin by Clint Helfers, with permission. |
|
8060 jQuery.fn.delay = function( time, type ) { |
|
8061 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; |
|
8062 type = type || "fx"; |
|
8063 |
|
8064 return this.queue( type, function( next, hooks ) { |
|
8065 var timeout = window.setTimeout( next, time ); |
|
8066 hooks.stop = function() { |
|
8067 window.clearTimeout( timeout ); |
|
8068 }; |
|
8069 } ); |
|
8070 }; |
|
8071 |
|
8072 |
|
8073 ( function() { |
|
8074 var input = document.createElement( "input" ), |
|
8075 select = document.createElement( "select" ), |
|
8076 opt = select.appendChild( document.createElement( "option" ) ); |
|
8077 |
|
8078 input.type = "checkbox"; |
|
8079 |
|
8080 // Support: Android <=4.3 only |
|
8081 // Default value for a checkbox should be "on" |
|
8082 support.checkOn = input.value !== ""; |
|
8083 |
|
8084 // Support: IE <=11 only |
|
8085 // Must access selectedIndex to make default options select |
|
8086 support.optSelected = opt.selected; |
|
8087 |
|
8088 // Support: IE <=11 only |
|
8089 // An input loses its value after becoming a radio |
|
8090 input = document.createElement( "input" ); |
|
8091 input.value = "t"; |
|
8092 input.type = "radio"; |
|
8093 support.radioValue = input.value === "t"; |
|
8094 } )(); |
|
8095 |
|
8096 |
|
8097 var boolHook, |
|
8098 attrHandle = jQuery.expr.attrHandle; |
|
8099 |
|
8100 jQuery.fn.extend( { |
|
8101 attr: function( name, value ) { |
|
8102 return access( this, jQuery.attr, name, value, arguments.length > 1 ); |
|
8103 }, |
|
8104 |
|
8105 removeAttr: function( name ) { |
|
8106 return this.each( function() { |
|
8107 jQuery.removeAttr( this, name ); |
|
8108 } ); |
|
8109 } |
|
8110 } ); |
|
8111 |
|
8112 jQuery.extend( { |
|
8113 attr: function( elem, name, value ) { |
|
8114 var ret, hooks, |
|
8115 nType = elem.nodeType; |
|
8116 |
|
8117 // Don't get/set attributes on text, comment and attribute nodes |
|
8118 if ( nType === 3 || nType === 8 || nType === 2 ) { |
|
8119 return; |
|
8120 } |
|
8121 |
|
8122 // Fallback to prop when attributes are not supported |
|
8123 if ( typeof elem.getAttribute === "undefined" ) { |
|
8124 return jQuery.prop( elem, name, value ); |
|
8125 } |
|
8126 |
|
8127 // Attribute hooks are determined by the lowercase version |
|
8128 // Grab necessary hook if one is defined |
|
8129 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { |
|
8130 hooks = jQuery.attrHooks[ name.toLowerCase() ] || |
|
8131 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); |
|
8132 } |
|
8133 |
|
8134 if ( value !== undefined ) { |
|
8135 if ( value === null ) { |
|
8136 jQuery.removeAttr( elem, name ); |
|
8137 return; |
|
8138 } |
|
8139 |
|
8140 if ( hooks && "set" in hooks && |
|
8141 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { |
|
8142 return ret; |
|
8143 } |
|
8144 |
|
8145 elem.setAttribute( name, value + "" ); |
|
8146 return value; |
|
8147 } |
|
8148 |
|
8149 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { |
|
8150 return ret; |
|
8151 } |
|
8152 |
|
8153 ret = jQuery.find.attr( elem, name ); |
|
8154 |
|
8155 // Non-existent attributes return null, we normalize to undefined |
|
8156 return ret == null ? undefined : ret; |
|
8157 }, |
|
8158 |
|
8159 attrHooks: { |
|
8160 type: { |
|
8161 set: function( elem, value ) { |
|
8162 if ( !support.radioValue && value === "radio" && |
|
8163 nodeName( elem, "input" ) ) { |
|
8164 var val = elem.value; |
|
8165 elem.setAttribute( "type", value ); |
|
8166 if ( val ) { |
|
8167 elem.value = val; |
|
8168 } |
|
8169 return value; |
|
8170 } |
|
8171 } |
|
8172 } |
|
8173 }, |
|
8174 |
|
8175 removeAttr: function( elem, value ) { |
|
8176 var name, |
|
8177 i = 0, |
|
8178 |
|
8179 // Attribute names can contain non-HTML whitespace characters |
|
8180 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 |
|
8181 attrNames = value && value.match( rnothtmlwhite ); |
|
8182 |
|
8183 if ( attrNames && elem.nodeType === 1 ) { |
|
8184 while ( ( name = attrNames[ i++ ] ) ) { |
|
8185 elem.removeAttribute( name ); |
|
8186 } |
|
8187 } |
|
8188 } |
|
8189 } ); |
|
8190 |
|
8191 // Hooks for boolean attributes |
|
8192 boolHook = { |
|
8193 set: function( elem, value, name ) { |
|
8194 if ( value === false ) { |
|
8195 |
|
8196 // Remove boolean attributes when set to false |
|
8197 jQuery.removeAttr( elem, name ); |
|
8198 } else { |
|
8199 elem.setAttribute( name, name ); |
|
8200 } |
|
8201 return name; |
|
8202 } |
|
8203 }; |
|
8204 |
|
8205 jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) { |
|
8206 var getter = attrHandle[ name ] || jQuery.find.attr; |
|
8207 |
|
8208 attrHandle[ name ] = function( elem, name, isXML ) { |
|
8209 var ret, handle, |
|
8210 lowercaseName = name.toLowerCase(); |
|
8211 |
|
8212 if ( !isXML ) { |
|
8213 |
|
8214 // Avoid an infinite loop by temporarily removing this function from the getter |
|
8215 handle = attrHandle[ lowercaseName ]; |
|
8216 attrHandle[ lowercaseName ] = ret; |
|
8217 ret = getter( elem, name, isXML ) != null ? |
|
8218 lowercaseName : |
|
8219 null; |
|
8220 attrHandle[ lowercaseName ] = handle; |
|
8221 } |
|
8222 return ret; |
|
8223 }; |
|
8224 } ); |
|
8225 |
|
8226 |
|
8227 |
|
8228 |
|
8229 var rfocusable = /^(?:input|select|textarea|button)$/i, |
|
8230 rclickable = /^(?:a|area)$/i; |
|
8231 |
|
8232 jQuery.fn.extend( { |
|
8233 prop: function( name, value ) { |
|
8234 return access( this, jQuery.prop, name, value, arguments.length > 1 ); |
|
8235 }, |
|
8236 |
|
8237 removeProp: function( name ) { |
|
8238 return this.each( function() { |
|
8239 delete this[ jQuery.propFix[ name ] || name ]; |
|
8240 } ); |
|
8241 } |
|
8242 } ); |
|
8243 |
|
8244 jQuery.extend( { |
|
8245 prop: function( elem, name, value ) { |
|
8246 var ret, hooks, |
|
8247 nType = elem.nodeType; |
|
8248 |
|
8249 // Don't get/set properties on text, comment and attribute nodes |
|
8250 if ( nType === 3 || nType === 8 || nType === 2 ) { |
|
8251 return; |
|
8252 } |
|
8253 |
|
8254 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { |
|
8255 |
|
8256 // Fix name and attach hooks |
|
8257 name = jQuery.propFix[ name ] || name; |
|
8258 hooks = jQuery.propHooks[ name ]; |
|
8259 } |
|
8260 |
|
8261 if ( value !== undefined ) { |
|
8262 if ( hooks && "set" in hooks && |
|
8263 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { |
|
8264 return ret; |
|
8265 } |
|
8266 |
|
8267 return ( elem[ name ] = value ); |
|
8268 } |
|
8269 |
|
8270 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { |
|
8271 return ret; |
|
8272 } |
|
8273 |
|
8274 return elem[ name ]; |
|
8275 }, |
|
8276 |
|
8277 propHooks: { |
|
8278 tabIndex: { |
|
8279 get: function( elem ) { |
|
8280 |
|
8281 // Support: IE <=9 - 11 only |
|
8282 // elem.tabIndex doesn't always return the |
|
8283 // correct value when it hasn't been explicitly set |
|
8284 // Use proper attribute retrieval (trac-12072) |
|
8285 var tabindex = jQuery.find.attr( elem, "tabindex" ); |
|
8286 |
|
8287 if ( tabindex ) { |
|
8288 return parseInt( tabindex, 10 ); |
|
8289 } |
|
8290 |
|
8291 if ( |
|
8292 rfocusable.test( elem.nodeName ) || |
|
8293 rclickable.test( elem.nodeName ) && |
|
8294 elem.href |
|
8295 ) { |
|
8296 return 0; |
|
8297 } |
|
8298 |
|
8299 return -1; |
|
8300 } |
|
8301 } |
|
8302 }, |
|
8303 |
|
8304 propFix: { |
|
8305 "for": "htmlFor", |
|
8306 "class": "className" |
|
8307 } |
|
8308 } ); |
|
8309 |
|
8310 // Support: IE <=11 only |
|
8311 // Accessing the selectedIndex property |
|
8312 // forces the browser to respect setting selected |
|
8313 // on the option |
|
8314 // The getter ensures a default option is selected |
|
8315 // when in an optgroup |
|
8316 // eslint rule "no-unused-expressions" is disabled for this code |
|
8317 // since it considers such accessions noop |
|
8318 if ( !support.optSelected ) { |
|
8319 jQuery.propHooks.selected = { |
|
8320 get: function( elem ) { |
|
8321 |
|
8322 /* eslint no-unused-expressions: "off" */ |
|
8323 |
|
8324 var parent = elem.parentNode; |
|
8325 if ( parent && parent.parentNode ) { |
|
8326 parent.parentNode.selectedIndex; |
|
8327 } |
|
8328 return null; |
|
8329 }, |
|
8330 set: function( elem ) { |
|
8331 |
|
8332 /* eslint no-unused-expressions: "off" */ |
|
8333 |
|
8334 var parent = elem.parentNode; |
|
8335 if ( parent ) { |
|
8336 parent.selectedIndex; |
|
8337 |
|
8338 if ( parent.parentNode ) { |
|
8339 parent.parentNode.selectedIndex; |
|
8340 } |
|
8341 } |
|
8342 } |
|
8343 }; |
|
8344 } |
|
8345 |
|
8346 jQuery.each( [ |
|
8347 "tabIndex", |
|
8348 "readOnly", |
|
8349 "maxLength", |
|
8350 "cellSpacing", |
|
8351 "cellPadding", |
|
8352 "rowSpan", |
|
8353 "colSpan", |
|
8354 "useMap", |
|
8355 "frameBorder", |
|
8356 "contentEditable" |
|
8357 ], function() { |
|
8358 jQuery.propFix[ this.toLowerCase() ] = this; |
|
8359 } ); |
|
8360 |
|
8361 |
|
8362 |
|
8363 |
|
8364 // Strip and collapse whitespace according to HTML spec |
|
8365 // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace |
|
8366 function stripAndCollapse( value ) { |
|
8367 var tokens = value.match( rnothtmlwhite ) || []; |
|
8368 return tokens.join( " " ); |
|
8369 } |
|
8370 |
|
8371 |
|
8372 function getClass( elem ) { |
|
8373 return elem.getAttribute && elem.getAttribute( "class" ) || ""; |
|
8374 } |
|
8375 |
|
8376 function classesToArray( value ) { |
|
8377 if ( Array.isArray( value ) ) { |
|
8378 return value; |
|
8379 } |
|
8380 if ( typeof value === "string" ) { |
|
8381 return value.match( rnothtmlwhite ) || []; |
|
8382 } |
|
8383 return []; |
|
8384 } |
|
8385 |
|
8386 jQuery.fn.extend( { |
|
8387 addClass: function( value ) { |
|
8388 var classNames, cur, curValue, className, i, finalValue; |
|
8389 |
|
8390 if ( isFunction( value ) ) { |
|
8391 return this.each( function( j ) { |
|
8392 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); |
|
8393 } ); |
|
8394 } |
|
8395 |
|
8396 classNames = classesToArray( value ); |
|
8397 |
|
8398 if ( classNames.length ) { |
|
8399 return this.each( function() { |
|
8400 curValue = getClass( this ); |
|
8401 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); |
|
8402 |
|
8403 if ( cur ) { |
|
8404 for ( i = 0; i < classNames.length; i++ ) { |
|
8405 className = classNames[ i ]; |
|
8406 if ( cur.indexOf( " " + className + " " ) < 0 ) { |
|
8407 cur += className + " "; |
|
8408 } |
|
8409 } |
|
8410 |
|
8411 // Only assign if different to avoid unneeded rendering. |
|
8412 finalValue = stripAndCollapse( cur ); |
|
8413 if ( curValue !== finalValue ) { |
|
8414 this.setAttribute( "class", finalValue ); |
|
8415 } |
|
8416 } |
|
8417 } ); |
|
8418 } |
|
8419 |
|
8420 return this; |
|
8421 }, |
|
8422 |
|
8423 removeClass: function( value ) { |
|
8424 var classNames, cur, curValue, className, i, finalValue; |
|
8425 |
|
8426 if ( isFunction( value ) ) { |
|
8427 return this.each( function( j ) { |
|
8428 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); |
|
8429 } ); |
|
8430 } |
|
8431 |
|
8432 if ( !arguments.length ) { |
|
8433 return this.attr( "class", "" ); |
|
8434 } |
|
8435 |
|
8436 classNames = classesToArray( value ); |
|
8437 |
|
8438 if ( classNames.length ) { |
|
8439 return this.each( function() { |
|
8440 curValue = getClass( this ); |
|
8441 |
|
8442 // This expression is here for better compressibility (see addClass) |
|
8443 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); |
|
8444 |
|
8445 if ( cur ) { |
|
8446 for ( i = 0; i < classNames.length; i++ ) { |
|
8447 className = classNames[ i ]; |
|
8448 |
|
8449 // Remove *all* instances |
|
8450 while ( cur.indexOf( " " + className + " " ) > -1 ) { |
|
8451 cur = cur.replace( " " + className + " ", " " ); |
|
8452 } |
|
8453 } |
|
8454 |
|
8455 // Only assign if different to avoid unneeded rendering. |
|
8456 finalValue = stripAndCollapse( cur ); |
|
8457 if ( curValue !== finalValue ) { |
|
8458 this.setAttribute( "class", finalValue ); |
|
8459 } |
|
8460 } |
|
8461 } ); |
|
8462 } |
|
8463 |
|
8464 return this; |
|
8465 }, |
|
8466 |
|
8467 toggleClass: function( value, stateVal ) { |
|
8468 var classNames, className, i, self, |
|
8469 type = typeof value, |
|
8470 isValidValue = type === "string" || Array.isArray( value ); |
|
8471 |
|
8472 if ( isFunction( value ) ) { |
|
8473 return this.each( function( i ) { |
|
8474 jQuery( this ).toggleClass( |
|
8475 value.call( this, i, getClass( this ), stateVal ), |
|
8476 stateVal |
|
8477 ); |
|
8478 } ); |
|
8479 } |
|
8480 |
|
8481 if ( typeof stateVal === "boolean" && isValidValue ) { |
|
8482 return stateVal ? this.addClass( value ) : this.removeClass( value ); |
|
8483 } |
|
8484 |
|
8485 classNames = classesToArray( value ); |
|
8486 |
|
8487 return this.each( function() { |
|
8488 if ( isValidValue ) { |
|
8489 |
|
8490 // Toggle individual class names |
|
8491 self = jQuery( this ); |
|
8492 |
|
8493 for ( i = 0; i < classNames.length; i++ ) { |
|
8494 className = classNames[ i ]; |
|
8495 |
|
8496 // Check each className given, space separated list |
|
8497 if ( self.hasClass( className ) ) { |
|
8498 self.removeClass( className ); |
|
8499 } else { |
|
8500 self.addClass( className ); |
|
8501 } |
|
8502 } |
|
8503 |
|
8504 // Toggle whole class name |
|
8505 } else if ( value === undefined || type === "boolean" ) { |
|
8506 className = getClass( this ); |
|
8507 if ( className ) { |
|
8508 |
|
8509 // Store className if set |
|
8510 dataPriv.set( this, "__className__", className ); |
|
8511 } |
|
8512 |
|
8513 // If the element has a class name or if we're passed `false`, |
|
8514 // then remove the whole classname (if there was one, the above saved it). |
|
8515 // Otherwise bring back whatever was previously saved (if anything), |
|
8516 // falling back to the empty string if nothing was stored. |
|
8517 if ( this.setAttribute ) { |
|
8518 this.setAttribute( "class", |
|
8519 className || value === false ? |
|
8520 "" : |
|
8521 dataPriv.get( this, "__className__" ) || "" |
|
8522 ); |
|
8523 } |
|
8524 } |
|
8525 } ); |
|
8526 }, |
|
8527 |
|
8528 hasClass: function( selector ) { |
|
8529 var className, elem, |
|
8530 i = 0; |
|
8531 |
|
8532 className = " " + selector + " "; |
|
8533 while ( ( elem = this[ i++ ] ) ) { |
|
8534 if ( elem.nodeType === 1 && |
|
8535 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { |
|
8536 return true; |
|
8537 } |
|
8538 } |
|
8539 |
|
8540 return false; |
|
8541 } |
|
8542 } ); |
|
8543 |
|
8544 |
|
8545 |
|
8546 |
|
8547 var rreturn = /\r/g; |
|
8548 |
|
8549 jQuery.fn.extend( { |
|
8550 val: function( value ) { |
|
8551 var hooks, ret, valueIsFunction, |
|
8552 elem = this[ 0 ]; |
|
8553 |
|
8554 if ( !arguments.length ) { |
|
8555 if ( elem ) { |
|
8556 hooks = jQuery.valHooks[ elem.type ] || |
|
8557 jQuery.valHooks[ elem.nodeName.toLowerCase() ]; |
|
8558 |
|
8559 if ( hooks && |
|
8560 "get" in hooks && |
|
8561 ( ret = hooks.get( elem, "value" ) ) !== undefined |
|
8562 ) { |
|
8563 return ret; |
|
8564 } |
|
8565 |
|
8566 ret = elem.value; |
|
8567 |
|
8568 // Handle most common string cases |
|
8569 if ( typeof ret === "string" ) { |
|
8570 return ret.replace( rreturn, "" ); |
|
8571 } |
|
8572 |
|
8573 // Handle cases where value is null/undef or number |
|
8574 return ret == null ? "" : ret; |
|
8575 } |
|
8576 |
|
8577 return; |
|
8578 } |
|
8579 |
|
8580 valueIsFunction = isFunction( value ); |
|
8581 |
|
8582 return this.each( function( i ) { |
|
8583 var val; |
|
8584 |
|
8585 if ( this.nodeType !== 1 ) { |
|
8586 return; |
|
8587 } |
|
8588 |
|
8589 if ( valueIsFunction ) { |
|
8590 val = value.call( this, i, jQuery( this ).val() ); |
|
8591 } else { |
|
8592 val = value; |
|
8593 } |
|
8594 |
|
8595 // Treat null/undefined as ""; convert numbers to string |
|
8596 if ( val == null ) { |
|
8597 val = ""; |
|
8598 |
|
8599 } else if ( typeof val === "number" ) { |
|
8600 val += ""; |
|
8601 |
|
8602 } else if ( Array.isArray( val ) ) { |
|
8603 val = jQuery.map( val, function( value ) { |
|
8604 return value == null ? "" : value + ""; |
|
8605 } ); |
|
8606 } |
|
8607 |
|
8608 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; |
|
8609 |
|
8610 // If set returns undefined, fall back to normal setting |
|
8611 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { |
|
8612 this.value = val; |
|
8613 } |
|
8614 } ); |
|
8615 } |
|
8616 } ); |
|
8617 |
|
8618 jQuery.extend( { |
|
8619 valHooks: { |
|
8620 option: { |
|
8621 get: function( elem ) { |
|
8622 |
|
8623 var val = jQuery.find.attr( elem, "value" ); |
|
8624 return val != null ? |
|
8625 val : |
|
8626 |
|
8627 // Support: IE <=10 - 11 only |
|
8628 // option.text throws exceptions (trac-14686, trac-14858) |
|
8629 // Strip and collapse whitespace |
|
8630 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace |
|
8631 stripAndCollapse( jQuery.text( elem ) ); |
|
8632 } |
|
8633 }, |
|
8634 select: { |
|
8635 get: function( elem ) { |
|
8636 var value, option, i, |
|
8637 options = elem.options, |
|
8638 index = elem.selectedIndex, |
|
8639 one = elem.type === "select-one", |
|
8640 values = one ? null : [], |
|
8641 max = one ? index + 1 : options.length; |
|
8642 |
|
8643 if ( index < 0 ) { |
|
8644 i = max; |
|
8645 |
|
8646 } else { |
|
8647 i = one ? index : 0; |
|
8648 } |
|
8649 |
|
8650 // Loop through all the selected options |
|
8651 for ( ; i < max; i++ ) { |
|
8652 option = options[ i ]; |
|
8653 |
|
8654 // Support: IE <=9 only |
|
8655 // IE8-9 doesn't update selected after form reset (trac-2551) |
|
8656 if ( ( option.selected || i === index ) && |
|
8657 |
|
8658 // Don't return options that are disabled or in a disabled optgroup |
|
8659 !option.disabled && |
|
8660 ( !option.parentNode.disabled || |
|
8661 !nodeName( option.parentNode, "optgroup" ) ) ) { |
|
8662 |
|
8663 // Get the specific value for the option |
|
8664 value = jQuery( option ).val(); |
|
8665 |
|
8666 // We don't need an array for one selects |
|
8667 if ( one ) { |
|
8668 return value; |
|
8669 } |
|
8670 |
|
8671 // Multi-Selects return an array |
|
8672 values.push( value ); |
|
8673 } |
|
8674 } |
|
8675 |
|
8676 return values; |
|
8677 }, |
|
8678 |
|
8679 set: function( elem, value ) { |
|
8680 var optionSet, option, |
|
8681 options = elem.options, |
|
8682 values = jQuery.makeArray( value ), |
|
8683 i = options.length; |
|
8684 |
|
8685 while ( i-- ) { |
|
8686 option = options[ i ]; |
|
8687 |
|
8688 /* eslint-disable no-cond-assign */ |
|
8689 |
|
8690 if ( option.selected = |
|
8691 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 |
|
8692 ) { |
|
8693 optionSet = true; |
|
8694 } |
|
8695 |
|
8696 /* eslint-enable no-cond-assign */ |
|
8697 } |
|
8698 |
|
8699 // Force browsers to behave consistently when non-matching value is set |
|
8700 if ( !optionSet ) { |
|
8701 elem.selectedIndex = -1; |
|
8702 } |
|
8703 return values; |
|
8704 } |
|
8705 } |
|
8706 } |
|
8707 } ); |
|
8708 |
|
8709 // Radios and checkboxes getter/setter |
|
8710 jQuery.each( [ "radio", "checkbox" ], function() { |
|
8711 jQuery.valHooks[ this ] = { |
|
8712 set: function( elem, value ) { |
|
8713 if ( Array.isArray( value ) ) { |
|
8714 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); |
|
8715 } |
|
8716 } |
|
8717 }; |
|
8718 if ( !support.checkOn ) { |
|
8719 jQuery.valHooks[ this ].get = function( elem ) { |
|
8720 return elem.getAttribute( "value" ) === null ? "on" : elem.value; |
|
8721 }; |
|
8722 } |
|
8723 } ); |
|
8724 |
|
8725 |
|
8726 |
|
8727 |
|
8728 // Return jQuery for attributes-only inclusion |
|
8729 |
|
8730 |
|
8731 support.focusin = "onfocusin" in window; |
|
8732 |
|
8733 |
|
8734 var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, |
|
8735 stopPropagationCallback = function( e ) { |
|
8736 e.stopPropagation(); |
|
8737 }; |
|
8738 |
|
8739 jQuery.extend( jQuery.event, { |
|
8740 |
|
8741 trigger: function( event, data, elem, onlyHandlers ) { |
|
8742 |
|
8743 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, |
|
8744 eventPath = [ elem || document ], |
|
8745 type = hasOwn.call( event, "type" ) ? event.type : event, |
|
8746 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; |
|
8747 |
|
8748 cur = lastElement = tmp = elem = elem || document; |
|
8749 |
|
8750 // Don't do events on text and comment nodes |
|
8751 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { |
|
8752 return; |
|
8753 } |
|
8754 |
|
8755 // focus/blur morphs to focusin/out; ensure we're not firing them right now |
|
8756 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { |
|
8757 return; |
|
8758 } |
|
8759 |
|
8760 if ( type.indexOf( "." ) > -1 ) { |
|
8761 |
|
8762 // Namespaced trigger; create a regexp to match event type in handle() |
|
8763 namespaces = type.split( "." ); |
|
8764 type = namespaces.shift(); |
|
8765 namespaces.sort(); |
|
8766 } |
|
8767 ontype = type.indexOf( ":" ) < 0 && "on" + type; |
|
8768 |
|
8769 // Caller can pass in a jQuery.Event object, Object, or just an event type string |
|
8770 event = event[ jQuery.expando ] ? |
|
8771 event : |
|
8772 new jQuery.Event( type, typeof event === "object" && event ); |
|
8773 |
|
8774 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) |
|
8775 event.isTrigger = onlyHandlers ? 2 : 3; |
|
8776 event.namespace = namespaces.join( "." ); |
|
8777 event.rnamespace = event.namespace ? |
|
8778 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : |
|
8779 null; |
|
8780 |
|
8781 // Clean up the event in case it is being reused |
|
8782 event.result = undefined; |
|
8783 if ( !event.target ) { |
|
8784 event.target = elem; |
|
8785 } |
|
8786 |
|
8787 // Clone any incoming data and prepend the event, creating the handler arg list |
|
8788 data = data == null ? |
|
8789 [ event ] : |
|
8790 jQuery.makeArray( data, [ event ] ); |
|
8791 |
|
8792 // Allow special events to draw outside the lines |
|
8793 special = jQuery.event.special[ type ] || {}; |
|
8794 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { |
|
8795 return; |
|
8796 } |
|
8797 |
|
8798 // Determine event propagation path in advance, per W3C events spec (trac-9951) |
|
8799 // Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724) |
|
8800 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { |
|
8801 |
|
8802 bubbleType = special.delegateType || type; |
|
8803 if ( !rfocusMorph.test( bubbleType + type ) ) { |
|
8804 cur = cur.parentNode; |
|
8805 } |
|
8806 for ( ; cur; cur = cur.parentNode ) { |
|
8807 eventPath.push( cur ); |
|
8808 tmp = cur; |
|
8809 } |
|
8810 |
|
8811 // Only add window if we got to document (e.g., not plain obj or detached DOM) |
|
8812 if ( tmp === ( elem.ownerDocument || document ) ) { |
|
8813 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); |
|
8814 } |
|
8815 } |
|
8816 |
|
8817 // Fire handlers on the event path |
|
8818 i = 0; |
|
8819 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { |
|
8820 lastElement = cur; |
|
8821 event.type = i > 1 ? |
|
8822 bubbleType : |
|
8823 special.bindType || type; |
|
8824 |
|
8825 // jQuery handler |
|
8826 handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] && |
|
8827 dataPriv.get( cur, "handle" ); |
|
8828 if ( handle ) { |
|
8829 handle.apply( cur, data ); |
|
8830 } |
|
8831 |
|
8832 // Native handler |
|
8833 handle = ontype && cur[ ontype ]; |
|
8834 if ( handle && handle.apply && acceptData( cur ) ) { |
|
8835 event.result = handle.apply( cur, data ); |
|
8836 if ( event.result === false ) { |
|
8837 event.preventDefault(); |
|
8838 } |
|
8839 } |
|
8840 } |
|
8841 event.type = type; |
|
8842 |
|
8843 // If nobody prevented the default action, do it now |
|
8844 if ( !onlyHandlers && !event.isDefaultPrevented() ) { |
|
8845 |
|
8846 if ( ( !special._default || |
|
8847 special._default.apply( eventPath.pop(), data ) === false ) && |
|
8848 acceptData( elem ) ) { |
|
8849 |
|
8850 // Call a native DOM method on the target with the same name as the event. |
|
8851 // Don't do default actions on window, that's where global variables be (trac-6170) |
|
8852 if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { |
|
8853 |
|
8854 // Don't re-trigger an onFOO event when we call its FOO() method |
|
8855 tmp = elem[ ontype ]; |
|
8856 |
|
8857 if ( tmp ) { |
|
8858 elem[ ontype ] = null; |
|
8859 } |
|
8860 |
|
8861 // Prevent re-triggering of the same event, since we already bubbled it above |
|
8862 jQuery.event.triggered = type; |
|
8863 |
|
8864 if ( event.isPropagationStopped() ) { |
|
8865 lastElement.addEventListener( type, stopPropagationCallback ); |
|
8866 } |
|
8867 |
|
8868 elem[ type ](); |
|
8869 |
|
8870 if ( event.isPropagationStopped() ) { |
|
8871 lastElement.removeEventListener( type, stopPropagationCallback ); |
|
8872 } |
|
8873 |
|
8874 jQuery.event.triggered = undefined; |
|
8875 |
|
8876 if ( tmp ) { |
|
8877 elem[ ontype ] = tmp; |
|
8878 } |
|
8879 } |
|
8880 } |
|
8881 } |
|
8882 |
|
8883 return event.result; |
|
8884 }, |
|
8885 |
|
8886 // Piggyback on a donor event to simulate a different one |
|
8887 // Used only for `focus(in | out)` events |
|
8888 simulate: function( type, elem, event ) { |
|
8889 var e = jQuery.extend( |
|
8890 new jQuery.Event(), |
|
8891 event, |
|
8892 { |
|
8893 type: type, |
|
8894 isSimulated: true |
|
8895 } |
|
8896 ); |
|
8897 |
|
8898 jQuery.event.trigger( e, null, elem ); |
|
8899 } |
|
8900 |
|
8901 } ); |
|
8902 |
|
8903 jQuery.fn.extend( { |
|
8904 |
|
8905 trigger: function( type, data ) { |
|
8906 return this.each( function() { |
|
8907 jQuery.event.trigger( type, data, this ); |
|
8908 } ); |
|
8909 }, |
|
8910 triggerHandler: function( type, data ) { |
|
8911 var elem = this[ 0 ]; |
|
8912 if ( elem ) { |
|
8913 return jQuery.event.trigger( type, data, elem, true ); |
|
8914 } |
|
8915 } |
|
8916 } ); |
|
8917 |
|
8918 |
|
8919 // Support: Firefox <=44 |
|
8920 // Firefox doesn't have focus(in | out) events |
|
8921 // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 |
|
8922 // |
|
8923 // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 |
|
8924 // focus(in | out) events fire after focus & blur events, |
|
8925 // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order |
|
8926 // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 |
|
8927 if ( !support.focusin ) { |
|
8928 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { |
|
8929 |
|
8930 // Attach a single capturing handler on the document while someone wants focusin/focusout |
|
8931 var handler = function( event ) { |
|
8932 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); |
|
8933 }; |
|
8934 |
|
8935 jQuery.event.special[ fix ] = { |
|
8936 setup: function() { |
|
8937 |
|
8938 // Handle: regular nodes (via `this.ownerDocument`), window |
|
8939 // (via `this.document`) & document (via `this`). |
|
8940 var doc = this.ownerDocument || this.document || this, |
|
8941 attaches = dataPriv.access( doc, fix ); |
|
8942 |
|
8943 if ( !attaches ) { |
|
8944 doc.addEventListener( orig, handler, true ); |
|
8945 } |
|
8946 dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); |
|
8947 }, |
|
8948 teardown: function() { |
|
8949 var doc = this.ownerDocument || this.document || this, |
|
8950 attaches = dataPriv.access( doc, fix ) - 1; |
|
8951 |
|
8952 if ( !attaches ) { |
|
8953 doc.removeEventListener( orig, handler, true ); |
|
8954 dataPriv.remove( doc, fix ); |
|
8955 |
|
8956 } else { |
|
8957 dataPriv.access( doc, fix, attaches ); |
|
8958 } |
|
8959 } |
|
8960 }; |
|
8961 } ); |
|
8962 } |
|
8963 var location = window.location; |
|
8964 |
|
8965 var nonce = { guid: Date.now() }; |
|
8966 |
|
8967 var rquery = ( /\?/ ); |
|
8968 |
|
8969 |
|
8970 |
|
8971 // Cross-browser xml parsing |
|
8972 jQuery.parseXML = function( data ) { |
|
8973 var xml, parserErrorElem; |
|
8974 if ( !data || typeof data !== "string" ) { |
|
8975 return null; |
|
8976 } |
|
8977 |
|
8978 // Support: IE 9 - 11 only |
|
8979 // IE throws on parseFromString with invalid input. |
|
8980 try { |
|
8981 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); |
|
8982 } catch ( e ) {} |
|
8983 |
|
8984 parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; |
|
8985 if ( !xml || parserErrorElem ) { |
|
8986 jQuery.error( "Invalid XML: " + ( |
|
8987 parserErrorElem ? |
|
8988 jQuery.map( parserErrorElem.childNodes, function( el ) { |
|
8989 return el.textContent; |
|
8990 } ).join( "\n" ) : |
|
8991 data |
|
8992 ) ); |
|
8993 } |
|
8994 return xml; |
|
8995 }; |
|
8996 |
|
8997 |
|
8998 var |
|
8999 rbracket = /\[\]$/, |
|
9000 rCRLF = /\r?\n/g, |
|
9001 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, |
|
9002 rsubmittable = /^(?:input|select|textarea|keygen)/i; |
|
9003 |
|
9004 function buildParams( prefix, obj, traditional, add ) { |
|
9005 var name; |
|
9006 |
|
9007 if ( Array.isArray( obj ) ) { |
|
9008 |
|
9009 // Serialize array item. |
|
9010 jQuery.each( obj, function( i, v ) { |
|
9011 if ( traditional || rbracket.test( prefix ) ) { |
|
9012 |
|
9013 // Treat each array item as a scalar. |
|
9014 add( prefix, v ); |
|
9015 |
|
9016 } else { |
|
9017 |
|
9018 // Item is non-scalar (array or object), encode its numeric index. |
|
9019 buildParams( |
|
9020 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", |
|
9021 v, |
|
9022 traditional, |
|
9023 add |
|
9024 ); |
|
9025 } |
|
9026 } ); |
|
9027 |
|
9028 } else if ( !traditional && toType( obj ) === "object" ) { |
|
9029 |
|
9030 // Serialize object item. |
|
9031 for ( name in obj ) { |
|
9032 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); |
|
9033 } |
|
9034 |
|
9035 } else { |
|
9036 |
|
9037 // Serialize scalar item. |
|
9038 add( prefix, obj ); |
|
9039 } |
|
9040 } |
|
9041 |
|
9042 // Serialize an array of form elements or a set of |
|
9043 // key/values into a query string |
|
9044 jQuery.param = function( a, traditional ) { |
|
9045 var prefix, |
|
9046 s = [], |
|
9047 add = function( key, valueOrFunction ) { |
|
9048 |
|
9049 // If value is a function, invoke it and use its return value |
|
9050 var value = isFunction( valueOrFunction ) ? |
|
9051 valueOrFunction() : |
|
9052 valueOrFunction; |
|
9053 |
|
9054 s[ s.length ] = encodeURIComponent( key ) + "=" + |
|
9055 encodeURIComponent( value == null ? "" : value ); |
|
9056 }; |
|
9057 |
|
9058 if ( a == null ) { |
|
9059 return ""; |
|
9060 } |
|
9061 |
|
9062 // If an array was passed in, assume that it is an array of form elements. |
|
9063 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { |
|
9064 |
|
9065 // Serialize the form elements |
|
9066 jQuery.each( a, function() { |
|
9067 add( this.name, this.value ); |
|
9068 } ); |
|
9069 |
|
9070 } else { |
|
9071 |
|
9072 // If traditional, encode the "old" way (the way 1.3.2 or older |
|
9073 // did it), otherwise encode params recursively. |
|
9074 for ( prefix in a ) { |
|
9075 buildParams( prefix, a[ prefix ], traditional, add ); |
|
9076 } |
|
9077 } |
|
9078 |
|
9079 // Return the resulting serialization |
|
9080 return s.join( "&" ); |
|
9081 }; |
|
9082 |
|
9083 jQuery.fn.extend( { |
|
9084 serialize: function() { |
|
9085 return jQuery.param( this.serializeArray() ); |
|
9086 }, |
|
9087 serializeArray: function() { |
|
9088 return this.map( function() { |
|
9089 |
|
9090 // Can add propHook for "elements" to filter or add form elements |
|
9091 var elements = jQuery.prop( this, "elements" ); |
|
9092 return elements ? jQuery.makeArray( elements ) : this; |
|
9093 } ).filter( function() { |
|
9094 var type = this.type; |
|
9095 |
|
9096 // Use .is( ":disabled" ) so that fieldset[disabled] works |
|
9097 return this.name && !jQuery( this ).is( ":disabled" ) && |
|
9098 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && |
|
9099 ( this.checked || !rcheckableType.test( type ) ); |
|
9100 } ).map( function( _i, elem ) { |
|
9101 var val = jQuery( this ).val(); |
|
9102 |
|
9103 if ( val == null ) { |
|
9104 return null; |
|
9105 } |
|
9106 |
|
9107 if ( Array.isArray( val ) ) { |
|
9108 return jQuery.map( val, function( val ) { |
|
9109 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; |
|
9110 } ); |
|
9111 } |
|
9112 |
|
9113 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; |
|
9114 } ).get(); |
|
9115 } |
|
9116 } ); |
|
9117 |
|
9118 |
|
9119 var |
|
9120 r20 = /%20/g, |
|
9121 rhash = /#.*$/, |
|
9122 rantiCache = /([?&])_=[^&]*/, |
|
9123 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, |
|
9124 |
|
9125 // trac-7653, trac-8125, trac-8152: local protocol detection |
|
9126 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, |
|
9127 rnoContent = /^(?:GET|HEAD)$/, |
|
9128 rprotocol = /^\/\//, |
|
9129 |
|
9130 /* Prefilters |
|
9131 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) |
|
9132 * 2) These are called: |
|
9133 * - BEFORE asking for a transport |
|
9134 * - AFTER param serialization (s.data is a string if s.processData is true) |
|
9135 * 3) key is the dataType |
|
9136 * 4) the catchall symbol "*" can be used |
|
9137 * 5) execution will start with transport dataType and THEN continue down to "*" if needed |
|
9138 */ |
|
9139 prefilters = {}, |
|
9140 |
|
9141 /* Transports bindings |
|
9142 * 1) key is the dataType |
|
9143 * 2) the catchall symbol "*" can be used |
|
9144 * 3) selection will start with transport dataType and THEN go to "*" if needed |
|
9145 */ |
|
9146 transports = {}, |
|
9147 |
|
9148 // Avoid comment-prolog char sequence (trac-10098); must appease lint and evade compression |
|
9149 allTypes = "*/".concat( "*" ), |
|
9150 |
|
9151 // Anchor tag for parsing the document origin |
|
9152 originAnchor = document.createElement( "a" ); |
|
9153 |
|
9154 originAnchor.href = location.href; |
|
9155 |
|
9156 // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport |
|
9157 function addToPrefiltersOrTransports( structure ) { |
|
9158 |
|
9159 // dataTypeExpression is optional and defaults to "*" |
|
9160 return function( dataTypeExpression, func ) { |
|
9161 |
|
9162 if ( typeof dataTypeExpression !== "string" ) { |
|
9163 func = dataTypeExpression; |
|
9164 dataTypeExpression = "*"; |
|
9165 } |
|
9166 |
|
9167 var dataType, |
|
9168 i = 0, |
|
9169 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; |
|
9170 |
|
9171 if ( isFunction( func ) ) { |
|
9172 |
|
9173 // For each dataType in the dataTypeExpression |
|
9174 while ( ( dataType = dataTypes[ i++ ] ) ) { |
|
9175 |
|
9176 // Prepend if requested |
|
9177 if ( dataType[ 0 ] === "+" ) { |
|
9178 dataType = dataType.slice( 1 ) || "*"; |
|
9179 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); |
|
9180 |
|
9181 // Otherwise append |
|
9182 } else { |
|
9183 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); |
|
9184 } |
|
9185 } |
|
9186 } |
|
9187 }; |
|
9188 } |
|
9189 |
|
9190 // Base inspection function for prefilters and transports |
|
9191 function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { |
|
9192 |
|
9193 var inspected = {}, |
|
9194 seekingTransport = ( structure === transports ); |
|
9195 |
|
9196 function inspect( dataType ) { |
|
9197 var selected; |
|
9198 inspected[ dataType ] = true; |
|
9199 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { |
|
9200 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); |
|
9201 if ( typeof dataTypeOrTransport === "string" && |
|
9202 !seekingTransport && !inspected[ dataTypeOrTransport ] ) { |
|
9203 |
|
9204 options.dataTypes.unshift( dataTypeOrTransport ); |
|
9205 inspect( dataTypeOrTransport ); |
|
9206 return false; |
|
9207 } else if ( seekingTransport ) { |
|
9208 return !( selected = dataTypeOrTransport ); |
|
9209 } |
|
9210 } ); |
|
9211 return selected; |
|
9212 } |
|
9213 |
|
9214 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); |
|
9215 } |
|
9216 |
|
9217 // A special extend for ajax options |
|
9218 // that takes "flat" options (not to be deep extended) |
|
9219 // Fixes trac-9887 |
|
9220 function ajaxExtend( target, src ) { |
|
9221 var key, deep, |
|
9222 flatOptions = jQuery.ajaxSettings.flatOptions || {}; |
|
9223 |
|
9224 for ( key in src ) { |
|
9225 if ( src[ key ] !== undefined ) { |
|
9226 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; |
|
9227 } |
|
9228 } |
|
9229 if ( deep ) { |
|
9230 jQuery.extend( true, target, deep ); |
|
9231 } |
|
9232 |
|
9233 return target; |
|
9234 } |
|
9235 |
|
9236 /* Handles responses to an ajax request: |
|
9237 * - finds the right dataType (mediates between content-type and expected dataType) |
|
9238 * - returns the corresponding response |
|
9239 */ |
|
9240 function ajaxHandleResponses( s, jqXHR, responses ) { |
|
9241 |
|
9242 var ct, type, finalDataType, firstDataType, |
|
9243 contents = s.contents, |
|
9244 dataTypes = s.dataTypes; |
|
9245 |
|
9246 // Remove auto dataType and get content-type in the process |
|
9247 while ( dataTypes[ 0 ] === "*" ) { |
|
9248 dataTypes.shift(); |
|
9249 if ( ct === undefined ) { |
|
9250 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); |
|
9251 } |
|
9252 } |
|
9253 |
|
9254 // Check if we're dealing with a known content-type |
|
9255 if ( ct ) { |
|
9256 for ( type in contents ) { |
|
9257 if ( contents[ type ] && contents[ type ].test( ct ) ) { |
|
9258 dataTypes.unshift( type ); |
|
9259 break; |
|
9260 } |
|
9261 } |
|
9262 } |
|
9263 |
|
9264 // Check to see if we have a response for the expected dataType |
|
9265 if ( dataTypes[ 0 ] in responses ) { |
|
9266 finalDataType = dataTypes[ 0 ]; |
|
9267 } else { |
|
9268 |
|
9269 // Try convertible dataTypes |
|
9270 for ( type in responses ) { |
|
9271 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { |
|
9272 finalDataType = type; |
|
9273 break; |
|
9274 } |
|
9275 if ( !firstDataType ) { |
|
9276 firstDataType = type; |
|
9277 } |
|
9278 } |
|
9279 |
|
9280 // Or just use first one |
|
9281 finalDataType = finalDataType || firstDataType; |
|
9282 } |
|
9283 |
|
9284 // If we found a dataType |
|
9285 // We add the dataType to the list if needed |
|
9286 // and return the corresponding response |
|
9287 if ( finalDataType ) { |
|
9288 if ( finalDataType !== dataTypes[ 0 ] ) { |
|
9289 dataTypes.unshift( finalDataType ); |
|
9290 } |
|
9291 return responses[ finalDataType ]; |
|
9292 } |
|
9293 } |
|
9294 |
|
9295 /* Chain conversions given the request and the original response |
|
9296 * Also sets the responseXXX fields on the jqXHR instance |
|
9297 */ |
|
9298 function ajaxConvert( s, response, jqXHR, isSuccess ) { |
|
9299 var conv2, current, conv, tmp, prev, |
|
9300 converters = {}, |
|
9301 |
|
9302 // Work with a copy of dataTypes in case we need to modify it for conversion |
|
9303 dataTypes = s.dataTypes.slice(); |
|
9304 |
|
9305 // Create converters map with lowercased keys |
|
9306 if ( dataTypes[ 1 ] ) { |
|
9307 for ( conv in s.converters ) { |
|
9308 converters[ conv.toLowerCase() ] = s.converters[ conv ]; |
|
9309 } |
|
9310 } |
|
9311 |
|
9312 current = dataTypes.shift(); |
|
9313 |
|
9314 // Convert to each sequential dataType |
|
9315 while ( current ) { |
|
9316 |
|
9317 if ( s.responseFields[ current ] ) { |
|
9318 jqXHR[ s.responseFields[ current ] ] = response; |
|
9319 } |
|
9320 |
|
9321 // Apply the dataFilter if provided |
|
9322 if ( !prev && isSuccess && s.dataFilter ) { |
|
9323 response = s.dataFilter( response, s.dataType ); |
|
9324 } |
|
9325 |
|
9326 prev = current; |
|
9327 current = dataTypes.shift(); |
|
9328 |
|
9329 if ( current ) { |
|
9330 |
|
9331 // There's only work to do if current dataType is non-auto |
|
9332 if ( current === "*" ) { |
|
9333 |
|
9334 current = prev; |
|
9335 |
|
9336 // Convert response if prev dataType is non-auto and differs from current |
|
9337 } else if ( prev !== "*" && prev !== current ) { |
|
9338 |
|
9339 // Seek a direct converter |
|
9340 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; |
|
9341 |
|
9342 // If none found, seek a pair |
|
9343 if ( !conv ) { |
|
9344 for ( conv2 in converters ) { |
|
9345 |
|
9346 // If conv2 outputs current |
|
9347 tmp = conv2.split( " " ); |
|
9348 if ( tmp[ 1 ] === current ) { |
|
9349 |
|
9350 // If prev can be converted to accepted input |
|
9351 conv = converters[ prev + " " + tmp[ 0 ] ] || |
|
9352 converters[ "* " + tmp[ 0 ] ]; |
|
9353 if ( conv ) { |
|
9354 |
|
9355 // Condense equivalence converters |
|
9356 if ( conv === true ) { |
|
9357 conv = converters[ conv2 ]; |
|
9358 |
|
9359 // Otherwise, insert the intermediate dataType |
|
9360 } else if ( converters[ conv2 ] !== true ) { |
|
9361 current = tmp[ 0 ]; |
|
9362 dataTypes.unshift( tmp[ 1 ] ); |
|
9363 } |
|
9364 break; |
|
9365 } |
|
9366 } |
|
9367 } |
|
9368 } |
|
9369 |
|
9370 // Apply converter (if not an equivalence) |
|
9371 if ( conv !== true ) { |
|
9372 |
|
9373 // Unless errors are allowed to bubble, catch and return them |
|
9374 if ( conv && s.throws ) { |
|
9375 response = conv( response ); |
|
9376 } else { |
|
9377 try { |
|
9378 response = conv( response ); |
|
9379 } catch ( e ) { |
|
9380 return { |
|
9381 state: "parsererror", |
|
9382 error: conv ? e : "No conversion from " + prev + " to " + current |
|
9383 }; |
|
9384 } |
|
9385 } |
|
9386 } |
|
9387 } |
|
9388 } |
|
9389 } |
|
9390 |
|
9391 return { state: "success", data: response }; |
|
9392 } |
|
9393 |
|
9394 jQuery.extend( { |
|
9395 |
|
9396 // Counter for holding the number of active queries |
|
9397 active: 0, |
|
9398 |
|
9399 // Last-Modified header cache for next request |
|
9400 lastModified: {}, |
|
9401 etag: {}, |
|
9402 |
|
9403 ajaxSettings: { |
|
9404 url: location.href, |
|
9405 type: "GET", |
|
9406 isLocal: rlocalProtocol.test( location.protocol ), |
|
9407 global: true, |
|
9408 processData: true, |
|
9409 async: true, |
|
9410 contentType: "application/x-www-form-urlencoded; charset=UTF-8", |
|
9411 |
|
9412 /* |
|
9413 timeout: 0, |
|
9414 data: null, |
|
9415 dataType: null, |
|
9416 username: null, |
|
9417 password: null, |
|
9418 cache: null, |
|
9419 throws: false, |
|
9420 traditional: false, |
|
9421 headers: {}, |
|
9422 */ |
|
9423 |
|
9424 accepts: { |
|
9425 "*": allTypes, |
|
9426 text: "text/plain", |
|
9427 html: "text/html", |
|
9428 xml: "application/xml, text/xml", |
|
9429 json: "application/json, text/javascript" |
|
9430 }, |
|
9431 |
|
9432 contents: { |
|
9433 xml: /\bxml\b/, |
|
9434 html: /\bhtml/, |
|
9435 json: /\bjson\b/ |
|
9436 }, |
|
9437 |
|
9438 responseFields: { |
|
9439 xml: "responseXML", |
|
9440 text: "responseText", |
|
9441 json: "responseJSON" |
|
9442 }, |
|
9443 |
|
9444 // Data converters |
|
9445 // Keys separate source (or catchall "*") and destination types with a single space |
|
9446 converters: { |
|
9447 |
|
9448 // Convert anything to text |
|
9449 "* text": String, |
|
9450 |
|
9451 // Text to html (true = no transformation) |
|
9452 "text html": true, |
|
9453 |
|
9454 // Evaluate text as a json expression |
|
9455 "text json": JSON.parse, |
|
9456 |
|
9457 // Parse text as xml |
|
9458 "text xml": jQuery.parseXML |
|
9459 }, |
|
9460 |
|
9461 // For options that shouldn't be deep extended: |
|
9462 // you can add your own custom options here if |
|
9463 // and when you create one that shouldn't be |
|
9464 // deep extended (see ajaxExtend) |
|
9465 flatOptions: { |
|
9466 url: true, |
|
9467 context: true |
|
9468 } |
|
9469 }, |
|
9470 |
|
9471 // Creates a full fledged settings object into target |
|
9472 // with both ajaxSettings and settings fields. |
|
9473 // If target is omitted, writes into ajaxSettings. |
|
9474 ajaxSetup: function( target, settings ) { |
|
9475 return settings ? |
|
9476 |
|
9477 // Building a settings object |
|
9478 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : |
|
9479 |
|
9480 // Extending ajaxSettings |
|
9481 ajaxExtend( jQuery.ajaxSettings, target ); |
|
9482 }, |
|
9483 |
|
9484 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), |
|
9485 ajaxTransport: addToPrefiltersOrTransports( transports ), |
|
9486 |
|
9487 // Main method |
|
9488 ajax: function( url, options ) { |
|
9489 |
|
9490 // If url is an object, simulate pre-1.5 signature |
|
9491 if ( typeof url === "object" ) { |
|
9492 options = url; |
|
9493 url = undefined; |
|
9494 } |
|
9495 |
|
9496 // Force options to be an object |
|
9497 options = options || {}; |
|
9498 |
|
9499 var transport, |
|
9500 |
|
9501 // URL without anti-cache param |
|
9502 cacheURL, |
|
9503 |
|
9504 // Response headers |
|
9505 responseHeadersString, |
|
9506 responseHeaders, |
|
9507 |
|
9508 // timeout handle |
|
9509 timeoutTimer, |
|
9510 |
|
9511 // Url cleanup var |
|
9512 urlAnchor, |
|
9513 |
|
9514 // Request state (becomes false upon send and true upon completion) |
|
9515 completed, |
|
9516 |
|
9517 // To know if global events are to be dispatched |
|
9518 fireGlobals, |
|
9519 |
|
9520 // Loop variable |
|
9521 i, |
|
9522 |
|
9523 // uncached part of the url |
|
9524 uncached, |
|
9525 |
|
9526 // Create the final options object |
|
9527 s = jQuery.ajaxSetup( {}, options ), |
|
9528 |
|
9529 // Callbacks context |
|
9530 callbackContext = s.context || s, |
|
9531 |
|
9532 // Context for global events is callbackContext if it is a DOM node or jQuery collection |
|
9533 globalEventContext = s.context && |
|
9534 ( callbackContext.nodeType || callbackContext.jquery ) ? |
|
9535 jQuery( callbackContext ) : |
|
9536 jQuery.event, |
|
9537 |
|
9538 // Deferreds |
|
9539 deferred = jQuery.Deferred(), |
|
9540 completeDeferred = jQuery.Callbacks( "once memory" ), |
|
9541 |
|
9542 // Status-dependent callbacks |
|
9543 statusCode = s.statusCode || {}, |
|
9544 |
|
9545 // Headers (they are sent all at once) |
|
9546 requestHeaders = {}, |
|
9547 requestHeadersNames = {}, |
|
9548 |
|
9549 // Default abort message |
|
9550 strAbort = "canceled", |
|
9551 |
|
9552 // Fake xhr |
|
9553 jqXHR = { |
|
9554 readyState: 0, |
|
9555 |
|
9556 // Builds headers hashtable if needed |
|
9557 getResponseHeader: function( key ) { |
|
9558 var match; |
|
9559 if ( completed ) { |
|
9560 if ( !responseHeaders ) { |
|
9561 responseHeaders = {}; |
|
9562 while ( ( match = rheaders.exec( responseHeadersString ) ) ) { |
|
9563 responseHeaders[ match[ 1 ].toLowerCase() + " " ] = |
|
9564 ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) |
|
9565 .concat( match[ 2 ] ); |
|
9566 } |
|
9567 } |
|
9568 match = responseHeaders[ key.toLowerCase() + " " ]; |
|
9569 } |
|
9570 return match == null ? null : match.join( ", " ); |
|
9571 }, |
|
9572 |
|
9573 // Raw string |
|
9574 getAllResponseHeaders: function() { |
|
9575 return completed ? responseHeadersString : null; |
|
9576 }, |
|
9577 |
|
9578 // Caches the header |
|
9579 setRequestHeader: function( name, value ) { |
|
9580 if ( completed == null ) { |
|
9581 name = requestHeadersNames[ name.toLowerCase() ] = |
|
9582 requestHeadersNames[ name.toLowerCase() ] || name; |
|
9583 requestHeaders[ name ] = value; |
|
9584 } |
|
9585 return this; |
|
9586 }, |
|
9587 |
|
9588 // Overrides response content-type header |
|
9589 overrideMimeType: function( type ) { |
|
9590 if ( completed == null ) { |
|
9591 s.mimeType = type; |
|
9592 } |
|
9593 return this; |
|
9594 }, |
|
9595 |
|
9596 // Status-dependent callbacks |
|
9597 statusCode: function( map ) { |
|
9598 var code; |
|
9599 if ( map ) { |
|
9600 if ( completed ) { |
|
9601 |
|
9602 // Execute the appropriate callbacks |
|
9603 jqXHR.always( map[ jqXHR.status ] ); |
|
9604 } else { |
|
9605 |
|
9606 // Lazy-add the new callbacks in a way that preserves old ones |
|
9607 for ( code in map ) { |
|
9608 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; |
|
9609 } |
|
9610 } |
|
9611 } |
|
9612 return this; |
|
9613 }, |
|
9614 |
|
9615 // Cancel the request |
|
9616 abort: function( statusText ) { |
|
9617 var finalText = statusText || strAbort; |
|
9618 if ( transport ) { |
|
9619 transport.abort( finalText ); |
|
9620 } |
|
9621 done( 0, finalText ); |
|
9622 return this; |
|
9623 } |
|
9624 }; |
|
9625 |
|
9626 // Attach deferreds |
|
9627 deferred.promise( jqXHR ); |
|
9628 |
|
9629 // Add protocol if not provided (prefilters might expect it) |
|
9630 // Handle falsy url in the settings object (trac-10093: consistency with old signature) |
|
9631 // We also use the url parameter if available |
|
9632 s.url = ( ( url || s.url || location.href ) + "" ) |
|
9633 .replace( rprotocol, location.protocol + "//" ); |
|
9634 |
|
9635 // Alias method option to type as per ticket trac-12004 |
|
9636 s.type = options.method || options.type || s.method || s.type; |
|
9637 |
|
9638 // Extract dataTypes list |
|
9639 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; |
|
9640 |
|
9641 // A cross-domain request is in order when the origin doesn't match the current origin. |
|
9642 if ( s.crossDomain == null ) { |
|
9643 urlAnchor = document.createElement( "a" ); |
|
9644 |
|
9645 // Support: IE <=8 - 11, Edge 12 - 15 |
|
9646 // IE throws exception on accessing the href property if url is malformed, |
|
9647 // e.g. http://example.com:80x/ |
|
9648 try { |
|
9649 urlAnchor.href = s.url; |
|
9650 |
|
9651 // Support: IE <=8 - 11 only |
|
9652 // Anchor's host property isn't correctly set when s.url is relative |
|
9653 urlAnchor.href = urlAnchor.href; |
|
9654 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== |
|
9655 urlAnchor.protocol + "//" + urlAnchor.host; |
|
9656 } catch ( e ) { |
|
9657 |
|
9658 // If there is an error parsing the URL, assume it is crossDomain, |
|
9659 // it can be rejected by the transport if it is invalid |
|
9660 s.crossDomain = true; |
|
9661 } |
|
9662 } |
|
9663 |
|
9664 // Convert data if not already a string |
|
9665 if ( s.data && s.processData && typeof s.data !== "string" ) { |
|
9666 s.data = jQuery.param( s.data, s.traditional ); |
|
9667 } |
|
9668 |
|
9669 // Apply prefilters |
|
9670 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); |
|
9671 |
|
9672 // If request was aborted inside a prefilter, stop there |
|
9673 if ( completed ) { |
|
9674 return jqXHR; |
|
9675 } |
|
9676 |
|
9677 // We can fire global events as of now if asked to |
|
9678 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (trac-15118) |
|
9679 fireGlobals = jQuery.event && s.global; |
|
9680 |
|
9681 // Watch for a new set of requests |
|
9682 if ( fireGlobals && jQuery.active++ === 0 ) { |
|
9683 jQuery.event.trigger( "ajaxStart" ); |
|
9684 } |
|
9685 |
|
9686 // Uppercase the type |
|
9687 s.type = s.type.toUpperCase(); |
|
9688 |
|
9689 // Determine if request has content |
|
9690 s.hasContent = !rnoContent.test( s.type ); |
|
9691 |
|
9692 // Save the URL in case we're toying with the If-Modified-Since |
|
9693 // and/or If-None-Match header later on |
|
9694 // Remove hash to simplify url manipulation |
|
9695 cacheURL = s.url.replace( rhash, "" ); |
|
9696 |
|
9697 // More options handling for requests with no content |
|
9698 if ( !s.hasContent ) { |
|
9699 |
|
9700 // Remember the hash so we can put it back |
|
9701 uncached = s.url.slice( cacheURL.length ); |
|
9702 |
|
9703 // If data is available and should be processed, append data to url |
|
9704 if ( s.data && ( s.processData || typeof s.data === "string" ) ) { |
|
9705 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; |
|
9706 |
|
9707 // trac-9682: remove data so that it's not used in an eventual retry |
|
9708 delete s.data; |
|
9709 } |
|
9710 |
|
9711 // Add or update anti-cache param if needed |
|
9712 if ( s.cache === false ) { |
|
9713 cacheURL = cacheURL.replace( rantiCache, "$1" ); |
|
9714 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) + |
|
9715 uncached; |
|
9716 } |
|
9717 |
|
9718 // Put hash and anti-cache on the URL that will be requested (gh-1732) |
|
9719 s.url = cacheURL + uncached; |
|
9720 |
|
9721 // Change '%20' to '+' if this is encoded form body content (gh-2658) |
|
9722 } else if ( s.data && s.processData && |
|
9723 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { |
|
9724 s.data = s.data.replace( r20, "+" ); |
|
9725 } |
|
9726 |
|
9727 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. |
|
9728 if ( s.ifModified ) { |
|
9729 if ( jQuery.lastModified[ cacheURL ] ) { |
|
9730 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); |
|
9731 } |
|
9732 if ( jQuery.etag[ cacheURL ] ) { |
|
9733 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); |
|
9734 } |
|
9735 } |
|
9736 |
|
9737 // Set the correct header, if data is being sent |
|
9738 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { |
|
9739 jqXHR.setRequestHeader( "Content-Type", s.contentType ); |
|
9740 } |
|
9741 |
|
9742 // Set the Accepts header for the server, depending on the dataType |
|
9743 jqXHR.setRequestHeader( |
|
9744 "Accept", |
|
9745 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? |
|
9746 s.accepts[ s.dataTypes[ 0 ] ] + |
|
9747 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : |
|
9748 s.accepts[ "*" ] |
|
9749 ); |
|
9750 |
|
9751 // Check for headers option |
|
9752 for ( i in s.headers ) { |
|
9753 jqXHR.setRequestHeader( i, s.headers[ i ] ); |
|
9754 } |
|
9755 |
|
9756 // Allow custom headers/mimetypes and early abort |
|
9757 if ( s.beforeSend && |
|
9758 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { |
|
9759 |
|
9760 // Abort if not done already and return |
|
9761 return jqXHR.abort(); |
|
9762 } |
|
9763 |
|
9764 // Aborting is no longer a cancellation |
|
9765 strAbort = "abort"; |
|
9766 |
|
9767 // Install callbacks on deferreds |
|
9768 completeDeferred.add( s.complete ); |
|
9769 jqXHR.done( s.success ); |
|
9770 jqXHR.fail( s.error ); |
|
9771 |
|
9772 // Get transport |
|
9773 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); |
|
9774 |
|
9775 // If no transport, we auto-abort |
|
9776 if ( !transport ) { |
|
9777 done( -1, "No Transport" ); |
|
9778 } else { |
|
9779 jqXHR.readyState = 1; |
|
9780 |
|
9781 // Send global event |
|
9782 if ( fireGlobals ) { |
|
9783 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); |
|
9784 } |
|
9785 |
|
9786 // If request was aborted inside ajaxSend, stop there |
|
9787 if ( completed ) { |
|
9788 return jqXHR; |
|
9789 } |
|
9790 |
|
9791 // Timeout |
|
9792 if ( s.async && s.timeout > 0 ) { |
|
9793 timeoutTimer = window.setTimeout( function() { |
|
9794 jqXHR.abort( "timeout" ); |
|
9795 }, s.timeout ); |
|
9796 } |
|
9797 |
|
9798 try { |
|
9799 completed = false; |
|
9800 transport.send( requestHeaders, done ); |
|
9801 } catch ( e ) { |
|
9802 |
|
9803 // Rethrow post-completion exceptions |
|
9804 if ( completed ) { |
|
9805 throw e; |
|
9806 } |
|
9807 |
|
9808 // Propagate others as results |
|
9809 done( -1, e ); |
|
9810 } |
|
9811 } |
|
9812 |
|
9813 // Callback for when everything is done |
|
9814 function done( status, nativeStatusText, responses, headers ) { |
|
9815 var isSuccess, success, error, response, modified, |
|
9816 statusText = nativeStatusText; |
|
9817 |
|
9818 // Ignore repeat invocations |
|
9819 if ( completed ) { |
|
9820 return; |
|
9821 } |
|
9822 |
|
9823 completed = true; |
|
9824 |
|
9825 // Clear timeout if it exists |
|
9826 if ( timeoutTimer ) { |
|
9827 window.clearTimeout( timeoutTimer ); |
|
9828 } |
|
9829 |
|
9830 // Dereference transport for early garbage collection |
|
9831 // (no matter how long the jqXHR object will be used) |
|
9832 transport = undefined; |
|
9833 |
|
9834 // Cache response headers |
|
9835 responseHeadersString = headers || ""; |
|
9836 |
|
9837 // Set readyState |
|
9838 jqXHR.readyState = status > 0 ? 4 : 0; |
|
9839 |
|
9840 // Determine if successful |
|
9841 isSuccess = status >= 200 && status < 300 || status === 304; |
|
9842 |
|
9843 // Get response data |
|
9844 if ( responses ) { |
|
9845 response = ajaxHandleResponses( s, jqXHR, responses ); |
|
9846 } |
|
9847 |
|
9848 // Use a noop converter for missing script but not if jsonp |
|
9849 if ( !isSuccess && |
|
9850 jQuery.inArray( "script", s.dataTypes ) > -1 && |
|
9851 jQuery.inArray( "json", s.dataTypes ) < 0 ) { |
|
9852 s.converters[ "text script" ] = function() {}; |
|
9853 } |
|
9854 |
|
9855 // Convert no matter what (that way responseXXX fields are always set) |
|
9856 response = ajaxConvert( s, response, jqXHR, isSuccess ); |
|
9857 |
|
9858 // If successful, handle type chaining |
|
9859 if ( isSuccess ) { |
|
9860 |
|
9861 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. |
|
9862 if ( s.ifModified ) { |
|
9863 modified = jqXHR.getResponseHeader( "Last-Modified" ); |
|
9864 if ( modified ) { |
|
9865 jQuery.lastModified[ cacheURL ] = modified; |
|
9866 } |
|
9867 modified = jqXHR.getResponseHeader( "etag" ); |
|
9868 if ( modified ) { |
|
9869 jQuery.etag[ cacheURL ] = modified; |
|
9870 } |
|
9871 } |
|
9872 |
|
9873 // if no content |
|
9874 if ( status === 204 || s.type === "HEAD" ) { |
|
9875 statusText = "nocontent"; |
|
9876 |
|
9877 // if not modified |
|
9878 } else if ( status === 304 ) { |
|
9879 statusText = "notmodified"; |
|
9880 |
|
9881 // If we have data, let's convert it |
|
9882 } else { |
|
9883 statusText = response.state; |
|
9884 success = response.data; |
|
9885 error = response.error; |
|
9886 isSuccess = !error; |
|
9887 } |
|
9888 } else { |
|
9889 |
|
9890 // Extract error from statusText and normalize for non-aborts |
|
9891 error = statusText; |
|
9892 if ( status || !statusText ) { |
|
9893 statusText = "error"; |
|
9894 if ( status < 0 ) { |
|
9895 status = 0; |
|
9896 } |
|
9897 } |
|
9898 } |
|
9899 |
|
9900 // Set data for the fake xhr object |
|
9901 jqXHR.status = status; |
|
9902 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; |
|
9903 |
|
9904 // Success/Error |
|
9905 if ( isSuccess ) { |
|
9906 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); |
|
9907 } else { |
|
9908 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); |
|
9909 } |
|
9910 |
|
9911 // Status-dependent callbacks |
|
9912 jqXHR.statusCode( statusCode ); |
|
9913 statusCode = undefined; |
|
9914 |
|
9915 if ( fireGlobals ) { |
|
9916 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", |
|
9917 [ jqXHR, s, isSuccess ? success : error ] ); |
|
9918 } |
|
9919 |
|
9920 // Complete |
|
9921 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); |
|
9922 |
|
9923 if ( fireGlobals ) { |
|
9924 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); |
|
9925 |
|
9926 // Handle the global AJAX counter |
|
9927 if ( !( --jQuery.active ) ) { |
|
9928 jQuery.event.trigger( "ajaxStop" ); |
|
9929 } |
|
9930 } |
|
9931 } |
|
9932 |
|
9933 return jqXHR; |
|
9934 }, |
|
9935 |
|
9936 getJSON: function( url, data, callback ) { |
|
9937 return jQuery.get( url, data, callback, "json" ); |
|
9938 }, |
|
9939 |
|
9940 getScript: function( url, callback ) { |
|
9941 return jQuery.get( url, undefined, callback, "script" ); |
|
9942 } |
|
9943 } ); |
|
9944 |
|
9945 jQuery.each( [ "get", "post" ], function( _i, method ) { |
|
9946 jQuery[ method ] = function( url, data, callback, type ) { |
|
9947 |
|
9948 // Shift arguments if data argument was omitted |
|
9949 if ( isFunction( data ) ) { |
|
9950 type = type || callback; |
|
9951 callback = data; |
|
9952 data = undefined; |
|
9953 } |
|
9954 |
|
9955 // The url can be an options object (which then must have .url) |
|
9956 return jQuery.ajax( jQuery.extend( { |
|
9957 url: url, |
|
9958 type: method, |
|
9959 dataType: type, |
|
9960 data: data, |
|
9961 success: callback |
|
9962 }, jQuery.isPlainObject( url ) && url ) ); |
|
9963 }; |
|
9964 } ); |
|
9965 |
|
9966 jQuery.ajaxPrefilter( function( s ) { |
|
9967 var i; |
|
9968 for ( i in s.headers ) { |
|
9969 if ( i.toLowerCase() === "content-type" ) { |
|
9970 s.contentType = s.headers[ i ] || ""; |
|
9971 } |
|
9972 } |
|
9973 } ); |
|
9974 |
|
9975 |
|
9976 jQuery._evalUrl = function( url, options, doc ) { |
|
9977 return jQuery.ajax( { |
|
9978 url: url, |
|
9979 |
|
9980 // Make this explicit, since user can override this through ajaxSetup (trac-11264) |
|
9981 type: "GET", |
|
9982 dataType: "script", |
|
9983 cache: true, |
|
9984 async: false, |
|
9985 global: false, |
|
9986 |
|
9987 // Only evaluate the response if it is successful (gh-4126) |
|
9988 // dataFilter is not invoked for failure responses, so using it instead |
|
9989 // of the default converter is kludgy but it works. |
|
9990 converters: { |
|
9991 "text script": function() {} |
|
9992 }, |
|
9993 dataFilter: function( response ) { |
|
9994 jQuery.globalEval( response, options, doc ); |
|
9995 } |
|
9996 } ); |
|
9997 }; |
|
9998 |
|
9999 |
|
10000 jQuery.fn.extend( { |
|
10001 wrapAll: function( html ) { |
|
10002 var wrap; |
|
10003 |
|
10004 if ( this[ 0 ] ) { |
|
10005 if ( isFunction( html ) ) { |
|
10006 html = html.call( this[ 0 ] ); |
|
10007 } |
|
10008 |
|
10009 // The elements to wrap the target around |
|
10010 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); |
|
10011 |
|
10012 if ( this[ 0 ].parentNode ) { |
|
10013 wrap.insertBefore( this[ 0 ] ); |
|
10014 } |
|
10015 |
|
10016 wrap.map( function() { |
|
10017 var elem = this; |
|
10018 |
|
10019 while ( elem.firstElementChild ) { |
|
10020 elem = elem.firstElementChild; |
|
10021 } |
|
10022 |
|
10023 return elem; |
|
10024 } ).append( this ); |
|
10025 } |
|
10026 |
|
10027 return this; |
|
10028 }, |
|
10029 |
|
10030 wrapInner: function( html ) { |
|
10031 if ( isFunction( html ) ) { |
|
10032 return this.each( function( i ) { |
|
10033 jQuery( this ).wrapInner( html.call( this, i ) ); |
|
10034 } ); |
|
10035 } |
|
10036 |
|
10037 return this.each( function() { |
|
10038 var self = jQuery( this ), |
|
10039 contents = self.contents(); |
|
10040 |
|
10041 if ( contents.length ) { |
|
10042 contents.wrapAll( html ); |
|
10043 |
|
10044 } else { |
|
10045 self.append( html ); |
|
10046 } |
|
10047 } ); |
|
10048 }, |
|
10049 |
|
10050 wrap: function( html ) { |
|
10051 var htmlIsFunction = isFunction( html ); |
|
10052 |
|
10053 return this.each( function( i ) { |
|
10054 jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); |
|
10055 } ); |
|
10056 }, |
|
10057 |
|
10058 unwrap: function( selector ) { |
|
10059 this.parent( selector ).not( "body" ).each( function() { |
|
10060 jQuery( this ).replaceWith( this.childNodes ); |
|
10061 } ); |
|
10062 return this; |
|
10063 } |
|
10064 } ); |
|
10065 |
|
10066 |
|
10067 jQuery.expr.pseudos.hidden = function( elem ) { |
|
10068 return !jQuery.expr.pseudos.visible( elem ); |
|
10069 }; |
|
10070 jQuery.expr.pseudos.visible = function( elem ) { |
|
10071 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); |
|
10072 }; |
|
10073 |
|
10074 |
|
10075 |
|
10076 |
|
10077 jQuery.ajaxSettings.xhr = function() { |
|
10078 try { |
|
10079 return new window.XMLHttpRequest(); |
|
10080 } catch ( e ) {} |
|
10081 }; |
|
10082 |
|
10083 var xhrSuccessStatus = { |
|
10084 |
|
10085 // File protocol always yields status code 0, assume 200 |
|
10086 0: 200, |
|
10087 |
|
10088 // Support: IE <=9 only |
|
10089 // trac-1450: sometimes IE returns 1223 when it should be 204 |
|
10090 1223: 204 |
|
10091 }, |
|
10092 xhrSupported = jQuery.ajaxSettings.xhr(); |
|
10093 |
|
10094 support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); |
|
10095 support.ajax = xhrSupported = !!xhrSupported; |
|
10096 |
|
10097 jQuery.ajaxTransport( function( options ) { |
|
10098 var callback, errorCallback; |
|
10099 |
|
10100 // Cross domain only allowed if supported through XMLHttpRequest |
|
10101 if ( support.cors || xhrSupported && !options.crossDomain ) { |
|
10102 return { |
|
10103 send: function( headers, complete ) { |
|
10104 var i, |
|
10105 xhr = options.xhr(); |
|
10106 |
|
10107 xhr.open( |
|
10108 options.type, |
|
10109 options.url, |
|
10110 options.async, |
|
10111 options.username, |
|
10112 options.password |
|
10113 ); |
|
10114 |
|
10115 // Apply custom fields if provided |
|
10116 if ( options.xhrFields ) { |
|
10117 for ( i in options.xhrFields ) { |
|
10118 xhr[ i ] = options.xhrFields[ i ]; |
|
10119 } |
|
10120 } |
|
10121 |
|
10122 // Override mime type if needed |
|
10123 if ( options.mimeType && xhr.overrideMimeType ) { |
|
10124 xhr.overrideMimeType( options.mimeType ); |
|
10125 } |
|
10126 |
|
10127 // X-Requested-With header |
|
10128 // For cross-domain requests, seeing as conditions for a preflight are |
|
10129 // akin to a jigsaw puzzle, we simply never set it to be sure. |
|
10130 // (it can always be set on a per-request basis or even using ajaxSetup) |
|
10131 // For same-domain requests, won't change header if already provided. |
|
10132 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { |
|
10133 headers[ "X-Requested-With" ] = "XMLHttpRequest"; |
|
10134 } |
|
10135 |
|
10136 // Set headers |
|
10137 for ( i in headers ) { |
|
10138 xhr.setRequestHeader( i, headers[ i ] ); |
|
10139 } |
|
10140 |
|
10141 // Callback |
|
10142 callback = function( type ) { |
|
10143 return function() { |
|
10144 if ( callback ) { |
|
10145 callback = errorCallback = xhr.onload = |
|
10146 xhr.onerror = xhr.onabort = xhr.ontimeout = |
|
10147 xhr.onreadystatechange = null; |
|
10148 |
|
10149 if ( type === "abort" ) { |
|
10150 xhr.abort(); |
|
10151 } else if ( type === "error" ) { |
|
10152 |
|
10153 // Support: IE <=9 only |
|
10154 // On a manual native abort, IE9 throws |
|
10155 // errors on any property access that is not readyState |
|
10156 if ( typeof xhr.status !== "number" ) { |
|
10157 complete( 0, "error" ); |
|
10158 } else { |
|
10159 complete( |
|
10160 |
|
10161 // File: protocol always yields status 0; see trac-8605, trac-14207 |
|
10162 xhr.status, |
|
10163 xhr.statusText |
|
10164 ); |
|
10165 } |
|
10166 } else { |
|
10167 complete( |
|
10168 xhrSuccessStatus[ xhr.status ] || xhr.status, |
|
10169 xhr.statusText, |
|
10170 |
|
10171 // Support: IE <=9 only |
|
10172 // IE9 has no XHR2 but throws on binary (trac-11426) |
|
10173 // For XHR2 non-text, let the caller handle it (gh-2498) |
|
10174 ( xhr.responseType || "text" ) !== "text" || |
|
10175 typeof xhr.responseText !== "string" ? |
|
10176 { binary: xhr.response } : |
|
10177 { text: xhr.responseText }, |
|
10178 xhr.getAllResponseHeaders() |
|
10179 ); |
|
10180 } |
|
10181 } |
|
10182 }; |
|
10183 }; |
|
10184 |
|
10185 // Listen to events |
|
10186 xhr.onload = callback(); |
|
10187 errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); |
|
10188 |
|
10189 // Support: IE 9 only |
|
10190 // Use onreadystatechange to replace onabort |
|
10191 // to handle uncaught aborts |
|
10192 if ( xhr.onabort !== undefined ) { |
|
10193 xhr.onabort = errorCallback; |
|
10194 } else { |
|
10195 xhr.onreadystatechange = function() { |
|
10196 |
|
10197 // Check readyState before timeout as it changes |
|
10198 if ( xhr.readyState === 4 ) { |
|
10199 |
|
10200 // Allow onerror to be called first, |
|
10201 // but that will not handle a native abort |
|
10202 // Also, save errorCallback to a variable |
|
10203 // as xhr.onerror cannot be accessed |
|
10204 window.setTimeout( function() { |
|
10205 if ( callback ) { |
|
10206 errorCallback(); |
|
10207 } |
|
10208 } ); |
|
10209 } |
|
10210 }; |
|
10211 } |
|
10212 |
|
10213 // Create the abort callback |
|
10214 callback = callback( "abort" ); |
|
10215 |
|
10216 try { |
|
10217 |
|
10218 // Do send the request (this may raise an exception) |
|
10219 xhr.send( options.hasContent && options.data || null ); |
|
10220 } catch ( e ) { |
|
10221 |
|
10222 // trac-14683: Only rethrow if this hasn't been notified as an error yet |
|
10223 if ( callback ) { |
|
10224 throw e; |
|
10225 } |
|
10226 } |
|
10227 }, |
|
10228 |
|
10229 abort: function() { |
|
10230 if ( callback ) { |
|
10231 callback(); |
|
10232 } |
|
10233 } |
|
10234 }; |
|
10235 } |
|
10236 } ); |
|
10237 |
|
10238 |
|
10239 |
|
10240 |
|
10241 // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) |
|
10242 jQuery.ajaxPrefilter( function( s ) { |
|
10243 if ( s.crossDomain ) { |
|
10244 s.contents.script = false; |
|
10245 } |
|
10246 } ); |
|
10247 |
|
10248 // Install script dataType |
|
10249 jQuery.ajaxSetup( { |
|
10250 accepts: { |
|
10251 script: "text/javascript, application/javascript, " + |
|
10252 "application/ecmascript, application/x-ecmascript" |
|
10253 }, |
|
10254 contents: { |
|
10255 script: /\b(?:java|ecma)script\b/ |
|
10256 }, |
|
10257 converters: { |
|
10258 "text script": function( text ) { |
|
10259 jQuery.globalEval( text ); |
|
10260 return text; |
|
10261 } |
|
10262 } |
|
10263 } ); |
|
10264 |
|
10265 // Handle cache's special case and crossDomain |
|
10266 jQuery.ajaxPrefilter( "script", function( s ) { |
|
10267 if ( s.cache === undefined ) { |
|
10268 s.cache = false; |
|
10269 } |
|
10270 if ( s.crossDomain ) { |
|
10271 s.type = "GET"; |
|
10272 } |
|
10273 } ); |
|
10274 |
|
10275 // Bind script tag hack transport |
|
10276 jQuery.ajaxTransport( "script", function( s ) { |
|
10277 |
|
10278 // This transport only deals with cross domain or forced-by-attrs requests |
|
10279 if ( s.crossDomain || s.scriptAttrs ) { |
|
10280 var script, callback; |
|
10281 return { |
|
10282 send: function( _, complete ) { |
|
10283 script = jQuery( "<script>" ) |
|
10284 .attr( s.scriptAttrs || {} ) |
|
10285 .prop( { charset: s.scriptCharset, src: s.url } ) |
|
10286 .on( "load error", callback = function( evt ) { |
|
10287 script.remove(); |
|
10288 callback = null; |
|
10289 if ( evt ) { |
|
10290 complete( evt.type === "error" ? 404 : 200, evt.type ); |
|
10291 } |
|
10292 } ); |
|
10293 |
|
10294 // Use native DOM manipulation to avoid our domManip AJAX trickery |
|
10295 document.head.appendChild( script[ 0 ] ); |
|
10296 }, |
|
10297 abort: function() { |
|
10298 if ( callback ) { |
|
10299 callback(); |
|
10300 } |
|
10301 } |
|
10302 }; |
|
10303 } |
|
10304 } ); |
|
10305 |
|
10306 |
|
10307 |
|
10308 |
|
10309 var oldCallbacks = [], |
|
10310 rjsonp = /(=)\?(?=&|$)|\?\?/; |
|
10311 |
|
10312 // Default jsonp settings |
|
10313 jQuery.ajaxSetup( { |
|
10314 jsonp: "callback", |
|
10315 jsonpCallback: function() { |
|
10316 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) ); |
|
10317 this[ callback ] = true; |
|
10318 return callback; |
|
10319 } |
|
10320 } ); |
|
10321 |
|
10322 // Detect, normalize options and install callbacks for jsonp requests |
|
10323 jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { |
|
10324 |
|
10325 var callbackName, overwritten, responseContainer, |
|
10326 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? |
|
10327 "url" : |
|
10328 typeof s.data === "string" && |
|
10329 ( s.contentType || "" ) |
|
10330 .indexOf( "application/x-www-form-urlencoded" ) === 0 && |
|
10331 rjsonp.test( s.data ) && "data" |
|
10332 ); |
|
10333 |
|
10334 // Handle iff the expected data type is "jsonp" or we have a parameter to set |
|
10335 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { |
|
10336 |
|
10337 // Get callback name, remembering preexisting value associated with it |
|
10338 callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ? |
|
10339 s.jsonpCallback() : |
|
10340 s.jsonpCallback; |
|
10341 |
|
10342 // Insert callback into url or form data |
|
10343 if ( jsonProp ) { |
|
10344 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); |
|
10345 } else if ( s.jsonp !== false ) { |
|
10346 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; |
|
10347 } |
|
10348 |
|
10349 // Use data converter to retrieve json after script execution |
|
10350 s.converters[ "script json" ] = function() { |
|
10351 if ( !responseContainer ) { |
|
10352 jQuery.error( callbackName + " was not called" ); |
|
10353 } |
|
10354 return responseContainer[ 0 ]; |
|
10355 }; |
|
10356 |
|
10357 // Force json dataType |
|
10358 s.dataTypes[ 0 ] = "json"; |
|
10359 |
|
10360 // Install callback |
|
10361 overwritten = window[ callbackName ]; |
|
10362 window[ callbackName ] = function() { |
|
10363 responseContainer = arguments; |
|
10364 }; |
|
10365 |
|
10366 // Clean-up function (fires after converters) |
|
10367 jqXHR.always( function() { |
|
10368 |
|
10369 // If previous value didn't exist - remove it |
|
10370 if ( overwritten === undefined ) { |
|
10371 jQuery( window ).removeProp( callbackName ); |
|
10372 |
|
10373 // Otherwise restore preexisting value |
|
10374 } else { |
|
10375 window[ callbackName ] = overwritten; |
|
10376 } |
|
10377 |
|
10378 // Save back as free |
|
10379 if ( s[ callbackName ] ) { |
|
10380 |
|
10381 // Make sure that re-using the options doesn't screw things around |
|
10382 s.jsonpCallback = originalSettings.jsonpCallback; |
|
10383 |
|
10384 // Save the callback name for future use |
|
10385 oldCallbacks.push( callbackName ); |
|
10386 } |
|
10387 |
|
10388 // Call if it was a function and we have a response |
|
10389 if ( responseContainer && isFunction( overwritten ) ) { |
|
10390 overwritten( responseContainer[ 0 ] ); |
|
10391 } |
|
10392 |
|
10393 responseContainer = overwritten = undefined; |
|
10394 } ); |
|
10395 |
|
10396 // Delegate to script |
|
10397 return "script"; |
|
10398 } |
|
10399 } ); |
|
10400 |
|
10401 |
|
10402 |
|
10403 |
|
10404 // Support: Safari 8 only |
|
10405 // In Safari 8 documents created via document.implementation.createHTMLDocument |
|
10406 // collapse sibling forms: the second one becomes a child of the first one. |
|
10407 // Because of that, this security measure has to be disabled in Safari 8. |
|
10408 // https://bugs.webkit.org/show_bug.cgi?id=137337 |
|
10409 support.createHTMLDocument = ( function() { |
|
10410 var body = document.implementation.createHTMLDocument( "" ).body; |
|
10411 body.innerHTML = "<form></form><form></form>"; |
|
10412 return body.childNodes.length === 2; |
|
10413 } )(); |
|
10414 |
|
10415 |
|
10416 // Argument "data" should be string of html |
|
10417 // context (optional): If specified, the fragment will be created in this context, |
|
10418 // defaults to document |
|
10419 // keepScripts (optional): If true, will include scripts passed in the html string |
|
10420 jQuery.parseHTML = function( data, context, keepScripts ) { |
|
10421 if ( typeof data !== "string" ) { |
|
10422 return []; |
|
10423 } |
|
10424 if ( typeof context === "boolean" ) { |
|
10425 keepScripts = context; |
|
10426 context = false; |
|
10427 } |
|
10428 |
|
10429 var base, parsed, scripts; |
|
10430 |
|
10431 if ( !context ) { |
|
10432 |
|
10433 // Stop scripts or inline event handlers from being executed immediately |
|
10434 // by using document.implementation |
|
10435 if ( support.createHTMLDocument ) { |
|
10436 context = document.implementation.createHTMLDocument( "" ); |
|
10437 |
|
10438 // Set the base href for the created document |
|
10439 // so any parsed elements with URLs |
|
10440 // are based on the document's URL (gh-2965) |
|
10441 base = context.createElement( "base" ); |
|
10442 base.href = document.location.href; |
|
10443 context.head.appendChild( base ); |
|
10444 } else { |
|
10445 context = document; |
|
10446 } |
|
10447 } |
|
10448 |
|
10449 parsed = rsingleTag.exec( data ); |
|
10450 scripts = !keepScripts && []; |
|
10451 |
|
10452 // Single tag |
|
10453 if ( parsed ) { |
|
10454 return [ context.createElement( parsed[ 1 ] ) ]; |
|
10455 } |
|
10456 |
|
10457 parsed = buildFragment( [ data ], context, scripts ); |
|
10458 |
|
10459 if ( scripts && scripts.length ) { |
|
10460 jQuery( scripts ).remove(); |
|
10461 } |
|
10462 |
|
10463 return jQuery.merge( [], parsed.childNodes ); |
|
10464 }; |
|
10465 |
|
10466 |
|
10467 /** |
|
10468 * Load a url into a page |
|
10469 */ |
|
10470 jQuery.fn.load = function( url, params, callback ) { |
|
10471 var selector, type, response, |
|
10472 self = this, |
|
10473 off = url.indexOf( " " ); |
|
10474 |
|
10475 if ( off > -1 ) { |
|
10476 selector = stripAndCollapse( url.slice( off ) ); |
|
10477 url = url.slice( 0, off ); |
|
10478 } |
|
10479 |
|
10480 // If it's a function |
|
10481 if ( isFunction( params ) ) { |
|
10482 |
|
10483 // We assume that it's the callback |
|
10484 callback = params; |
|
10485 params = undefined; |
|
10486 |
|
10487 // Otherwise, build a param string |
|
10488 } else if ( params && typeof params === "object" ) { |
|
10489 type = "POST"; |
|
10490 } |
|
10491 |
|
10492 // If we have elements to modify, make the request |
|
10493 if ( self.length > 0 ) { |
|
10494 jQuery.ajax( { |
|
10495 url: url, |
|
10496 |
|
10497 // If "type" variable is undefined, then "GET" method will be used. |
|
10498 // Make value of this field explicit since |
|
10499 // user can override it through ajaxSetup method |
|
10500 type: type || "GET", |
|
10501 dataType: "html", |
|
10502 data: params |
|
10503 } ).done( function( responseText ) { |
|
10504 |
|
10505 // Save response for use in complete callback |
|
10506 response = arguments; |
|
10507 |
|
10508 self.html( selector ? |
|
10509 |
|
10510 // If a selector was specified, locate the right elements in a dummy div |
|
10511 // Exclude scripts to avoid IE 'Permission Denied' errors |
|
10512 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : |
|
10513 |
|
10514 // Otherwise use the full result |
|
10515 responseText ); |
|
10516 |
|
10517 // If the request succeeds, this function gets "data", "status", "jqXHR" |
|
10518 // but they are ignored because response was set above. |
|
10519 // If it fails, this function gets "jqXHR", "status", "error" |
|
10520 } ).always( callback && function( jqXHR, status ) { |
|
10521 self.each( function() { |
|
10522 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); |
|
10523 } ); |
|
10524 } ); |
|
10525 } |
|
10526 |
|
10527 return this; |
|
10528 }; |
|
10529 |
|
10530 |
|
10531 |
|
10532 |
|
10533 jQuery.expr.pseudos.animated = function( elem ) { |
|
10534 return jQuery.grep( jQuery.timers, function( fn ) { |
|
10535 return elem === fn.elem; |
|
10536 } ).length; |
|
10537 }; |
|
10538 |
|
10539 |
|
10540 |
|
10541 |
|
10542 jQuery.offset = { |
|
10543 setOffset: function( elem, options, i ) { |
|
10544 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, |
|
10545 position = jQuery.css( elem, "position" ), |
|
10546 curElem = jQuery( elem ), |
|
10547 props = {}; |
|
10548 |
|
10549 // Set position first, in-case top/left are set even on static elem |
|
10550 if ( position === "static" ) { |
|
10551 elem.style.position = "relative"; |
|
10552 } |
|
10553 |
|
10554 curOffset = curElem.offset(); |
|
10555 curCSSTop = jQuery.css( elem, "top" ); |
|
10556 curCSSLeft = jQuery.css( elem, "left" ); |
|
10557 calculatePosition = ( position === "absolute" || position === "fixed" ) && |
|
10558 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; |
|
10559 |
|
10560 // Need to be able to calculate position if either |
|
10561 // top or left is auto and position is either absolute or fixed |
|
10562 if ( calculatePosition ) { |
|
10563 curPosition = curElem.position(); |
|
10564 curTop = curPosition.top; |
|
10565 curLeft = curPosition.left; |
|
10566 |
|
10567 } else { |
|
10568 curTop = parseFloat( curCSSTop ) || 0; |
|
10569 curLeft = parseFloat( curCSSLeft ) || 0; |
|
10570 } |
|
10571 |
|
10572 if ( isFunction( options ) ) { |
|
10573 |
|
10574 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) |
|
10575 options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); |
|
10576 } |
|
10577 |
|
10578 if ( options.top != null ) { |
|
10579 props.top = ( options.top - curOffset.top ) + curTop; |
|
10580 } |
|
10581 if ( options.left != null ) { |
|
10582 props.left = ( options.left - curOffset.left ) + curLeft; |
|
10583 } |
|
10584 |
|
10585 if ( "using" in options ) { |
|
10586 options.using.call( elem, props ); |
|
10587 |
|
10588 } else { |
|
10589 curElem.css( props ); |
|
10590 } |
|
10591 } |
|
10592 }; |
|
10593 |
|
10594 jQuery.fn.extend( { |
|
10595 |
|
10596 // offset() relates an element's border box to the document origin |
|
10597 offset: function( options ) { |
|
10598 |
|
10599 // Preserve chaining for setter |
|
10600 if ( arguments.length ) { |
|
10601 return options === undefined ? |
|
10602 this : |
|
10603 this.each( function( i ) { |
|
10604 jQuery.offset.setOffset( this, options, i ); |
|
10605 } ); |
|
10606 } |
|
10607 |
|
10608 var rect, win, |
|
10609 elem = this[ 0 ]; |
|
10610 |
|
10611 if ( !elem ) { |
|
10612 return; |
|
10613 } |
|
10614 |
|
10615 // Return zeros for disconnected and hidden (display: none) elements (gh-2310) |
|
10616 // Support: IE <=11 only |
|
10617 // Running getBoundingClientRect on a |
|
10618 // disconnected node in IE throws an error |
|
10619 if ( !elem.getClientRects().length ) { |
|
10620 return { top: 0, left: 0 }; |
|
10621 } |
|
10622 |
|
10623 // Get document-relative position by adding viewport scroll to viewport-relative gBCR |
|
10624 rect = elem.getBoundingClientRect(); |
|
10625 win = elem.ownerDocument.defaultView; |
|
10626 return { |
|
10627 top: rect.top + win.pageYOffset, |
|
10628 left: rect.left + win.pageXOffset |
|
10629 }; |
|
10630 }, |
|
10631 |
|
10632 // position() relates an element's margin box to its offset parent's padding box |
|
10633 // This corresponds to the behavior of CSS absolute positioning |
|
10634 position: function() { |
|
10635 if ( !this[ 0 ] ) { |
|
10636 return; |
|
10637 } |
|
10638 |
|
10639 var offsetParent, offset, doc, |
|
10640 elem = this[ 0 ], |
|
10641 parentOffset = { top: 0, left: 0 }; |
|
10642 |
|
10643 // position:fixed elements are offset from the viewport, which itself always has zero offset |
|
10644 if ( jQuery.css( elem, "position" ) === "fixed" ) { |
|
10645 |
|
10646 // Assume position:fixed implies availability of getBoundingClientRect |
|
10647 offset = elem.getBoundingClientRect(); |
|
10648 |
|
10649 } else { |
|
10650 offset = this.offset(); |
|
10651 |
|
10652 // Account for the *real* offset parent, which can be the document or its root element |
|
10653 // when a statically positioned element is identified |
|
10654 doc = elem.ownerDocument; |
|
10655 offsetParent = elem.offsetParent || doc.documentElement; |
|
10656 while ( offsetParent && |
|
10657 ( offsetParent === doc.body || offsetParent === doc.documentElement ) && |
|
10658 jQuery.css( offsetParent, "position" ) === "static" ) { |
|
10659 |
|
10660 offsetParent = offsetParent.parentNode; |
|
10661 } |
|
10662 if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) { |
|
10663 |
|
10664 // Incorporate borders into its offset, since they are outside its content origin |
|
10665 parentOffset = jQuery( offsetParent ).offset(); |
|
10666 parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true ); |
|
10667 parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true ); |
|
10668 } |
|
10669 } |
|
10670 |
|
10671 // Subtract parent offsets and element margins |
|
10672 return { |
|
10673 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), |
|
10674 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) |
|
10675 }; |
|
10676 }, |
|
10677 |
|
10678 // This method will return documentElement in the following cases: |
|
10679 // 1) For the element inside the iframe without offsetParent, this method will return |
|
10680 // documentElement of the parent window |
|
10681 // 2) For the hidden or detached element |
|
10682 // 3) For body or html element, i.e. in case of the html node - it will return itself |
|
10683 // |
|
10684 // but those exceptions were never presented as a real life use-cases |
|
10685 // and might be considered as more preferable results. |
|
10686 // |
|
10687 // This logic, however, is not guaranteed and can change at any point in the future |
|
10688 offsetParent: function() { |
|
10689 return this.map( function() { |
|
10690 var offsetParent = this.offsetParent; |
|
10691 |
|
10692 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { |
|
10693 offsetParent = offsetParent.offsetParent; |
|
10694 } |
|
10695 |
|
10696 return offsetParent || documentElement; |
|
10697 } ); |
|
10698 } |
|
10699 } ); |
|
10700 |
|
10701 // Create scrollLeft and scrollTop methods |
|
10702 jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { |
|
10703 var top = "pageYOffset" === prop; |
|
10704 |
|
10705 jQuery.fn[ method ] = function( val ) { |
|
10706 return access( this, function( elem, method, val ) { |
|
10707 |
|
10708 // Coalesce documents and windows |
|
10709 var win; |
|
10710 if ( isWindow( elem ) ) { |
|
10711 win = elem; |
|
10712 } else if ( elem.nodeType === 9 ) { |
|
10713 win = elem.defaultView; |
|
10714 } |
|
10715 |
|
10716 if ( val === undefined ) { |
|
10717 return win ? win[ prop ] : elem[ method ]; |
|
10718 } |
|
10719 |
|
10720 if ( win ) { |
|
10721 win.scrollTo( |
|
10722 !top ? val : win.pageXOffset, |
|
10723 top ? val : win.pageYOffset |
|
10724 ); |
|
10725 |
|
10726 } else { |
|
10727 elem[ method ] = val; |
|
10728 } |
|
10729 }, method, val, arguments.length ); |
|
10730 }; |
|
10731 } ); |
|
10732 |
|
10733 // Support: Safari <=7 - 9.1, Chrome <=37 - 49 |
|
10734 // Add the top/left cssHooks using jQuery.fn.position |
|
10735 // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 |
|
10736 // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 |
|
10737 // getComputedStyle returns percent when specified for top/left/bottom/right; |
|
10738 // rather than make the css module depend on the offset module, just check for it here |
|
10739 jQuery.each( [ "top", "left" ], function( _i, prop ) { |
|
10740 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, |
|
10741 function( elem, computed ) { |
|
10742 if ( computed ) { |
|
10743 computed = curCSS( elem, prop ); |
|
10744 |
|
10745 // If curCSS returns percentage, fallback to offset |
|
10746 return rnumnonpx.test( computed ) ? |
|
10747 jQuery( elem ).position()[ prop ] + "px" : |
|
10748 computed; |
|
10749 } |
|
10750 } |
|
10751 ); |
|
10752 } ); |
|
10753 |
|
10754 |
|
10755 // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods |
|
10756 jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { |
|
10757 jQuery.each( { |
|
10758 padding: "inner" + name, |
|
10759 content: type, |
|
10760 "": "outer" + name |
|
10761 }, function( defaultExtra, funcName ) { |
|
10762 |
|
10763 // Margin is only for outerHeight, outerWidth |
|
10764 jQuery.fn[ funcName ] = function( margin, value ) { |
|
10765 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), |
|
10766 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); |
|
10767 |
|
10768 return access( this, function( elem, type, value ) { |
|
10769 var doc; |
|
10770 |
|
10771 if ( isWindow( elem ) ) { |
|
10772 |
|
10773 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) |
|
10774 return funcName.indexOf( "outer" ) === 0 ? |
|
10775 elem[ "inner" + name ] : |
|
10776 elem.document.documentElement[ "client" + name ]; |
|
10777 } |
|
10778 |
|
10779 // Get document width or height |
|
10780 if ( elem.nodeType === 9 ) { |
|
10781 doc = elem.documentElement; |
|
10782 |
|
10783 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], |
|
10784 // whichever is greatest |
|
10785 return Math.max( |
|
10786 elem.body[ "scroll" + name ], doc[ "scroll" + name ], |
|
10787 elem.body[ "offset" + name ], doc[ "offset" + name ], |
|
10788 doc[ "client" + name ] |
|
10789 ); |
|
10790 } |
|
10791 |
|
10792 return value === undefined ? |
|
10793 |
|
10794 // Get width or height on the element, requesting but not forcing parseFloat |
|
10795 jQuery.css( elem, type, extra ) : |
|
10796 |
|
10797 // Set width or height on the element |
|
10798 jQuery.style( elem, type, value, extra ); |
|
10799 }, type, chainable ? margin : undefined, chainable ); |
|
10800 }; |
|
10801 } ); |
|
10802 } ); |
|
10803 |
|
10804 |
|
10805 jQuery.each( [ |
|
10806 "ajaxStart", |
|
10807 "ajaxStop", |
|
10808 "ajaxComplete", |
|
10809 "ajaxError", |
|
10810 "ajaxSuccess", |
|
10811 "ajaxSend" |
|
10812 ], function( _i, type ) { |
|
10813 jQuery.fn[ type ] = function( fn ) { |
|
10814 return this.on( type, fn ); |
|
10815 }; |
|
10816 } ); |
|
10817 |
|
10818 |
|
10819 |
|
10820 |
|
10821 jQuery.fn.extend( { |
|
10822 |
|
10823 bind: function( types, data, fn ) { |
|
10824 return this.on( types, null, data, fn ); |
|
10825 }, |
|
10826 unbind: function( types, fn ) { |
|
10827 return this.off( types, null, fn ); |
|
10828 }, |
|
10829 |
|
10830 delegate: function( selector, types, data, fn ) { |
|
10831 return this.on( types, selector, data, fn ); |
|
10832 }, |
|
10833 undelegate: function( selector, types, fn ) { |
|
10834 |
|
10835 // ( namespace ) or ( selector, types [, fn] ) |
|
10836 return arguments.length === 1 ? |
|
10837 this.off( selector, "**" ) : |
|
10838 this.off( types, selector || "**", fn ); |
|
10839 }, |
|
10840 |
|
10841 hover: function( fnOver, fnOut ) { |
|
10842 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); |
|
10843 } |
|
10844 } ); |
|
10845 |
|
10846 jQuery.each( |
|
10847 ( "blur focus focusin focusout resize scroll click dblclick " + |
|
10848 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + |
|
10849 "change select submit keydown keypress keyup contextmenu" ).split( " " ), |
|
10850 function( _i, name ) { |
|
10851 |
|
10852 // Handle event binding |
|
10853 jQuery.fn[ name ] = function( data, fn ) { |
|
10854 return arguments.length > 0 ? |
|
10855 this.on( name, null, data, fn ) : |
|
10856 this.trigger( name ); |
|
10857 }; |
|
10858 } |
|
10859 ); |
|
10860 |
|
10861 |
|
10862 |
|
10863 |
|
10864 // Support: Android <=4.0 only |
|
10865 // Make sure we trim BOM and NBSP |
|
10866 // Require that the "whitespace run" starts from a non-whitespace |
|
10867 // to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position. |
|
10868 var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g; |
|
10869 |
|
10870 // Bind a function to a context, optionally partially applying any |
|
10871 // arguments. |
|
10872 // jQuery.proxy is deprecated to promote standards (specifically Function#bind) |
|
10873 // However, it is not slated for removal any time soon |
|
10874 jQuery.proxy = function( fn, context ) { |
|
10875 var tmp, args, proxy; |
|
10876 |
|
10877 if ( typeof context === "string" ) { |
|
10878 tmp = fn[ context ]; |
|
10879 context = fn; |
|
10880 fn = tmp; |
|
10881 } |
|
10882 |
|
10883 // Quick check to determine if target is callable, in the spec |
|
10884 // this throws a TypeError, but we will just return undefined. |
|
10885 if ( !isFunction( fn ) ) { |
|
10886 return undefined; |
|
10887 } |
|
10888 |
|
10889 // Simulated bind |
|
10890 args = slice.call( arguments, 2 ); |
|
10891 proxy = function() { |
|
10892 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); |
|
10893 }; |
|
10894 |
|
10895 // Set the guid of unique handler to the same of original handler, so it can be removed |
|
10896 proxy.guid = fn.guid = fn.guid || jQuery.guid++; |
|
10897 |
|
10898 return proxy; |
|
10899 }; |
|
10900 |
|
10901 jQuery.holdReady = function( hold ) { |
|
10902 if ( hold ) { |
|
10903 jQuery.readyWait++; |
|
10904 } else { |
|
10905 jQuery.ready( true ); |
|
10906 } |
|
10907 }; |
|
10908 jQuery.isArray = Array.isArray; |
|
10909 jQuery.parseJSON = JSON.parse; |
|
10910 jQuery.nodeName = nodeName; |
|
10911 jQuery.isFunction = isFunction; |
|
10912 jQuery.isWindow = isWindow; |
|
10913 jQuery.camelCase = camelCase; |
|
10914 jQuery.type = toType; |
|
10915 |
|
10916 jQuery.now = Date.now; |
|
10917 |
|
10918 jQuery.isNumeric = function( obj ) { |
|
10919 |
|
10920 // As of jQuery 3.0, isNumeric is limited to |
|
10921 // strings and numbers (primitives or objects) |
|
10922 // that can be coerced to finite numbers (gh-2662) |
|
10923 var type = jQuery.type( obj ); |
|
10924 return ( type === "number" || type === "string" ) && |
|
10925 |
|
10926 // parseFloat NaNs numeric-cast false positives ("") |
|
10927 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") |
|
10928 // subtraction forces infinities to NaN |
|
10929 !isNaN( obj - parseFloat( obj ) ); |
|
10930 }; |
|
10931 |
|
10932 jQuery.trim = function( text ) { |
|
10933 return text == null ? |
|
10934 "" : |
|
10935 ( text + "" ).replace( rtrim, "$1" ); |
|
10936 }; |
|
10937 |
|
10938 |
|
10939 |
|
10940 // Register as a named AMD module, since jQuery can be concatenated with other |
|
10941 // files that may use define, but not via a proper concatenation script that |
|
10942 // understands anonymous AMD modules. A named AMD is safest and most robust |
|
10943 // way to register. Lowercase jquery is used because AMD module names are |
|
10944 // derived from file names, and jQuery is normally delivered in a lowercase |
|
10945 // file name. Do this after creating the global so that if an AMD module wants |
|
10946 // to call noConflict to hide this version of jQuery, it will work. |
|
10947 |
|
10948 // Note that for maximum portability, libraries that are not jQuery should |
|
10949 // declare themselves as anonymous modules, and avoid setting a global if an |
|
10950 // AMD loader is present. jQuery is a special case. For more information, see |
|
10951 // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon |
|
10952 |
|
10953 if ( typeof define === "function" && define.amd ) { |
|
10954 define( "jquery", [], function() { |
|
10955 return jQuery; |
|
10956 } ); |
|
10957 } |
|
10958 |
|
10959 |
|
10960 |
|
10961 |
|
10962 var |
|
10963 |
|
10964 // Map over jQuery in case of overwrite |
|
10965 _jQuery = window.jQuery, |
|
10966 |
|
10967 // Map over the $ in case of overwrite |
|
10968 _$ = window.$; |
|
10969 |
|
10970 jQuery.noConflict = function( deep ) { |
|
10971 if ( window.$ === jQuery ) { |
|
10972 window.$ = _$; |
|
10973 } |
|
10974 |
|
10975 if ( deep && window.jQuery === jQuery ) { |
|
10976 window.jQuery = _jQuery; |
|
10977 } |
|
10978 |
|
10979 return jQuery; |
|
10980 }; |
|
10981 |
|
10982 // Expose jQuery and $ identifiers, even in AMD |
|
10983 // (trac-7102#comment:10, https://github.com/jquery/jquery/pull/557) |
|
10984 // and CommonJS for browser emulators (trac-13566) |
|
10985 if ( typeof noGlobal === "undefined" ) { |
|
10986 window.jQuery = window.$ = jQuery; |
|
10987 } |
|
10988 |
|
10989 |
|
10990 |
|
10991 |
|
10992 return jQuery; |
|
10993 } ); |