envjs 0.1.7 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (187) hide show
  1. data/.jslintrbrc +29 -0
  2. data/.project +17 -0
  3. data/CHANGELOG.rdoc +3 -0
  4. data/DTD/xhtml-lat1.ent +196 -0
  5. data/DTD/xhtml-special.ent +80 -0
  6. data/DTD/xhtml-symbol.ent +237 -0
  7. data/DTD/xhtml.soc +14 -0
  8. data/DTD/xhtml1-frameset.dtd +1235 -0
  9. data/DTD/xhtml1-strict.dtd +978 -0
  10. data/DTD/xhtml1-transitional.dtd +1201 -0
  11. data/DTD/xhtml1.dcl +192 -0
  12. data/Makefile +7 -0
  13. data/Manifest.txt +287 -0
  14. data/{README → README.rdoc} +24 -3
  15. data/Rakefile +196 -0
  16. data/Wakefile +24 -0
  17. data/build.properties +9 -0
  18. data/build.xml +247 -0
  19. data/gm/jquery.js +6002 -0
  20. data/gm/mainx.js +2648 -0
  21. data/gm/sensx.js +135 -0
  22. data/gm/t.js +6 -0
  23. data/gm/x.html +76 -0
  24. data/htmlparser/BrowserTreeBuilder.java +456 -0
  25. data/htmlparser/README +34 -0
  26. data/htmlparser/build.sh +38 -0
  27. data/jsl/jsl +0 -0
  28. data/jsl/jsl.default.conf +129 -0
  29. data/jsl/jsl.exe +0 -0
  30. data/lib/envjs.rb +2 -0
  31. data/lib/envjs/env.js +22 -3
  32. data/lib/envjs/event_loop.js +2 -0
  33. data/lib/envjs/static.js +155 -21
  34. data/licenses/GPL-LICENSE.txt +278 -0
  35. data/licenses/MIT-LICENSE.txt +20 -0
  36. data/src/base64.js +80 -0
  37. data/src/build.js +6 -0
  38. data/src/cruft/bad.html +24 -0
  39. data/src/cruft/dom.js +606 -0
  40. data/src/cruft/element.js +297 -0
  41. data/src/cruft/good.html +30 -0
  42. data/src/cruft/good.js +32 -0
  43. data/src/cruft/internal.js +81 -0
  44. data/src/cruft/parser.js +458 -0
  45. data/src/css/properties.js +293 -0
  46. data/src/css/rule.js +22 -0
  47. data/src/css/sizzle.js +717 -0
  48. data/src/css/stylesheet.js +52 -0
  49. data/src/dom/attr.js +55 -0
  50. data/src/dom/cdatasection.js +31 -0
  51. data/src/dom/characterdata.js +119 -0
  52. data/src/dom/comment.js +30 -0
  53. data/src/dom/doctype.js +9 -0
  54. data/src/dom/document.js +553 -0
  55. data/src/dom/dom.js +134 -0
  56. data/src/dom/element.js +217 -0
  57. data/src/dom/entities.js +273 -0
  58. data/src/dom/exception.js +28 -0
  59. data/src/dom/fragment.js +37 -0
  60. data/src/dom/implementation.js +602 -0
  61. data/src/dom/instruction.js +51 -0
  62. data/src/dom/namednodemap.js +374 -0
  63. data/src/dom/namespace.js +50 -0
  64. data/src/dom/node.js +618 -0
  65. data/src/dom/nodelist.js +195 -0
  66. data/src/dom/parser.js +1207 -0
  67. data/src/dom/text.js +73 -0
  68. data/src/event/event.js +39 -0
  69. data/src/event/mouseevent.js +4 -0
  70. data/src/event/uievent.js +8 -0
  71. data/src/html/a.js +110 -0
  72. data/src/html/anchor.js +80 -0
  73. data/src/html/area.js +57 -0
  74. data/src/html/base.js +26 -0
  75. data/src/html/blockquote-q.js +19 -0
  76. data/src/html/body.js +19 -0
  77. data/src/html/button.js +21 -0
  78. data/src/html/canvas.js +14 -0
  79. data/src/html/col-colgroup.js +49 -0
  80. data/src/html/collection.js +72 -0
  81. data/src/html/cookie.js +151 -0
  82. data/src/html/del-ins.js +25 -0
  83. data/src/html/div.js +28 -0
  84. data/src/html/document.js +359 -0
  85. data/src/html/element.js +380 -0
  86. data/src/html/fieldset.js +19 -0
  87. data/src/html/form.js +484 -0
  88. data/src/html/frame.js +89 -0
  89. data/src/html/frameset.js +25 -0
  90. data/src/html/head.js +44 -0
  91. data/src/html/html.js +0 -0
  92. data/src/html/htmlparser.js +340 -0
  93. data/src/html/iframe.js +26 -0
  94. data/src/html/image.js +0 -0
  95. data/src/html/img.js +62 -0
  96. data/src/html/input-elements.js +307 -0
  97. data/src/html/input.js +65 -0
  98. data/src/html/label.js +26 -0
  99. data/src/html/legend.js +19 -0
  100. data/src/html/link.js +82 -0
  101. data/src/html/map.js +22 -0
  102. data/src/html/meta.js +37 -0
  103. data/src/html/object.js +89 -0
  104. data/src/html/optgroup.js +25 -0
  105. data/src/html/option.js +97 -0
  106. data/src/html/param.js +38 -0
  107. data/src/html/script.js +122 -0
  108. data/src/html/select.js +129 -0
  109. data/src/html/style.js +31 -0
  110. data/src/html/table.js +199 -0
  111. data/src/html/tbody-thead-tfoot.js +91 -0
  112. data/src/html/td-th.js +18 -0
  113. data/src/html/textarea.js +25 -0
  114. data/src/html/title.js +20 -0
  115. data/src/html/tr.js +114 -0
  116. data/src/intro.js +141 -0
  117. data/src/outro.js +70 -0
  118. data/src/parser/html5.detailed.js +10762 -0
  119. data/src/parser/html5.min.js +503 -0
  120. data/src/parser/html5.pretty.js +10815 -0
  121. data/src/parser/intro.js +42 -0
  122. data/src/parser/outro.js +9 -0
  123. data/src/platform/core.js +323 -0
  124. data/src/platform/johnson.js +479 -0
  125. data/src/platform/rhino.js +327 -0
  126. data/src/platform/static/intro.js +41 -0
  127. data/src/platform/static/outro.js +30 -0
  128. data/src/profile/aop.js +238 -0
  129. data/src/profile/profile.js +402 -0
  130. data/src/serializer/xml.js +21 -0
  131. data/src/svg/animatedstring.js +25 -0
  132. data/src/svg/document.js +25 -0
  133. data/src/svg/element.js +22 -0
  134. data/src/svg/locatable.js +17 -0
  135. data/src/svg/rect.js +18 -0
  136. data/src/svg/rectelement.js +24 -0
  137. data/src/svg/stylable.js +49 -0
  138. data/src/svg/svgelement.js +22 -0
  139. data/src/svg/transformable.js +15 -0
  140. data/src/window/css.js +15 -0
  141. data/src/window/dialog.js +16 -0
  142. data/src/window/document.js +28 -0
  143. data/src/window/event.js +262 -0
  144. data/src/window/history.js +62 -0
  145. data/src/window/location.js +138 -0
  146. data/src/window/navigator.js +48 -0
  147. data/src/window/screen.js +53 -0
  148. data/src/window/timer.js +21 -0
  149. data/src/window/window.js +284 -0
  150. data/src/window/xhr.js +127 -0
  151. data/src/xpath/expression.js +49 -0
  152. data/src/xpath/implementation.js +2482 -0
  153. data/src/xpath/result.js +67 -0
  154. data/src/xpath/util.js +551 -0
  155. data/src/xpath/xmltoken.js +149 -0
  156. data/src/xslt/COPYING +34 -0
  157. data/src/xslt/ajaxslt-0.8.1/AUTHORS +1 -0
  158. data/src/xslt/ajaxslt-0.8.1/ChangeLog +136 -0
  159. data/src/xslt/ajaxslt-0.8.1/Makefile +49 -0
  160. data/src/xslt/ajaxslt-0.8.1/README +102 -0
  161. data/src/xslt/ajaxslt-0.8.1/TODO +15 -0
  162. data/src/xslt/ajaxslt-0.8.1/dom.js +566 -0
  163. data/src/xslt/ajaxslt-0.8.1/dom_unittest.html +24 -0
  164. data/src/xslt/ajaxslt-0.8.1/dom_unittest.js +131 -0
  165. data/src/xslt/ajaxslt-0.8.1/simplelog.js +79 -0
  166. data/src/xslt/ajaxslt-0.8.1/test/xpath.html +18 -0
  167. data/src/xslt/ajaxslt-0.8.1/test/xpath_script.js +45 -0
  168. data/src/xslt/ajaxslt-0.8.1/test/xslt.html +58 -0
  169. data/src/xslt/ajaxslt-0.8.1/test/xslt_script.js +33 -0
  170. data/src/xslt/ajaxslt-0.8.1/unittestsuite.html +26 -0
  171. data/src/xslt/ajaxslt-0.8.1/xmltoken.js +149 -0
  172. data/src/xslt/ajaxslt-0.8.1/xmltoken_unittest.html +18 -0
  173. data/src/xslt/ajaxslt-0.8.1/xmltoken_unittest.js +811 -0
  174. data/src/xslt/ajaxslt-0.8.1/xpath_unittest.html +39 -0
  175. data/src/xslt/ajaxslt-0.8.1/xpath_unittest.js +557 -0
  176. data/src/xslt/ajaxslt-0.8.1/xpathdebug.js +234 -0
  177. data/src/xslt/ajaxslt-0.8.1/xslt_unittest.html +138 -0
  178. data/src/xslt/ajaxslt-0.8.1/xslt_unittest.js +68 -0
  179. data/src/xslt/implementation.js +625 -0
  180. data/src/xslt/processor.js +37 -0
  181. data/src/xslt/util.js +449 -0
  182. data/test/foo.html +8 -0
  183. data/test/foo.js +40 -0
  184. data/test/jquery.js +6002 -0
  185. data/test/x.js +1 -0
  186. data/test/y.js +1 -0
  187. metadata +245 -14
@@ -0,0 +1,24 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2
+ "http://www.w3.org/TR/html4/loose.dtd">
3
+
4
+ <html>
5
+ <head>
6
+ <title>JsUnit test page for file dom.js of goog-ajaxslt</title>
7
+ <script language="JavaScript" type="text/javascript"
8
+ src="jsunit/app/jsUnitCore.js"></script>
9
+ <script language="JavaScript" type="text/javascript"
10
+ src="util.js"></script>
11
+ <script language="JavaScript" type="text/javascript"
12
+ src="xmltoken.js"></script>
13
+ <script language="JavaScript" type="text/javascript"
14
+ src="dom.js"></script>
15
+ <script language="JavaScript" type="text/javascript"
16
+ src="dom_unittest.js"></script>
17
+ </head>
18
+
19
+ <body>
20
+ This is a <a href="http://www.jsunit.net/">jsUnit</a> test
21
+ page. Run it using the <a
22
+ href="jsunit/testRunner.html">jsUnit runner</a>.
23
+ </body>
24
+ </html>
@@ -0,0 +1,131 @@
1
+ // Copyright 2005 Google Inc.
2
+ // All Rights Reserved
3
+ //
4
+ // Unit test for dom.js. This also uses DOMParser, so it only runs
5
+ // in firefox.
6
+ //
7
+ // Author: Steffen Meschkat <mesch@google.com>
8
+ // Junji Takagi <jtakagi@google.com>
9
+
10
+ //********************************************
11
+ // DGF BEWARE! You MUST update this function if you add tests!
12
+ //********************************************
13
+ function exposeTestFunctionNames() {
14
+ return ['testXmlParse', 'testXmlParseWeird', 'testXmlParseJapanese', 'testXmlResolveEntities'];
15
+ }
16
+
17
+ function testXmlParse() {
18
+ if (typeof(DOMParser) == 'undefined') return;
19
+
20
+ var xml = [
21
+ '<page>',
22
+ '<request>',
23
+ '<q id="q">new york</q>',
24
+ '</request>',
25
+ '<location lat="100" ', "lon='200'/>",
26
+ '</page>'
27
+ ].join('');
28
+
29
+ dom = xmlParse(xml);
30
+ dom1 = (new DOMParser).parseFromString(xml, 'text/xml');
31
+ doTestXmlParse(dom, dom1);
32
+
33
+ dom = xmlParse('<?xml version="1.0"?>' + xml);
34
+ dom1 = xmlParse("<?xml version='1.1'?>" + xml);
35
+ doTestXmlParse(dom, dom1);
36
+
37
+ var tag = 'q';
38
+ var byTag = dom.getElementsByTagName(tag);
39
+ assertEquals(1, byTag.length);
40
+ assertEquals(tag, byTag[0].nodeName);
41
+
42
+ var id = 'q';
43
+ var byId = dom.getElementById(id);
44
+ assertNotNull(byId);
45
+ assertEquals(id, byId.getAttribute('id'));
46
+ }
47
+
48
+ function testXmlParseWeird() {
49
+
50
+ var xml = [
51
+ '<_>',
52
+ '<_.:->',
53
+ '<:>!"#$%&\'()*+,-./:;&lt;=&gt;?[\\]^_`{|}~</:>',
54
+ '</_.:->',
55
+ '<:-_. _=".-" :="-."/>',
56
+ '</_>'
57
+ ].join('');
58
+
59
+ // DOMParser seems not supporting a tagname that starts with ':', so
60
+ // avoid comparing xmlParse() and DomParser.parseFromString() here.
61
+
62
+ dom = xmlParse('<?xml version="1.0"?>' + xml);
63
+ dom1 = xmlParse("<?xml version='1.1'?>" + xml);
64
+ doTestXmlParse(dom, dom1);
65
+ }
66
+
67
+ function testXmlParseJapanese() {
68
+ if (typeof(DOMParser) == 'undefined') return;
69
+
70
+ var xml = [
71
+ '<\u30da\u30fc\u30b8>',
72
+ '<\u30ea\u30af\u30a8\u30b9\u30c8>',
73
+ '<\u30af\u30a8\u30ea>\u6771\u4eac</\u30af\u30a8\u30ea>',
74
+ '</\u30ea\u30af\u30a8\u30b9\u30c8>',
75
+ '<\u4f4d\u7f6e \u7def\u5ea6="\u4e09\u5341\u4e94" ',
76
+ "\u7d4c\u5ea6='\u767e\u56db\u5341'/>",
77
+ '</\u30da\u30fc\u30b8>'
78
+ ].join('');
79
+
80
+ dom = xmlParse(xml);
81
+ dom1 = (new DOMParser).parseFromString(xml, 'text/xml');
82
+ doTestXmlParse(dom, dom1);
83
+
84
+ dom = xmlParse('<?xml version="1.0"?>' + xml);
85
+ dom1 = xmlParse("<?xml version='1.1'?>" + xml);
86
+ doTestXmlParse(dom, dom1);
87
+ }
88
+
89
+ function doTestXmlParse(dom, dom1) {
90
+ assertEquals('xmlText', xmlText(dom), xmlText(dom1));
91
+
92
+ assertEquals('#document',
93
+ dom.nodeName,
94
+ dom1.nodeName);
95
+
96
+ assertEquals('documentElement', dom.documentElement, dom.firstChild);
97
+ assertEquals('documentElement', dom1.documentElement, dom1.firstChild);
98
+
99
+ assertEquals('parentNode', dom.parentNode, null);
100
+ assertEquals('parentNode', dom1.parentNode, null);
101
+
102
+ assertEquals('parentNode', dom.documentElement.parentNode, dom);
103
+ assertEquals('parentNode', dom1.documentElement.parentNode, dom1);
104
+
105
+ assertEquals('page',
106
+ dom.documentElement.nodeName,
107
+ dom1.documentElement.nodeName);
108
+ assertEquals('dom.childNodes.length',
109
+ dom.childNodes.length,
110
+ dom1.childNodes.length);
111
+ assertEquals('dom.childNodes.length',
112
+ dom.childNodes.length,
113
+ dom1.childNodes.length);
114
+ assertEquals('page.childNodes.length',
115
+ dom.firstChild.childNodes.length,
116
+ dom1.firstChild.childNodes.length);
117
+ assertEquals('page.childNodes.length',
118
+ dom.firstChild.childNodes.length,
119
+ dom1.firstChild.childNodes.length);
120
+
121
+ assertEquals('location.attributes.length',
122
+ dom.firstChild.childNodes[1].attributes.length,
123
+ dom1.firstChild.childNodes[1].attributes.length);
124
+ assertEquals('location.attributes.length',
125
+ dom.firstChild.childNodes[1].attributes.length, 2);
126
+ }
127
+
128
+
129
+ function testXmlResolveEntities() {
130
+ assertEquals('";"', xmlResolveEntities('&quot;;&quot;'));
131
+ }
@@ -0,0 +1,79 @@
1
+ // Copyright 2005-2006 Google
2
+ //
3
+ // Author: Steffen Meschkat <mesch@google.com>
4
+ //
5
+ // A very simple logging facility, used in test/xpath.html.
6
+
7
+ var logging__ = true;
8
+
9
+ function Log() {};
10
+
11
+ Log.lines = [];
12
+
13
+ Log.write = function(s) {
14
+ if (logging__) {
15
+ this.lines.push(xmlEscapeText(s));
16
+ this.show();
17
+ }
18
+ };
19
+
20
+ // Writes the given XML with every tag on a new line.
21
+ Log.writeXML = function(xml) {
22
+ if (logging__) {
23
+ var s0 = xml.replace(/</g, '\n<');
24
+ var s1 = xmlEscapeText(s0);
25
+ var s2 = s1.replace(/\s*\n(\s|\n)*/g, '<br/>');
26
+ this.lines.push(s2);
27
+ this.show();
28
+ }
29
+ }
30
+
31
+ // Writes without any escaping
32
+ Log.writeRaw = function(s) {
33
+ if (logging__) {
34
+ this.lines.push(s);
35
+ this.show();
36
+ }
37
+ }
38
+
39
+ Log.clear = function() {
40
+ if (logging__) {
41
+ var l = this.div();
42
+ l.innerHTML = '';
43
+ this.lines = [];
44
+ }
45
+ }
46
+
47
+ Log.show = function() {
48
+ var l = this.div();
49
+ l.innerHTML += this.lines.join('<br/>') + '<br/>';
50
+ this.lines = [];
51
+ l.scrollTop = l.scrollHeight;
52
+ }
53
+
54
+ Log.div = function() {
55
+ var l = document.getElementById('log');
56
+ if (!l) {
57
+ l = document.createElement('div');
58
+ l.id = 'log';
59
+ l.style.position = 'absolute';
60
+ l.style.right = '5px';
61
+ l.style.top = '5px';
62
+ l.style.width = '250px';
63
+ l.style.height = '150px';
64
+ l.style.overflow = 'auto';
65
+ l.style.backgroundColor = '#f0f0f0';
66
+ l.style.border = '1px solid gray';
67
+ l.style.fontSize = '10px';
68
+ l.style.padding = '5px';
69
+ document.body.appendChild(l);
70
+ }
71
+ return l;
72
+ }
73
+
74
+ // Reimplement the log functions from util.js to use the simple log.
75
+ function xpathLog(msg) {
76
+ Log.write(msg);
77
+ };
78
+ function xsltLog(msg) {};
79
+ function xsltLogXml(msg) {};
@@ -0,0 +1,18 @@
1
+ <html>
2
+ <head>
3
+ <script src="../util.js" language="JavaScript"></script>
4
+ <script src="../xmltoken.js" language="JavaScript"></script>
5
+ <script src="../dom.js" language="JavaScript"></script>
6
+ <script src="../xpath.js" language="JavaScript"></script>
7
+ <script src="../xpath_unittest.js" language="JavaScript"></script>
8
+ <script src="../xpathdebug.js" language="JavaScript"></script>
9
+ <script src="../simplelog.js" language="JavaScript"></script>
10
+ <script src="xpath_script.js" language="JavaScript"></script>
11
+ </head>
12
+ <body onload="load_expr()">
13
+ <form onsubmit="xpath_test(this);return false" action="javascript:void(0)">
14
+ <select id="s" multiple="1" size="30" name="cases"></select>
15
+ <input type="submit" value="parse" align="top"/>
16
+ </form>
17
+ </body>
18
+ </html>
@@ -0,0 +1,45 @@
1
+ // Copyright 2005 Google Inc.
2
+ // All Rights Reserved
3
+ //
4
+ // Tests for the XPath parser. To run the test, open the file from the
5
+ // file system. No server support is required.
6
+ //
7
+ //
8
+ // Author: Steffen Meschkat <mesch@google.com>
9
+
10
+ logging = true;
11
+ xpathdebug = true;
12
+
13
+ function load_expr() {
14
+ var s = document.getElementById('s');
15
+ for (var i = 0; i < expr.length; ++i) {
16
+ var o = new Option(expr[i].replace(/&gt;/,'>').replace(/&lt;/,'<'));
17
+ s.options[s.options.length] = o;
18
+ }
19
+ s.selectedIndex = 0;
20
+ }
21
+
22
+ function xpath_test(form) {
23
+ Log.clear();
24
+ try {
25
+ var i = form.cases.selectedIndex;
26
+ var options = form.cases.options;
27
+
28
+ var text = options[i].value;
29
+ Log.writeRaw('<tt><b>' + text + '</b></tt>');
30
+
31
+ var expr = xpathParse(text);
32
+ Log.writeRaw('<tt><b>' + text + '</b></tt>');
33
+ Log.writeRaw('<pre>' + expr.parseTree('') + '</pre>');
34
+
35
+ options[i].selected = false;
36
+ if (i < options.length - 1) {
37
+ options[i+1].selected = true;
38
+ } else {
39
+ options[0].selected = true;
40
+ }
41
+
42
+ } catch (e) {
43
+ Log.write('EXCEPTION ' + e);
44
+ }
45
+ }
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html>
3
+ <head>
4
+ <title>Simple XSLT test</title>
5
+ <script src="../util.js" type="text/javascript"></script>
6
+ <script src="../xmltoken.js" type="text/javascript"></script>
7
+ <script src="../dom.js" type="text/javascript"></script>
8
+ <script src="../xpath.js" type="text/javascript"></script>
9
+ <script src="../xslt.js" type="text/javascript"></script>
10
+ <script src="xslt_script.js" type="text/javascript"></script>
11
+ </head>
12
+ <body onload="cleanxml()">
13
+ <form onsubmit="test_xslt();return false">
14
+ <table>
15
+ <tr>
16
+ <td>
17
+ <textarea id="xml" cols="40" rows="10">
18
+ <page>
19
+ <message>
20
+ Hello World.
21
+ </message>
22
+ </page>
23
+ </textarea>
24
+ </td>
25
+ <td>
26
+ <textarea id="xslt" cols="40" rows="10">
27
+ <xsl:stylesheet>
28
+ <xsl:template match="/">
29
+ <xsl:apply-templates select="page/message"/>
30
+ </xsl:template>
31
+
32
+ <xsl:template match="page/message">
33
+ <div style="color:green">
34
+ <xsl:value-of select="."/>
35
+ </div>
36
+ </xsl:template>
37
+ </xsl:stylesheet>
38
+ </textarea>
39
+ </td>
40
+ </tr>
41
+ <tr>
42
+ <td colspan="2">
43
+ <input type="submit" value="process"/>
44
+ </td>
45
+ </tr>
46
+ <tr>
47
+ <td>
48
+ <textarea id="html" cols="40" rows="10">
49
+ </textarea>
50
+ </td>
51
+ <td>
52
+ <div id="htmldisplay"></div>
53
+ </td>
54
+ </tr>
55
+ </table>
56
+ </form>
57
+ </body>
58
+ </html>
@@ -0,0 +1,33 @@
1
+ // Copyright 2005 Google Inc.
2
+ // All Rights Reserved
3
+ //
4
+ // Tests for the XSLT processor. To run the test, open the file from
5
+ // the file system. No server support is required.
6
+ //
7
+ //
8
+ // Author: Steffen Meschkat <mesch@google.com>
9
+
10
+ logging = true;
11
+ xsltdebug = true;
12
+
13
+ function el(id) {
14
+ return document.getElementById(id);
15
+ }
16
+
17
+ function test_xslt() {
18
+ var xml = xmlParse(el('xml').value);
19
+ var xslt = xmlParse(el('xslt').value);
20
+ var html = xsltProcess(xml, xslt);
21
+ el('html').value = html;
22
+ el('htmldisplay').innerHTML = html;
23
+ }
24
+
25
+ function cleanxml() {
26
+ cleanvalue('xml');
27
+ cleanvalue('xslt');
28
+ }
29
+
30
+ function cleanvalue(id) {
31
+ var x = el(id);
32
+ x.value = x.value.replace(/^\s*/, '').replace(/\n\s*/g, '\n');
33
+ }
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2
+ "http://www.w3.org/TR/html4/loose.dtd">
3
+ <html>
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
6
+ <title>AJAXSLT Test Suite</title>
7
+ <script language="JavaScript" type="text/javascript"
8
+ src="jsunit/app/xbDebug.js"></script>
9
+ <script language="JavaScript" type="text/javascript"
10
+ src="jsunit/app/jsUnitCore.js"></script>
11
+ <script language="JavaScript" type="text/javascript"
12
+ src="jsunit/app/jsUnitTestSuite.js"></script>
13
+ <script language="Javascript" type="text/javascript">
14
+ function suite() {
15
+ var testSuite = new top.jsUnitTestSuite();
16
+ var testRoot = window.location.href.replace(/[^\/\\]+$/, "");
17
+ testSuite.addTestPage(testRoot + "dom_unittest.html");
18
+ testSuite.addTestPage(testRoot + "xmltoken_unittest.html");
19
+ testSuite.addTestPage(testRoot + "xpath_unittest.html");
20
+ testSuite.addTestPage(testRoot + "xslt_unittest.html");
21
+ return testSuite;
22
+ }
23
+ </script>
24
+ </head>
25
+ <body>AJAXSLT Test Suite</body>
26
+ </html>
@@ -0,0 +1,149 @@
1
+ // Copyright 2006 Google Inc.
2
+ // All Rights Reserved
3
+ //
4
+ // Defines regular expression patterns to extract XML tokens from string.
5
+ // See <http://www.w3.org/TR/REC-xml/#sec-common-syn>,
6
+ // <http://www.w3.org/TR/xml11/#sec-common-syn> and
7
+ // <http://www.w3.org/TR/REC-xml-names/#NT-NCName> for the specifications.
8
+ //
9
+ // Author: Junji Takagi <jtakagi@google.com>
10
+
11
+ // Detect whether RegExp supports Unicode characters or not.
12
+
13
+ var REGEXP_UNICODE = function() {
14
+ var tests = [' ', '\u0120', -1, // Konquerer 3.4.0 fails here.
15
+ '!', '\u0120', -1,
16
+ '\u0120', '\u0120', 0,
17
+ '\u0121', '\u0120', -1,
18
+ '\u0121', '\u0120|\u0121', 0,
19
+ '\u0122', '\u0120|\u0121', -1,
20
+ '\u0120', '[\u0120]', 0, // Safari 2.0.3 fails here.
21
+ '\u0121', '[\u0120]', -1,
22
+ '\u0121', '[\u0120\u0121]', 0, // Safari 2.0.3 fails here.
23
+ '\u0122', '[\u0120\u0121]', -1,
24
+ '\u0121', '[\u0120-\u0121]', 0, // Safari 2.0.3 fails here.
25
+ '\u0122', '[\u0120-\u0121]', -1];
26
+ for (var i = 0; i < tests.length; i += 3) {
27
+ if (tests[i].search(new RegExp(tests[i + 1])) != tests[i + 2]) {
28
+ return false;
29
+ }
30
+ }
31
+ return true;
32
+ }();
33
+
34
+ // Common tokens in XML 1.0 and XML 1.1.
35
+
36
+ var XML_S = '[ \t\r\n]+';
37
+ var XML_EQ = '(' + XML_S + ')?=(' + XML_S + ')?';
38
+ var XML_CHAR_REF = '&#[0-9]+;|&#x[0-9a-fA-F]+;';
39
+
40
+ // XML 1.0 tokens.
41
+
42
+ var XML10_VERSION_INFO = XML_S + 'version' + XML_EQ + '("1\\.0"|' + "'1\\.0')";
43
+ var XML10_BASE_CHAR = (REGEXP_UNICODE) ?
44
+ '\u0041-\u005a\u0061-\u007a\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u00ff' +
45
+ '\u0100-\u0131\u0134-\u013e\u0141-\u0148\u014a-\u017e\u0180-\u01c3' +
46
+ '\u01cd-\u01f0\u01f4-\u01f5\u01fa-\u0217\u0250-\u02a8\u02bb-\u02c1\u0386' +
47
+ '\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03ce\u03d0-\u03d6\u03da\u03dc' +
48
+ '\u03de\u03e0\u03e2-\u03f3\u0401-\u040c\u040e-\u044f\u0451-\u045c' +
49
+ '\u045e-\u0481\u0490-\u04c4\u04c7-\u04c8\u04cb-\u04cc\u04d0-\u04eb' +
50
+ '\u04ee-\u04f5\u04f8-\u04f9\u0531-\u0556\u0559\u0561-\u0586\u05d0-\u05ea' +
51
+ '\u05f0-\u05f2\u0621-\u063a\u0641-\u064a\u0671-\u06b7\u06ba-\u06be' +
52
+ '\u06c0-\u06ce\u06d0-\u06d3\u06d5\u06e5-\u06e6\u0905-\u0939\u093d' +
53
+ '\u0958-\u0961\u0985-\u098c\u098f-\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2' +
54
+ '\u09b6-\u09b9\u09dc-\u09dd\u09df-\u09e1\u09f0-\u09f1\u0a05-\u0a0a' +
55
+ '\u0a0f-\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32-\u0a33\u0a35-\u0a36' +
56
+ '\u0a38-\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8b\u0a8d' +
57
+ '\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2-\u0ab3\u0ab5-\u0ab9' +
58
+ '\u0abd\u0ae0\u0b05-\u0b0c\u0b0f-\u0b10\u0b13-\u0b28\u0b2a-\u0b30' +
59
+ '\u0b32-\u0b33\u0b36-\u0b39\u0b3d\u0b5c-\u0b5d\u0b5f-\u0b61\u0b85-\u0b8a' +
60
+ '\u0b8e-\u0b90\u0b92-\u0b95\u0b99-\u0b9a\u0b9c\u0b9e-\u0b9f\u0ba3-\u0ba4' +
61
+ '\u0ba8-\u0baa\u0bae-\u0bb5\u0bb7-\u0bb9\u0c05-\u0c0c\u0c0e-\u0c10' +
62
+ '\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c60-\u0c61\u0c85-\u0c8c' +
63
+ '\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cde\u0ce0-\u0ce1' +
64
+ '\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d28\u0d2a-\u0d39\u0d60-\u0d61' +
65
+ '\u0e01-\u0e2e\u0e30\u0e32-\u0e33\u0e40-\u0e45\u0e81-\u0e82\u0e84' +
66
+ '\u0e87-\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5' +
67
+ '\u0ea7\u0eaa-\u0eab\u0ead-\u0eae\u0eb0\u0eb2-\u0eb3\u0ebd\u0ec0-\u0ec4' +
68
+ '\u0f40-\u0f47\u0f49-\u0f69\u10a0-\u10c5\u10d0-\u10f6\u1100\u1102-\u1103' +
69
+ '\u1105-\u1107\u1109\u110b-\u110c\u110e-\u1112\u113c\u113e\u1140\u114c' +
70
+ '\u114e\u1150\u1154-\u1155\u1159\u115f-\u1161\u1163\u1165\u1167\u1169' +
71
+ '\u116d-\u116e\u1172-\u1173\u1175\u119e\u11a8\u11ab\u11ae-\u11af' +
72
+ '\u11b7-\u11b8\u11ba\u11bc-\u11c2\u11eb\u11f0\u11f9\u1e00-\u1e9b' +
73
+ '\u1ea0-\u1ef9\u1f00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d' +
74
+ '\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc' +
75
+ '\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec' +
76
+ '\u1ff2-\u1ff4\u1ff6-\u1ffc\u2126\u212a-\u212b\u212e\u2180-\u2182' +
77
+ '\u3041-\u3094\u30a1-\u30fa\u3105-\u312c\uac00-\ud7a3' :
78
+ 'A-Za-z';
79
+ var XML10_IDEOGRAPHIC = (REGEXP_UNICODE) ?
80
+ '\u4e00-\u9fa5\u3007\u3021-\u3029' :
81
+ '';
82
+ var XML10_COMBINING_CHAR = (REGEXP_UNICODE) ?
83
+ '\u0300-\u0345\u0360-\u0361\u0483-\u0486\u0591-\u05a1\u05a3-\u05b9' +
84
+ '\u05bb-\u05bd\u05bf\u05c1-\u05c2\u05c4\u064b-\u0652\u0670\u06d6-\u06dc' +
85
+ '\u06dd-\u06df\u06e0-\u06e4\u06e7-\u06e8\u06ea-\u06ed\u0901-\u0903\u093c' +
86
+ '\u093e-\u094c\u094d\u0951-\u0954\u0962-\u0963\u0981-\u0983\u09bc\u09be' +
87
+ '\u09bf\u09c0-\u09c4\u09c7-\u09c8\u09cb-\u09cd\u09d7\u09e2-\u09e3\u0a02' +
88
+ '\u0a3c\u0a3e\u0a3f\u0a40-\u0a42\u0a47-\u0a48\u0a4b-\u0a4d\u0a70-\u0a71' +
89
+ '\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0b01-\u0b03' +
90
+ '\u0b3c\u0b3e-\u0b43\u0b47-\u0b48\u0b4b-\u0b4d\u0b56-\u0b57\u0b82-\u0b83' +
91
+ '\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0c01-\u0c03\u0c3e-\u0c44' +
92
+ '\u0c46-\u0c48\u0c4a-\u0c4d\u0c55-\u0c56\u0c82-\u0c83\u0cbe-\u0cc4' +
93
+ '\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5-\u0cd6\u0d02-\u0d03\u0d3e-\u0d43' +
94
+ '\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1' +
95
+ '\u0eb4-\u0eb9\u0ebb-\u0ebc\u0ec8-\u0ecd\u0f18-\u0f19\u0f35\u0f37\u0f39' +
96
+ '\u0f3e\u0f3f\u0f71-\u0f84\u0f86-\u0f8b\u0f90-\u0f95\u0f97\u0f99-\u0fad' +
97
+ '\u0fb1-\u0fb7\u0fb9\u20d0-\u20dc\u20e1\u302a-\u302f\u3099\u309a' :
98
+ '';
99
+ var XML10_DIGIT = (REGEXP_UNICODE) ?
100
+ '\u0030-\u0039\u0660-\u0669\u06f0-\u06f9\u0966-\u096f\u09e6-\u09ef' +
101
+ '\u0a66-\u0a6f\u0ae6-\u0aef\u0b66-\u0b6f\u0be7-\u0bef\u0c66-\u0c6f' +
102
+ '\u0ce6-\u0cef\u0d66-\u0d6f\u0e50-\u0e59\u0ed0-\u0ed9\u0f20-\u0f29' :
103
+ '0-9';
104
+ var XML10_EXTENDER = (REGEXP_UNICODE) ?
105
+ '\u00b7\u02d0\u02d1\u0387\u0640\u0e46\u0ec6\u3005\u3031-\u3035' +
106
+ '\u309d-\u309e\u30fc-\u30fe' :
107
+ '';
108
+ var XML10_LETTER = XML10_BASE_CHAR + XML10_IDEOGRAPHIC;
109
+ var XML10_NAME_CHAR = XML10_LETTER + XML10_DIGIT + '\\._:' +
110
+ XML10_COMBINING_CHAR + XML10_EXTENDER + '-';
111
+ var XML10_NAME = '[' + XML10_LETTER + '_:][' + XML10_NAME_CHAR + ']*';
112
+
113
+ var XML10_ENTITY_REF = '&' + XML10_NAME + ';';
114
+ var XML10_REFERENCE = XML10_ENTITY_REF + '|' + XML_CHAR_REF;
115
+ var XML10_ATT_VALUE = '"(([^<&"]|' + XML10_REFERENCE + ')*)"|' +
116
+ "'(([^<&']|" + XML10_REFERENCE + ")*)'";
117
+ var XML10_ATTRIBUTE =
118
+ '(' + XML10_NAME + ')' + XML_EQ + '(' + XML10_ATT_VALUE + ')';
119
+
120
+ // XML 1.1 tokens.
121
+ // TODO(jtakagi): NameStartChar also includes \u10000-\ueffff.
122
+ // ECMAScript Language Specifiction defines UnicodeEscapeSequence as
123
+ // "\u HexDigit HexDigit HexDigit HexDigit" and we may need to use
124
+ // surrogate pairs, but any browser doesn't support surrogate paris in
125
+ // character classes of regular expression, so avoid including them for now.
126
+
127
+ var XML11_VERSION_INFO = XML_S + 'version' + XML_EQ + '("1\\.1"|' + "'1\\.1')";
128
+ var XML11_NAME_START_CHAR = (REGEXP_UNICODE) ?
129
+ ':A-Z_a-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02ff\u0370-\u037d' +
130
+ '\u037f-\u1fff\u200c-\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff' +
131
+ '\uf900-\ufdcf\ufdf0-\ufffd' :
132
+ ':A-Z_a-z';
133
+ var XML11_NAME_CHAR = XML11_NAME_START_CHAR +
134
+ ((REGEXP_UNICODE) ? '\\.0-9\u00b7\u0300-\u036f\u203f-\u2040-' : '\\.0-9-');
135
+ var XML11_NAME = '[' + XML11_NAME_START_CHAR + '][' + XML11_NAME_CHAR + ']*';
136
+
137
+ var XML11_ENTITY_REF = '&' + XML11_NAME + ';';
138
+ var XML11_REFERENCE = XML11_ENTITY_REF + '|' + XML_CHAR_REF;
139
+ var XML11_ATT_VALUE = '"(([^<&"]|' + XML11_REFERENCE + ')*)"|' +
140
+ "'(([^<&']|" + XML11_REFERENCE + ")*)'";
141
+ var XML11_ATTRIBUTE =
142
+ '(' + XML11_NAME + ')' + XML_EQ + '(' + XML11_ATT_VALUE + ')';
143
+
144
+ // XML Namespace tokens.
145
+ // Used in XML parser and XPath parser.
146
+
147
+ var XML_NC_NAME_CHAR = XML10_LETTER + XML10_DIGIT + '\\._' +
148
+ XML10_COMBINING_CHAR + XML10_EXTENDER + '-';
149
+ var XML_NC_NAME = '[' + XML10_LETTER + '_][' + XML_NC_NAME_CHAR + ']*';