agriget/lib/dojo/selector/acme.js

8 lines
13 KiB
JavaScript
Raw Normal View History

2019-03-22 22:17:29 +08:00
/*
Copyright (c) 2004-2016, The JS Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
//>>built
define("dojo/selector/acme",["../dom","../sniff","../_base/array","../_base/lang","../_base/window"],function(_1,_2,_3,_4,_5){var _6=_4.trim;var _7=_3.forEach;var _8=function(){return _5.doc;};var _9=(_8().compatMode)=="BackCompat";var _a=">~+";var _b=false;var _c=function(){return true;};var _d=function(_e){if(_a.indexOf(_e.slice(-1))>=0){_e+=" * ";}else{_e+=" ";}var ts=function(s,e){return _6(_e.slice(s,e));};var _f=[];var _10=-1,_11=-1,_12=-1,_13=-1,_14=-1,_15=-1,_16=-1,_17,lc="",cc="",_18;var x=0,ql=_e.length,_19=null,_1a=null;var _1b=function(){if(_16>=0){var tv=(_16==x)?null:ts(_16,x);_19[(_a.indexOf(tv)<0)?"tag":"oper"]=tv;_16=-1;}};var _1c=function(){if(_15>=0){_19.id=ts(_15,x).replace(/\\/g,"");_15=-1;}};var _1d=function(){if(_14>=0){_19.classes.push(ts(_14+1,x).replace(/\\/g,""));_14=-1;}};var _1e=function(){_1c();_1b();_1d();};var _1f=function(){_1e();if(_13>=0){_19.pseudos.push({name:ts(_13+1,x)});}_19.loops=(_19.pseudos.length||_19.attrs.length||_19.classes.length);_19.oquery=_19.query=ts(_18,x);_19.otag=_19.tag=(_19["oper"])?null:(_19.tag||"*");if(_19.tag){_19.tag=_19.tag.toUpperCase();}if(_f.length&&(_f[_f.length-1].oper)){_19.infixOper=_f.pop();_19.query=_19.infixOper.query+" "+_19.query;}_f.push(_19);_19=null;};for(;lc=cc,cc=_e.charAt(x),x<ql;x++){if(lc=="\\"){continue;}if(!_19){_18=x;_19={query:null,pseudos:[],attrs:[],classes:[],tag:null,oper:null,id:null,getTag:function(){return _b?this.otag:this.tag;}};_16=x;}if(_17){if(cc==_17){_17=null;}continue;}else{if(cc=="'"||cc=="\""){_17=cc;continue;}}if(_10>=0){if(cc=="]"){if(!_1a.attr){_1a.attr=ts(_10+1,x);}else{_1a.matchFor=ts((_12||_10+1),x);}var cmf=_1a.matchFor;if(cmf){if((cmf.charAt(0)=="\"")||(cmf.charAt(0)=="'")){_1a.matchFor=cmf.slice(1,-1);}}if(_1a.matchFor){_1a.matchFor=_1a.matchFor.replace(/\\/g,"");}_19.attrs.push(_1a);_1a=null;_10=_12=-1;}else{if(cc=="="){var _20=("|~^$*".indexOf(lc)>=0)?lc:"";_1a.type=_20+cc;_1a.attr=ts(_10+1,x-_20.length);_12=x+1;}}}else{if(_11>=0){if(cc==")"){if(_13>=0){_1a.value=ts(_11+1,x);}_13=_11=-1;}}else{if(cc=="#"){_1e();_15=x+1;}else{if(cc=="."){_1e();_14=x;}else{if(cc==":"){_1e();_13=x;}else{if(cc=="["){_1e();_10=x;_1a={};}else{if(cc=="("){if(_13>=0){_1a={name:ts(_13+1,x),value:null};_19.pseudos.push(_1a);}_11=x;}else{if((cc==" ")&&(lc!=cc)){_1f();}}}}}}}}}return _f;};var _21=function(_22,_23){if(!_22){return _23;}if(!_23){return _22;}return function(){return _22.apply(window,arguments)&&_23.apply(window,arguments);};};var _24=function(i,arr){var r=arr||[];if(i){r.push(i);}return r;};var _25=function(n){return (1==n.nodeType);};var _26="";var _27=function(_28,_29){if(!_28){return _26;}if(_29=="class"){return _28.className||_26;}if(_29=="for"){return _28.htmlFor||_26;}if(_29=="style"){return _28.style.cssText||_26;}return (_b?_28.getAttribute(_29):_28.getAttribute(_29,2))||_26;};var _2a={"*=":function(_2b,_2c){return function(_2d){return (_27(_2d,_2b).indexOf(_2c)>=0);};},"^=":function(_2e,_2f){return function(_30){return (_27(_30,_2e).indexOf(_2f)==0);};},"$=":function(_31,_32){return function(_33){var ea=" "+_27(_33,_31);var _34=ea.lastIndexOf(_32);return _34>-1&&(_34==(ea.length-_32.length));};},"~=":function(_35,_36){var _37=" "+_36+" ";return function(_38){var ea=" "+_27(_38,_35)+" ";return (ea.indexOf(_37)>=0);};},"|=":function(_39,_3a){var _3b=_3a+"-";return function(_3c){var ea=_27(_3c,_39);return ((ea==_3a)||(ea.indexOf(_3b)==0));};},"=":function(_3d,_3e){return function(_3f){return (_27(_3f,_3d)==_3e);};}};var _40=_8().documentElement;var _41=!(_40.nextElementSibling||"nextElementSibling" in _40);var _42=!_41?"nextElementSibling":"nextSibling";var _43=!_41?"previousElementSibling":"previousSibling";var _44=(_41?_25:_c);var _45=function(_46){while(_46=_46[_43]){if(_44(_46)){return false;}}return true;};var _47=function(_48){while(_48=_48[_42]){if(_44(_48)){return false;}}return true;};var _49=function(_4a){var _4b=_4a.parentNode;_4b=_4b.nodeType!=7?_4b:_4b.nextSibling;var i=0,_4c=_4b.children||_4b.childNodes,ci=(_4a["_i"]||_4a.getAttribute("_i")||-1),cl=(_4b["_l"]||(typeof _4b.getAttribute!=="undefined"?_4b