Changeset 5270

Show
Ignore:
Timestamp:
01/22/08 15:58:08 (5 years ago)
Author:
amachang
Message:

lang/javascript/bokuscheme: created bokuscheme

Location:
lang/javascript
Files:
3 added
1 removed
19 modified
7 copied

Legend:

Unmodified
Added
Removed
  • lang/javascript/javascript-xpath/bindings/jquery/ChangeLog

    r1692 r5270  
     1== 0.1.2 / 2007-11-16  drry 
     2 
     3        * fixed namespace resolver 
     4 
    15== 0.1.2 / 2007-11-16  amachang <seijro@gmail.com> 
    26 
  • lang/javascript/javascript-xpath/bindings/jquery/release/xpath4jquery-latest.js

    r1692 r5270  
    1 /*  XPath for jQuery 0.1.2 
     1/*  XPath for jQuery 0.1.3 
    22 *  (c) 2007 Cybozu Labs, Inc. 
    33 * 
     
    5656 
    5757        context = context || document; 
    58  
    59         expr = document.createExpression(expr, function (prefix) { 
    60             var o = document.createNSResolver(context)(prefix); 
    61             if (o) return o; 
    62             return (document.contentType == "application/xhtml+xml") ? "http://www.w3.org/1999/xhtml" : ""; 
    63         }); 
     58        expr    = document.createExpression(expr, null); 
    6459 
    6560        switch (type) { 
     
    6863            case Boolean: return expr.evaluate(context, 3, null).booleanValue; 
    6964            case Array: { 
    70                 if (ordered)  
     65                if (ordered) 
    7166                    result = expr.evaluate(context, 7, null); 
    7267                else 
  • lang/javascript/javascript-xpath/bindings/jquery/version.txt

    r1692 r5270  
    1 0.1.2 
     10.1.3 
  • lang/javascript/javascript-xpath/bindings/prototype/ChangeLog

    r1701 r5270  
     1== 0.1.3 / 2007-11-16  drry 
     2 
     3        * fixed Namespace Resolver 
     4 
    15== 0.1.2 / 2007-11-16  amachang <seijro@gmail.com> 
    26 
  • lang/javascript/javascript-xpath/bindings/prototype/release/xpath4prototype-latest.js

    r1701 r5270  
    1 /*  XPath for Prototype 0.1.2 
     1/*  XPath for Prototype 0.1.3 
    22 *  (c) 2007 Cybozu Labs, Inc. 
    33 * 
     
    3939        var type = ordered ? 7 : 6; 
    4040 
    41         expr = document.createExpression(expr, function (prefix) { 
    42             var o = document.createNSResolver(context)(prefix); 
    43             if (o) return o; 
    44             return (document.contentType == "application/xhtml+xml") ? "http://www.w3.org/1999/xhtml" : ""; 
    45         }); 
     41        expr = document.createExpression(expr, null); 
    4642 
    4743        var result = expr.evaluate(context, type, null); 
  • lang/javascript/javascript-xpath/bindings/prototype/version.txt

    r1701 r5270  
    1 0.1.2 
     10.1.3 
  • lang/javascript/javascript-xpath/branches/support-namespace/ChangeLog

    r1783 r5270  
     1== 0.1.8 / 2007-11-19  amachang <seijro@gmail.com> 
     2 
     3        * fixed IE's //select[@id="foo"] problem thanks nya 
     4        * fixed compress tool 
     5 
     6== 0.1.7 / 2007-11-19  amachang <seijro@gmail.com> 
     7 
     8        * added config 'exportInstaller' (default value is false) 
     9        * added config 'useNative' (default value is true) 
     10        * added functional/dist-test.html and functional/dist-cmp-test.html 
     11        * fixed codes to pass the compress tool 
     12 
    113== 0.1.6 / 2007-11-14  amachang <seijro@gmail.com> 
    214 
  • lang/javascript/javascript-xpath/branches/support-namespace/Makefile

    r1783 r5270  
    1818 
    1919SRC_FILES = ${SRC_DIR}/head.js\ 
    20         ${SRC_DIR}/config.js\ 
    2120        ${SRC_DIR}/global_decls.js\ 
    2221        ${SRC_DIR}/uai.js\ 
     
    4948FUNCTEST_ORIGINAL = ${FUNC_TEST_DIR}/index.html 
    5049FUNCTEST_ANALYZE = ${FUNC_TEST_DIR}/analyze-test.html 
     50FUNCTEST_DIST_TEMPLATE = ${FUNC_TEST_DIR}/dist-test-template.html 
     51FUNCTEST_DIST = ${FUNC_TEST_DIR}/dist-test.html 
     52FUNCTEST_DIST_CMP = ${FUNC_TEST_DIR}/dist-cmp-test.html 
    5153 
    5254FUNCTEST_NOXHR = ${FUNC_TEST_DIR}/index-no-xhr.html 
     
    5961        @@echo "JavaScript-XPath build complete" 
    6062 
    61 jsxpath: ${JSXPATH_CMP} ${TESTDATA_LOCALJS} ${FUNCTEST_NOXHR} ${FUNCTEST_ANALYZE_NOXHR} 
     63jsxpath: ${JSXPATH_CMP} ${TESTDATA_LOCALJS} ${FUNCTEST_NOXHR} ${FUNCTEST_ANALYZE_NOXHR} ${FUNCTEST_DIST} ${FUNCTEST_DIST_CMP} 
     64 
    6265 
    6366${DIST_DIR}: 
     
    7376${FUNCTEST_ANALYZE_NOXHR}: 
    7477        @@sed -e "s/<!--LOCAL_DATA_HERE-->/<script type=\"text\/javascript\" src=\"\.\/testdatas.js\"><\/script>/g" ${FUNCTEST_ANALYZE} > $@ 
     78 
     79${FUNCTEST_DIST}: 
     80        @@cat ${FUNCTEST_DIST_TEMPLATE} | sed s/@VERSION/${VER}/ > $@ 
     81 
     82${FUNCTEST_DIST_CMP}: 
     83        @@cat ${FUNCTEST_DIST_TEMPLATE} | sed s/@VERSION/${VER}-cmp/ > $@ 
    7584 
    7685${JSXPATH}: ${DIST_DIR} ${VERSION_FILE} ${SRC_FILES} Makefile 
     
    98107        @@rm ${FUNCTEST_NOXHR} 
    99108        @@rm ${FUNCTEST_ANALYZE_NOXHR} 
     109        @@rm ${FUNCTEST_DIST} 
     110        @@rm ${FUNCTEST_DIST_CMP} 
    100111        @@rm ${TESTDATA_LOCALJS} 
    101112        @@rm ${DIST_DIR}/* 
  • lang/javascript/javascript-xpath/branches/support-namespace/release/javascript-xpath-latest-cmp.js

    r1783 r5270  
    1 if(!document.implementation||!document.implementation.hasFeature||!document.implementation.hasFeature("XPath",null))(function(){var ca=void(0);var da={targetFrame:ca,useInnerText:true};var ea;if(window.jsxpath){ea=window.jsxpath;} 
     1(function(){var ca=void(0);var da={targetFrame:ca,exportInstaller:false,useNative:true,useInnerText:true};var ea;if(window.jsxpath){ea=window.jsxpath;} 
    22else{var fa=document.getElementsByTagName('script');var ga=fa[fa.length-1];var ha=ga.src;ea={};var ia=ha.match(/\?(.*)$/);if(ia){var ja=ia[1].split('&');for(var i=0,l=ja.length;i<l;i++){var ka=ja[i];var la=ka.split('=');var ma=la[0];var na=la[1];if(configValue==ca){configValue==true;} 
    33else if(configValue=='false'||/^-?d+$/.test(configValue)){configValue=eval(configValue);} 
    44ea[ma]=configValue;}}} 
    5 for(var n in da){if(!(n in ea))ea[n]=da[n]} 
     5for(var n in da){if(!(n in ea))ea[n]=da[n];} 
     6ea.hasNative=!!(document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("XPath",null));if(ea.hasNative&&ea.useNative&&!ea.exportInstaller){return;} 
    67var oa;var pa;var qa;var ra;var sa;var ta;var va;var wa;var xa;var ya;var za;var Aa;var Ba;var Ca;var Da=new function(){var ua=navigator.userAgent;if(RegExp==ca){if(ua.indexOf("Opera")>=0){this.opera=true;} 
    78else if(ua.indexOf("Netscape")>=0){this.netscape=true;} 
     
    1415else if(ua.indexOf("BSD")>=0){this.bsd=true;} 
    1516else if(ua.indexOf("SunOS")>=0){this.sunos=true;}} 
    16 else{n/*@cc_on @if(@_jscript)function jscriptVersion(){switch(@_jscript_version){case 3.0:return "4.0";case 5.0:return "5.0";case 5.1:return "5.01";case 5.5:return "5.5";case 5.6:if("XMLHttpRequest" in window)return "7.0";return "6.0";case 5.7:return "7.0";default:return true;}} 
     17else{ /*@cc_on @if(@_jscript)function jscriptVersion(){switch(@_jscript_version){case 3.0:return "4.0";case 5.0:return "5.0";case 5.1:return "5.01";case 5.5:return "5.5";case 5.6:if("XMLHttpRequest" in window)return "7.0";return "6.0";case 5.7:return "7.0";default:return true;}} 
    1718if(@_win16||@_win32||@_win64){this.windows=true;this.trident=jscriptVersion();} 
    1819else if(@_mac||navigator.platform.indexOf("Mac")>=0){this.mac=true;this.tasman=jscriptVersion();} 
    19 if(/MSIE (\d+\.\d+)b?;/.test(ua)){this.ie=RegExp.$1;this['ie'+RegExp.$1.charAt(0)]=true;}@else @*/ 
     20if(/MSIE (\d+\.\d+)b?;/.test(ua)){this.ie=RegExp.$1;this['ie'+RegExp.$1.charAt(0)]=true;}@else @*/  
    2021if(/AppleWebKit\/(\d+(?:\.\d+)*)/.test(ua)){this.applewebkit=RegExp.$1;if(RegExp.$1.charAt(0)==4){this.applewebkit2=true;} 
    2122else{this.applewebkit3=true;}} 
    22 else if(typeof Components=="object"&&(/Gecko\/(\d{8})/.test(ua)||navigator.product=="Gecko"&&/^(\d{8})$/.test(navigator.productSub))){this.gecko=RegExp.$1;}/*@end @*/ 
     23else if(typeof Components=="object"&&(/Gecko\/(\d{8})/.test(ua)||navigator.product=="Gecko"&&/^(\d{8})$/.test(navigator.productSub))){this.gecko=RegExp.$1;}/*@end @*/  
    2324if(typeof(opera)=="object"&&typeof(opera.version)=="function"){this.opera=opera.version();this['opera'+this.opera[0]+this.opera[2]]=true;} 
    2425else if(typeof opera=="object"&&(/Opera[\/ ](\d+\.\d+)/.test(ua))){this.opera=RegExp.$1;} 
     
    8687return this.evaluatePredicates(Fc);};pa.prototype.predicate=function(Gc){this.predicates.push(Gc);};pa.prototype.show=function(Hc){Hc=Hc||'';var t='';t+=Hc+'filter: '+'\n';Hc+='    ';t+=this.primary.show(Hc);if(this.predicates.length){t+=Hc+'predicates: '+'\n';Hc+='    ';for(var i=0;i<this.predicates.length;i++){t+=this.predicates[i].show(Hc);}} 
    8788return t;};if(!window.NodeUtil&&window.defaultConfig)window.NodeUtil=null;wa={to:function(Ic,Jc){var t,type=Jc.nodeType;if(type==1&&ea.useInnerText&&!Da.applewebkit2){t=Jc.textContent;t=(t==ca||t==null)?Jc.innerText:t;t=(t==ca||t==null)?'':t;} 
    88 if(typeof t!='string'){n/*@cc_on  
     89if(typeof t!='string'){ /*@cc_on  
    8990if(type==1&&Jc.nodeName.toLowerCase()=='title'){t=Jc.text;} 
    9091else@*/if(type==9||type==1){if(type==9){Jc=Jc.documentElement;} 
    9192else{Jc=Jc.firstChild;} 
    92 for(t='',stack=[],i=0;Jc;){do{if(Jc.nodeType!=1){t+=Jc.nodeValue;}n/*@cc_on  
     93for(t='',stack=[],i=0;Jc;){do{if(Jc.nodeType!=1){t+=Jc.nodeValue;} /*@cc_on  
    9394else if(Jc.nodeName.toLowerCase()=='title'){t+=Jc.text;}@*/stack[i++]=Jc;} 
    9495while(Jc=Jc.firstChild);while(i&&!(Jc=stack[--i].nextSibling)){}}} 
    9596else{t=Jc.nodeValue;}} 
    96 switch(Ic){case 'number':return+t;case 'boolean':return!!t;default:return t;}},attrPropMap:{name:'name','class':'className',dir:'dir',id:'id',name:'name',title:'title'},attrMatch:function(Kc,Lc,Mc){n/*@cc_on @if(@_jscript)var Nc=wa.attrPropMap[Lc];if(!Lc||Mc==null&&(Nc&&Kc[Nc]||!Nc&&Kc.getAttribute&&Kc.getAttribute(Lc))||Mc!=null&&(Nc&&Kc[Nc]==Mc||!Nc&&Kc.getAttribute&&Kc.getAttribute(Lc)==Mc)){@else @*/ 
    97 if(!Lc||Mc==null&&Kc.hasAttribute&&Kc.hasAttribute(Lc)||Mc!=null&&Kc.getAttribute&&Kc.getAttribute(Lc)==Mc){/*@end @*/ 
     97switch(Ic){case 'number':return+t;case 'boolean':return!!t;default:return t;}},attrPropMap:{name:'name','class':'className',dir:'dir',id:'id',name:'name',title:'title'},attrMatch:function(Kc,Lc,Mc){ /*@cc_on @if(@_jscript)var Nc=wa.attrPropMap[Lc];if(!Lc||Mc==null&&(Nc&&Kc[Nc]||!Nc&&Kc.getAttribute&&Kc.getAttribute(Lc))||Mc!=null&&(Nc&&Kc[Nc]==Mc||!Nc&&Kc.getAttribute&&Kc.getAttribute(Lc)==Mc)){@else @*/  
     98if(!Lc||Mc==null&&Kc.hasAttribute&&Kc.hasAttribute(Lc)||Mc!=null&&Kc.getAttribute&&Kc.getAttribute(Lc)==Mc){/*@end @*/  
    9899return true;} 
    99 else{return false;}},getDescendantNodes:function(Oc,Kc,Pc,Lc,Mc,Qc,Rc){if(Qc){Qc.delDescendant(Kc,Rc);}n/*@cc_on  
     100else{return false;}},getDescendantNodes:function(Oc,Kc,Pc,Lc,Mc,Qc,Rc){if(Qc){Qc.delDescendant(Kc,Rc);} /*@cc_on  
    100101if(!Oc.notOnlyElement||Oc.type==8||(Lc&&Oc.type==0)){var Sc=Kc.all;if(!Sc){return Pc;} 
    101102var Tc=Oc.name;if(Oc.type==8)Tc='!';else if(Oc.type==0)Tc='*';if(Tc!='*'){Sc=Sc.tags(Tc);if(!Sc){return Pc;}} 
    102103if(Lc){var Uc=[] 
    103104var i=0;if(Mc!=null&&(Lc=='id'||Lc=='name')){Sc=Sc[Mc];if(!Sc){return Pc;} 
    104 if(!Sc.length){Sc=[Sc];}} 
     105if(!Sc.length||Sc.nodeType){Sc=[Sc];}} 
    105106while(Kc=Sc[i++]){if(wa.attrMatch(Kc,Lc,Mc))Uc.push(Kc);} 
    106107Sc=Uc;} 
     
    113114f(Kc);}})(Kc);} 
    114115else{var Tc=Oc.name;if(Kc.getElementsByTagName){var Wc=Kc.getElementsByTagName(Tc);if(Wc){var i=0;while(Kc=Wc[i++]){if(wa.attrMatch(Kc,Lc,Mc))Pc.push(Kc);}}}} 
    115 return Pc;},getChildNodes:function(Yc,Kc,Zc,Lc,Mc){n/*@cc_on  
     116return Pc;},getChildNodes:function(Yc,Kc,Zc,Lc,Mc){ /*@cc_on  
    116117var $c;if((!Yc.notOnlyElement||Yc.type==8||(Lc&&Yc.type==0))&&($c=Kc.children)){var ad,elm;ad=Yc.name;if(Yc.type==8)ad='!';else if(Yc.type==0)ad='*';if(ad!='*'){$c=$c.tags(ad);if(!$c){return Zc;}} 
    117118if(Lc){var bd=[] 
    118119var i=0;if(Lc=='id'||Lc=='name'){$c=$c[Mc];if(!$c){return Zc;} 
    119 if(!$c.length){$c=[$c];}} 
     120if(!$c.length||$c.nodeType){$c=[$c];}} 
    120121while(Kc=$c[i++]){if(wa.attrMatch(Kc,Lc,Mc))bd.push(Kc);} 
    121122$c=bd;} 
     
    124125for(var i=0,Kc=Kc.firstChild;Kc;i++,Kc=Kc.nextSibling){if(wa.attrMatch(Kc,Lc,Mc)){if(Yc.match(Kc))Zc.push(Kc);}} 
    125126return Zc;@*/for(var Kc=Kc.firstChild;Kc;Kc=Kc.nextSibling){if(wa.attrMatch(Kc,Lc,Mc)){if(Yc.match(Kc))Zc.push(Kc);}} 
    126 return Zc;}};n/*@cc_on  
     127return Zc;}}; /*@cc_on  
    127128var cd=function(dd,ed,fd){this.node=dd;this.nodeType=2;this.nodeValue=dd.nodeValue;this.nodeName=dd.nodeName;this.parentNode=ed;this.ownerElement=ed;this.parentSourceIndex=fd;};@*/if(!window.Step&&window.defaultConfig)window.Step=null;za=function(gd,hd){this.axis=gd;this.reverse=za.axises[gd][0];this.func=za.axises[gd][1];this.test=hd;this.predicates=[];this._quickAttr=za.axises[gd][2]};za.axises={ancestor:[true,function(jd,kd,ld,_,md,od,pd){while(kd=kd.parentNode){if(od&&kd.nodeType==1){od.reserveDelByNode(kd,pd,true);} 
    128129if(jd.match(kd))ld.unshift(kd);} 
    129130return ld;}],'ancestor-or-self':[true,function(qd,rd,sd,_,td,ud,vd){do{if(ud&&rd.nodeType==1){ud.reserveDelByNode(rd,vd,true);} 
    130131if(qd.match(rd))sd.unshift(rd);} 
    131 while(rd=rd.parentNode)return sd;}],attribute:[false,function(wd,xd,yd){var zd=xd.attributes;if(zd){n/*@cc_on  
    132 var Ad=xd.sourceIndex;@*/if((wd.notOnlyElement&&wd.type==0)||wd.name=='*'){for(var i=0,l=zd.length;i<l;i++){var Bd=zd[i];n/*@cc_on @if(@_jscript)if(Bd.nodeValue){yd.push(new cd(Bd,xd,Ad));}@else @*/ 
    133 yd.push(Bd);/*@end @*/}} 
    134 else{var Bd=zd.getNamedItem(wd.name)n/*@cc_on @if(@_jscript)if(Bd&&Bd.nodeValue){Bd=new cd(Bd,xd,Ad);;@else @*/ 
    135 if(Bd){/*@end @*/ 
     132while(rd=rd.parentNode)return sd;}],attribute:[false,function(wd,xd,yd){var zd=xd.attributes;if(zd){ /*@cc_on  
     133var Ad=xd.sourceIndex;@*/if((wd.notOnlyElement&&wd.type==0)||wd.name=='*'){for(var i=0,l=zd.length;i<l;i++){var Bd=zd[i]; /*@cc_on @if(@_jscript)if(Bd.nodeValue){yd.push(new cd(Bd,xd,Ad));}@else @*/  
     134yd.push(Bd);/*@end @*/ }} 
     135else{var Bd=zd.getNamedItem(wd.name); /*@cc_on @if(@_jscript)if(Bd&&Bd.nodeValue){Bd=new cd(Bd,xd,Ad);;@else @*/  
     136if(Bd){/*@end @*/  
    136137yd.push(Bd);}}} 
    137138return yd;}],child:[false,wa.getChildNodes,true],descendant:[false,wa.getDescendantNodes,true],'descendant-or-self':[false,function(wd,xd,yd,Cd,Dd,Ed,Fd){if(wa.attrMatch(xd,Cd,Dd)){if(wd.match(xd))yd.push(xd);} 
     
    171172if(Xd){Xd.doDel();}} 
    172173return be;};za.prototype.predicate=function(ee){this.predicates.push(ee);if(ee.needContextPosition||ee.datatype=='number'||ee.datatype=='void'){this.needContextPosition=true;} 
    173 if(this._quickAttr&&this.predicates.length==1&&ee.quickAttr){var fe=ee.attrName;n/*@cc_on @if(@_jscript)this.attrName=fe.toLowerCase();@else @*/ 
    174 this.attrName=fe;/*@end @*/ 
     174if(this._quickAttr&&this.predicates.length==1&&ee.quickAttr){var fe=ee.attrName; /*@cc_on @if(@_jscript)this.attrName=fe.toLowerCase();@else @*/  
     175this.attrName=fe;/*@end @*/  
    175176this.attrValueExpr=ee.attrValueExpr;this.quickAttr=true;}};za.prototype.show=function(ge){ge=ge||'';var t='';t+=ge+'step: '+'\n';ge+='    ';if(this.axis)t+=ge+'axis: '+this.axis+'\n';t+=this.test.show(ge);if(this.predicates.length){t+=ge+'predicates: '+'\n';ge+='    ';for(var i=0;i<this.predicates.length;i++){t+=this.predicates[i].show(ge);}} 
    176177return t;};if(!window.NodeType&&window.defaultConfig)window.NodeType=null;va=function(he,je){this.name=he;this.literal=je;switch(he){case 'comment':this.type=8;break;case 'text':this.type=3;break;case 'processing-instruction':this.type=7;break;case 'node':this.type=0;break;}};va.types={'comment':1,'text':1,'processing-instruction':1,'node':1};va.parse=function(ke){var le,literal,ch;le=ke.next();ke.next();if(ke.empty()){throw Error('bad nodetype');} 
     
    190191return this.position;},'number',true,[]],count:[function(ns){if(arguments.length!=1||!(ns=ns.evaluate(this)).isNodeSet){throw Error('Function count expects (nodeset)');} 
    191192return ns.length;},'number',false,[]],id:[function(s){var Ie,ns,i,id,elm,ctxn,doc;if(arguments.length!=1){throw Error('Function id expects (object)');} 
    192 ctxn=this.node;if(ctxn.nodeType==9)doc=ctxn;else doc=ctxn.ownerDocument;n/*@cc_on  
    193 all=doc.all;@*/s=s.string(this);Ie=s.split(/\s+/);ns=new ta();for(i=0,l=Ie.length;i<l;i++){id=Ie[i];n/*@cc_on @if(@_jscript)elm=all[id];if(elm){if(elm.length){var Je=elm;for(var j=0,l0=Je.length;j<l0;j++){var Ke=Je[j];if(id==Ke.id){ns.push(Ke);break;}}} 
    194 else if(id==elm.id){ns.push(elm)}}@else @*/ 
    195 elm=doc.getElementById(id);if(Da.opera&&elm.id!=id){var Je=doc.getElementsByName(id);for(var j=0,l0=Je.length;j<l0;j++){elm=Je[j];if(elm.id==id){ns.push(elm);}}} 
    196 else{if(elm)ns.push(elm)}/*@end @*/} 
     193ctxn=this.node;if(ctxn.nodeType==9)doc=ctxn;else doc=ctxn.ownerDocument; /*@cc_on  
     194all=doc.all;@*/s=s.string(this);Ie=s.split(/\s+/);ns=new ta();for(i=0,l=Ie.length;i<l;i++){id=Ie[i]; /*@cc_on @if(@_jscript)elm=all[id];if(elm){if((!elm.length||elm.nodeType)&&id==elm.id){ns.push(elm)} 
     195else if(elm.length){var Je=elm;for(var j=0,l0=Je.length;j<l0;j++){var Ke=Je[j];if(id==Ke.id){ns.push(Ke);break;}}}}@else @*/  
     196elm=doc.getElementById(id);if(Da.opera&&elm&&elm.id!=id){var Je=doc.getElementsByName(id);for(var j=0,l0=Je.length;j<l0;j++){elm=Je[j];if(elm.id==id){ns.push(elm);}}} 
     197else{if(elm)ns.push(elm)}/*@end @*/ } 
    197198ns.isSorted=false;return ns;},'nodeset',false,[]],'local-name':[function(ns){var nd;switch(arguments.length){case 0:nd=this.node;break;case 1:if((ns=ns.evaluate(this)).isNodeSet){nd=ns.first();break;} 
    198199default:throw Error('Function local-name expects (nodeset?)');break;} 
     
    229230var Se=this.args;if(Re.needContextNode){Se.needContexNode=true;} 
    230231this.needContextNode=Se.needContextNode||this.needContextNodeInfo[Se.length];};qa.prototype.show=function(Te){Te=Te||'';var t='';t+=Te+'function: '+this.name+'\n';Te+='    ';if(this.args.length){t+=Te+'arguments: '+'\n';Te+='    ';for(var i=0;i<this.args.length;i++){t+=this.args[i].show(Te);}} 
    231 return t;};n/*@cc_on @if(@_jscript)var Ue=function(Ve,We,Xe,Ye){this.node=Ve;this.nodeType=Ve.nodeType;this.sourceIndex=We;this.subIndex=Xe;this.attributeName=Ye||'';this.order=String.fromCharCode(We)+String.fromCharCode(Xe)+Ye;};Ue.prototype.toString=function(){return this.order;};@else @*/ 
    232 var Ze={uuid:1,get:function($e){return $e.__ba||($e.__ba=this.uuid++);}};/*@end @*/ 
    233 if(!window.NodeSet&&window.defaultConfig)window.NodeSet=null;ta=function(){this.length=0;this.nodes=[];this.seen={};this.idIndexMap=null;this.reserveDels=[];};ta.prototype.isNodeSet=true;ta.prototype.isSorted=true;n/*@_cc_on 
     232return t;}; /*@cc_on @if(@_jscript)var Ue=function(Ve,We,Xe,Ye){this.node=Ve;this.nodeType=Ve.nodeType;this.sourceIndex=We;this.subIndex=Xe;this.attributeName=Ye||'';this.order=String.fromCharCode(We)+String.fromCharCode(Xe)+Ye;};Ue.prototype.toString=function(){return this.order;};@else @*/  
     233var Ze={uuid:1,get:function($e){return $e.__ba||($e.__ba=this.uuid++);}};/*@end @*/  
     234if(!window.NodeSet&&window.defaultConfig)window.NodeSet=null;ta=function(){this.length=0;this.nodes=[];this.seen={};this.idIndexMap=null;this.reserveDels=[];};ta.prototype.isNodeSet=true;ta.prototype.isSorted=true; /*@_cc_on 
    234235ta.prototype.shortcut=true;@*/ta.prototype.merge=function(af){this.isSorted=false;if(af.only){return this.push(af.only);} 
    235236if(this.only){var bf=this.only;delete this.only;this.push(bf);this.length--;} 
    236 var cf=af.nodes;for(var i=0,l=cf.length;i<l;i++){this._add(cf[i]);}};ta.prototype.sort=function(){if(this.only)return;if(this.sortOff)return;if(!this.isSorted){this.isSorted=true;this.idIndexMap=null;n/*@cc_on  
     237var cf=af.nodes;for(var i=0,l=cf.length;i<l;i++){this._add(cf[i]);}};ta.prototype.sort=function(){if(this.only)return;if(this.sortOff)return;if(!this.isSorted){this.isSorted=true;this.idIndexMap=null; /*@cc_on  
    237238if(this.shortcut){this.nodes.sort();} 
    238239else{this.nodes.sort(function(a,b){var df;df=a.sourceIndex-b.sourceIndex;if(df==0)return a.subIndex-a.subIndex;else return df;});} 
     
    241242else if(deep2>deep1){while(deep2--!=deep1)node2=node2.parentNode;if(gf==node2)return -1;} 
    242243while((ancestor1=gf.parentNode)!=(ancestor2=node2.parentNode)){gf=ancestor1;node2=ancestor2;} 
    243 while(gf=gf.nextSibling)if(gf==node2)return -1;return 1;}});}};n/*@cc_on @if(@_jscript)ta.prototype.sourceOffset=1;ta.prototype.subOffset=2;ta.prototype.createWrapper=function(hf){var jf,child,attributes,attributesLength,sourceIndex,subIndex,attributeName;sourceIndex=hf.sourceIndex;if(typeof sourceIndex!='number'){type=hf.nodeType;switch(type){case 2:jf=hf.parentNode;sourceIndex=hf.parentSourceIndex;subIndex=-1;attributeName=hf.nodeName;break;case 9:subIndex=-2;sourceIndex=-1;break;default:child=hf;subIndex=0;do{subIndex++;sourceIndex=child.sourceIndex;if(sourceIndex){jf=child;child=child.lastChild;if(!child){child=jf;break;} 
     244while(gf=gf.nextSibling)if(gf==node2)return -1;return 1;}});}}; /*@cc_on @if(@_jscript)ta.prototype.sourceOffset=1;ta.prototype.subOffset=2;ta.prototype.createWrapper=function(hf){var jf,child,attributes,attributesLength,sourceIndex,subIndex,attributeName;sourceIndex=hf.sourceIndex;if(typeof sourceIndex!='number'){type=hf.nodeType;switch(type){case 2:jf=hf.parentNode;sourceIndex=hf.parentSourceIndex;subIndex=-1;attributeName=hf.nodeName;break;case 9:subIndex=-2;sourceIndex=-1;break;default:child=hf;subIndex=0;do{subIndex++;sourceIndex=child.sourceIndex;if(sourceIndex){jf=child;child=child.lastChild;if(!child){child=jf;break;} 
    244245subIndex++;}} 
    245246while(child=child.previousSibling);if(!sourceIndex){sourceIndex=hf.parentNode.sourceIndex;} 
    246247break;}} 
    247248else{subIndex=-2;} 
    248 sourceIndex+=this.sourceOffset;subIndex+=this.subOffset;return new Ue(hf,sourceIndex,subIndex,attributeName);};ta.prototype.reserveDelBySourceIndexAndSubIndex=function(kf,lf,mf,nf){var of=this.createIdIndexMap();var pf;if((of=of[kf])&&(pf=of[lf])){if(nf&&(this.length-mf-1)>pf||!nf&&mf<pf){var qf={value:pf,order:String.fromCharCode(pf),toString:function(){return this.order},valueOf:function(){return this.value}};this.reserveDels.push(qf);}}};@else @*/ 
    249 ta.prototype.reserveDelByNodeID=function(id,rf,sf){var tf=this.createIdIndexMap();var uf;if(uf=tf[id]){if(sf&&(this.length-rf-1)>uf||!sf&&rf<uf){var vf={value:uf,order:String.fromCharCode(uf),toString:function(){return this.order},valueOf:function(){return this.value}};this.reserveDels.push(vf);}}};/*@end @*/ 
    250 ta.prototype.reserveDelByNode=function(wf,xf,yf){n/*@cc_on @if(@_jscript)wf=this.createWrapper(wf);this.reserveDelBySourceIndexAndSubIndex(wf.sourceIndex,wf.subIndex,xf,yf);@else @*/ 
    251 this.reserveDelByNodeID(Ze.get(wf),xf,yf);/*@end @*/};ta.prototype.doDel=function(){if(!this.reserveDels.length)return;if(this.length<0x10000){var zf=this.reserveDels.sort(function(a,b){return b-a});} 
     249sourceIndex+=this.sourceOffset;subIndex+=this.subOffset;return new Ue(hf,sourceIndex,subIndex,attributeName);};ta.prototype.reserveDelBySourceIndexAndSubIndex=function(kf,lf,mf,nf){var of=this.createIdIndexMap();var pf;if((of=of[kf])&&(pf=of[lf])){if(nf&&(this.length-mf-1)>pf||!nf&&mf<pf){var qf={value:pf,order:String.fromCharCode(pf),toString:function(){return this.order},valueOf:function(){return this.value}};this.reserveDels.push(qf);}}};@else @*/  
     250ta.prototype.reserveDelByNodeID=function(id,rf,sf){var tf=this.createIdIndexMap();var uf;if(uf=tf[id]){if(sf&&(this.length-rf-1)>uf||!sf&&rf<uf){var vf={value:uf,order:String.fromCharCode(uf),toString:function(){return this.order},valueOf:function(){return this.value}};this.reserveDels.push(vf);}}};/*@end @*/  
     251ta.prototype.reserveDelByNode=function(wf,xf,yf){ /*@cc_on @if(@_jscript)wf=this.createWrapper(wf);this.reserveDelBySourceIndexAndSubIndex(wf.sourceIndex,wf.subIndex,xf,yf);@else @*/  
     252this.reserveDelByNodeID(Ze.get(wf),xf,yf);/*@end @*/ };ta.prototype.doDel=function(){if(!this.reserveDels.length)return;if(this.length<0x10000){var zf=this.reserveDels.sort(function(a,b){return b-a});} 
    252253else{var zf=this.reserveDels.sort(function(a,b){return b-a});} 
    253254for(var i=0,l=zf.length;i<l;i++){this.del(zf[i]);} 
    254255this.reserveDels=[];this.idIndexMap=null;};ta.prototype.createIdIndexMap=function(){if(this.idIndexMap){return this.idIndexMap;} 
    255 else{var Af=this.idIndexMap={};var Bf=this.nodes;for(var i=0,l=Bf.length;i<l;i++){var Cf=Bf[i];n/*@cc_on @if(@_jscript)var Df=Cf.sourceIndex;var Ef=Cf.subIndex;if(!Af[Df])Af[Df]={};Af[Df][Ef]=i;@else @*/ 
    256 var id=Ze.get(Cf);Af[id]=i;/*@end @*/} 
     256else{var Af=this.idIndexMap={};var Bf=this.nodes;for(var i=0,l=Bf.length;i<l;i++){var Cf=Bf[i]; /*@cc_on @if(@_jscript)var Df=Cf.sourceIndex;var Ef=Cf.subIndex;if(!Af[Df])Af[Df]={};Af[Df][Ef]=i;@else @*/  
     257var id=Ze.get(Cf);Af[id]=i;/*@end @*/ } 
    257258return Af;}};ta.prototype.del=function(Ff){this.length--;if(this.only){delete this.only;} 
    258 else{var Gf=this.nodes.splice(Ff,1)[0];if(this._first==Gf){delete this._first;delete this._firstSourceIndex;delete this._firstSubIndex;}n/*@cc_on @if(@_jscript)delete this.seen[Gf.sourceIndex][Gf.subIndex];@else @*/ 
    259 delete this.seen[Ze.get(Gf)];/*@end @*/}};ta.prototype.delDescendant=function(Hf,If){if(this.only)return;var Jf=Hf.nodeType;if(Jf!=1&&Jf!=9)return;if(Da.applewebkit2)return;if(!Hf.contains){if(Jf==1){var Kf=Hf;Hf={contains:function(Lf){return Lf.compareDocumentPosition(Kf)&8;}};} 
     259else{var Gf=this.nodes.splice(Ff,1)[0];if(this._first==Gf){delete this._first;delete this._firstSourceIndex;delete this._firstSubIndex;} /*@cc_on @if(@_jscript)delete this.seen[Gf.sourceIndex][Gf.subIndex];@else @*/  
     260delete this.seen[Ze.get(Gf)];/*@end @*/ }};ta.prototype.delDescendant=function(Hf,If){if(this.only)return;var Jf=Hf.nodeType;if(Jf!=1&&Jf!=9)return;if(Da.applewebkit2)return;if(!Hf.contains){if(Jf==1){var Kf=Hf;Hf={contains:function(Lf){return Lf.compareDocumentPosition(Kf)&8;}};} 
    260261else{Hf={contains:function(){return true;}};}} 
    261 var Mf=this.nodes;for(var i=If+1;i<Mf.length;i++){n/*@cc_on @if(@_jscript)if(Mf[i].node.nodeType==1&&Hf.contains(Mf[i].node)){@else @*/ 
    262 if(Hf.contains(Mf[i])){/*@end @*/ 
    263 this.del(i);i--;}}};ta.prototype._add=function(Nf,Of){n/*@cc_on @if(@_jscript)var Pf,firstSourceIndex,firstSubIndex,sourceIndex,subIndex,attributeName;sourceIndex=Nf.sourceIndex;subIndex=Nf.subIndex;attributeName=Nf.attributeName;seen=this.seen;seen=seen[sourceIndex]||(seen[sourceIndex]={});if(Nf.nodeType==2){seen=seen[subIndex]||(seen[subIndex]={});if(seen[attributeName]){return true;} 
     262var Mf=this.nodes;for(var i=If+1;i<Mf.length;i++){ /*@cc_on @if(@_jscript)if(Mf[i].node.nodeType==1&&Hf.contains(Mf[i].node)){@else @*/  
     263if(Hf.contains(Mf[i])){/*@end @*/  
     264this.del(i);i--;}}};ta.prototype._add=function(Nf,Of){ /*@cc_on @if(@_jscript)var Pf,firstSourceIndex,firstSubIndex,sourceIndex,subIndex,attributeName;sourceIndex=Nf.sourceIndex;subIndex=Nf.subIndex;attributeName=Nf.attributeName;seen=this.seen;seen=seen[sourceIndex]||(seen[sourceIndex]={});if(Nf.nodeType==2){seen=seen[subIndex]||(seen[subIndex]={});if(seen[attributeName]){return true;} 
    264265seen[attributeName]=true;} 
    265266else{if(seen[subIndex]){return true;} 
    266267seen[subIndex]=true;} 
    267268if(sourceIndex>=0x10000||subIndex>=0x10000){this.shortcut=false;} 
    268 if(this._first||this.nodes.length==0){Pf=this._first;firstSourceIndex=this._firstSourceIndex;firstSubIndex=this._firstSubIndex;if(!Pf||firstSourceIndex>sourceIndex||(firstSourceIndex==sourceIndex&&firstSubIndex>subIndex)){this._first=Nf;this._firstSourceIndex=sourceIndex;this._firstSubIndex=subIndex}}@else @*/ 
    269 var Qf=this.seen;var id=Ze.get(Nf);if(Qf[id])return true;Qf[id]=true;/*@end @*/ 
     269if(this._first||this.nodes.length==0){Pf=this._first;firstSourceIndex=this._firstSourceIndex;firstSubIndex=this._firstSubIndex;if(!Pf||firstSourceIndex>sourceIndex||(firstSourceIndex==sourceIndex&&firstSubIndex>subIndex)){this._first=Nf;this._firstSourceIndex=sourceIndex;this._firstSubIndex=subIndex}}@else @*/  
     270var Qf=this.seen;var id=Ze.get(Nf);if(Qf[id])return true;Qf[id]=true;/*@end @*/  
    270271this.length++;if(Of)this.nodes.unshift(Nf);else this.nodes.push(Nf);};ta.prototype.unshift=function(Rf){if(!this.length){this.length++;this.only=Rf;return} 
    271 if(this.only){var Sf=this.only;delete this.only;this.unshift(Sf);this.length--;}n/*@cc_on  
     272if(this.only){var Sf=this.only;delete this.only;this.unshift(Sf);this.length--;} /*@cc_on  
    272273Rf=this.createWrapper(Rf);@*/return this._add(Rf,true);};ta.prototype.push=function(Tf){if(!this.length){this.length++;this.only=Tf;return;} 
    273 if(this.only){var Uf=this.only;delete this.only;this.push(Uf);this.length--;}n/*@cc_on  
    274 Tf=this.createWrapper(Tf);@*/return this._add(Tf);};ta.prototype.first=function(){if(this.only)return this.only;n/*@cc_on  
    275 if(this._first)return this._first.node;if(this.nodes.length>1)this.sort();var Vf=this.nodes[0];return Vf?Vf.node:ca;@*/if(this.nodes.length>1)this.sort();return this.nodes[0];};ta.prototype.list=function(){if(this.only)return[this.only];this.sort();n/*@cc_on  
     274if(this.only){var Uf=this.only;delete this.only;this.push(Uf);this.length--;} /*@cc_on  
     275Tf=this.createWrapper(Tf);@*/return this._add(Tf);};ta.prototype.first=function(){if(this.only)return this.only; /*@cc_on  
     276if(this._first)return this._first.node;if(this.nodes.length>1)this.sort();var Vf=this.nodes[0];return Vf?Vf.node:ca;@*/if(this.nodes.length>1)this.sort();return this.nodes[0];};ta.prototype.list=function(){if(this.only)return[this.only];this.sort(); /*@cc_on  
    276277var i,l,Mf,results;Mf=this.nodes;results=[];for(i=0,l=Mf.length;i<l;i++){results.push(Mf[i].node);} 
    277 return results;@*/return this.nodes;};ta.prototype.string=function(){var Wf=this.only||this.first();return Wf?wa.to('string',Wf):'';};ta.prototype.bool=function(){return!!(this.length||this.only);};ta.prototype.number=function(){return+this.string();};ta.prototype.iterator=function(Xf){this.sort();var Yf=this;if(!Xf){var Zf=0;return function(){if(Yf.only&&Zf++==0)return Yf.only;n/*@cc_on @if(@_jscript)var $f=Yf.nodes[Zf++];if($f)return $f.node;return ca;@else @*/ 
    278 return Yf.nodes[Zf++];/*@end @*/};} 
    279 else{var Zf=0;return function(){var ag=Yf.length-(Zf++)-1;if(Yf.only&&ag==0)return Yf.only;n/*@cc_on @if(@_jscript)var bg=Yf.nodes[ag];if(bg)return bg.node;return ca;@else @*/ 
    280 return Yf.nodes[ag];/*@end @*/};}};var cg=function(dg){dg=dg||this;dg.XPathExpression=function(eg){if(!eg.length){throw Error('no expression');} 
    281 var fg=this.lexer=Ea(eg);if(fg.empty()){throw Error('no expression');} 
    282 this.expr=oa.parse(fg);if(!fg.empty()){throw Error('bad token: '+fg.next());}};dg.XPathExpression.prototype.evaluate=function(gg,hg){return new XPathResult(this.expr.evaluate(new Ia(gg)),hg);};dg.XPathResult=function(ig,jg){if(jg==0){switch(typeof ig){case 'object':jg++;case 'boolean':jg++;case 'string':jg++;case 'number':jg++;}} 
    283 this.resultType=jg;switch(jg){case 1:this.numberValue=ig.isNodeSet?ig.number():+ig;return;case 2:this.stringValue=ig.isNodeSet?ig.string():''+ig;return;case 3:this.booleanValue=ig.isNodeSet?ig.bool():!!ig;return;case 4:case 5:case 6:case 7:this.nodes=ig.list();this.snapshotLength=ig.length;this.index=0;this.invalidIteratorState=false;break;case 8:case 9:this.singleNodeValue=ig.first();return;}};dg.XPathResult.prototype.iterateNext=function(){return this.nodes[this.index++]};dg.XPathResult.prototype.snapshotItem=function(i){return this.nodes[i]};dg.XPathResult.ANY_TYPE=0;dg.XPathResult.NUMBER_TYPE=1;dg.XPathResult.STRING_TYPE=2;dg.XPathResult.BOOLEAN_TYPE=3;dg.XPathResult.UNORDERED_NODE_ITERATOR_TYPE=4;dg.XPathResult.ORDERED_NODE_ITERATOR_TYPE=5;dg.XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE=6;dg.XPathResult.ORDERED_NODE_SNAPSHOT_TYPE=7;dg.XPathResult.ANY_UNORDERED_NODE_TYPE=8;dg.XPathResult.FIRST_ORDERED_NODE_TYPE=9;dg.document.createExpression=function(kg){return new XPathExpression(kg,null);};dg.document.evaluate=function(lg,mg,_,ng){return document.createExpression(lg,null).evaluate(mg,ng);};};var og;if(ea.targetFrame){var pg=document.getElementById(ea.targetFrame);if(pg)og=pg.contentWindow;} 
    284 cg(og||window);})(); 
     278return results;@*/return this.nodes;};ta.prototype.string=function(){var Wf=this.only||this.first();return Wf?wa.to('string',Wf):'';};ta.prototype.bool=function(){return!!(this.length||this.only);};ta.prototype.number=function(){return+this.string();};ta.prototype.iterator=function(Xf){this.sort();var Yf=this;if(!Xf){var Zf=0;return function(){if(Yf.only&&Zf++==0)return Yf.only; /*@cc_on @if(@_jscript)var $f=Yf.nodes[Zf++];if($f)return $f.node;return ca;@else @*/  
     279return Yf.nodes[Zf++];/*@end @*/ };} 
     280else{var Zf=0;return function(){var ag=Yf.length-(Zf++)-1;if(Yf.only&&ag==0)return Yf.only; /*@cc_on @if(@_jscript)var bg=Yf.nodes[ag];if(bg)return bg.node;return ca;@else @*/  
     281return Yf.nodes[ag];/*@end @*/ };}};var cg=function(dg){dg=dg||this;var eg=dg.document;var ca=dg.undefined;dg.XPathExpression=function(fg){if(!fg.length){throw dg.Error('no expression');} 
     282var gg=this.lexer=Ea(fg);if(gg.empty()){throw dg.Error('no expression');} 
     283this.expr=oa.parse(gg);if(!gg.empty()){throw dg.Error('bad token: '+gg.next());}};dg.XPathExpression.prototype.evaluate=function(hg,ig){return new dg.XPathResult(this.expr.evaluate(new Ia(hg)),ig);};dg.XPathResult=function(jg,kg){if(kg==0){switch(typeof jg){case 'object':kg++;case 'boolean':kg++;case 'string':kg++;case 'number':kg++;}} 
     284this.resultType=kg;switch(kg){case 1:this.numberValue=jg.isNodeSet?jg.number():+jg;return;case 2:this.stringValue=jg.isNodeSet?jg.string():''+jg;return;case 3:this.booleanValue=jg.isNodeSet?jg.bool():!!jg;return;case 4:case 5:case 6:case 7:this.nodes=jg.list();this.snapshotLength=jg.length;this.index=0;this.invalidIteratorState=false;break;case 8:case 9:this.singleNodeValue=jg.first();return;}};dg.XPathResult.prototype.iterateNext=function(){return this.nodes[this.index++]};dg.XPathResult.prototype.snapshotItem=function(i){return this.nodes[i]};dg.XPathResult.ANY_TYPE=0;dg.XPathResult.NUMBER_TYPE=1;dg.XPathResult.STRING_TYPE=2;dg.XPathResult.BOOLEAN_TYPE=3;dg.XPathResult.UNORDERED_NODE_ITERATOR_TYPE=4;dg.XPathResult.ORDERED_NODE_ITERATOR_TYPE=5;dg.XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE=6;dg.XPathResult.ORDERED_NODE_SNAPSHOT_TYPE=7;dg.XPathResult.ANY_UNORDERED_NODE_TYPE=8;dg.XPathResult.FIRST_ORDERED_NODE_TYPE=9;eg.createExpression=function(lg){return new dg.XPathExpression(lg,null);};eg.evaluate=function(mg,ng,_,og){return eg.createExpression(mg,null).evaluate(ng,og);};};var pg;if(ea.targetFrame){var qg=document.getElementById(ea.targetFrame);if(qg)pg=qg.contentWindow;} 
     285if(ea.exportInstaller){window.install=cg;} 
     286if(!ea.hasNative||!ea.useNative){cg(pg||window);}})(); 
  • lang/javascript/javascript-xpath/branches/support-namespace/release/javascript-xpath-latest.js

    r1783 r5270  
    1 /*  JavaScript-XPath 0.1.6 
     1/*  JavaScript-XPath 0.1.8 
    22 *  (c) 2007 Cybozu Labs, Inc. 
    33 * 
     
    77/*--------------------------------------------------------------------------*/ 
    88 
    9 if (!document.implementation 
    10                 || !document.implementation.hasFeature 
    11                 || !document.implementation.hasFeature("XPath", null)) (function() { 
     9 
     10 
     11(function () { 
    1212 
    1313var undefined = void(0); 
    14  
    1514 
    1615var defaultConfig = { 
    1716    targetFrame: undefined, 
     17    exportInstaller: false, 
     18    useNative: true, 
    1819    useInnerText: true 
    1920}; 
     
    4950 
    5051for (var n in defaultConfig) { 
    51     if (!(n in config)) config[n] = defaultConfig[n] 
     52    if (!(n in config)) config[n] = defaultConfig[n]; 
    5253} 
     54 
     55config.hasNative = !!(document.implementation 
     56                        && document.implementation.hasFeature 
     57                        && document.implementation.hasFeature("XPath", null)); 
     58 
     59if (config.hasNative && config.useNative && !config.exportInstaller) { 
     60    return; 
     61} 
     62 
    5363 
    5464 
     
    10301040                        return nodeset; 
    10311041                    } 
    1032                     if (!all.length) { 
     1042                    if (!all.length || all.nodeType) { 
    10331043                        all = [all]; 
    10341044                    } 
     
    11461156                    } 
    11471157     
    1148                     if (!children.length) { 
     1158                    if (!children.length || children.nodeType) { 
    11491159                        children = [children]; 
    11501160                    } 
     
    12551265            } 
    12561266            else { 
    1257                 var attr = attrs.getNamedItem(test.name) 
     1267                var attr = attrs.getNamedItem(test.name); 
    12581268                 
    12591269/*@cc_on @if (@_jscript) 
     
    18461856            elm = all[id]; 
    18471857            if (elm) { 
    1848                 if (elm.length) { 
     1858                if ((!elm.length || elm.nodeType) && id == elm.id) { 
     1859                    ns.push(elm) 
     1860                } 
     1861                else if (elm.length) { 
    18491862                    var elms = elm; 
    18501863                    for (var j = 0, l0 = elms.length; j < l0; j ++) { 
     
    18561869                    } 
    18571870                } 
    1858                 else if (id == elm.id) { 
    1859                     ns.push(elm) 
    1860                 } 
    18611871            } 
    18621872@else @*/ 
    18631873            elm = doc.getElementById(id); 
    1864             if (uai.opera && elm.id != id) { 
     1874            if (uai.opera && elm && elm.id != id) { 
    18651875                var elms = doc.getElementsByName(id); 
    18661876                for (var j = 0, l0 = elms.length; j < l0; j ++) { 
     
    26962706 
    26972707    win = win || this; 
     2708    var doc = win.document; 
     2709    var undefined = win.undefined; 
    26982710 
    26992711    win.XPathExpression = function(expr) { 
    27002712        if (!expr.length) { 
    2701             throw Error('no expression'); 
     2713            throw win.Error('no expression'); 
    27022714        } 
    27032715        var lexer = this.lexer = Lexer(expr); 
    27042716        if (lexer.empty()) { 
    2705             throw Error('no expression'); 
     2717            throw win.Error('no expression'); 
    27062718        } 
    27072719        this.expr = BinaryExpr.parse(lexer); 
    27082720        if (!lexer.empty()) { 
    2709             throw Error('bad token: ' + lexer.next()); 
     2721            throw win.Error('bad token: ' + lexer.next()); 
    27102722        } 
    27112723    }; 
    27122724     
    27132725    win.XPathExpression.prototype.evaluate = function(node, type) { 
    2714         return new XPathResult(this.expr.evaluate(new Ctx(node)), type); 
     2726        return new win.XPathResult(this.expr.evaluate(new Ctx(node)), type); 
    27152727    }; 
    27162728     
     
    27642776     
    27652777     
    2766     win.document.createExpression = function(expr) { 
    2767         return new XPathExpression(expr, null); 
     2778    doc.createExpression = function(expr) { 
     2779        return new win.XPathExpression(expr, null); 
    27682780    }; 
    27692781     
    2770     win.document.evaluate = function(expr, context, _, type) { 
    2771         return document.createExpression(expr, null).evaluate(context, type); 
     2782    doc.evaluate = function(expr, context, _, type) { 
     2783        return doc.createExpression(expr, null).evaluate(context, type); 
    27722784    }; 
    27732785}; 
     
    27802792} 
    27812793 
    2782 install(win || window); 
     2794if (config.exportInstaller) { 
     2795    window.install = install; 
     2796} 
     2797 
     2798if (!config.hasNative || !config.useNative) { 
     2799    install(win || window); 
     2800} 
     2801 
    27832802 
    27842803})(); 
  • lang/javascript/javascript-xpath/branches/support-namespace/src/api.js

    r1269 r5270  
    33 
    44    win = win || this; 
     5    var doc = win.document; 
     6    var undefined = win.undefined; 
    57 
    68    win.XPathExpression = function(expr) { 
    79        if (!expr.length) { 
    8             throw Error('no expression'); 
     10            throw win.Error('no expression'); 
    911        } 
    1012        var lexer = this.lexer = Lexer(expr); 
    1113        if (lexer.empty()) { 
    12             throw Error('no expression'); 
     14            throw win.Error('no expression'); 
    1315        } 
    1416        this.expr = BinaryExpr.parse(lexer); 
    1517        if (!lexer.empty()) { 
    16             throw Error('bad token: ' + lexer.next()); 
     18            throw win.Error('bad token: ' + lexer.next()); 
    1719        } 
    1820    }; 
    1921     
    2022    win.XPathExpression.prototype.evaluate = function(node, type) { 
    21         return new XPathResult(this.expr.evaluate(new Ctx(node)), type); 
     23        return new win.XPathResult(this.expr.evaluate(new Ctx(node)), type); 
    2224    }; 
    2325     
     
    7173     
    7274     
    73     win.document.createExpression = function(expr) { 
    74         return new XPathExpression(expr, null); 
     75    doc.createExpression = function(expr) { 
     76        return new win.XPathExpression(expr, null); 
    7577    }; 
    7678     
    77     win.document.evaluate = function(expr, context, _, type) { 
    78         return document.createExpression(expr, null).evaluate(context, type); 
     79    doc.evaluate = function(expr, context, _, type) { 
     80        return doc.createExpression(expr, null).evaluate(context, type); 
    7981    }; 
    8082}; 
     
    8789} 
    8890 
    89 install(win || window); 
     91if (config.exportInstaller) { 
     92    window.install = install; 
     93} 
    9094 
     95if (!config.hasNative || !config.useNative) { 
     96    install(win || window); 
     97} 
     98 
     99 
  • lang/javascript/javascript-xpath/branches/support-namespace/src/functionCall.js

    r1771 r5270  
    9595            elm = all[id]; 
    9696            if (elm) { 
    97                 if (elm.length) { 
     97                if ((!elm.length || elm.nodeType) && id == elm.id) { 
     98                    ns.push(elm) 
     99                } 
     100                else if (elm.length) { 
    98101                    var elms = elm; 
    99102                    for (var j = 0, l0 = elms.length; j < l0; j ++) { 
     
    105108                    } 
    106109                } 
    107                 else if (id == elm.id) { 
    108                     ns.push(elm) 
    109                 } 
    110110            } 
    111111@else @*/ 
    112112            elm = doc.getElementById(id); 
    113             if (uai.opera && elm.id != id) { 
     113            if (uai.opera && elm && elm.id != id) { 
    114114                var elms = doc.getElementsByName(id); 
    115115                for (var j = 0, l0 = elms.length; j < l0; j ++) { 
  • lang/javascript/javascript-xpath/branches/support-namespace/src/head.js

    r1269 r5270  
    77/*--------------------------------------------------------------------------*/ 
    88 
    9 if (!document.implementation 
    10                 || !document.implementation.hasFeature 
    11                 || !document.implementation.hasFeature("XPath", null)) (function() { 
     9 
     10 
     11(function () { 
    1212 
    1313var undefined = void(0); 
    1414 
     15var defaultConfig = { 
     16    targetFrame: undefined, 
     17    exportInstaller: false, 
     18    useNative: true, 
     19    useInnerText: true 
     20}; 
     21 
     22var config; 
     23 
     24if (window.jsxpath) { 
     25    config = window.jsxpath; 
     26} 
     27else { 
     28    var scriptElms = document.getElementsByTagName('script'); 
     29    var scriptElm = scriptElms[scriptElms.length - 1]; 
     30    var scriptSrc = scriptElm.src; 
     31    config = {}; 
     32    var scriptSrcMatchResult = scriptSrc.match(/\?(.*)$/); 
     33    if (scriptSrcMatchResult) { 
     34        var configStrings = scriptSrcMatchResult[1].split('&'); 
     35        for (var i = 0, l = configStrings.length; i < l; i ++) { 
     36            var configString = configStrings[i]; 
     37            var configStringSplited = configString.split('='); 
     38            var configName = configStringSplited[0]; 
     39            var convigValue = configStringSplited[1]; 
     40            if (configValue == undefined) { 
     41                configValue == true; 
     42            } 
     43            else if (configValue == 'false' || /^-?d+$/.test(configValue)) { 
     44                configValue = eval(configValue); 
     45            } 
     46            config[configName] = configValue; 
     47        } 
     48    } 
     49} 
     50 
     51for (var n in defaultConfig) { 
     52    if (!(n in config)) config[n] = defaultConfig[n]; 
     53} 
     54 
     55config.hasNative = !!(document.implementation 
     56                        && document.implementation.hasFeature 
     57                        && document.implementation.hasFeature("XPath", null)); 
     58 
     59if (config.hasNative && config.useNative && !config.exportInstaller) { 
     60    return; 
     61} 
     62 
     63 
  • lang/javascript/javascript-xpath/branches/support-namespace/src/stepExpr.js

    r1783 r5270  
    115115                        return nodeset; 
    116116                    } 
    117                     if (!all.length) { 
     117                    if (!all.length || all.nodeType) { 
    118118                        all = [all]; 
    119119                    } 
     
    231231                    } 
    232232     
    233                     if (!children.length) { 
     233                    if (!children.length || children.nodeType) { 
    234234                        children = [children]; 
    235235                    } 
     
    340340            } 
    341341            else { 
    342                 var attr = attrs.getNamedItem(test.name) 
     342                var attr = attrs.getNamedItem(test.name); 
    343343                 
    344344/*@cc_on @if (@_jscript) 
  • lang/javascript/javascript-xpath/branches/support-namespace/test/functional/analyze-test.html

    r1722 r5270  
    1212  <!--LOCAL_DATA_HERE--> 
    1313 
    14   <script type="text/javascript" src="../../src/config.js"></script> 
     14  <script type="text/javascript" src="./config.js"></script> 
    1515  <script type="text/javascript" src="../../src/uai.js"></script> 
    1616  <script type="text/javascript" src="../../src/lexer.js"></script> 
  • lang/javascript/javascript-xpath/branches/support-namespace/test/functional/index.html

    r1549 r5270  
    1111  <!--LOCAL_DATA_HERE--> 
    1212 
    13   <script type="text/javascript" src="../../src/config.js"></script> 
     13  <script type="text/javascript" src="./config.js"></script> 
    1414  <script type="text/javascript" src="../../src/uai.js"></script> 
    1515  <script type="text/javascript" src="../../src/lexer.js"></script> 
  • lang/javascript/javascript-xpath/branches/support-namespace/test/functional/logger.js

    r1651 r5270  
    44if (!window.Counter) 
    55    window.Counter = null; 
     6 
     7if (!document.createElementNS) { 
     8    document.createElementNS = function(ns, localName) { 
     9        return this.createElement(localName); 
     10    } 
     11} 
    612 
    713Counter = function(elem_ok, elem_all, alertClassName) { 
     
    1521Counter.prototype = { 
    1622    inc: function(ok) { 
    17         this.elem_all.innerHTML = ++this.countAll; 
     23        this.elem_all.replaceChild(document.createTextNode(++this.countAll), this.elem_all.firstChild) 
    1824        if (ok) 
    19             this.elem_ok.innerHTML = ++this.countOKs; 
     25            this.elem_ok.replaceChild(document.createTextNode(++this.countOKs), this.elem_ok.firstChild) 
    2026        else 
    2127            this.elem_ok.className = this.alertClassName; 
     
    2430 
    2531Logger = function(header, html, id, prevId) { 
    26     this.container = document.createElement('div'); 
     32    this.container = document.createElementNS('http://www.w3.org/1999/xhtml', 'div'); 
    2733    this.container.id = 'test-' + id; 
    2834    testLog.appendChild(this.container); 
    2935 
    3036 
    31     this.h2 = document.createElement('h2'); 
     37    this.h2 = document.createElementNS('http://www.w3.org/1999/xhtml', 'h2'); 
    3238    this.container.appendChild(this.h2); 
    3339 
    34     this.thisAnchor = document.createElement('a'); 
     40    this.thisAnchor = document.createElementNS('http://www.w3.org/1999/xhtml', 'a'); 
    3541    this.thisAnchor.href = '#test-' + id; 
    3642    this.thisAnchor.appendChild(document.createTextNode(header)); 
    3743    this.h2.appendChild(this.thisAnchor); 
    3844 
    39     this.localCountElm = document.createElement('span'); 
     45    this.localCountElm = document.createElementNS('http://www.w3.org/1999/xhtml', 'span'); 
    4046    this.localCountElm.className = 'local-counter'; 
    41     this.localCountElm.innerHTML = '<span class="local-counter-ok">0</span> / <span>0</span>' 
     47    var span; 
     48    span = document.createElementNS('http://www.w3.org/1999/xhtml', 'span') 
     49    this.localCountElm.appendChild(span); 
     50    span.className = 'local-counter-ok'; 
     51    span.appendChild(document.createTextNode('0')); 
     52    this.localCountElm.appendChild(document.createTextNode(' / ')); 
     53    span = document.createElementNS('http://www.w3.org/1999/xhtml', 'span'); 
     54    this.localCountElm.appendChild(span); 
     55    span.appendChild(document.createTextNode('0')); 
    4256    this.h2.appendChild(document.createTextNode(' ')); 
    4357    this.h2.appendChild(this.localCountElm); 
     
    4660 
    4761 
    48     this.anchorContainer = document.createElement('div'); 
     62    this.anchorContainer = document.createElementNS('http://www.w3.org/1999/xhtml', 'div'); 
    4963    this.container.appendChild(this.anchorContainer); 
    5064 
    51     var anchor = document.createElement('a'); 
     65    var anchor = document.createElementNS('http://www.w3.org/1999/xhtml', 'a'); 
    5266    anchor.href = '?' + id; 
    5367    anchor.appendChild(document.createTextNode('(only this test)')); 
     
    5670 
    5771    if (prevId) { 
    58         this.prevAnchor = document.createElement('a'); 
     72        this.prevAnchor = document.createElementNS('http://www.w3.org/1999/xhtml', 'a'); 
    5973        this.prevAnchor.href = '#test-' + prevId; 
    6074        this.prevAnchor.appendChild(document.createTextNode('(prev)')); 
     
    6478    } 
    6579 
    66     this.pre = document.createElement('pre'); 
     80    this.pre = document.createElementNS('http://www.w3.org/1999/xhtml', 'pre'); 
    6781    if (uai.ie) { 
    68         var dummy = document.createElement('pre'); 
     82        var dummy = document.createElementNS('http://www.w3.org/1999/xhtml', 'pre'); 
    6983        dummy.appendChild(document.createTextNode(html)); 
    7084        this.pre.innerHTML = dummy.innerHTML.replace(/\n/g, '<br/>\n').replace(/\t/g, '&nbsp;&nbsp;&nbsp;&nbsp;').replace(/ /g, '&nbsp;'); 
     
    7589    this.container.appendChild(this.pre); 
    7690 
    77     this.table = document.createElement('table'); 
    78     this.thead = document.createElement('thead'); 
    79     this.tbody = document.createElement('tbody'); 
     91    this.table = document.createElementNS('http://www.w3.org/1999/xhtml', 'table'); 
     92    this.thead = document.createElementNS('http://www.w3.org/1999/xhtml', 'thead'); 
     93    this.tbody = document.createElementNS('http://www.w3.org/1999/xhtml', 'tbody'); 
    8094    this.table.appendChild(this.thead); 
    8195    this.table.appendChild(this.tbody); 
    82     this.theadRow = document.createElement('tr'); 
     96    this.theadRow = document.createElementNS('http://www.w3.org/1999/xhtml', 'tr'); 
    8397    this.thead.appendChild(this.theadRow); 
    8498    this.countCols = 0; 
     
    98112Logger.prototype = { 
    99113    appendHeader: function(label) { 
    100         th = document.createElement('th'); 
     114        th = document.createElementNS('http://www.w3.org/1999/xhtml', 'th'); 
    101115        th.appendChild(document.createTextNode(label)); 
    102116        this.theadRow.appendChild(th); 
     
    106120 
    107121    next:function (id) { 
    108         this.nextAnchor = document.createElement('a'); 
     122        this.nextAnchor = document.createElementNS('http://www.w3.org/1999/xhtml', 'a'); 
    109123        this.nextAnchor.href = '#test-' + id; 
    110124        this.nextAnchor.appendChild(document.createTextNode('(next)')); 
     
    115129 
    116130    log: function(cols) { 
    117         var td, tr = document.createElement('tr'); 
     131        var td, tr = document.createElementNS('http://www.w3.org/1999/xhtml', 'tr'); 
    118132        this.tbody.appendChild(tr); 
    119133 
     
    126140                c = {label: c ? (c.label || c.toString()) : c}; 
    127141 
    128             td = document.createElement('td'); 
     142            td = document.createElementNS('http://www.w3.org/1999/xhtml', 'td'); 
    129143            td.appendChild( c.richLabel || (document.createTextNode(c.label || '(none)')) ); 
    130144            tr.appendChild(td); 
     
    137151     
    138152    logFullSpan: function(content) { 
    139         var td, tr = document.createElement('tr'); 
     153        var td, tr = document.createElementNS('http://www.w3.org/1999/xhtml', 'tr'); 
    140154        this.tbody.appendChild(tr); 
    141         td = document.createElement('td'); 
     155        td = document.createElementNS('http://www.w3.org/1999/xhtml', 'td'); 
    142156        td.appendChild(content); 
    143157        tr.appendChild(td); 
     
    147161 
    148162    lazyLogFullSpan: function(labelText, closure) { 
    149         var td, tr = document.createElement('tr'); 
     163        var td, tr = document.createElementNS('http://www.w3.org/1999/xhtml', 'tr'); 
    150164        this.tbody.appendChild(tr); 
    151         td = document.createElement('td'); 
    152         var label = document.createElement('span'); 
     165        td = document.createElementNS('http://www.w3.org/1999/xhtml', 'td'); 
     166        var label = document.createElementNS('http://www.w3.org/1999/xhtml', 'span'); 
    153167        label.innerHTML = labelText; 
    154168        label.className = "lazy-log-open"; 
  • lang/javascript/javascript-xpath/branches/support-namespace/tools/compress.sh

    r1429 r5270  
    55        sed -e "s/\/\*@cc_on/{@cc_on}/g;s/\/\*@_cc_on/{@_cc_on}/g;s/@else @\*\//{@else@}/g;s/\/\*@end @\*\//{@end@}/g;" $1 > ${BASEDIR}/tmp.js 
    66        java -jar ${BASEDIR}/consyntools.jar Obfuscator ${BASEDIR}/tmp.js ${BASEDIR}/tmp2.js __ 
    7         sed -e "s/{@cc_on}/\n\/\*@cc_on /g;s/{@_cc_on}/\n\/\*@_cc_on/g;s/{@else@}/@else @\*\//g;s/{@end@}/\/\*@end @\*\//g;" ${BASEDIR}/tmp2.js > $2 
     7        sed -e "s/{@cc_on}/ \/\*@cc_on /g;s/{@_cc_on}/ \/\*@_cc_on/g;s/{@else@}/@else @\*\/ /g;s/{@end@}/\/\*@end @\*\/ /g;" ${BASEDIR}/tmp2.js > $2 
    88        rm ${BASEDIR}/tmp.js 
    99        rm ${BASEDIR}/tmp2.js 
  • lang/javascript/javascript-xpath/branches/support-namespace/version.txt

    r1783 r5270  
    1 0.1.6 
     10.1.8