⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 domquery-min.js

📁 ext js demo ext学习资料
💻 JS
字号:
/*
 * Ext JS Library 1.1 RC 1
 * Copyright(c) 2006-2007, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://www.extjs.com/license
 */

Ext.DomQuery=function(){var _1={},_2={},_3={};var _4=/\S/;var _5=/^\s+|\s+$/g;var _6=/\{(\d+)\}/g;var _7=/^(\s?[\/>+~]\s?|\s|$)/;var _8=/^(#)?([\w-\*]+)/;var _9=/(\d*)n\+?(\d*)/,_a=/\D/;function child(p,_c){var i=0;var n=p.firstChild;while(n){if(n.nodeType==1){if(++i==_c){return n;}}n=n.nextSibling;}return null;}function next(n){while((n=n.nextSibling)&&n.nodeType!=1){}return n;}function prev(n){while((n=n.previousSibling)&&n.nodeType!=1){}return n;}function children(d){var n=d.firstChild,ni=-1;while(n){var nx=n.nextSibling;if(n.nodeType==3&&!_4.test(n.nodeValue)){d.removeChild(n);}else{n.nodeIndex=++ni;}n=nx;}return this;}function byClassName(c,a,v,re,cn){if(!v){return c;}var r=[];for(var i=0,ci;ci=c[i];i++){cn=ci.className;if(cn&&(" "+cn+" ").indexOf(v)!=-1){r[r.length]=ci;}}return r;}function attrValue(n,_1e){if(!n.tagName&&typeof n.length!="undefined"){n=n[0];}if(!n){return null;}if(_1e=="for"){return n.htmlFor;}if(_1e=="class"||_1e=="className"){return n.className;}return n.getAttribute(_1e)||n[_1e];}function getNodes(ns,_20,_21){var _22=[],cs;if(!ns){return _22;}_21=_21||"*";if(typeof ns.getElementsByTagName!="undefined"){ns=[ns];}if(!_20){for(var i=0,ni;ni=ns[i];i++){cs=ni.getElementsByTagName(_21);for(var j=0,ci;ci=cs[j];j++){_22[_22.length]=ci;}}}else{if(_20=="/"||_20==">"){for(var i=0,ni;ni=ns[i];i++){var cn=ni.getElementsByTagName(_21);for(var j=0,cj;cj=cn[j];j++){if(cj.parentNode==ni){_22[_22.length]=cj;}}}}else{if(_20=="+"){for(var i=0,n;n=ns[i];i++){while((n=n.nextSibling)&&n.nodeType!=1){}if(n&&(_21=="*"||n.tagName.toLowerCase()==_21)){_22[_22.length]=n;}}}else{if(_20=="~"){for(var i=0,n;n=ns[i];i++){while((n=n.nextSibling)&&(n.nodeType!=1||(_21=="*"||n.tagName.toLowerCase()!=_21))){}if(n){_22[_22.length]=n;}}}}}}return _22;}function concat(a,b){if(b.slice){return a.concat(b);}for(var i=0,l=b.length;i<l;i++){a[a.length]=b[i];}return a;}function byTag(cs,_30){if(cs.tagName||cs==document){cs=[cs];}if(!_30){return cs;}var r=[];_30=_30.toLowerCase();for(var i=0,ci;ci=cs[i];i++){if(ci.nodeType==1&&ci.tagName.toLowerCase()==_30){r[r.length]=ci;}}return r;}function byId(cs,_35,id){if(cs.tagName||cs==document){cs=[cs];}if(!id){return cs;}var r=[];for(var i=0,ci;ci=cs[i];i++){if(ci&&ci.id==id){r[r.length]=ci;return r;}}return r;}function byAttribute(cs,_3b,_3c,op,_3e){var r=[],st=_3e=="{";var f=Ext.DomQuery.operators[op];for(var i=0,ci;ci=cs[i];i++){var a;if(st){a=Ext.DomQuery.getStyle(ci,_3b);}else{if(_3b=="class"||_3b=="className"){a=ci.className;}else{if(_3b=="for"){a=ci.htmlFor;}else{if(_3b=="href"){a=ci.getAttribute("href",2);}else{a=ci.getAttribute(_3b);}}}}if((f&&f(a,_3c))||(!f&&a)){r[r.length]=ci;}}return r;}function byPseudo(cs,_46,_47){return Ext.DomQuery.pseudos[_46](cs,_47);}var _48=window.ActiveXObject?true:false;eval("var batch = 30803;");var key=30803;function nodupIEXml(cs){var d=++key;cs[0].setAttribute("_nodup",d);var r=[cs[0]];for(var i=1,len=cs.length;i<len;i++){var c=cs[i];if(!c.getAttribute("_nodup")!=d){c.setAttribute("_nodup",d);r[r.length]=c;}}for(var i=0,len=cs.length;i<len;i++){cs[i].removeAttribute("_nodup");}return r;}function nodup(cs){if(!cs){return[];}var len=cs.length,c,i,r=cs,cj;if(!len||typeof cs.nodeType!="undefined"||len==1){return cs;}if(_48&&typeof cs[0].selectSingleNode!="undefined"){return nodupIEXml(cs);}var d=++key;cs[0]._nodup=d;for(i=1;c=cs[i];i++){if(c._nodup!=d){c._nodup=d;}else{r=[];for(var j=0;j<i;j++){r[r.length]=cs[j];}for(j=i+1;cj=cs[j];j++){if(cj._nodup!=d){cj._nodup=d;r[r.length]=cj;}}return r;}}return r;}function quickDiffIEXml(c1,c2){var d=++key;for(var i=0,len=c1.length;i<len;i++){c1[i].setAttribute("_qdiff",d);}var r=[];for(var i=0,len=c2.length;i<len;i++){if(c2[i].getAttribute("_qdiff")!=d){r[r.length]=c2[i];}}for(var i=0,len=c1.length;i<len;i++){c1[i].removeAttribute("_qdiff");}return r;}function quickDiff(c1,c2){var _60=c1.length;if(!_60){return c2;}if(_48&&c1[0].selectSingleNode){return quickDiffIEXml(c1,c2);}var d=++key;for(var i=0;i<_60;i++){c1[i]._qdiff=d;}var r=[];for(var i=0,len=c2.length;i<len;i++){if(c2[i]._qdiff!=d){r[r.length]=c2[i];}}return r;}function quickId(ns,_66,_67,id){if(ns==_67){var d=_67.ownerDocument||_67;return d.getElementById(id);}ns=getNodes(ns,_66,"*");return byId(ns,null,id);}return{getStyle:function(el,_6b){return Ext.fly(el).getStyle(_6b);},compile:function(_6c,_6d){_6d=_6d||"select";var fn=["var f = function(root){\n var mode; ++batch; var n = root || document;\n"];var q=_6c,_70,lq;var tk=Ext.DomQuery.matchers;var _73=tk.length;var mm;var _75=q.match(_7);if(_75&&_75[1]){fn[fn.length]="mode=\""+_75[1].replace(_5,"")+"\";";q=q.replace(_75[1],"");}while(_6c.substr(0,1)=="/"){_6c=_6c.substr(1);}while(q&&lq!=q){lq=q;var tm=q.match(_8);if(_6d=="select"){if(tm){if(tm[1]=="#"){fn[fn.length]="n = quickId(n, mode, root, \""+tm[2]+"\");";}else{fn[fn.length]="n = getNodes(n, mode, \""+tm[2]+"\");";}q=q.replace(tm[0],"");}else{if(q.substr(0,1)!="@"){fn[fn.length]="n = getNodes(n, mode, \"*\");";}}}else{if(tm){if(tm[1]=="#"){fn[fn.length]="n = byId(n, null, \""+tm[2]+"\");";}else{fn[fn.length]="n = byTag(n, \""+tm[2]+"\");";}q=q.replace(tm[0],"");}}while(!(mm=q.match(_7))){var _77=false;for(var j=0;j<_73;j++){var t=tk[j];var m=q.match(t.re);if(m){fn[fn.length]=t.select.replace(_6,function(x,i){return m[i];});q=q.replace(m[0],"");_77=true;break;}}if(!_77){throw"Error parsing selector, parsing failed at \""+q+"\"";}}if(mm[1]){fn[fn.length]="mode=\""+mm[1].replace(_5,"")+"\";";q=q.replace(mm[1],"");}}fn[fn.length]="return nodup(n);\n}";eval(fn.join(""));return f;},select:function(_7d,_7e,_7f){if(!_7e||_7e==document){_7e=document;}if(typeof _7e=="string"){_7e=document.getElementById(_7e);}var _80=_7d.split(",");var _81=[];for(var i=0,len=_80.length;i<len;i++){var p=_80[i].replace(_5,"");if(!_1[p]){_1[p]=Ext.DomQuery.compile(p);if(!_1[p]){throw p+" is not a valid selector";}}var _85=_1[p](_7e);if(_85&&_85!=document){_81=_81.concat(_85);}}if(_80.length>1){return nodup(_81);}return _81;},selectNode:function(_86,_87){return Ext.DomQuery.select(_86,_87)[0];},selectValue:function(_88,_89,_8a){_88=_88.replace(_5,"");if(!_3[_88]){_3[_88]=Ext.DomQuery.compile(_88,"select");}var n=_3[_88](_89);n=n[0]?n[0]:n;var v=(n&&n.firstChild?n.firstChild.nodeValue:null);return((v===null||v===undefined||v==="")?_8a:v);},selectNumber:function(_8d,_8e,_8f){var v=Ext.DomQuery.selectValue(_8d,_8e,_8f||0);return parseFloat(v);},is:function(el,ss){if(typeof el=="string"){el=document.getElementById(el);}var _93=(el instanceof Array);var _94=Ext.DomQuery.filter(_93?el:[el],ss);return _93?(_94.length==el.length):(_94.length>0);},filter:function(els,ss,_97){ss=ss.replace(_5,"");if(!_2[ss]){_2[ss]=Ext.DomQuery.compile(ss,"simple");}var _98=_2[ss](els);return _97?quickDiff(_98,els):_98;},matchers:[{re:/^\.([\w-]+)/,select:"n = byClassName(n, null, \" {1} \");"},{re:/^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,select:"n = byPseudo(n, \"{1}\", \"{2}\");"},{re:/^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,select:"n = byAttribute(n, \"{2}\", \"{4}\", \"{3}\", \"{1}\");"},{re:/^#([\w-]+)/,select:"n = byId(n, null, \"{1}\");"},{re:/^@([\w-]+)/,select:"return {firstChild:{nodeValue:attrValue(n, \"{1}\")}};"}],operators:{"=":function(a,v){return a==v;},"!=":function(a,v){return a!=v;},"^=":function(a,v){return a&&a.substr(0,v.length)==v;},"$=":function(a,v){return a&&a.substr(a.length-v.length)==v;},"*=":function(a,v){return a&&a.indexOf(v)!==-1;},"%=":function(a,v){return(a%v)==0;}},pseudos:{"first-child":function(c){var r=[],n;for(var i=0,ci;ci=n=c[i];i++){while((n=n.previousSibling)&&n.nodeType!=1){}if(!n){r[r.length]=ci;}}return r;},"last-child":function(c){var r=[],n;for(var i=0,ci;ci=n=c[i];i++){while((n=n.nextSibling)&&n.nodeType!=1){}if(!n){r[r.length]=ci;}}return r;},"nth-child":function(c,a){var r=[];var m=_9.exec(a=="even"&&"2n"||a=="odd"&&"2n+1"||!_a.test(a)&&"n+"+a||a);var f=(m[1]||1)-0,l=m[2]-0;for(var i=0,n;n=c[i];i++){var pn=n.parentNode;if(batch!=pn._batch){var j=0;for(var cn=pn.firstChild;cn;cn=cn.nextSibling){if(cn.nodeType==1){cn.nodeIndex=++j;}}pn._batch=batch;}if(f==1){if(l==0||n.nodeIndex==l){r[r.length]=n;}}else{if((n.nodeIndex+l)%f==0){r[r.length]=n;}}}return r;},"only-child":function(c){var r=[];for(var i=0,ci;ci=c[i];i++){if(!prev(ci)&&!next(ci)){r[r.length]=ci;}}return r;},"empty":function(c){var r=[];for(var i=0,ci;ci=c[i];i++){var cns=ci.childNodes,j=0,cn,_c5=true;while(cn=cns[j]){++j;if(cn.nodeType==1||cn.nodeType==3){_c5=false;break;}}if(_c5){r[r.length]=ci;}}return r;},"contains":function(c,v){var r=[];for(var i=0,ci;ci=c[i];i++){if(ci.innerHTML.indexOf(v)!==-1){r[r.length]=ci;}}return r;},"nodeValue":function(c,v){var r=[];for(var i=0,ci;ci=c[i];i++){if(ci.firstChild&&ci.firstChild.nodeValue==v){r[r.length]=ci;}}return r;},"checked":function(c){var r=[];for(var i=0,ci;ci=c[i];i++){if(ci.checked==true){r[r.length]=ci;}}return r;},"not":function(c,ss){return Ext.DomQuery.filter(c,ss,true);},"odd":function(c){return this["nth-child"](c,"odd");},"even":function(c){return this["nth-child"](c,"even");},"nth":function(c,a){return c[a-1]||[];},"first":function(c){return c[0]||[];},"last":function(c){return c[c.length-1]||[];},"has":function(c,ss){var s=Ext.DomQuery.select;var r=[];for(var i=0,ci;ci=c[i];i++){if(s(ss,ci).length>0){r[r.length]=ci;}}return r;},"next":function(c,ss){var is=Ext.DomQuery.is;var r=[];for(var i=0,ci;ci=c[i];i++){var n=next(ci);if(n&&is(n,ss)){r[r.length]=ci;}}return r;},"prev":function(c,ss){var is=Ext.DomQuery.is;var r=[];for(var i=0,ci;ci=c[i];i++){var n=prev(ci);if(n&&is(n,ss)){r[r.length]=ci;}}return r;}}};}();Ext.query=Ext.DomQuery.select;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -