diff options
Diffstat (limited to 'tests/test_tools')
8 files changed, 894 insertions, 894 deletions
diff --git a/tests/test_tools/selenium/core/lib/cssQuery/cssQuery-p.js b/tests/test_tools/selenium/core/lib/cssQuery/cssQuery-p.js index 4a7eb88a..00e43a42 100644 --- a/tests/test_tools/selenium/core/lib/cssQuery/cssQuery-p.js +++ b/tests/test_tools/selenium/core/lib/cssQuery/cssQuery-p.js @@ -1,6 +1,6 @@ -/*
- cssQuery, version 2.0.2 (2005-08-19)
- Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/)
- License: http://creativecommons.org/licenses/LGPL/2.1/
-*/
-eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('7 x=6(){7 1D="2.0.2";7 C=/\\s*,\\s*/;7 x=6(s,A){33{7 m=[];7 u=1z.32.2c&&!A;7 b=(A)?(A.31==22)?A:[A]:[1g];7 1E=18(s).1l(C),i;9(i=0;i<1E.y;i++){s=1y(1E[i]);8(U&&s.Z(0,3).2b("")==" *#"){s=s.Z(2);A=24([],b,s[1])}1A A=b;7 j=0,t,f,a,c="";H(j<s.y){t=s[j++];f=s[j++];c+=t+f;a="";8(s[j]=="("){H(s[j++]!=")")a+=s[j];a=a.Z(0,-1);c+="("+a+")"}A=(u&&V[c])?V[c]:21(A,t,f,a);8(u)V[c]=A}m=m.30(A)}2a x.2d;5 m}2Z(e){x.2d=e;5[]}};x.1Z=6(){5"6 x() {\\n [1D "+1D+"]\\n}"};7 V={};x.2c=L;x.2Y=6(s){8(s){s=1y(s).2b("");2a V[s]}1A V={}};7 29={};7 19=L;x.15=6(n,s){8(19)1i("s="+1U(s));29[n]=12 s()};x.2X=6(c){5 c?1i(c):o};7 D={};7 h={};7 q={P:/\\[([\\w-]+(\\|[\\w-]+)?)\\s*(\\W?=)?\\s*([^\\]]*)\\]/};7 T=[];D[" "]=6(r,f,t,n){7 e,i,j;9(i=0;i<f.y;i++){7 s=X(f[i],t,n);9(j=0;(e=s[j]);j++){8(M(e)&&14(e,n))r.z(e)}}};D["#"]=6(r,f,i){7 e,j;9(j=0;(e=f[j]);j++)8(e.B==i)r.z(e)};D["."]=6(r,f,c){c=12 1t("(^|\\\\s)"+c+"(\\\\s|$)");7 e,i;9(i=0;(e=f[i]);i++)8(c.l(e.1V))r.z(e)};D[":"]=6(r,f,p,a){7 t=h[p],e,i;8(t)9(i=0;(e=f[i]);i++)8(t(e,a))r.z(e)};h["2W"]=6(e){7 d=Q(e);8(d.1C)9(7 i=0;i<d.1C.y;i++){8(d.1C[i]==e)5 K}};h["2V"]=6(e){};7 M=6(e){5(e&&e.1c==1&&e.1f!="!")?e:23};7 16=6(e){H(e&&(e=e.2U)&&!M(e))28;5 e};7 G=6(e){H(e&&(e=e.2T)&&!M(e))28;5 e};7 1r=6(e){5 M(e.27)||G(e.27)};7 1P=6(e){5 M(e.26)||16(e.26)};7 1o=6(e){7 c=[];e=1r(e);H(e){c.z(e);e=G(e)}5 c};7 U=K;7 1h=6(e){7 d=Q(e);5(2S d.25=="2R")?/\\.1J$/i.l(d.2Q):2P(d.25=="2O 2N")};7 Q=6(e){5 e.2M||e.1g};7 X=6(e,t){5(t=="*"&&e.1B)?e.1B:e.X(t)};7 17=6(e,t,n){8(t=="*")5 M(e);8(!14(e,n))5 L;8(!1h(e))t=t.2L();5 e.1f==t};7 14=6(e,n){5!n||(n=="*")||(e.2K==n)};7 1e=6(e){5 e.1G};6 24(r,f,B){7 m,i,j;9(i=0;i<f.y;i++){8(m=f[i].1B.2J(B)){8(m.B==B)r.z(m);1A 8(m.y!=23){9(j=0;j<m.y;j++){8(m[j].B==B)r.z(m[j])}}}}5 r};8(![].z)22.2I.z=6(){9(7 i=0;i<1z.y;i++){o[o.y]=1z[i]}5 o.y};7 N=/\\|/;6 21(A,t,f,a){8(N.l(f)){f=f.1l(N);a=f[0];f=f[1]}7 r=[];8(D[t]){D[t](r,A,f,a)}5 r};7 S=/^[^\\s>+~]/;7 20=/[\\s#.:>+~()@]|[^\\s#.:>+~()@]+/g;6 1y(s){8(S.l(s))s=" "+s;5 s.P(20)||[]};7 W=/\\s*([\\s>+~(),]|^|$)\\s*/g;7 I=/([\\s>+~,]|[^(]\\+|^)([#.:@])/g;7 18=6(s){5 s.O(W,"$1").O(I,"$1*$2")};7 1u={1Z:6(){5"\'"},P:/^(\'[^\']*\')|("[^"]*")$/,l:6(s){5 o.P.l(s)},1S:6(s){5 o.l(s)?s:o+s+o},1Y:6(s){5 o.l(s)?s.Z(1,-1):s}};7 1s=6(t){5 1u.1Y(t)};7 E=/([\\/()[\\]?{}|*+-])/g;6 R(s){5 s.O(E,"\\\\$1")};x.15("1j-2H",6(){D[">"]=6(r,f,t,n){7 e,i,j;9(i=0;i<f.y;i++){7 s=1o(f[i]);9(j=0;(e=s[j]);j++)8(17(e,t,n))r.z(e)}};D["+"]=6(r,f,t,n){9(7 i=0;i<f.y;i++){7 e=G(f[i]);8(e&&17(e,t,n))r.z(e)}};D["@"]=6(r,f,a){7 t=T[a].l;7 e,i;9(i=0;(e=f[i]);i++)8(t(e))r.z(e)};h["2G-10"]=6(e){5!16(e)};h["1x"]=6(e,c){c=12 1t("^"+c,"i");H(e&&!e.13("1x"))e=e.1n;5 e&&c.l(e.13("1x"))};q.1X=/\\\\:/g;q.1w="@";q.J={};q.O=6(m,a,n,c,v){7 k=o.1w+m;8(!T[k]){a=o.1W(a,c||"",v||"");T[k]=a;T.z(a)}5 T[k].B};q.1Q=6(s){s=s.O(o.1X,"|");7 m;H(m=s.P(o.P)){7 r=o.O(m[0],m[1],m[2],m[3],m[4]);s=s.O(o.P,r)}5 s};q.1W=6(p,t,v){7 a={};a.B=o.1w+T.y;a.2F=p;t=o.J[t];t=t?t(o.13(p),1s(v)):L;a.l=12 2E("e","5 "+t);5 a};q.13=6(n){1d(n.2D()){F"B":5"e.B";F"2C":5"e.1V";F"9":5"e.2B";F"1T":8(U){5"1U((e.2A.P(/1T=\\\\1v?([^\\\\s\\\\1v]*)\\\\1v?/)||[])[1]||\'\')"}}5"e.13(\'"+n.O(N,":")+"\')"};q.J[""]=6(a){5 a};q.J["="]=6(a,v){5 a+"=="+1u.1S(v)};q.J["~="]=6(a,v){5"/(^| )"+R(v)+"( |$)/.l("+a+")"};q.J["|="]=6(a,v){5"/^"+R(v)+"(-|$)/.l("+a+")"};7 1R=18;18=6(s){5 1R(q.1Q(s))}});x.15("1j-2z",6(){D["~"]=6(r,f,t,n){7 e,i;9(i=0;(e=f[i]);i++){H(e=G(e)){8(17(e,t,n))r.z(e)}}};h["2y"]=6(e,t){t=12 1t(R(1s(t)));5 t.l(1e(e))};h["2x"]=6(e){5 e==Q(e).1H};h["2w"]=6(e){7 n,i;9(i=0;(n=e.1F[i]);i++){8(M(n)||n.1c==3)5 L}5 K};h["1N-10"]=6(e){5!G(e)};h["2v-10"]=6(e){e=e.1n;5 1r(e)==1P(e)};h["2u"]=6(e,s){7 n=x(s,Q(e));9(7 i=0;i<n.y;i++){8(n[i]==e)5 L}5 K};h["1O-10"]=6(e,a){5 1p(e,a,16)};h["1O-1N-10"]=6(e,a){5 1p(e,a,G)};h["2t"]=6(e){5 e.B==2s.2r.Z(1)};h["1M"]=6(e){5 e.1M};h["2q"]=6(e){5 e.1q===L};h["1q"]=6(e){5 e.1q};h["1L"]=6(e){5 e.1L};q.J["^="]=6(a,v){5"/^"+R(v)+"/.l("+a+")"};q.J["$="]=6(a,v){5"/"+R(v)+"$/.l("+a+")"};q.J["*="]=6(a,v){5"/"+R(v)+"/.l("+a+")"};6 1p(e,a,t){1d(a){F"n":5 K;F"2p":a="2n";1a;F"2o":a="2n+1"}7 1m=1o(e.1n);6 1k(i){7 i=(t==G)?1m.y-i:i-1;5 1m[i]==e};8(!Y(a))5 1k(a);a=a.1l("n");7 m=1K(a[0]);7 s=1K(a[1]);8((Y(m)||m==1)&&s==0)5 K;8(m==0&&!Y(s))5 1k(s);8(Y(s))s=0;7 c=1;H(e=t(e))c++;8(Y(m)||m==1)5(t==G)?(c<=s):(s>=c);5(c%m)==s}});x.15("1j-2m",6(){U=1i("L;/*@2l@8(@\\2k)U=K@2j@*/");8(!U){X=6(e,t,n){5 n?e.2i("*",t):e.X(t)};14=6(e,n){5!n||(n=="*")||(e.2h==n)};1h=1g.1I?6(e){5/1J/i.l(Q(e).1I)}:6(e){5 Q(e).1H.1f!="2g"};1e=6(e){5 e.2f||e.1G||1b(e)};6 1b(e){7 t="",n,i;9(i=0;(n=e.1F[i]);i++){1d(n.1c){F 11:F 1:t+=1b(n);1a;F 3:t+=n.2e;1a}}5 t}}});19=K;5 x}();',62,190,'|||||return|function|var|if|for||||||||pseudoClasses||||test|||this||AttributeSelector|||||||cssQuery|length|push|fr|id||selectors||case|nextElementSibling|while||tests|true|false|thisElement||replace|match|getDocument|regEscape||attributeSelectors|isMSIE|cache||getElementsByTagName|isNaN|slice|child||new|getAttribute|compareNamespace|addModule|previousElementSibling|compareTagName|parseSelector|loaded|break|_0|nodeType|switch|getTextContent|tagName|document|isXML|eval|css|_1|split|ch|parentNode|childElements|nthChild|disabled|firstElementChild|getText|RegExp|Quote|x22|PREFIX|lang|_2|arguments|else|all|links|version|se|childNodes|innerText|documentElement|contentType|xml|parseInt|indeterminate|checked|last|nth|lastElementChild|parse|_3|add|href|String|className|create|NS_IE|remove|toString|ST|select|Array|null|_4|mimeType|lastChild|firstChild|continue|modules|delete|join|caching|error|nodeValue|textContent|HTML|prefix|getElementsByTagNameNS|end|x5fwin32|cc_on|standard||odd|even|enabled|hash|location|target|not|only|empty|root|contains|level3|outerHTML|htmlFor|class|toLowerCase|Function|name|first|level2|prototype|item|scopeName|toUpperCase|ownerDocument|Document|XML|Boolean|URL|unknown|typeof|nextSibling|previousSibling|visited|link|valueOf|clearCache|catch|concat|constructor|callee|try'.split('|'),0,{}))
+/* + cssQuery, version 2.0.2 (2005-08-19) + Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/) + License: http://creativecommons.org/licenses/LGPL/2.1/ +*/ +eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('7 x=6(){7 1D="2.0.2";7 C=/\\s*,\\s*/;7 x=6(s,A){33{7 m=[];7 u=1z.32.2c&&!A;7 b=(A)?(A.31==22)?A:[A]:[1g];7 1E=18(s).1l(C),i;9(i=0;i<1E.y;i++){s=1y(1E[i]);8(U&&s.Z(0,3).2b("")==" *#"){s=s.Z(2);A=24([],b,s[1])}1A A=b;7 j=0,t,f,a,c="";H(j<s.y){t=s[j++];f=s[j++];c+=t+f;a="";8(s[j]=="("){H(s[j++]!=")")a+=s[j];a=a.Z(0,-1);c+="("+a+")"}A=(u&&V[c])?V[c]:21(A,t,f,a);8(u)V[c]=A}m=m.30(A)}2a x.2d;5 m}2Z(e){x.2d=e;5[]}};x.1Z=6(){5"6 x() {\\n [1D "+1D+"]\\n}"};7 V={};x.2c=L;x.2Y=6(s){8(s){s=1y(s).2b("");2a V[s]}1A V={}};7 29={};7 19=L;x.15=6(n,s){8(19)1i("s="+1U(s));29[n]=12 s()};x.2X=6(c){5 c?1i(c):o};7 D={};7 h={};7 q={P:/\\[([\\w-]+(\\|[\\w-]+)?)\\s*(\\W?=)?\\s*([^\\]]*)\\]/};7 T=[];D[" "]=6(r,f,t,n){7 e,i,j;9(i=0;i<f.y;i++){7 s=X(f[i],t,n);9(j=0;(e=s[j]);j++){8(M(e)&&14(e,n))r.z(e)}}};D["#"]=6(r,f,i){7 e,j;9(j=0;(e=f[j]);j++)8(e.B==i)r.z(e)};D["."]=6(r,f,c){c=12 1t("(^|\\\\s)"+c+"(\\\\s|$)");7 e,i;9(i=0;(e=f[i]);i++)8(c.l(e.1V))r.z(e)};D[":"]=6(r,f,p,a){7 t=h[p],e,i;8(t)9(i=0;(e=f[i]);i++)8(t(e,a))r.z(e)};h["2W"]=6(e){7 d=Q(e);8(d.1C)9(7 i=0;i<d.1C.y;i++){8(d.1C[i]==e)5 K}};h["2V"]=6(e){};7 M=6(e){5(e&&e.1c==1&&e.1f!="!")?e:23};7 16=6(e){H(e&&(e=e.2U)&&!M(e))28;5 e};7 G=6(e){H(e&&(e=e.2T)&&!M(e))28;5 e};7 1r=6(e){5 M(e.27)||G(e.27)};7 1P=6(e){5 M(e.26)||16(e.26)};7 1o=6(e){7 c=[];e=1r(e);H(e){c.z(e);e=G(e)}5 c};7 U=K;7 1h=6(e){7 d=Q(e);5(2S d.25=="2R")?/\\.1J$/i.l(d.2Q):2P(d.25=="2O 2N")};7 Q=6(e){5 e.2M||e.1g};7 X=6(e,t){5(t=="*"&&e.1B)?e.1B:e.X(t)};7 17=6(e,t,n){8(t=="*")5 M(e);8(!14(e,n))5 L;8(!1h(e))t=t.2L();5 e.1f==t};7 14=6(e,n){5!n||(n=="*")||(e.2K==n)};7 1e=6(e){5 e.1G};6 24(r,f,B){7 m,i,j;9(i=0;i<f.y;i++){8(m=f[i].1B.2J(B)){8(m.B==B)r.z(m);1A 8(m.y!=23){9(j=0;j<m.y;j++){8(m[j].B==B)r.z(m[j])}}}}5 r};8(![].z)22.2I.z=6(){9(7 i=0;i<1z.y;i++){o[o.y]=1z[i]}5 o.y};7 N=/\\|/;6 21(A,t,f,a){8(N.l(f)){f=f.1l(N);a=f[0];f=f[1]}7 r=[];8(D[t]){D[t](r,A,f,a)}5 r};7 S=/^[^\\s>+~]/;7 20=/[\\s#.:>+~()@]|[^\\s#.:>+~()@]+/g;6 1y(s){8(S.l(s))s=" "+s;5 s.P(20)||[]};7 W=/\\s*([\\s>+~(),]|^|$)\\s*/g;7 I=/([\\s>+~,]|[^(]\\+|^)([#.:@])/g;7 18=6(s){5 s.O(W,"$1").O(I,"$1*$2")};7 1u={1Z:6(){5"\'"},P:/^(\'[^\']*\')|("[^"]*")$/,l:6(s){5 o.P.l(s)},1S:6(s){5 o.l(s)?s:o+s+o},1Y:6(s){5 o.l(s)?s.Z(1,-1):s}};7 1s=6(t){5 1u.1Y(t)};7 E=/([\\/()[\\]?{}|*+-])/g;6 R(s){5 s.O(E,"\\\\$1")};x.15("1j-2H",6(){D[">"]=6(r,f,t,n){7 e,i,j;9(i=0;i<f.y;i++){7 s=1o(f[i]);9(j=0;(e=s[j]);j++)8(17(e,t,n))r.z(e)}};D["+"]=6(r,f,t,n){9(7 i=0;i<f.y;i++){7 e=G(f[i]);8(e&&17(e,t,n))r.z(e)}};D["@"]=6(r,f,a){7 t=T[a].l;7 e,i;9(i=0;(e=f[i]);i++)8(t(e))r.z(e)};h["2G-10"]=6(e){5!16(e)};h["1x"]=6(e,c){c=12 1t("^"+c,"i");H(e&&!e.13("1x"))e=e.1n;5 e&&c.l(e.13("1x"))};q.1X=/\\\\:/g;q.1w="@";q.J={};q.O=6(m,a,n,c,v){7 k=o.1w+m;8(!T[k]){a=o.1W(a,c||"",v||"");T[k]=a;T.z(a)}5 T[k].B};q.1Q=6(s){s=s.O(o.1X,"|");7 m;H(m=s.P(o.P)){7 r=o.O(m[0],m[1],m[2],m[3],m[4]);s=s.O(o.P,r)}5 s};q.1W=6(p,t,v){7 a={};a.B=o.1w+T.y;a.2F=p;t=o.J[t];t=t?t(o.13(p),1s(v)):L;a.l=12 2E("e","5 "+t);5 a};q.13=6(n){1d(n.2D()){F"B":5"e.B";F"2C":5"e.1V";F"9":5"e.2B";F"1T":8(U){5"1U((e.2A.P(/1T=\\\\1v?([^\\\\s\\\\1v]*)\\\\1v?/)||[])[1]||\'\')"}}5"e.13(\'"+n.O(N,":")+"\')"};q.J[""]=6(a){5 a};q.J["="]=6(a,v){5 a+"=="+1u.1S(v)};q.J["~="]=6(a,v){5"/(^| )"+R(v)+"( |$)/.l("+a+")"};q.J["|="]=6(a,v){5"/^"+R(v)+"(-|$)/.l("+a+")"};7 1R=18;18=6(s){5 1R(q.1Q(s))}});x.15("1j-2z",6(){D["~"]=6(r,f,t,n){7 e,i;9(i=0;(e=f[i]);i++){H(e=G(e)){8(17(e,t,n))r.z(e)}}};h["2y"]=6(e,t){t=12 1t(R(1s(t)));5 t.l(1e(e))};h["2x"]=6(e){5 e==Q(e).1H};h["2w"]=6(e){7 n,i;9(i=0;(n=e.1F[i]);i++){8(M(n)||n.1c==3)5 L}5 K};h["1N-10"]=6(e){5!G(e)};h["2v-10"]=6(e){e=e.1n;5 1r(e)==1P(e)};h["2u"]=6(e,s){7 n=x(s,Q(e));9(7 i=0;i<n.y;i++){8(n[i]==e)5 L}5 K};h["1O-10"]=6(e,a){5 1p(e,a,16)};h["1O-1N-10"]=6(e,a){5 1p(e,a,G)};h["2t"]=6(e){5 e.B==2s.2r.Z(1)};h["1M"]=6(e){5 e.1M};h["2q"]=6(e){5 e.1q===L};h["1q"]=6(e){5 e.1q};h["1L"]=6(e){5 e.1L};q.J["^="]=6(a,v){5"/^"+R(v)+"/.l("+a+")"};q.J["$="]=6(a,v){5"/"+R(v)+"$/.l("+a+")"};q.J["*="]=6(a,v){5"/"+R(v)+"/.l("+a+")"};6 1p(e,a,t){1d(a){F"n":5 K;F"2p":a="2n";1a;F"2o":a="2n+1"}7 1m=1o(e.1n);6 1k(i){7 i=(t==G)?1m.y-i:i-1;5 1m[i]==e};8(!Y(a))5 1k(a);a=a.1l("n");7 m=1K(a[0]);7 s=1K(a[1]);8((Y(m)||m==1)&&s==0)5 K;8(m==0&&!Y(s))5 1k(s);8(Y(s))s=0;7 c=1;H(e=t(e))c++;8(Y(m)||m==1)5(t==G)?(c<=s):(s>=c);5(c%m)==s}});x.15("1j-2m",6(){U=1i("L;/*@2l@8(@\\2k)U=K@2j@*/");8(!U){X=6(e,t,n){5 n?e.2i("*",t):e.X(t)};14=6(e,n){5!n||(n=="*")||(e.2h==n)};1h=1g.1I?6(e){5/1J/i.l(Q(e).1I)}:6(e){5 Q(e).1H.1f!="2g"};1e=6(e){5 e.2f||e.1G||1b(e)};6 1b(e){7 t="",n,i;9(i=0;(n=e.1F[i]);i++){1d(n.1c){F 11:F 1:t+=1b(n);1a;F 3:t+=n.2e;1a}}5 t}}});19=K;5 x}();',62,190,'|||||return|function|var|if|for||||||||pseudoClasses||||test|||this||AttributeSelector|||||||cssQuery|length|push|fr|id||selectors||case|nextElementSibling|while||tests|true|false|thisElement||replace|match|getDocument|regEscape||attributeSelectors|isMSIE|cache||getElementsByTagName|isNaN|slice|child||new|getAttribute|compareNamespace|addModule|previousElementSibling|compareTagName|parseSelector|loaded|break|_0|nodeType|switch|getTextContent|tagName|document|isXML|eval|css|_1|split|ch|parentNode|childElements|nthChild|disabled|firstElementChild|getText|RegExp|Quote|x22|PREFIX|lang|_2|arguments|else|all|links|version|se|childNodes|innerText|documentElement|contentType|xml|parseInt|indeterminate|checked|last|nth|lastElementChild|parse|_3|add|href|String|className|create|NS_IE|remove|toString|ST|select|Array|null|_4|mimeType|lastChild|firstChild|continue|modules|delete|join|caching|error|nodeValue|textContent|HTML|prefix|getElementsByTagNameNS|end|x5fwin32|cc_on|standard||odd|even|enabled|hash|location|target|not|only|empty|root|contains|level3|outerHTML|htmlFor|class|toLowerCase|Function|name|first|level2|prototype|item|scopeName|toUpperCase|ownerDocument|Document|XML|Boolean|URL|unknown|typeof|nextSibling|previousSibling|visited|link|valueOf|clearCache|catch|concat|constructor|callee|try'.split('|'),0,{})) diff --git a/tests/test_tools/selenium/core/lib/cssQuery/src/cssQuery-level2.js b/tests/test_tools/selenium/core/lib/cssQuery/src/cssQuery-level2.js index 02dd0e5f..2987b15b 100644 --- a/tests/test_tools/selenium/core/lib/cssQuery/src/cssQuery-level2.js +++ b/tests/test_tools/selenium/core/lib/cssQuery/src/cssQuery-level2.js @@ -1,142 +1,142 @@ -/*
- cssQuery, version 2.0.2 (2005-08-19)
- Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/)
- License: http://creativecommons.org/licenses/LGPL/2.1/
-*/
-
-cssQuery.addModule("css-level2", function() {
-
-// -----------------------------------------------------------------------
-// selectors
-// -----------------------------------------------------------------------
-
-// child selector
-selectors[">"] = function($results, $from, $tagName, $namespace) {
- var $element, i, j;
- for (i = 0; i < $from.length; i++) {
- var $subset = childElements($from[i]);
- for (j = 0; ($element = $subset[j]); j++)
- if (compareTagName($element, $tagName, $namespace))
- $results.push($element);
- }
-};
-
-// sibling selector
-selectors["+"] = function($results, $from, $tagName, $namespace) {
- for (var i = 0; i < $from.length; i++) {
- var $element = nextElementSibling($from[i]);
- if ($element && compareTagName($element, $tagName, $namespace))
- $results.push($element);
- }
-};
-
-// attribute selector
-selectors["@"] = function($results, $from, $attributeSelectorID) {
- var $test = attributeSelectors[$attributeSelectorID].test;
- var $element, i;
- for (i = 0; ($element = $from[i]); i++)
- if ($test($element)) $results.push($element);
-};
-
-// -----------------------------------------------------------------------
-// pseudo-classes
-// -----------------------------------------------------------------------
-
-pseudoClasses["first-child"] = function($element) {
- return !previousElementSibling($element);
-};
-
-pseudoClasses["lang"] = function($element, $code) {
- $code = new RegExp("^" + $code, "i");
- while ($element && !$element.getAttribute("lang")) $element = $element.parentNode;
- return $element && $code.test($element.getAttribute("lang"));
-};
-
-// -----------------------------------------------------------------------
-// attribute selectors
-// -----------------------------------------------------------------------
-
-// constants
-AttributeSelector.NS_IE = /\\:/g;
-AttributeSelector.PREFIX = "@";
-// properties
-AttributeSelector.tests = {};
-// methods
-AttributeSelector.replace = function($match, $attribute, $namespace, $compare, $value) {
- var $key = this.PREFIX + $match;
- if (!attributeSelectors[$key]) {
- $attribute = this.create($attribute, $compare || "", $value || "");
- // store the selector
- attributeSelectors[$key] = $attribute;
- attributeSelectors.push($attribute);
- }
- return attributeSelectors[$key].id;
-};
-AttributeSelector.parse = function($selector) {
- $selector = $selector.replace(this.NS_IE, "|");
- var $match;
- while ($match = $selector.match(this.match)) {
- var $replace = this.replace($match[0], $match[1], $match[2], $match[3], $match[4]);
- $selector = $selector.replace(this.match, $replace);
- }
- return $selector;
-};
-AttributeSelector.create = function($propertyName, $test, $value) {
- var $attributeSelector = {};
- $attributeSelector.id = this.PREFIX + attributeSelectors.length;
- $attributeSelector.name = $propertyName;
- $test = this.tests[$test];
- $test = $test ? $test(this.getAttribute($propertyName), getText($value)) : false;
- $attributeSelector.test = new Function("e", "return " + $test);
- return $attributeSelector;
-};
-AttributeSelector.getAttribute = function($name) {
- switch ($name.toLowerCase()) {
- case "id":
- return "e.id";
- case "class":
- return "e.className";
- case "for":
- return "e.htmlFor";
- case "href":
- if (isMSIE) {
- // IE always returns the full path not the fragment in the href attribute
- // so we RegExp it out of outerHTML. Opera does the same thing but there
- // is no way to get the original attribute.
- return "String((e.outerHTML.match(/href=\\x22?([^\\s\\x22]*)\\x22?/)||[])[1]||'')";
- }
- }
- return "e.getAttribute('" + $name.replace($NAMESPACE, ":") + "')";
-};
-
-// -----------------------------------------------------------------------
-// attribute selector tests
-// -----------------------------------------------------------------------
-
-AttributeSelector.tests[""] = function($attribute) {
- return $attribute;
-};
-
-AttributeSelector.tests["="] = function($attribute, $value) {
- return $attribute + "==" + Quote.add($value);
-};
-
-AttributeSelector.tests["~="] = function($attribute, $value) {
- return "/(^| )" + regEscape($value) + "( |$)/.test(" + $attribute + ")";
-};
-
-AttributeSelector.tests["|="] = function($attribute, $value) {
- return "/^" + regEscape($value) + "(-|$)/.test(" + $attribute + ")";
-};
-
-// -----------------------------------------------------------------------
-// parsing
-// -----------------------------------------------------------------------
-
-// override parseSelector to parse out attribute selectors
-var _parseSelector = parseSelector;
-parseSelector = function($selector) {
- return _parseSelector(AttributeSelector.parse($selector));
-};
-
-}); // addModule
+/* + cssQuery, version 2.0.2 (2005-08-19) + Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/) + License: http://creativecommons.org/licenses/LGPL/2.1/ +*/ + +cssQuery.addModule("css-level2", function() { + +// ----------------------------------------------------------------------- +// selectors +// ----------------------------------------------------------------------- + +// child selector +selectors[">"] = function($results, $from, $tagName, $namespace) { + var $element, i, j; + for (i = 0; i < $from.length; i++) { + var $subset = childElements($from[i]); + for (j = 0; ($element = $subset[j]); j++) + if (compareTagName($element, $tagName, $namespace)) + $results.push($element); + } +}; + +// sibling selector +selectors["+"] = function($results, $from, $tagName, $namespace) { + for (var i = 0; i < $from.length; i++) { + var $element = nextElementSibling($from[i]); + if ($element && compareTagName($element, $tagName, $namespace)) + $results.push($element); + } +}; + +// attribute selector +selectors["@"] = function($results, $from, $attributeSelectorID) { + var $test = attributeSelectors[$attributeSelectorID].test; + var $element, i; + for (i = 0; ($element = $from[i]); i++) + if ($test($element)) $results.push($element); +}; + +// ----------------------------------------------------------------------- +// pseudo-classes +// ----------------------------------------------------------------------- + +pseudoClasses["first-child"] = function($element) { + return !previousElementSibling($element); +}; + +pseudoClasses["lang"] = function($element, $code) { + $code = new RegExp("^" + $code, "i"); + while ($element && !$element.getAttribute("lang")) $element = $element.parentNode; + return $element && $code.test($element.getAttribute("lang")); +}; + +// ----------------------------------------------------------------------- +// attribute selectors +// ----------------------------------------------------------------------- + +// constants +AttributeSelector.NS_IE = /\\:/g; +AttributeSelector.PREFIX = "@"; +// properties +AttributeSelector.tests = {}; +// methods +AttributeSelector.replace = function($match, $attribute, $namespace, $compare, $value) { + var $key = this.PREFIX + $match; + if (!attributeSelectors[$key]) { + $attribute = this.create($attribute, $compare || "", $value || ""); + // store the selector + attributeSelectors[$key] = $attribute; + attributeSelectors.push($attribute); + } + return attributeSelectors[$key].id; +}; +AttributeSelector.parse = function($selector) { + $selector = $selector.replace(this.NS_IE, "|"); + var $match; + while ($match = $selector.match(this.match)) { + var $replace = this.replace($match[0], $match[1], $match[2], $match[3], $match[4]); + $selector = $selector.replace(this.match, $replace); + } + return $selector; +}; +AttributeSelector.create = function($propertyName, $test, $value) { + var $attributeSelector = {}; + $attributeSelector.id = this.PREFIX + attributeSelectors.length; + $attributeSelector.name = $propertyName; + $test = this.tests[$test]; + $test = $test ? $test(this.getAttribute($propertyName), getText($value)) : false; + $attributeSelector.test = new Function("e", "return " + $test); + return $attributeSelector; +}; +AttributeSelector.getAttribute = function($name) { + switch ($name.toLowerCase()) { + case "id": + return "e.id"; + case "class": + return "e.className"; + case "for": + return "e.htmlFor"; + case "href": + if (isMSIE) { + // IE always returns the full path not the fragment in the href attribute + // so we RegExp it out of outerHTML. Opera does the same thing but there + // is no way to get the original attribute. + return "String((e.outerHTML.match(/href=\\x22?([^\\s\\x22]*)\\x22?/)||[])[1]||'')"; + } + } + return "e.getAttribute('" + $name.replace($NAMESPACE, ":") + "')"; +}; + +// ----------------------------------------------------------------------- +// attribute selector tests +// ----------------------------------------------------------------------- + +AttributeSelector.tests[""] = function($attribute) { + return $attribute; +}; + +AttributeSelector.tests["="] = function($attribute, $value) { + return $attribute + "==" + Quote.add($value); +}; + +AttributeSelector.tests["~="] = function($attribute, $value) { + return "/(^| )" + regEscape($value) + "( |$)/.test(" + $attribute + ")"; +}; + +AttributeSelector.tests["|="] = function($attribute, $value) { + return "/^" + regEscape($value) + "(-|$)/.test(" + $attribute + ")"; +}; + +// ----------------------------------------------------------------------- +// parsing +// ----------------------------------------------------------------------- + +// override parseSelector to parse out attribute selectors +var _parseSelector = parseSelector; +parseSelector = function($selector) { + return _parseSelector(AttributeSelector.parse($selector)); +}; + +}); // addModule diff --git a/tests/test_tools/selenium/core/lib/cssQuery/src/cssQuery-level3.js b/tests/test_tools/selenium/core/lib/cssQuery/src/cssQuery-level3.js index 11d19664..4dce4651 100644 --- a/tests/test_tools/selenium/core/lib/cssQuery/src/cssQuery-level3.js +++ b/tests/test_tools/selenium/core/lib/cssQuery/src/cssQuery-level3.js @@ -1,150 +1,150 @@ -/*
- cssQuery, version 2.0.2 (2005-08-19)
- Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/)
- License: http://creativecommons.org/licenses/LGPL/2.1/
-*/
-
-/* Thanks to Bill Edney */
-
-cssQuery.addModule("css-level3", function() {
-
-// -----------------------------------------------------------------------
-// selectors
-// -----------------------------------------------------------------------
-
-// indirect sibling selector
-selectors["~"] = function($results, $from, $tagName, $namespace) {
- var $element, i;
- for (i = 0; ($element = $from[i]); i++) {
- while ($element = nextElementSibling($element)) {
- if (compareTagName($element, $tagName, $namespace))
- $results.push($element);
- }
- }
-};
-
-// -----------------------------------------------------------------------
-// pseudo-classes
-// -----------------------------------------------------------------------
-
-// I'm hoping these pseudo-classes are pretty readable. Let me know if
-// any need explanation.
-
-pseudoClasses["contains"] = function($element, $text) {
- $text = new RegExp(regEscape(getText($text)));
- return $text.test(getTextContent($element));
-};
-
-pseudoClasses["root"] = function($element) {
- return $element == getDocument($element).documentElement;
-};
-
-pseudoClasses["empty"] = function($element) {
- var $node, i;
- for (i = 0; ($node = $element.childNodes[i]); i++) {
- if (thisElement($node) || $node.nodeType == 3) return false;
- }
- return true;
-};
-
-pseudoClasses["last-child"] = function($element) {
- return !nextElementSibling($element);
-};
-
-pseudoClasses["only-child"] = function($element) {
- $element = $element.parentNode;
- return firstElementChild($element) == lastElementChild($element);
-};
-
-pseudoClasses["not"] = function($element, $selector) {
- var $negated = cssQuery($selector, getDocument($element));
- for (var i = 0; i < $negated.length; i++) {
- if ($negated[i] == $element) return false;
- }
- return true;
-};
-
-pseudoClasses["nth-child"] = function($element, $arguments) {
- return nthChild($element, $arguments, previousElementSibling);
-};
-
-pseudoClasses["nth-last-child"] = function($element, $arguments) {
- return nthChild($element, $arguments, nextElementSibling);
-};
-
-pseudoClasses["target"] = function($element) {
- return $element.id == location.hash.slice(1);
-};
-
-// UI element states
-
-pseudoClasses["checked"] = function($element) {
- return $element.checked;
-};
-
-pseudoClasses["enabled"] = function($element) {
- return $element.disabled === false;
-};
-
-pseudoClasses["disabled"] = function($element) {
- return $element.disabled;
-};
-
-pseudoClasses["indeterminate"] = function($element) {
- return $element.indeterminate;
-};
-
-// -----------------------------------------------------------------------
-// attribute selector tests
-// -----------------------------------------------------------------------
-
-AttributeSelector.tests["^="] = function($attribute, $value) {
- return "/^" + regEscape($value) + "/.test(" + $attribute + ")";
-};
-
-AttributeSelector.tests["$="] = function($attribute, $value) {
- return "/" + regEscape($value) + "$/.test(" + $attribute + ")";
-};
-
-AttributeSelector.tests["*="] = function($attribute, $value) {
- return "/" + regEscape($value) + "/.test(" + $attribute + ")";
-};
-
-// -----------------------------------------------------------------------
-// nth child support (Bill Edney)
-// -----------------------------------------------------------------------
-
-function nthChild($element, $arguments, $traverse) {
- switch ($arguments) {
- case "n": return true;
- case "even": $arguments = "2n"; break;
- case "odd": $arguments = "2n+1";
- }
-
- var $$children = childElements($element.parentNode);
- function _checkIndex($index) {
- var $index = ($traverse == nextElementSibling) ? $$children.length - $index : $index - 1;
- return $$children[$index] == $element;
- };
-
- // it was just a number (no "n")
- if (!isNaN($arguments)) return _checkIndex($arguments);
-
- $arguments = $arguments.split("n");
- var $multiplier = parseInt($arguments[0]);
- var $step = parseInt($arguments[1]);
-
- if ((isNaN($multiplier) || $multiplier == 1) && $step == 0) return true;
- if ($multiplier == 0 && !isNaN($step)) return _checkIndex($step);
- if (isNaN($step)) $step = 0;
-
- var $count = 1;
- while ($element = $traverse($element)) $count++;
-
- if (isNaN($multiplier) || $multiplier == 1)
- return ($traverse == nextElementSibling) ? ($count <= $step) : ($step >= $count);
-
- return ($count % $multiplier) == $step;
-};
-
-}); // addModule
+/* + cssQuery, version 2.0.2 (2005-08-19) + Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/) + License: http://creativecommons.org/licenses/LGPL/2.1/ +*/ + +/* Thanks to Bill Edney */ + +cssQuery.addModule("css-level3", function() { + +// ----------------------------------------------------------------------- +// selectors +// ----------------------------------------------------------------------- + +// indirect sibling selector +selectors["~"] = function($results, $from, $tagName, $namespace) { + var $element, i; + for (i = 0; ($element = $from[i]); i++) { + while ($element = nextElementSibling($element)) { + if (compareTagName($element, $tagName, $namespace)) + $results.push($element); + } + } +}; + +// ----------------------------------------------------------------------- +// pseudo-classes +// ----------------------------------------------------------------------- + +// I'm hoping these pseudo-classes are pretty readable. Let me know if +// any need explanation. + +pseudoClasses["contains"] = function($element, $text) { + $text = new RegExp(regEscape(getText($text))); + return $text.test(getTextContent($element)); +}; + +pseudoClasses["root"] = function($element) { + return $element == getDocument($element).documentElement; +}; + +pseudoClasses["empty"] = function($element) { + var $node, i; + for (i = 0; ($node = $element.childNodes[i]); i++) { + if (thisElement($node) || $node.nodeType == 3) return false; + } + return true; +}; + +pseudoClasses["last-child"] = function($element) { + return !nextElementSibling($element); +}; + +pseudoClasses["only-child"] = function($element) { + $element = $element.parentNode; + return firstElementChild($element) == lastElementChild($element); +}; + +pseudoClasses["not"] = function($element, $selector) { + var $negated = cssQuery($selector, getDocument($element)); + for (var i = 0; i < $negated.length; i++) { + if ($negated[i] == $element) return false; + } + return true; +}; + +pseudoClasses["nth-child"] = function($element, $arguments) { + return nthChild($element, $arguments, previousElementSibling); +}; + +pseudoClasses["nth-last-child"] = function($element, $arguments) { + return nthChild($element, $arguments, nextElementSibling); +}; + +pseudoClasses["target"] = function($element) { + return $element.id == location.hash.slice(1); +}; + +// UI element states + +pseudoClasses["checked"] = function($element) { + return $element.checked; +}; + +pseudoClasses["enabled"] = function($element) { + return $element.disabled === false; +}; + +pseudoClasses["disabled"] = function($element) { + return $element.disabled; +}; + +pseudoClasses["indeterminate"] = function($element) { + return $element.indeterminate; +}; + +// ----------------------------------------------------------------------- +// attribute selector tests +// ----------------------------------------------------------------------- + +AttributeSelector.tests["^="] = function($attribute, $value) { + return "/^" + regEscape($value) + "/.test(" + $attribute + ")"; +}; + +AttributeSelector.tests["$="] = function($attribute, $value) { + return "/" + regEscape($value) + "$/.test(" + $attribute + ")"; +}; + +AttributeSelector.tests["*="] = function($attribute, $value) { + return "/" + regEscape($value) + "/.test(" + $attribute + ")"; +}; + +// ----------------------------------------------------------------------- +// nth child support (Bill Edney) +// ----------------------------------------------------------------------- + +function nthChild($element, $arguments, $traverse) { + switch ($arguments) { + case "n": return true; + case "even": $arguments = "2n"; break; + case "odd": $arguments = "2n+1"; + } + + var $$children = childElements($element.parentNode); + function _checkIndex($index) { + var $index = ($traverse == nextElementSibling) ? $$children.length - $index : $index - 1; + return $$children[$index] == $element; + }; + + // it was just a number (no "n") + if (!isNaN($arguments)) return _checkIndex($arguments); + + $arguments = $arguments.split("n"); + var $multiplier = parseInt($arguments[0]); + var $step = parseInt($arguments[1]); + + if ((isNaN($multiplier) || $multiplier == 1) && $step == 0) return true; + if ($multiplier == 0 && !isNaN($step)) return _checkIndex($step); + if (isNaN($step)) $step = 0; + + var $count = 1; + while ($element = $traverse($element)) $count++; + + if (isNaN($multiplier) || $multiplier == 1) + return ($traverse == nextElementSibling) ? ($count <= $step) : ($step >= $count); + + return ($count % $multiplier) == $step; +}; + +}); // addModule diff --git a/tests/test_tools/selenium/core/lib/cssQuery/src/cssQuery-standard.js b/tests/test_tools/selenium/core/lib/cssQuery/src/cssQuery-standard.js index 77314b86..309184d5 100644 --- a/tests/test_tools/selenium/core/lib/cssQuery/src/cssQuery-standard.js +++ b/tests/test_tools/selenium/core/lib/cssQuery/src/cssQuery-standard.js @@ -1,53 +1,53 @@ -/*
- cssQuery, version 2.0.2 (2005-08-19)
- Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/)
- License: http://creativecommons.org/licenses/LGPL/2.1/
-*/
-
-cssQuery.addModule("css-standard", function() { // override IE optimisation
-
-// cssQuery was originally written as the CSS engine for IE7. It is
-// optimised (in terms of size not speed) for IE so this module is
-// provided separately to provide cross-browser support.
-
-// -----------------------------------------------------------------------
-// browser compatibility
-// -----------------------------------------------------------------------
-
-// sniff for Win32 Explorer
-isMSIE = eval("false;/*@cc_on@if(@\x5fwin32)isMSIE=true@end@*/");
-
-if (!isMSIE) {
- getElementsByTagName = function($element, $tagName, $namespace) {
- return $namespace ? $element.getElementsByTagNameNS("*", $tagName) :
- $element.getElementsByTagName($tagName);
- };
-
- compareNamespace = function($element, $namespace) {
- return !$namespace || ($namespace == "*") || ($element.prefix == $namespace);
- };
-
- isXML = document.contentType ? function($element) {
- return /xml/i.test(getDocument($element).contentType);
- } : function($element) {
- return getDocument($element).documentElement.tagName != "HTML";
- };
-
- getTextContent = function($element) {
- // mozilla || opera || other
- return $element.textContent || $element.innerText || _getTextContent($element);
- };
-
- function _getTextContent($element) {
- var $textContent = "", $node, i;
- for (i = 0; ($node = $element.childNodes[i]); i++) {
- switch ($node.nodeType) {
- case 11: // document fragment
- case 1: $textContent += _getTextContent($node); break;
- case 3: $textContent += $node.nodeValue; break;
- }
- }
- return $textContent;
- };
-}
-}); // addModule
+/* + cssQuery, version 2.0.2 (2005-08-19) + Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/) + License: http://creativecommons.org/licenses/LGPL/2.1/ +*/ + +cssQuery.addModule("css-standard", function() { // override IE optimisation + +// cssQuery was originally written as the CSS engine for IE7. It is +// optimised (in terms of size not speed) for IE so this module is +// provided separately to provide cross-browser support. + +// ----------------------------------------------------------------------- +// browser compatibility +// ----------------------------------------------------------------------- + +// sniff for Win32 Explorer +isMSIE = eval("false;/*@cc_on@if(@\x5fwin32)isMSIE=true@end@*/"); + +if (!isMSIE) { + getElementsByTagName = function($element, $tagName, $namespace) { + return $namespace ? $element.getElementsByTagNameNS("*", $tagName) : + $element.getElementsByTagName($tagName); + }; + + compareNamespace = function($element, $namespace) { + return !$namespace || ($namespace == "*") || ($element.prefix == $namespace); + }; + + isXML = document.contentType ? function($element) { + return /xml/i.test(getDocument($element).contentType); + } : function($element) { + return getDocument($element).documentElement.tagName != "HTML"; + }; + + getTextContent = function($element) { + // mozilla || opera || other + return $element.textContent || $element.innerText || _getTextContent($element); + }; + + function _getTextContent($element) { + var $textContent = "", $node, i; + for (i = 0; ($node = $element.childNodes[i]); i++) { + switch ($node.nodeType) { + case 11: // document fragment + case 1: $textContent += _getTextContent($node); break; + case 3: $textContent += $node.nodeValue; break; + } + } + return $textContent; + }; +} +}); // addModule diff --git a/tests/test_tools/selenium/core/lib/cssQuery/src/cssQuery.js b/tests/test_tools/selenium/core/lib/cssQuery/src/cssQuery.js index 1fcab4a1..7a6efee8 100644 --- a/tests/test_tools/selenium/core/lib/cssQuery/src/cssQuery.js +++ b/tests/test_tools/selenium/core/lib/cssQuery/src/cssQuery.js @@ -1,356 +1,356 @@ -/*
- cssQuery, version 2.0.2 (2005-08-19)
- Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/)
- License: http://creativecommons.org/licenses/LGPL/2.1/
-*/
-
-// the following functions allow querying of the DOM using CSS selectors
-var cssQuery = function() {
-var version = "2.0.2";
-
-// -----------------------------------------------------------------------
-// main query function
-// -----------------------------------------------------------------------
-
-var $COMMA = /\s*,\s*/;
-var cssQuery = function($selector, $$from) {
-try {
- var $match = [];
- var $useCache = arguments.callee.caching && !$$from;
- var $base = ($$from) ? ($$from.constructor == Array) ? $$from : [$$from] : [document];
- // process comma separated selectors
- var $$selectors = parseSelector($selector).split($COMMA), i;
- for (i = 0; i < $$selectors.length; i++) {
- // convert the selector to a stream
- $selector = _toStream($$selectors[i]);
- // faster chop if it starts with id (MSIE only)
- if (isMSIE && $selector.slice(0, 3).join("") == " *#") {
- $selector = $selector.slice(2);
- $$from = _msie_selectById([], $base, $selector[1]);
- } else $$from = $base;
- // process the stream
- var j = 0, $token, $filter, $arguments, $cacheSelector = "";
- while (j < $selector.length) {
- $token = $selector[j++];
- $filter = $selector[j++];
- $cacheSelector += $token + $filter;
- // some pseudo-classes allow arguments to be passed
- // e.g. nth-child(even)
- $arguments = "";
- if ($selector[j] == "(") {
- while ($selector[j++] != ")" && j < $selector.length) {
- $arguments += $selector[j];
- }
- $arguments = $arguments.slice(0, -1);
- $cacheSelector += "(" + $arguments + ")";
- }
- // process a token/filter pair use cached results if possible
- $$from = ($useCache && cache[$cacheSelector]) ?
- cache[$cacheSelector] : select($$from, $token, $filter, $arguments);
- if ($useCache) cache[$cacheSelector] = $$from;
- }
- $match = $match.concat($$from);
- }
- delete cssQuery.error;
- return $match;
-} catch ($error) {
- cssQuery.error = $error;
- return [];
-}};
-
-// -----------------------------------------------------------------------
-// public interface
-// -----------------------------------------------------------------------
-
-cssQuery.toString = function() {
- return "function cssQuery() {\n [version " + version + "]\n}";
-};
-
-// caching
-var cache = {};
-cssQuery.caching = false;
-cssQuery.clearCache = function($selector) {
- if ($selector) {
- $selector = _toStream($selector).join("");
- delete cache[$selector];
- } else cache = {};
-};
-
-// allow extensions
-var modules = {};
-var loaded = false;
-cssQuery.addModule = function($name, $script) {
- if (loaded) eval("$script=" + String($script));
- modules[$name] = new $script();;
-};
-
-// hackery
-cssQuery.valueOf = function($code) {
- return $code ? eval($code) : this;
-};
-
-// -----------------------------------------------------------------------
-// declarations
-// -----------------------------------------------------------------------
-
-var selectors = {};
-var pseudoClasses = {};
-// a safari bug means that these have to be declared here
-var AttributeSelector = {match: /\[([\w-]+(\|[\w-]+)?)\s*(\W?=)?\s*([^\]]*)\]/};
-var attributeSelectors = [];
-
-// -----------------------------------------------------------------------
-// selectors
-// -----------------------------------------------------------------------
-
-// descendant selector
-selectors[" "] = function($results, $from, $tagName, $namespace) {
- // loop through current selection
- var $element, i, j;
- for (i = 0; i < $from.length; i++) {
- // get descendants
- var $subset = getElementsByTagName($from[i], $tagName, $namespace);
- // loop through descendants and add to results selection
- for (j = 0; ($element = $subset[j]); j++) {
- if (thisElement($element) && compareNamespace($element, $namespace))
- $results.push($element);
- }
- }
-};
-
-// ID selector
-selectors["#"] = function($results, $from, $id) {
- // loop through current selection and check ID
- var $element, j;
- for (j = 0; ($element = $from[j]); j++) if ($element.id == $id) $results.push($element);
-};
-
-// class selector
-selectors["."] = function($results, $from, $className) {
- // create a RegExp version of the class
- $className = new RegExp("(^|\\s)" + $className + "(\\s|$)");
- // loop through current selection and check class
- var $element, i;
- for (i = 0; ($element = $from[i]); i++)
- if ($className.test($element.className)) $results.push($element);
-};
-
-// pseudo-class selector
-selectors[":"] = function($results, $from, $pseudoClass, $arguments) {
- // retrieve the cssQuery pseudo-class function
- var $test = pseudoClasses[$pseudoClass], $element, i;
- // loop through current selection and apply pseudo-class filter
- if ($test) for (i = 0; ($element = $from[i]); i++)
- // if the cssQuery pseudo-class function returns "true" add the element
- if ($test($element, $arguments)) $results.push($element);
-};
-
-// -----------------------------------------------------------------------
-// pseudo-classes
-// -----------------------------------------------------------------------
-
-pseudoClasses["link"] = function($element) {
- var $document = getDocument($element);
- if ($document.links) for (var i = 0; i < $document.links.length; i++) {
- if ($document.links[i] == $element) return true;
- }
-};
-
-pseudoClasses["visited"] = function($element) {
- // can't do this without jiggery-pokery
-};
-
-// -----------------------------------------------------------------------
-// DOM traversal
-// -----------------------------------------------------------------------
-
-// IE5/6 includes comments (LOL) in it's elements collections.
-// so we have to check for this. the test is tagName != "!". LOL (again).
-var thisElement = function($element) {
- return ($element && $element.nodeType == 1 && $element.tagName != "!") ? $element : null;
-};
-
-// return the previous element to the supplied element
-// previousSibling is not good enough as it might return a text or comment node
-var previousElementSibling = function($element) {
- while ($element && ($element = $element.previousSibling) && !thisElement($element)) continue;
- return $element;
-};
-
-// return the next element to the supplied element
-var nextElementSibling = function($element) {
- while ($element && ($element = $element.nextSibling) && !thisElement($element)) continue;
- return $element;
-};
-
-// return the first child ELEMENT of an element
-// NOT the first child node (though they may be the same thing)
-var firstElementChild = function($element) {
- return thisElement($element.firstChild) || nextElementSibling($element.firstChild);
-};
-
-var lastElementChild = function($element) {
- return thisElement($element.lastChild) || previousElementSibling($element.lastChild);
-};
-
-// return child elements of an element (not child nodes)
-var childElements = function($element) {
- var $childElements = [];
- $element = firstElementChild($element);
- while ($element) {
- $childElements.push($element);
- $element = nextElementSibling($element);
- }
- return $childElements;
-};
-
-// -----------------------------------------------------------------------
-// browser compatibility
-// -----------------------------------------------------------------------
-
-// all of the functions in this section can be overwritten. the default
-// configuration is for IE. The functions below reflect this. standard
-// methods are included in a separate module. It would probably be better
-// the other way round of course but this makes it easier to keep IE7 trim.
-
-var isMSIE = true;
-
-var isXML = function($element) {
- var $document = getDocument($element);
- return (typeof $document.mimeType == "unknown") ?
- /\.xml$/i.test($document.URL) :
- Boolean($document.mimeType == "XML Document");
-};
-
-// return the element's containing document
-var getDocument = function($element) {
- return $element.ownerDocument || $element.document;
-};
-
-var getElementsByTagName = function($element, $tagName) {
- return ($tagName == "*" && $element.all) ? $element.all : $element.getElementsByTagName($tagName);
-};
-
-var compareTagName = function($element, $tagName, $namespace) {
- if ($tagName == "*") return thisElement($element);
- if (!compareNamespace($element, $namespace)) return false;
- if (!isXML($element)) $tagName = $tagName.toUpperCase();
- return $element.tagName == $tagName;
-};
-
-var compareNamespace = function($element, $namespace) {
- return !$namespace || ($namespace == "*") || ($element.scopeName == $namespace);
-};
-
-var getTextContent = function($element) {
- return $element.innerText;
-};
-
-function _msie_selectById($results, $from, id) {
- var $match, i, j;
- for (i = 0; i < $from.length; i++) {
- if ($match = $from[i].all.item(id)) {
- if ($match.id == id) $results.push($match);
- else if ($match.length != null) {
- for (j = 0; j < $match.length; j++) {
- if ($match[j].id == id) $results.push($match[j]);
- }
- }
- }
- }
- return $results;
-};
-
-// for IE5.0
-if (![].push) Array.prototype.push = function() {
- for (var i = 0; i < arguments.length; i++) {
- this[this.length] = arguments[i];
- }
- return this.length;
-};
-
-// -----------------------------------------------------------------------
-// query support
-// -----------------------------------------------------------------------
-
-// select a set of matching elements.
-// "from" is an array of elements.
-// "token" is a character representing the type of filter
-// e.g. ">" means child selector
-// "filter" represents the tag name, id or class name that is being selected
-// the function returns an array of matching elements
-var $NAMESPACE = /\|/;
-function select($$from, $token, $filter, $arguments) {
- if ($NAMESPACE.test($filter)) {
- $filter = $filter.split($NAMESPACE);
- $arguments = $filter[0];
- $filter = $filter[1];
- }
- var $results = [];
- if (selectors[$token]) {
- selectors[$token]($results, $$from, $filter, $arguments);
- }
- return $results;
-};
-
-// -----------------------------------------------------------------------
-// parsing
-// -----------------------------------------------------------------------
-
-// convert css selectors to a stream of tokens and filters
-// it's not a real stream. it's just an array of strings.
-var $STANDARD_SELECT = /^[^\s>+~]/;
-var $$STREAM = /[\s#.:>+~()@]|[^\s#.:>+~()@]+/g;
-function _toStream($selector) {
- if ($STANDARD_SELECT.test($selector)) $selector = " " + $selector;
- return $selector.match($$STREAM) || [];
-};
-
-var $WHITESPACE = /\s*([\s>+~(),]|^|$)\s*/g;
-var $IMPLIED_ALL = /([\s>+~,]|[^(]\+|^)([#.:@])/g;
-var parseSelector = function($selector) {
- return $selector
- // trim whitespace
- .replace($WHITESPACE, "$1")
- // e.g. ".class1" --> "*.class1"
- .replace($IMPLIED_ALL, "$1*$2");
-};
-
-var Quote = {
- toString: function() {return "'"},
- match: /^('[^']*')|("[^"]*")$/,
- test: function($string) {
- return this.match.test($string);
- },
- add: function($string) {
- return this.test($string) ? $string : this + $string + this;
- },
- remove: function($string) {
- return this.test($string) ? $string.slice(1, -1) : $string;
- }
-};
-
-var getText = function($text) {
- return Quote.remove($text);
-};
-
-var $ESCAPE = /([\/()[\]?{}|*+-])/g;
-function regEscape($string) {
- return $string.replace($ESCAPE, "\\$1");
-};
-
-// -----------------------------------------------------------------------
-// modules
-// -----------------------------------------------------------------------
-
-// -------- >> insert modules here for packaging << -------- \\
-
-loaded = true;
-
-// -----------------------------------------------------------------------
-// return the query function
-// -----------------------------------------------------------------------
-
-return cssQuery;
-
-}(); // cssQuery
+/* + cssQuery, version 2.0.2 (2005-08-19) + Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/) + License: http://creativecommons.org/licenses/LGPL/2.1/ +*/ + +// the following functions allow querying of the DOM using CSS selectors +var cssQuery = function() { +var version = "2.0.2"; + +// ----------------------------------------------------------------------- +// main query function +// ----------------------------------------------------------------------- + +var $COMMA = /\s*,\s*/; +var cssQuery = function($selector, $$from) { +try { + var $match = []; + var $useCache = arguments.callee.caching && !$$from; + var $base = ($$from) ? ($$from.constructor == Array) ? $$from : [$$from] : [document]; + // process comma separated selectors + var $$selectors = parseSelector($selector).split($COMMA), i; + for (i = 0; i < $$selectors.length; i++) { + // convert the selector to a stream + $selector = _toStream($$selectors[i]); + // faster chop if it starts with id (MSIE only) + if (isMSIE && $selector.slice(0, 3).join("") == " *#") { + $selector = $selector.slice(2); + $$from = _msie_selectById([], $base, $selector[1]); + } else $$from = $base; + // process the stream + var j = 0, $token, $filter, $arguments, $cacheSelector = ""; + while (j < $selector.length) { + $token = $selector[j++]; + $filter = $selector[j++]; + $cacheSelector += $token + $filter; + // some pseudo-classes allow arguments to be passed + // e.g. nth-child(even) + $arguments = ""; + if ($selector[j] == "(") { + while ($selector[j++] != ")" && j < $selector.length) { + $arguments += $selector[j]; + } + $arguments = $arguments.slice(0, -1); + $cacheSelector += "(" + $arguments + ")"; + } + // process a token/filter pair use cached results if possible + $$from = ($useCache && cache[$cacheSelector]) ? + cache[$cacheSelector] : select($$from, $token, $filter, $arguments); + if ($useCache) cache[$cacheSelector] = $$from; + } + $match = $match.concat($$from); + } + delete cssQuery.error; + return $match; +} catch ($error) { + cssQuery.error = $error; + return []; +}}; + +// ----------------------------------------------------------------------- +// public interface +// ----------------------------------------------------------------------- + +cssQuery.toString = function() { + return "function cssQuery() {\n [version " + version + "]\n}"; +}; + +// caching +var cache = {}; +cssQuery.caching = false; +cssQuery.clearCache = function($selector) { + if ($selector) { + $selector = _toStream($selector).join(""); + delete cache[$selector]; + } else cache = {}; +}; + +// allow extensions +var modules = {}; +var loaded = false; +cssQuery.addModule = function($name, $script) { + if (loaded) eval("$script=" + String($script)); + modules[$name] = new $script();; +}; + +// hackery +cssQuery.valueOf = function($code) { + return $code ? eval($code) : this; +}; + +// ----------------------------------------------------------------------- +// declarations +// ----------------------------------------------------------------------- + +var selectors = {}; +var pseudoClasses = {}; +// a safari bug means that these have to be declared here +var AttributeSelector = {match: /\[([\w-]+(\|[\w-]+)?)\s*(\W?=)?\s*([^\]]*)\]/}; +var attributeSelectors = []; + +// ----------------------------------------------------------------------- +// selectors +// ----------------------------------------------------------------------- + +// descendant selector +selectors[" "] = function($results, $from, $tagName, $namespace) { + // loop through current selection + var $element, i, j; + for (i = 0; i < $from.length; i++) { + // get descendants + var $subset = getElementsByTagName($from[i], $tagName, $namespace); + // loop through descendants and add to results selection + for (j = 0; ($element = $subset[j]); j++) { + if (thisElement($element) && compareNamespace($element, $namespace)) + $results.push($element); + } + } +}; + +// ID selector +selectors["#"] = function($results, $from, $id) { + // loop through current selection and check ID + var $element, j; + for (j = 0; ($element = $from[j]); j++) if ($element.id == $id) $results.push($element); +}; + +// class selector +selectors["."] = function($results, $from, $className) { + // create a RegExp version of the class + $className = new RegExp("(^|\\s)" + $className + "(\\s|$)"); + // loop through current selection and check class + var $element, i; + for (i = 0; ($element = $from[i]); i++) + if ($className.test($element.className)) $results.push($element); +}; + +// pseudo-class selector +selectors[":"] = function($results, $from, $pseudoClass, $arguments) { + // retrieve the cssQuery pseudo-class function + var $test = pseudoClasses[$pseudoClass], $element, i; + // loop through current selection and apply pseudo-class filter + if ($test) for (i = 0; ($element = $from[i]); i++) + // if the cssQuery pseudo-class function returns "true" add the element + if ($test($element, $arguments)) $results.push($element); +}; + +// ----------------------------------------------------------------------- +// pseudo-classes +// ----------------------------------------------------------------------- + +pseudoClasses["link"] = function($element) { + var $document = getDocument($element); + if ($document.links) for (var i = 0; i < $document.links.length; i++) { + if ($document.links[i] == $element) return true; + } +}; + +pseudoClasses["visited"] = function($element) { + // can't do this without jiggery-pokery +}; + +// ----------------------------------------------------------------------- +// DOM traversal +// ----------------------------------------------------------------------- + +// IE5/6 includes comments (LOL) in it's elements collections. +// so we have to check for this. the test is tagName != "!". LOL (again). +var thisElement = function($element) { + return ($element && $element.nodeType == 1 && $element.tagName != "!") ? $element : null; +}; + +// return the previous element to the supplied element +// previousSibling is not good enough as it might return a text or comment node +var previousElementSibling = function($element) { + while ($element && ($element = $element.previousSibling) && !thisElement($element)) continue; + return $element; +}; + +// return the next element to the supplied element +var nextElementSibling = function($element) { + while ($element && ($element = $element.nextSibling) && !thisElement($element)) continue; + return $element; +}; + +// return the first child ELEMENT of an element +// NOT the first child node (though they may be the same thing) +var firstElementChild = function($element) { + return thisElement($element.firstChild) || nextElementSibling($element.firstChild); +}; + +var lastElementChild = function($element) { + return thisElement($element.lastChild) || previousElementSibling($element.lastChild); +}; + +// return child elements of an element (not child nodes) +var childElements = function($element) { + var $childElements = []; + $element = firstElementChild($element); + while ($element) { + $childElements.push($element); + $element = nextElementSibling($element); + } + return $childElements; +}; + +// ----------------------------------------------------------------------- +// browser compatibility +// ----------------------------------------------------------------------- + +// all of the functions in this section can be overwritten. the default +// configuration is for IE. The functions below reflect this. standard +// methods are included in a separate module. It would probably be better +// the other way round of course but this makes it easier to keep IE7 trim. + +var isMSIE = true; + +var isXML = function($element) { + var $document = getDocument($element); + return (typeof $document.mimeType == "unknown") ? + /\.xml$/i.test($document.URL) : + Boolean($document.mimeType == "XML Document"); +}; + +// return the element's containing document +var getDocument = function($element) { + return $element.ownerDocument || $element.document; +}; + +var getElementsByTagName = function($element, $tagName) { + return ($tagName == "*" && $element.all) ? $element.all : $element.getElementsByTagName($tagName); +}; + +var compareTagName = function($element, $tagName, $namespace) { + if ($tagName == "*") return thisElement($element); + if (!compareNamespace($element, $namespace)) return false; + if (!isXML($element)) $tagName = $tagName.toUpperCase(); + return $element.tagName == $tagName; +}; + +var compareNamespace = function($element, $namespace) { + return !$namespace || ($namespace == "*") || ($element.scopeName == $namespace); +}; + +var getTextContent = function($element) { + return $element.innerText; +}; + +function _msie_selectById($results, $from, id) { + var $match, i, j; + for (i = 0; i < $from.length; i++) { + if ($match = $from[i].all.item(id)) { + if ($match.id == id) $results.push($match); + else if ($match.length != null) { + for (j = 0; j < $match.length; j++) { + if ($match[j].id == id) $results.push($match[j]); + } + } + } + } + return $results; +}; + +// for IE5.0 +if (![].push) Array.prototype.push = function() { + for (var i = 0; i < arguments.length; i++) { + this[this.length] = arguments[i]; + } + return this.length; +}; + +// ----------------------------------------------------------------------- +// query support +// ----------------------------------------------------------------------- + +// select a set of matching elements. +// "from" is an array of elements. +// "token" is a character representing the type of filter +// e.g. ">" means child selector +// "filter" represents the tag name, id or class name that is being selected +// the function returns an array of matching elements +var $NAMESPACE = /\|/; +function select($$from, $token, $filter, $arguments) { + if ($NAMESPACE.test($filter)) { + $filter = $filter.split($NAMESPACE); + $arguments = $filter[0]; + $filter = $filter[1]; + } + var $results = []; + if (selectors[$token]) { + selectors[$token]($results, $$from, $filter, $arguments); + } + return $results; +}; + +// ----------------------------------------------------------------------- +// parsing +// ----------------------------------------------------------------------- + +// convert css selectors to a stream of tokens and filters +// it's not a real stream. it's just an array of strings. +var $STANDARD_SELECT = /^[^\s>+~]/; +var $$STREAM = /[\s#.:>+~()@]|[^\s#.:>+~()@]+/g; +function _toStream($selector) { + if ($STANDARD_SELECT.test($selector)) $selector = " " + $selector; + return $selector.match($$STREAM) || []; +}; + +var $WHITESPACE = /\s*([\s>+~(),]|^|$)\s*/g; +var $IMPLIED_ALL = /([\s>+~,]|[^(]\+|^)([#.:@])/g; +var parseSelector = function($selector) { + return $selector + // trim whitespace + .replace($WHITESPACE, "$1") + // e.g. ".class1" --> "*.class1" + .replace($IMPLIED_ALL, "$1*$2"); +}; + +var Quote = { + toString: function() {return "'"}, + match: /^('[^']*')|("[^"]*")$/, + test: function($string) { + return this.match.test($string); + }, + add: function($string) { + return this.test($string) ? $string : this + $string + this; + }, + remove: function($string) { + return this.test($string) ? $string.slice(1, -1) : $string; + } +}; + +var getText = function($text) { + return Quote.remove($text); +}; + +var $ESCAPE = /([\/()[\]?{}|*+-])/g; +function regEscape($string) { + return $string.replace($ESCAPE, "\\$1"); +}; + +// ----------------------------------------------------------------------- +// modules +// ----------------------------------------------------------------------- + +// -------- >> insert modules here for packaging << -------- \\ + +loaded = true; + +// ----------------------------------------------------------------------- +// return the query function +// ----------------------------------------------------------------------- + +return cssQuery; + +}(); // cssQuery diff --git a/tests/test_tools/selenium/core/scripts/js2html.js b/tests/test_tools/selenium/core/scripts/js2html.js index a384dce3..407709df 100644 --- a/tests/test_tools/selenium/core/scripts/js2html.js +++ b/tests/test_tools/selenium/core/scripts/js2html.js @@ -1,70 +1,70 @@ -/*
-
-This is an experiment in using the Narcissus JavaScript engine
-to allow Selenium scripts to be written in plain JavaScript.
-
-The 'jsparse' function will compile each high level block into a Selenium table script.
-
-
-TODO:
-1) Test! (More browsers, more sample scripts)
-2) Stepping and walking lower levels of the parse tree
-3) Calling Selenium commands directly from JavaScript
-4) Do we want comments to appear in the TestRunner?
-5) Fix context so variables don't have to be global
- For now, variables defined with "var" won't be found
- if used later on in a script.
-6) Fix formatting
-*/
-
-
-function jsparse() {
- var script = document.getElementById('sejs')
- var fname = 'javascript script';
- parse_result = parse(script.text, fname, 0);
-
- var x2 = new ExecutionContext(GLOBAL_CODE);
- ExecutionContext.current = x2;
-
-
- var new_test_source = '';
- var new_line = '';
-
- for (i=0;i<parse_result.$length;i++){
- var the_start = parse_result[i].start;
- var the_end;
- if ( i == (parse_result.$length-1)) {
- the_end = parse_result.tokenizer.source.length;
- } else {
- the_end = parse_result[i+1].start;
- }
-
- var script_fragment = parse_result.tokenizer.source.slice(the_start,the_end)
-
- new_line = '<tr><td style="display:none;" class="js">getEval</td>' +
- '<td style="display:none;">currentTest.doNextCommand()</td>' +
- '<td style="white-space: pre;">' + script_fragment + '</td>' +
- '<td></td></tr>\n';
- new_test_source += new_line;
- //eval(script_fragment);
-
-
- };
-
-
-
- execute(parse_result,x2)
-
- // Create HTML Table
- body = document.body
- body.innerHTML += "<table class='selenium' id='se-js-table'>"+
- "<tbody>" +
- "<tr><td>// " + document.title + "</td></tr>" +
- new_test_source +
- "</tbody" +
- "</table>";
-
- //body.innerHTML = "<pre>" + parse_result + "</pre>"
-}
-
-
+/* + +This is an experiment in using the Narcissus JavaScript engine +to allow Selenium scripts to be written in plain JavaScript. + +The 'jsparse' function will compile each high level block into a Selenium table script. + + +TODO: +1) Test! (More browsers, more sample scripts) +2) Stepping and walking lower levels of the parse tree +3) Calling Selenium commands directly from JavaScript +4) Do we want comments to appear in the TestRunner? +5) Fix context so variables don't have to be global + For now, variables defined with "var" won't be found + if used later on in a script. +6) Fix formatting +*/ + + +function jsparse() { + var script = document.getElementById('sejs') + var fname = 'javascript script'; + parse_result = parse(script.text, fname, 0); + + var x2 = new ExecutionContext(GLOBAL_CODE); + ExecutionContext.current = x2; + + + var new_test_source = ''; + var new_line = ''; + + for (i=0;i<parse_result.$length;i++){ + var the_start = parse_result[i].start; + var the_end; + if ( i == (parse_result.$length-1)) { + the_end = parse_result.tokenizer.source.length; + } else { + the_end = parse_result[i+1].start; + } + + var script_fragment = parse_result.tokenizer.source.slice(the_start,the_end) + + new_line = '<tr><td style="display:none;" class="js">getEval</td>' + + '<td style="display:none;">currentTest.doNextCommand()</td>' + + '<td style="white-space: pre;">' + script_fragment + '</td>' + + '<td></td></tr>\n'; + new_test_source += new_line; + //eval(script_fragment); + + + }; + + + + execute(parse_result,x2) + + // Create HTML Table + body = document.body + body.innerHTML += "<table class='selenium' id='se-js-table'>"+ + "<tbody>" + + "<tr><td>// " + document.title + "</td></tr>" + + new_test_source + + "</tbody" + + "</table>"; + + //body.innerHTML = "<pre>" + parse_result + "</pre>" +} + + diff --git a/tests/test_tools/selenium/core/scripts/se2html.js b/tests/test_tools/selenium/core/scripts/se2html.js index 67054a49..4894d4b1 100644 --- a/tests/test_tools/selenium/core/scripts/se2html.js +++ b/tests/test_tools/selenium/core/scripts/se2html.js @@ -1,63 +1,63 @@ -/*
-
-This is an experiment in creating a "selenese" parser that drastically
-cuts down on the line noise associated with writing tests in HTML.
-
-The 'parse' function will accept the follow sample commands.
-
-test-cases:
- //comment
- command "param"
- command "param" // comment
- command "param" "param2"
- command "param" "param2" // this is a comment
-
-TODO:
-1) Deal with multiline parameters
-2) Escape quotes properly
-3) Determine whether this should/will become the "preferred" syntax
- for delivered Selenium self-test scripts
-*/
-
-
-function separse(doc) {
- // Get object
- script = doc.getElementById('testcase')
- // Split into lines
- lines = script.text.split('\n');
-
-
- var command_pattern = / *(\w+) *"([^"]*)" *(?:"([^"]*)"){0,1}(?: *(\/\/ *.+))*/i;
- var comment_pattern = /^ *(\/\/ *.+)/
-
- // Regex each line into selenium command and convert into table row.
- // eg. "<command> <quote> <quote> <comment>"
- var new_test_source = '';
- var new_line = '';
- for (var x=0; x < lines.length; x++) {
- result = lines[x].match(command_pattern);
- if (result != null) {
- new_line = "<tr><td>" + (result[1] || ' ') + "</td>" +
- "<td>" + (result[2] || ' ') + "</td>" +
- "<td>" + (result[3] || ' ') + "</td>" +
- "<td>" + (result[4] || ' ') + "</td></tr>\n";
- new_test_source += new_line;
- }
- result = lines[x].match(comment_pattern);
- if (result != null) {
- new_line = '<tr><td rowspan="1" colspan="4">' +
- (result[1] || ' ') +
- '</td></tr>';
- new_test_source += new_line;
- }
- }
-
- // Create HTML Table
- body = doc.body
- body.innerHTML += "<table class='selenium' id='testtable'>"+
- new_test_source +
- "</table>";
-
-}
-
-
+/* + +This is an experiment in creating a "selenese" parser that drastically +cuts down on the line noise associated with writing tests in HTML. + +The 'parse' function will accept the follow sample commands. + +test-cases: + //comment + command "param" + command "param" // comment + command "param" "param2" + command "param" "param2" // this is a comment + +TODO: +1) Deal with multiline parameters +2) Escape quotes properly +3) Determine whether this should/will become the "preferred" syntax + for delivered Selenium self-test scripts +*/ + + +function separse(doc) { + // Get object + script = doc.getElementById('testcase') + // Split into lines + lines = script.text.split('\n'); + + + var command_pattern = / *(\w+) *"([^"]*)" *(?:"([^"]*)"){0,1}(?: *(\/\/ *.+))*/i; + var comment_pattern = /^ *(\/\/ *.+)/ + + // Regex each line into selenium command and convert into table row. + // eg. "<command> <quote> <quote> <comment>" + var new_test_source = ''; + var new_line = ''; + for (var x=0; x < lines.length; x++) { + result = lines[x].match(command_pattern); + if (result != null) { + new_line = "<tr><td>" + (result[1] || ' ') + "</td>" + + "<td>" + (result[2] || ' ') + "</td>" + + "<td>" + (result[3] || ' ') + "</td>" + + "<td>" + (result[4] || ' ') + "</td></tr>\n"; + new_test_source += new_line; + } + result = lines[x].match(comment_pattern); + if (result != null) { + new_line = '<tr><td rowspan="1" colspan="4">' + + (result[1] || ' ') + + '</td></tr>'; + new_test_source += new_line; + } + } + + // Create HTML Table + body = doc.body + body.innerHTML += "<table class='selenium' id='testtable'>"+ + new_test_source + + "</table>"; + +} + + diff --git a/tests/test_tools/selenium/php/TestSuiteHeader.php b/tests/test_tools/selenium/php/TestSuiteHeader.php index 6fe2f6b6..d253740c 100644 --- a/tests/test_tools/selenium/php/TestSuiteHeader.php +++ b/tests/test_tools/selenium/php/TestSuiteHeader.php @@ -1,54 +1,54 @@ -<!--
-Copyright 2004 ThoughtWorks, Inc
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<html>
-<head>
-<meta content="text/html; charset=ISO-8859-1"
-http-equiv="content-type">
-<title>Test Suite</title>
-<link rel="stylesheet" type="text/css" href="<?php echo $base_dir; ?>core/selenium.css" />
-<script language="JavaScript" type="text/javascript" src="<?php echo $base_dir; ?>core/scripts/selenium-browserdetect.js"></script>
-<script language="JavaScript" type="text/javascript">
- var DISABLED = true; // used to flag failing tests
-
- function filterTestsForBrowser() {
- var suiteTable = document.getElementById("suiteTable");
- var skippedTests = document.getElementById("skippedTests");
-
- for(rowNum = suiteTable.rows.length - 1; rowNum >= 0; rowNum--)
- {
- var row = suiteTable.rows[rowNum];
- var filterString = row.getAttribute("unless");
- if (filterString && eval(filterString))
- {
- var cellHTML = row.cells[0].innerHTML;
- suiteTable.deleteRow(rowNum);
-
- var newRow = skippedTests.insertRow(1);
- var newCell = newRow.insertCell(0)
- newCell.innerHTML = cellHTML;
- }
- }
- }
-</script>
-</head>
-
-<body onload="filterTestsForBrowser()">
-
- <table id="suiteTable" cellpadding="1"
- cellspacing="1"
- border="1"
- class="selenium">
- <tbody>
+<!-- +Copyright 2004 ThoughtWorks, Inc + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<html> +<head> +<meta content="text/html; charset=ISO-8859-1" +http-equiv="content-type"> +<title>Test Suite</title> +<link rel="stylesheet" type="text/css" href="<?php echo $base_dir; ?>core/selenium.css" /> +<script language="JavaScript" type="text/javascript" src="<?php echo $base_dir; ?>core/scripts/selenium-browserdetect.js"></script> +<script language="JavaScript" type="text/javascript"> + var DISABLED = true; // used to flag failing tests + + function filterTestsForBrowser() { + var suiteTable = document.getElementById("suiteTable"); + var skippedTests = document.getElementById("skippedTests"); + + for(rowNum = suiteTable.rows.length - 1; rowNum >= 0; rowNum--) + { + var row = suiteTable.rows[rowNum]; + var filterString = row.getAttribute("unless"); + if (filterString && eval(filterString)) + { + var cellHTML = row.cells[0].innerHTML; + suiteTable.deleteRow(rowNum); + + var newRow = skippedTests.insertRow(1); + var newCell = newRow.insertCell(0) + newCell.innerHTML = cellHTML; + } + } + } +</script> +</head> + +<body onload="filterTestsForBrowser()"> + + <table id="suiteTable" cellpadding="1" + cellspacing="1" + border="1" + class="selenium"> + <tbody> |