selenium-core-runner 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +9 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +30 -0
- data/app/controllers/selenium_core_runner/suites_controller.rb +19 -0
- data/app/views/selenium_core_runner/suites/index.html.erb +177 -0
- data/app/views/selenium_core_runner/suites/show.html.erb +0 -0
- data/config/routes.rb +6 -0
- data/lib/selenium-core-runner/engine.rb +19 -0
- data/lib/selenium-core-runner.rb +3 -0
- data/public/selenium-core-runner/Blank.html +7 -0
- data/public/selenium-core-runner/InjectedRemoteRunner.html +8 -0
- data/public/selenium-core-runner/RemoteRunner.html +101 -0
- data/public/selenium-core-runner/SeleniumLog.html +109 -0
- data/public/selenium-core-runner/TestPrompt.html +145 -0
- data/public/selenium-core-runner/TestRunner-splash.html +55 -0
- data/public/selenium-core-runner/TestRunner.hta +177 -0
- data/public/selenium-core-runner/TestRunner.html +177 -0
- data/public/selenium-core-runner/icons/all.png +0 -0
- data/public/selenium-core-runner/icons/continue.png +0 -0
- data/public/selenium-core-runner/icons/continue_disabled.png +0 -0
- data/public/selenium-core-runner/icons/pause.png +0 -0
- data/public/selenium-core-runner/icons/pause_disabled.png +0 -0
- data/public/selenium-core-runner/icons/selected.png +0 -0
- data/public/selenium-core-runner/icons/step.png +0 -0
- data/public/selenium-core-runner/icons/step_disabled.png +0 -0
- data/public/selenium-core-runner/iedoc-core.xml +1789 -0
- data/public/selenium-core-runner/iedoc.xml +1830 -0
- data/public/selenium-core-runner/lib/cssQuery/cssQuery-p.js +6 -0
- data/public/selenium-core-runner/lib/cssQuery/src/cssQuery-level2.js +142 -0
- data/public/selenium-core-runner/lib/cssQuery/src/cssQuery-level3.js +150 -0
- data/public/selenium-core-runner/lib/cssQuery/src/cssQuery-standard.js +53 -0
- data/public/selenium-core-runner/lib/cssQuery/src/cssQuery.js +356 -0
- data/public/selenium-core-runner/lib/prototype.js +2006 -0
- data/public/selenium-core-runner/lib/scriptaculous/builder.js +101 -0
- data/public/selenium-core-runner/lib/scriptaculous/controls.js +815 -0
- data/public/selenium-core-runner/lib/scriptaculous/dragdrop.js +915 -0
- data/public/selenium-core-runner/lib/scriptaculous/effects.js +958 -0
- data/public/selenium-core-runner/lib/scriptaculous/scriptaculous.js +47 -0
- data/public/selenium-core-runner/lib/scriptaculous/slider.js +283 -0
- data/public/selenium-core-runner/lib/scriptaculous/unittest.js +383 -0
- data/public/selenium-core-runner/lib/snapsie.js +91 -0
- data/public/selenium-core-runner/scripts/find_matching_child.js +69 -0
- data/public/selenium-core-runner/scripts/htmlutils.js +1623 -0
- data/public/selenium-core-runner/scripts/injection.html +72 -0
- data/public/selenium-core-runner/scripts/selenium-api.js +3240 -0
- data/public/selenium-core-runner/scripts/selenium-browserbot.js +2333 -0
- data/public/selenium-core-runner/scripts/selenium-browserdetect.js +153 -0
- data/public/selenium-core-runner/scripts/selenium-commandhandlers.js +379 -0
- data/public/selenium-core-runner/scripts/selenium-executionloop.js +175 -0
- data/public/selenium-core-runner/scripts/selenium-logging.js +148 -0
- data/public/selenium-core-runner/scripts/selenium-remoterunner.js +695 -0
- data/public/selenium-core-runner/scripts/selenium-testrunner.js +1362 -0
- data/public/selenium-core-runner/scripts/selenium-version.js +5 -0
- data/public/selenium-core-runner/scripts/ui-doc.html +803 -0
- data/public/selenium-core-runner/scripts/ui-element.js +1627 -0
- data/public/selenium-core-runner/scripts/ui-map-sample.js +979 -0
- data/public/selenium-core-runner/scripts/user-extensions.js +3 -0
- data/public/selenium-core-runner/scripts/user-extensions.js.sample +75 -0
- data/public/selenium-core-runner/scripts/xmlextras.js +153 -0
- data/public/selenium-core-runner/selenium-logo.png +0 -0
- data/public/selenium-core-runner/selenium-test.css +43 -0
- data/public/selenium-core-runner/selenium.css +316 -0
- data/public/selenium-core-runner/xpath/dom.js +566 -0
- data/public/selenium-core-runner/xpath/javascript-xpath-0.1.11.js +2816 -0
- data/public/selenium-core-runner/xpath/util.js +549 -0
- data/public/selenium-core-runner/xpath/xmltoken.js +149 -0
- data/public/selenium-core-runner/xpath/xpath.js +2481 -0
- metadata +121 -0
@@ -0,0 +1,6 @@
|
|
1
|
+
/*
|
2
|
+
cssQuery, version 2.0.2 (2005-08-19)
|
3
|
+
Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/)
|
4
|
+
License: http://creativecommons.org/licenses/LGPL/2.1/
|
5
|
+
*/
|
6
|
+
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,{}))
|
@@ -0,0 +1,142 @@
|
|
1
|
+
/*
|
2
|
+
cssQuery, version 2.0.2 (2005-08-19)
|
3
|
+
Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/)
|
4
|
+
License: http://creativecommons.org/licenses/LGPL/2.1/
|
5
|
+
*/
|
6
|
+
|
7
|
+
cssQuery.addModule("css-level2", function() {
|
8
|
+
|
9
|
+
// -----------------------------------------------------------------------
|
10
|
+
// selectors
|
11
|
+
// -----------------------------------------------------------------------
|
12
|
+
|
13
|
+
// child selector
|
14
|
+
selectors[">"] = function($results, $from, $tagName, $namespace) {
|
15
|
+
var $element, i, j;
|
16
|
+
for (i = 0; i < $from.length; i++) {
|
17
|
+
var $subset = childElements($from[i]);
|
18
|
+
for (j = 0; ($element = $subset[j]); j++)
|
19
|
+
if (compareTagName($element, $tagName, $namespace))
|
20
|
+
$results.push($element);
|
21
|
+
}
|
22
|
+
};
|
23
|
+
|
24
|
+
// sibling selector
|
25
|
+
selectors["+"] = function($results, $from, $tagName, $namespace) {
|
26
|
+
for (var i = 0; i < $from.length; i++) {
|
27
|
+
var $element = nextElementSibling($from[i]);
|
28
|
+
if ($element && compareTagName($element, $tagName, $namespace))
|
29
|
+
$results.push($element);
|
30
|
+
}
|
31
|
+
};
|
32
|
+
|
33
|
+
// attribute selector
|
34
|
+
selectors["@"] = function($results, $from, $attributeSelectorID) {
|
35
|
+
var $test = attributeSelectors[$attributeSelectorID].test;
|
36
|
+
var $element, i;
|
37
|
+
for (i = 0; ($element = $from[i]); i++)
|
38
|
+
if ($test($element)) $results.push($element);
|
39
|
+
};
|
40
|
+
|
41
|
+
// -----------------------------------------------------------------------
|
42
|
+
// pseudo-classes
|
43
|
+
// -----------------------------------------------------------------------
|
44
|
+
|
45
|
+
pseudoClasses["first-child"] = function($element) {
|
46
|
+
return !previousElementSibling($element);
|
47
|
+
};
|
48
|
+
|
49
|
+
pseudoClasses["lang"] = function($element, $code) {
|
50
|
+
$code = new RegExp("^" + $code, "i");
|
51
|
+
while ($element && !$element.getAttribute("lang")) $element = $element.parentNode;
|
52
|
+
return $element && $code.test($element.getAttribute("lang"));
|
53
|
+
};
|
54
|
+
|
55
|
+
// -----------------------------------------------------------------------
|
56
|
+
// attribute selectors
|
57
|
+
// -----------------------------------------------------------------------
|
58
|
+
|
59
|
+
// constants
|
60
|
+
AttributeSelector.NS_IE = /\\:/g;
|
61
|
+
AttributeSelector.PREFIX = "@";
|
62
|
+
// properties
|
63
|
+
AttributeSelector.tests = {};
|
64
|
+
// methods
|
65
|
+
AttributeSelector.replace = function($match, $attribute, $namespace, $compare, $value) {
|
66
|
+
var $key = this.PREFIX + $match;
|
67
|
+
if (!attributeSelectors[$key]) {
|
68
|
+
$attribute = this.create($attribute, $compare || "", $value || "");
|
69
|
+
// store the selector
|
70
|
+
attributeSelectors[$key] = $attribute;
|
71
|
+
attributeSelectors.push($attribute);
|
72
|
+
}
|
73
|
+
return attributeSelectors[$key].id;
|
74
|
+
};
|
75
|
+
AttributeSelector.parse = function($selector) {
|
76
|
+
$selector = $selector.replace(this.NS_IE, "|");
|
77
|
+
var $match;
|
78
|
+
while ($match = $selector.match(this.match)) {
|
79
|
+
var $replace = this.replace($match[0], $match[1], $match[2], $match[3], $match[4]);
|
80
|
+
$selector = $selector.replace(this.match, $replace);
|
81
|
+
}
|
82
|
+
return $selector;
|
83
|
+
};
|
84
|
+
AttributeSelector.create = function($propertyName, $test, $value) {
|
85
|
+
var $attributeSelector = {};
|
86
|
+
$attributeSelector.id = this.PREFIX + attributeSelectors.length;
|
87
|
+
$attributeSelector.name = $propertyName;
|
88
|
+
$test = this.tests[$test];
|
89
|
+
$test = $test ? $test(this.getAttribute($propertyName), getText($value)) : false;
|
90
|
+
$attributeSelector.test = new Function("e", "return " + $test);
|
91
|
+
return $attributeSelector;
|
92
|
+
};
|
93
|
+
AttributeSelector.getAttribute = function($name) {
|
94
|
+
switch ($name.toLowerCase()) {
|
95
|
+
case "id":
|
96
|
+
return "e.id";
|
97
|
+
case "class":
|
98
|
+
return "e.className";
|
99
|
+
case "for":
|
100
|
+
return "e.htmlFor";
|
101
|
+
case "href":
|
102
|
+
if (isMSIE) {
|
103
|
+
// IE always returns the full path not the fragment in the href attribute
|
104
|
+
// so we RegExp it out of outerHTML. Opera does the same thing but there
|
105
|
+
// is no way to get the original attribute.
|
106
|
+
return "String((e.outerHTML.match(/href=\\x22?([^\\s\\x22]*)\\x22?/)||[])[1]||'')";
|
107
|
+
}
|
108
|
+
}
|
109
|
+
return "e.getAttribute('" + $name.replace($NAMESPACE, ":") + "')";
|
110
|
+
};
|
111
|
+
|
112
|
+
// -----------------------------------------------------------------------
|
113
|
+
// attribute selector tests
|
114
|
+
// -----------------------------------------------------------------------
|
115
|
+
|
116
|
+
AttributeSelector.tests[""] = function($attribute) {
|
117
|
+
return $attribute;
|
118
|
+
};
|
119
|
+
|
120
|
+
AttributeSelector.tests["="] = function($attribute, $value) {
|
121
|
+
return $attribute + "==" + Quote.add($value);
|
122
|
+
};
|
123
|
+
|
124
|
+
AttributeSelector.tests["~="] = function($attribute, $value) {
|
125
|
+
return "/(^| )" + regEscape($value) + "( |$)/.test(" + $attribute + ")";
|
126
|
+
};
|
127
|
+
|
128
|
+
AttributeSelector.tests["|="] = function($attribute, $value) {
|
129
|
+
return "/^" + regEscape($value) + "(-|$)/.test(" + $attribute + ")";
|
130
|
+
};
|
131
|
+
|
132
|
+
// -----------------------------------------------------------------------
|
133
|
+
// parsing
|
134
|
+
// -----------------------------------------------------------------------
|
135
|
+
|
136
|
+
// override parseSelector to parse out attribute selectors
|
137
|
+
var _parseSelector = parseSelector;
|
138
|
+
parseSelector = function($selector) {
|
139
|
+
return _parseSelector(AttributeSelector.parse($selector));
|
140
|
+
};
|
141
|
+
|
142
|
+
}); // addModule
|
@@ -0,0 +1,150 @@
|
|
1
|
+
/*
|
2
|
+
cssQuery, version 2.0.2 (2005-08-19)
|
3
|
+
Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/)
|
4
|
+
License: http://creativecommons.org/licenses/LGPL/2.1/
|
5
|
+
*/
|
6
|
+
|
7
|
+
/* Thanks to Bill Edney */
|
8
|
+
|
9
|
+
cssQuery.addModule("css-level3", function() {
|
10
|
+
|
11
|
+
// -----------------------------------------------------------------------
|
12
|
+
// selectors
|
13
|
+
// -----------------------------------------------------------------------
|
14
|
+
|
15
|
+
// indirect sibling selector
|
16
|
+
selectors["~"] = function($results, $from, $tagName, $namespace) {
|
17
|
+
var $element, i;
|
18
|
+
for (i = 0; ($element = $from[i]); i++) {
|
19
|
+
while ($element = nextElementSibling($element)) {
|
20
|
+
if (compareTagName($element, $tagName, $namespace))
|
21
|
+
$results.push($element);
|
22
|
+
}
|
23
|
+
}
|
24
|
+
};
|
25
|
+
|
26
|
+
// -----------------------------------------------------------------------
|
27
|
+
// pseudo-classes
|
28
|
+
// -----------------------------------------------------------------------
|
29
|
+
|
30
|
+
// I'm hoping these pseudo-classes are pretty readable. Let me know if
|
31
|
+
// any need explanation.
|
32
|
+
|
33
|
+
pseudoClasses["contains"] = function($element, $text) {
|
34
|
+
$text = new RegExp(regEscape(getText($text)));
|
35
|
+
return $text.test(getTextContent($element));
|
36
|
+
};
|
37
|
+
|
38
|
+
pseudoClasses["root"] = function($element) {
|
39
|
+
return $element == getDocument($element).documentElement;
|
40
|
+
};
|
41
|
+
|
42
|
+
pseudoClasses["empty"] = function($element) {
|
43
|
+
var $node, i;
|
44
|
+
for (i = 0; ($node = $element.childNodes[i]); i++) {
|
45
|
+
if (thisElement($node) || $node.nodeType == 3) return false;
|
46
|
+
}
|
47
|
+
return true;
|
48
|
+
};
|
49
|
+
|
50
|
+
pseudoClasses["last-child"] = function($element) {
|
51
|
+
return !nextElementSibling($element);
|
52
|
+
};
|
53
|
+
|
54
|
+
pseudoClasses["only-child"] = function($element) {
|
55
|
+
$element = $element.parentNode;
|
56
|
+
return firstElementChild($element) == lastElementChild($element);
|
57
|
+
};
|
58
|
+
|
59
|
+
pseudoClasses["not"] = function($element, $selector) {
|
60
|
+
var $negated = cssQuery($selector, getDocument($element));
|
61
|
+
for (var i = 0; i < $negated.length; i++) {
|
62
|
+
if ($negated[i] == $element) return false;
|
63
|
+
}
|
64
|
+
return true;
|
65
|
+
};
|
66
|
+
|
67
|
+
pseudoClasses["nth-child"] = function($element, $arguments) {
|
68
|
+
return nthChild($element, $arguments, previousElementSibling);
|
69
|
+
};
|
70
|
+
|
71
|
+
pseudoClasses["nth-last-child"] = function($element, $arguments) {
|
72
|
+
return nthChild($element, $arguments, nextElementSibling);
|
73
|
+
};
|
74
|
+
|
75
|
+
pseudoClasses["target"] = function($element) {
|
76
|
+
return $element.id == location.hash.slice(1);
|
77
|
+
};
|
78
|
+
|
79
|
+
// UI element states
|
80
|
+
|
81
|
+
pseudoClasses["checked"] = function($element) {
|
82
|
+
return $element.checked;
|
83
|
+
};
|
84
|
+
|
85
|
+
pseudoClasses["enabled"] = function($element) {
|
86
|
+
return $element.disabled === false;
|
87
|
+
};
|
88
|
+
|
89
|
+
pseudoClasses["disabled"] = function($element) {
|
90
|
+
return $element.disabled;
|
91
|
+
};
|
92
|
+
|
93
|
+
pseudoClasses["indeterminate"] = function($element) {
|
94
|
+
return $element.indeterminate;
|
95
|
+
};
|
96
|
+
|
97
|
+
// -----------------------------------------------------------------------
|
98
|
+
// attribute selector tests
|
99
|
+
// -----------------------------------------------------------------------
|
100
|
+
|
101
|
+
AttributeSelector.tests["^="] = function($attribute, $value) {
|
102
|
+
return "/^" + regEscape($value) + "/.test(" + $attribute + ")";
|
103
|
+
};
|
104
|
+
|
105
|
+
AttributeSelector.tests["$="] = function($attribute, $value) {
|
106
|
+
return "/" + regEscape($value) + "$/.test(" + $attribute + ")";
|
107
|
+
};
|
108
|
+
|
109
|
+
AttributeSelector.tests["*="] = function($attribute, $value) {
|
110
|
+
return "/" + regEscape($value) + "/.test(" + $attribute + ")";
|
111
|
+
};
|
112
|
+
|
113
|
+
// -----------------------------------------------------------------------
|
114
|
+
// nth child support (Bill Edney)
|
115
|
+
// -----------------------------------------------------------------------
|
116
|
+
|
117
|
+
function nthChild($element, $arguments, $traverse) {
|
118
|
+
switch ($arguments) {
|
119
|
+
case "n": return true;
|
120
|
+
case "even": $arguments = "2n"; break;
|
121
|
+
case "odd": $arguments = "2n+1";
|
122
|
+
}
|
123
|
+
|
124
|
+
var $$children = childElements($element.parentNode);
|
125
|
+
function _checkIndex($index) {
|
126
|
+
var $index = ($traverse == nextElementSibling) ? $$children.length - $index : $index - 1;
|
127
|
+
return $$children[$index] == $element;
|
128
|
+
};
|
129
|
+
|
130
|
+
// it was just a number (no "n")
|
131
|
+
if (!isNaN($arguments)) return _checkIndex($arguments);
|
132
|
+
|
133
|
+
$arguments = $arguments.split("n");
|
134
|
+
var $multiplier = parseInt($arguments[0]);
|
135
|
+
var $step = parseInt($arguments[1]);
|
136
|
+
|
137
|
+
if ((isNaN($multiplier) || $multiplier == 1) && $step == 0) return true;
|
138
|
+
if ($multiplier == 0 && !isNaN($step)) return _checkIndex($step);
|
139
|
+
if (isNaN($step)) $step = 0;
|
140
|
+
|
141
|
+
var $count = 1;
|
142
|
+
while ($element = $traverse($element)) $count++;
|
143
|
+
|
144
|
+
if (isNaN($multiplier) || $multiplier == 1)
|
145
|
+
return ($traverse == nextElementSibling) ? ($count <= $step) : ($step >= $count);
|
146
|
+
|
147
|
+
return ($count % $multiplier) == $step;
|
148
|
+
};
|
149
|
+
|
150
|
+
}); // addModule
|
@@ -0,0 +1,53 @@
|
|
1
|
+
/*
|
2
|
+
cssQuery, version 2.0.2 (2005-08-19)
|
3
|
+
Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/)
|
4
|
+
License: http://creativecommons.org/licenses/LGPL/2.1/
|
5
|
+
*/
|
6
|
+
|
7
|
+
cssQuery.addModule("css-standard", function() { // override IE optimisation
|
8
|
+
|
9
|
+
// cssQuery was originally written as the CSS engine for IE7. It is
|
10
|
+
// optimised (in terms of size not speed) for IE so this module is
|
11
|
+
// provided separately to provide cross-browser support.
|
12
|
+
|
13
|
+
// -----------------------------------------------------------------------
|
14
|
+
// browser compatibility
|
15
|
+
// -----------------------------------------------------------------------
|
16
|
+
|
17
|
+
// sniff for Win32 Explorer
|
18
|
+
isMSIE = eval("false;/*@cc_on@if(@\x5fwin32)isMSIE=true@end@*/");
|
19
|
+
|
20
|
+
if (!isMSIE) {
|
21
|
+
getElementsByTagName = function($element, $tagName, $namespace) {
|
22
|
+
return $namespace ? $element.getElementsByTagNameNS("*", $tagName) :
|
23
|
+
$element.getElementsByTagName($tagName);
|
24
|
+
};
|
25
|
+
|
26
|
+
compareNamespace = function($element, $namespace) {
|
27
|
+
return !$namespace || ($namespace == "*") || ($element.prefix == $namespace);
|
28
|
+
};
|
29
|
+
|
30
|
+
isXML = document.contentType ? function($element) {
|
31
|
+
return /xml/i.test(getDocument($element).contentType);
|
32
|
+
} : function($element) {
|
33
|
+
return getDocument($element).documentElement.tagName != "HTML";
|
34
|
+
};
|
35
|
+
|
36
|
+
getTextContent = function($element) {
|
37
|
+
// mozilla || opera || other
|
38
|
+
return $element.textContent || $element.innerText || _getTextContent($element);
|
39
|
+
};
|
40
|
+
|
41
|
+
function _getTextContent($element) {
|
42
|
+
var $textContent = "", $node, i;
|
43
|
+
for (i = 0; ($node = $element.childNodes[i]); i++) {
|
44
|
+
switch ($node.nodeType) {
|
45
|
+
case 11: // document fragment
|
46
|
+
case 1: $textContent += _getTextContent($node); break;
|
47
|
+
case 3: $textContent += $node.nodeValue; break;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
return $textContent;
|
51
|
+
};
|
52
|
+
}
|
53
|
+
}); // addModule
|