envjs19 0.3.8.20101029121421

Sign up to get free protection for your applications and to get access to all the features.
Files changed (279) hide show
  1. data/.jslintrbrc +30 -0
  2. data/.project +17 -0
  3. data/CHANGELOG.rdoc +57 -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 +280 -0
  14. data/README.rdoc +65 -0
  15. data/Rakefile +196 -0
  16. data/Wakefile +11 -0
  17. data/bin/envjsrb +257 -0
  18. data/build.properties +9 -0
  19. data/build.xml +247 -0
  20. data/gm/jquery.js +6002 -0
  21. data/gm/mainx.js +2648 -0
  22. data/gm/sensx.js +135 -0
  23. data/gm/t.js +6 -0
  24. data/gm/x.html +76 -0
  25. data/htmlparser/BrowserTreeBuilder.java +456 -0
  26. data/htmlparser/README +34 -0
  27. data/htmlparser/build.sh +38 -0
  28. data/jsl/jsl +0 -0
  29. data/jsl/jsl.default.conf +129 -0
  30. data/jsl/jsl.exe +0 -0
  31. data/lib/envjs.rb +35 -0
  32. data/lib/envjs/event_loop.js +206 -0
  33. data/lib/envjs/net.rb +3 -0
  34. data/lib/envjs/net/cgi.rb +94 -0
  35. data/lib/envjs/net/file.rb +69 -0
  36. data/lib/envjs/options.rb +11 -0
  37. data/lib/envjs/runtime.rb +346 -0
  38. data/lib/envjs/tempfile.rb +24 -0
  39. data/licenses/GPL-LICENSE.txt +278 -0
  40. data/licenses/MIT-LICENSE.txt +20 -0
  41. data/src/base64.js +80 -0
  42. data/src/build.js +6 -0
  43. data/src/cruft/bad.html +24 -0
  44. data/src/cruft/dom.js +606 -0
  45. data/src/cruft/element.js +297 -0
  46. data/src/cruft/good.html +30 -0
  47. data/src/cruft/good.js +32 -0
  48. data/src/cruft/internal.js +81 -0
  49. data/src/cruft/parser.js +458 -0
  50. data/src/css/properties.js +293 -0
  51. data/src/css/rule.js +22 -0
  52. data/src/css/sizzle.js +717 -0
  53. data/src/css/stylesheet.js +52 -0
  54. data/src/dom/attr.js +55 -0
  55. data/src/dom/cdatasection.js +31 -0
  56. data/src/dom/characterdata.js +119 -0
  57. data/src/dom/comment.js +30 -0
  58. data/src/dom/doctype.js +9 -0
  59. data/src/dom/document.js +1023 -0
  60. data/src/dom/dom.js +134 -0
  61. data/src/dom/element.js +217 -0
  62. data/src/dom/entities.js +273 -0
  63. data/src/dom/exception.js +28 -0
  64. data/src/dom/fragment.js +37 -0
  65. data/src/dom/implementation.js +140 -0
  66. data/src/dom/instruction.js +51 -0
  67. data/src/dom/namednodemap.js +374 -0
  68. data/src/dom/namespace.js +50 -0
  69. data/src/dom/node.js +618 -0
  70. data/src/dom/nodelist.js +195 -0
  71. data/src/dom/parser.js +1207 -0
  72. data/src/dom/text.js +73 -0
  73. data/src/event/event.js +47 -0
  74. data/src/event/mouseevent.js +4 -0
  75. data/src/event/uievent.js +8 -0
  76. data/src/html/a.js +110 -0
  77. data/src/html/anchor.js +80 -0
  78. data/src/html/area.js +57 -0
  79. data/src/html/base.js +26 -0
  80. data/src/html/blockquote-q.js +19 -0
  81. data/src/html/body.js +19 -0
  82. data/src/html/button.js +21 -0
  83. data/src/html/canvas.js +14 -0
  84. data/src/html/col-colgroup.js +49 -0
  85. data/src/html/collection.js +72 -0
  86. data/src/html/cookie.js +153 -0
  87. data/src/html/del-ins.js +25 -0
  88. data/src/html/div.js +28 -0
  89. data/src/html/document.js +364 -0
  90. data/src/html/element.js +382 -0
  91. data/src/html/fieldset.js +19 -0
  92. data/src/html/form.js +484 -0
  93. data/src/html/frame.js +89 -0
  94. data/src/html/frameset.js +25 -0
  95. data/src/html/head.js +44 -0
  96. data/src/html/html.js +0 -0
  97. data/src/html/htmlparser.js +340 -0
  98. data/src/html/iframe.js +26 -0
  99. data/src/html/image.js +0 -0
  100. data/src/html/img.js +62 -0
  101. data/src/html/input-elements.js +307 -0
  102. data/src/html/input.js +65 -0
  103. data/src/html/label.js +26 -0
  104. data/src/html/legend.js +19 -0
  105. data/src/html/link.js +82 -0
  106. data/src/html/map.js +22 -0
  107. data/src/html/meta.js +37 -0
  108. data/src/html/object.js +89 -0
  109. data/src/html/optgroup.js +25 -0
  110. data/src/html/option.js +103 -0
  111. data/src/html/param.js +38 -0
  112. data/src/html/script.js +122 -0
  113. data/src/html/select.js +132 -0
  114. data/src/html/style.js +31 -0
  115. data/src/html/table.js +199 -0
  116. data/src/html/tbody-thead-tfoot.js +92 -0
  117. data/src/html/td-th.js +18 -0
  118. data/src/html/textarea.js +31 -0
  119. data/src/html/title.js +20 -0
  120. data/src/html/tr.js +114 -0
  121. data/src/intro.js +141 -0
  122. data/src/outro.js +70 -0
  123. data/src/parser/html5.detailed.js +10762 -0
  124. data/src/parser/html5.min.js +503 -0
  125. data/src/parser/html5.pretty.js +10815 -0
  126. data/src/parser/intro.js +42 -0
  127. data/src/parser/outro.js +9 -0
  128. data/src/platform/core.js +323 -0
  129. data/src/platform/johnson.js +484 -0
  130. data/src/platform/rhino.js +327 -0
  131. data/src/platform/static/intro.js +41 -0
  132. data/src/platform/static/outro.js +30 -0
  133. data/src/profile/aop.js +238 -0
  134. data/src/profile/profile.js +402 -0
  135. data/src/serializer/xml.js +21 -0
  136. data/src/svg/animatedstring.js +25 -0
  137. data/src/svg/document.js +25 -0
  138. data/src/svg/element.js +22 -0
  139. data/src/svg/locatable.js +17 -0
  140. data/src/svg/rect.js +18 -0
  141. data/src/svg/rectelement.js +24 -0
  142. data/src/svg/stylable.js +49 -0
  143. data/src/svg/svgelement.js +22 -0
  144. data/src/svg/transformable.js +15 -0
  145. data/src/window/css.js +15 -0
  146. data/src/window/dialog.js +16 -0
  147. data/src/window/document.js +28 -0
  148. data/src/window/event.js +265 -0
  149. data/src/window/history.js +62 -0
  150. data/src/window/location.js +156 -0
  151. data/src/window/navigator.js +48 -0
  152. data/src/window/screen.js +53 -0
  153. data/src/window/timer.js +21 -0
  154. data/src/window/window.js +284 -0
  155. data/src/window/xhr.js +135 -0
  156. data/src/xpath/expression.js +49 -0
  157. data/src/xpath/implementation.js +2505 -0
  158. data/src/xpath/result.js +67 -0
  159. data/src/xpath/util.js +551 -0
  160. data/src/xpath/xmltoken.js +149 -0
  161. data/src/xslt/COPYING +34 -0
  162. data/src/xslt/ajaxslt-0.8.1/AUTHORS +1 -0
  163. data/src/xslt/ajaxslt-0.8.1/ChangeLog +136 -0
  164. data/src/xslt/ajaxslt-0.8.1/Makefile +49 -0
  165. data/src/xslt/ajaxslt-0.8.1/README +102 -0
  166. data/src/xslt/ajaxslt-0.8.1/TODO +15 -0
  167. data/src/xslt/ajaxslt-0.8.1/dom.js +566 -0
  168. data/src/xslt/ajaxslt-0.8.1/dom_unittest.html +24 -0
  169. data/src/xslt/ajaxslt-0.8.1/dom_unittest.js +131 -0
  170. data/src/xslt/ajaxslt-0.8.1/simplelog.js +79 -0
  171. data/src/xslt/ajaxslt-0.8.1/test/xpath.html +18 -0
  172. data/src/xslt/ajaxslt-0.8.1/test/xpath_script.js +45 -0
  173. data/src/xslt/ajaxslt-0.8.1/test/xslt.html +58 -0
  174. data/src/xslt/ajaxslt-0.8.1/test/xslt_script.js +33 -0
  175. data/src/xslt/ajaxslt-0.8.1/unittestsuite.html +26 -0
  176. data/src/xslt/ajaxslt-0.8.1/xmltoken.js +149 -0
  177. data/src/xslt/ajaxslt-0.8.1/xmltoken_unittest.html +18 -0
  178. data/src/xslt/ajaxslt-0.8.1/xmltoken_unittest.js +811 -0
  179. data/src/xslt/ajaxslt-0.8.1/xpath_unittest.html +39 -0
  180. data/src/xslt/ajaxslt-0.8.1/xpath_unittest.js +557 -0
  181. data/src/xslt/ajaxslt-0.8.1/xpathdebug.js +234 -0
  182. data/src/xslt/ajaxslt-0.8.1/xslt_unittest.html +138 -0
  183. data/src/xslt/ajaxslt-0.8.1/xslt_unittest.js +68 -0
  184. data/src/xslt/implementation.js +625 -0
  185. data/src/xslt/processor.js +37 -0
  186. data/src/xslt/util.js +449 -0
  187. data/test/base64.js +80 -0
  188. data/test/call-load-test.js +15 -0
  189. data/test/data.js +45 -0
  190. data/test/debug.js +53 -0
  191. data/test/firebug/errorIcon.png +0 -0
  192. data/test/firebug/firebug.css +209 -0
  193. data/test/firebug/firebug.html +23 -0
  194. data/test/firebug/firebug.js +672 -0
  195. data/test/firebug/firebugx.js +10 -0
  196. data/test/firebug/infoIcon.png +0 -0
  197. data/test/firebug/warningIcon.png +0 -0
  198. data/test/fixtures/html/events.html +171 -0
  199. data/test/fixtures/html/iframe1.html +46 -0
  200. data/test/fixtures/html/iframe1a.html +46 -0
  201. data/test/fixtures/html/iframe2.html +45 -0
  202. data/test/fixtures/html/iframe3.html +28 -0
  203. data/test/fixtures/html/iframeN.html +57 -0
  204. data/test/fixtures/html/malformed.html +181 -0
  205. data/test/fixtures/html/scope.html +81 -0
  206. data/test/fixtures/html/trivial.html +19 -0
  207. data/test/fixtures/html/with_js.html +26 -0
  208. data/test/fixtures/images/icon-blue.png +0 -0
  209. data/test/fixtures/js/external_script.js +1 -0
  210. data/test/fixtures/js/script.js +1 -0
  211. data/test/fixtures/js/script_error.js +2 -0
  212. data/test/foo.html +8 -0
  213. data/test/foo.js +40 -0
  214. data/test/html/events.html +171 -0
  215. data/test/html/iframe1.html +46 -0
  216. data/test/html/iframe1a.html +46 -0
  217. data/test/html/iframe2.html +45 -0
  218. data/test/html/iframe3.html +30 -0
  219. data/test/html/iframeN.html +57 -0
  220. data/test/html/malformed.html +181 -0
  221. data/test/html/scope.html +87 -0
  222. data/test/html/script.js +1 -0
  223. data/test/html/trivial.html +19 -0
  224. data/test/html/with_js.html +26 -0
  225. data/test/index.html +328 -0
  226. data/test/java-prototype.js +9 -0
  227. data/test/jquery.js +6002 -0
  228. data/test/primary-tests.js +26 -0
  229. data/test/prototype-test.js +13 -0
  230. data/test/qunit.js +61 -0
  231. data/test/qunit/qunit/qunit.css +17 -0
  232. data/test/qunit/qunit/qunit.js +997 -0
  233. data/test/scope.html +19 -0
  234. data/test/scope.rb +24 -0
  235. data/test/smp/dmathieu/index.html +8 -0
  236. data/test/specs/dist/env.spec.js +1534 -0
  237. data/test/specs/envjs.spec.css +46 -0
  238. data/test/specs/parser/html.js +31 -0
  239. data/test/specs/parser/spec.html +40 -0
  240. data/test/specs/parser/xml.js +31 -0
  241. data/test/specs/qunit.bdd.js +210 -0
  242. data/test/specs/qunit.css +17 -0
  243. data/test/specs/qunit.js +997 -0
  244. data/test/specs/template/spec-0.js +31 -0
  245. data/test/specs/template/spec-1.js +31 -0
  246. data/test/specs/template/spec.html +40 -0
  247. data/test/specs/window/css.js +23 -0
  248. data/test/specs/window/dialog.js +25 -0
  249. data/test/specs/window/document.js +23 -0
  250. data/test/specs/window/event.js +25 -0
  251. data/test/specs/window/history.js +34 -0
  252. data/test/specs/window/location.js +34 -0
  253. data/test/specs/window/navigator.js +71 -0
  254. data/test/specs/window/screen.js +42 -0
  255. data/test/specs/window/spec.html +48 -0
  256. data/test/specs/window/timer.js +26 -0
  257. data/test/specs/window/window.js +53 -0
  258. data/test/specs/xhr/spec.html +47 -0
  259. data/test/specs/xhr/xhr.js +31 -0
  260. data/test/test.js +10 -0
  261. data/test/unit/dom.js +44 -0
  262. data/test/unit/elementmembers.js +92 -0
  263. data/test/unit/events.js +195 -0
  264. data/test/unit/fixtures/external_script.js +1 -0
  265. data/test/unit/form.js +40 -0
  266. data/test/unit/iframe.js +234 -0
  267. data/test/unit/insertion.js +23 -0
  268. data/test/unit/multi-window.js +212 -0
  269. data/test/unit/nu.validator.js +34 -0
  270. data/test/unit/onload.js +90 -0
  271. data/test/unit/parser.js +122 -0
  272. data/test/unit/prototypecompat.js +22 -0
  273. data/test/unit/proxy.js +6 -0
  274. data/test/unit/scope.js +209 -0
  275. data/test/unit/timer.js +115 -0
  276. data/test/unit/window.js +57 -0
  277. data/test/x.js +1 -0
  278. data/test/y.js +1 -0
  279. metadata +367 -0
@@ -0,0 +1,18 @@
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 xmltoken.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="xmltoken.js"></script>
11
+ <script language="JavaScript" type="text/javascript"
12
+ src="xmltoken_unittest.js"></script>
13
+ </head>
14
+
15
+ <body>
16
+ JsUnit test page for file xmltoken.js of goog-ajaxslt.
17
+ </body>
18
+ </html>
@@ -0,0 +1,811 @@
1
+ // Copyright 2006 Google Inc.
2
+ // All Rights Reserved
3
+ //
4
+ // Unit test for xmltoken.js.
5
+ //
6
+ // Author: Junji Takagi <jtakagi@google.com>
7
+
8
+ //********************************************
9
+ // DGF BEWARE! You MUST update this function if you add tests!
10
+ //********************************************
11
+ function exposeTestFunctionNames() {
12
+ return ['testRegexpUnicode', 'testXmlVersionInfo', 'testXmlCharRef', 'testXmlEntityRef', 'testXml10Name', 'testXml10Attribute', 'testXml11Name', 'testXml11Attribute', 'testXmlNcName'];
13
+ }
14
+
15
+ // Test if regexp matches the str and RegExp.exec returns exactly the match.
16
+ function assertOk(comment, regexp, str, match) {
17
+ assertNotNull(comment, regexp.exec(str));
18
+ assertEquals(comment, regexp.exec(str)[0], match);
19
+ assertTrue(comment, regexp.test(str));
20
+ }
21
+
22
+ // Test if regexp doesn't match the str.
23
+ function assertNg(comment, regexp, str) {
24
+ assertNull(comment, regexp.exec(str));
25
+ assertFalse(comment, regexp.test(str));
26
+ }
27
+
28
+ // Concat chars in various way and test them with regexp.
29
+ function doTestXmlName(comment, regexp,
30
+ okFirstChars, ngFirstChars,
31
+ okSecondChars, ngSecondChars) {
32
+ var okSecondString = okSecondChars.join('');
33
+ for (var i = 0; i < okFirstChars.length; i++) {
34
+ assertOk(comment + ' with ok #' + i, regexp,
35
+ okFirstChars[i],
36
+ okFirstChars[i]);
37
+ assertOk(comment + ' with ok #' + i + ' + oks', regexp,
38
+ okFirstChars[i] + okSecondString,
39
+ okFirstChars[i] + okSecondString);
40
+ for (var j = 0; j < okSecondChars.length; j++) {
41
+ assertOk(comment + ' with ok #' + i + ' + ok #' + j, regexp,
42
+ okFirstChars[i] + okSecondChars[j],
43
+ okFirstChars[i] + okSecondChars[j]);
44
+ assertOk(comment + ' with ok #' + i + ' + ok #' + j + ' + oks', regexp,
45
+ okFirstChars[i] + okSecondChars[j] + okSecondString,
46
+ okFirstChars[i] + okSecondChars[j] + okSecondString);
47
+ var k = (i + j) % ngSecondChars.length;
48
+ assertOk(comment + ' with ' +
49
+ 'ok #' + i + ' + ok #' + j + ' + ng #' + k, regexp,
50
+ okFirstChars[i] + okSecondChars[j] + ngSecondChars[k],
51
+ okFirstChars[i] + okSecondChars[j]);
52
+ }
53
+ var j = i % ngSecondChars.length;
54
+ assertOk(comment + ' with ok #' + i + ' + ng #' + j, regexp,
55
+ okFirstChars[i] + ngSecondChars[j],
56
+ okFirstChars[i]);
57
+ assertOk(comment + ' with ok #' + i + ' + oks + ng #' + j, regexp,
58
+ okFirstChars[i] + okSecondString + ngSecondChars[j],
59
+ okFirstChars[i] + okSecondString);
60
+ }
61
+ for (var i = 0; i < ngFirstChars.length; i++) {
62
+ assertNg(comment + ' with ng #' + i, regexp,
63
+ ngFirstChars[i]);
64
+ // It doesn't make sense to test with ngFirstChars[i] + okSecondChars[j].
65
+ for (var j = 0; j < ngSecondChars.length; j++) {
66
+ assertNg(comment + ' with ng #' + i + ' + ng #' + j, regexp,
67
+ ngFirstChars[i] + ngSecondChars[j]);
68
+ }
69
+ }
70
+ }
71
+
72
+ // Test REGEXP_UNICODE to make sure the browser supports Unicode in RegExp.
73
+ function testRegexpUnicode() {
74
+ assertTrue('REGEXP_UNICODE', REGEXP_UNICODE);
75
+ }
76
+
77
+ // Test XML10_VERSION_INFO and XML11_VERSION_INFO.
78
+ // Also test XML_S and XML_EQ.
79
+ function testXmlVersionInfo() {
80
+ var okVersion10 = [
81
+ ' version="1.0"',
82
+ ' version = "1.0"',
83
+ '\tversion\t\t=\t\t\t"1.0"',
84
+ '\rversion\r\r=\r\r\r"1.0"',
85
+ '\nversion\n\n=\n\n\n"1.0"',
86
+ '\r\nversion\r\n\r\n=\r\n\r\n\r\n"1.0"',
87
+ '\n\rversion\n\r\n\r=\n\r\n\r\n\r"1.0"',
88
+ ' \t\r\n \t\n\rversion \r\t\n \r\n\t= \n\t\r \n\r\t"1.0"',
89
+ " version='1.0'",
90
+ " version = '1.0'",
91
+ "\tversion\t\t=\t\t\t'1.0'",
92
+ "\rversion\r\r=\r\r\r'1.0'",
93
+ "\nversion\n\n=\n\n\n'1.0'",
94
+ "\r\nversion\r\n\r\n=\r\n\r\n\r\n'1.0'",
95
+ "\n\rversion\n\r\n\r=\n\r\n\r\n\r'1.0'",
96
+ "\t \r\n\t \n\rversion\t\r \n\t\r\n =\t\n \r\t\n\r '1.0'"
97
+ ];
98
+ var ngVersion10 = [
99
+ 'version="1.0"', // Must start with space char
100
+ ' Version="1.0"', // Must be lower letter
101
+ ' VERSION="1.0"', // Must be lower letter
102
+ ' version"1.0"', // Must have '='
103
+ ' version "1.0"', // Must have '='
104
+ ' version\t"1.0"', // Must have '='
105
+ ' version+"1.0"', // Must have '='
106
+ ' version-"1.0"', // Must have '='
107
+ ' version=1.0', // Must be quoted
108
+ ' version="1.1"', // Must be '1.0'
109
+ ' version="1"', // Must be '1.0'
110
+ ' version="10"', // Must be '1.0'
111
+ ' version="100"', // Must be '1.0'
112
+ ' version="1-0"', // Must be '1.0'
113
+ ' version="1_0"' // Must be '1.0'
114
+ ];
115
+ var okVersion11 = [
116
+ ' version="1.1"',
117
+ ' version = "1.1"',
118
+ '\tversion\t\t=\t\t\t"1.1"',
119
+ '\rversion\r\r=\r\r\r"1.1"',
120
+ '\nversion\n\n=\n\n\n"1.1"',
121
+ '\r\nversion\r\n\r\n=\r\n\r\n\r\n"1.1"',
122
+ '\n\rversion\n\r\n\r=\n\r\n\r\n\r"1.1"',
123
+ '\r \t\n\r \n\tversion\r\t \n\r\t\n =\r\n \t\r\n\t "1.1"',
124
+ " version='1.1'",
125
+ " version = '1.1'",
126
+ "\tversion\t\t=\t\t\t'1.1'",
127
+ "\rversion\r\r=\r\r\r'1.1'",
128
+ "\nversion\n\n=\n\n\n'1.1'",
129
+ "\r\nversion\r\n\r\n=\r\n\r\n\r\n'1.1'",
130
+ "\n\rversion\n\r\n\r=\n\r\n\r\n\r'1.1'",
131
+ "\n \t\r\n \r\tversion\n\t \r\n\t\r =\n\r \t\n\r\t '1.1'"
132
+ ];
133
+ var ngVersion11 = [
134
+ 'version="1.1"', // Must start with space char
135
+ ' Version="1.1"', // Must be lower letter
136
+ ' VERSION="1.1"', // Must be lower letter
137
+ ' version"1.1"', // Must have '='
138
+ ' version "1.1"', // Must have '='
139
+ ' version\t"1.1"', // Must have '='
140
+ ' version+"1.1"', // Must have '='
141
+ ' version-"1.1"', // Must have '='
142
+ ' version=1.1', // Must be quoted
143
+ ' version="1.0"', // Must be '1.1'
144
+ ' version="1"', // Must be '1.1'
145
+ ' version="11"', // Must be '1.1'
146
+ ' version="111"', // Must be '1.1'
147
+ ' version="1-1"', // Must be '1.1'
148
+ ' version="1_1"' // Must be '1.1'
149
+ ];
150
+
151
+ var regexp = new RegExp(XML10_VERSION_INFO);
152
+ for (var i = 0; i < okVersion10.length; i++) {
153
+ assertOk('XML10_VERSION_INFO with ok #' + i, regexp,
154
+ okVersion10[i], okVersion10[i]);
155
+ }
156
+ for (var i = 0; i < ngVersion10.length; i++) {
157
+ assertNg('XML10_VERSION_INFO with ng #' + i, regexp,
158
+ ngVersion10[i]);
159
+ }
160
+ var regexp = new RegExp(XML11_VERSION_INFO);
161
+ for (var i = 0; i < okVersion11.length; i++) {
162
+ assertOk('XML11_VERSION_INFO with ok #' + i, regexp,
163
+ okVersion11[i], okVersion11[i]);
164
+ }
165
+ for (var i = 0; i < ngVersion11.length; i++) {
166
+ assertNg('XML11_VERSION_INFO with ng #' + i, regexp,
167
+ ngVersion11[i]);
168
+ }
169
+ }
170
+
171
+ // Test XML_CHAR_REF.
172
+ function testXmlCharRef() {
173
+ var okCharRef = [
174
+ '&#0;',
175
+ '&#9;',
176
+ '&#32;', // ' '
177
+ '&#34;', // '"'
178
+ '&#38;', // '&'
179
+ '&#39;', // "'"
180
+ '&#60;', // "<"
181
+ '&#62;', // ">"
182
+ '&#65;', // "A"
183
+ '&#100;',
184
+ '&#9999;',
185
+ '&#65536;',
186
+ '&#0123456789;',
187
+ '&#9876543210;',
188
+ '&#314159265358979323846264338327950;', // Pi, until all 0-9 appears
189
+ '&#x0;',
190
+ '&#x9;',
191
+ '&#xA;',
192
+ '&#xF;',
193
+ '&#xa;',
194
+ '&#xf;',
195
+ '&#x20;', // ' '
196
+ '&#x22;', // '"'
197
+ '&#x26;', // '&'
198
+ '&#x27;', // "'"
199
+ '&#x3c;', // "<"
200
+ '&#x3e;', // ">"
201
+ '&#x41;', // "A"
202
+ '&#xAA;', // Both upper letter
203
+ '&#xBb;', // Start with upper letter, end with lower letter
204
+ '&#xcC;', // Start with lower letter, end with upper letter
205
+ '&#xdd;', // Both lower letter
206
+ '&#x100;',
207
+ '&#x9999;',
208
+ '&#xaaaa;',
209
+ '&#xffff;',
210
+ '&#xcafebabe;',
211
+ '&#x0123456789ABCDEFabcdef;',
212
+ '&#xfedcbaFEDCBA9876543210;'
213
+ ];
214
+ var ngCharRef = [
215
+ '&0;', // Must start with '&#'
216
+ '#0;', // Must start with '&#'
217
+ 'x0;', // Must start with '&#'
218
+ '&#;', // Must have one or more digit
219
+ '&#/;', // Must be 0-9 ('/' is a char before '0')
220
+ '&#0', // Must end with ';'
221
+ '&#9', // Must end with ';'
222
+ '&#0:', // Must end with ';'
223
+ '&#9:', // Must end with ';'
224
+ '&# 0;', // Must not have a space char
225
+ '&#0 ;', // Must not have a space char
226
+ '&# 0 ;', // Must not have space chars
227
+ '&#A;', // Must not have A-Fa-f
228
+ '&#F;', // Must not have A-Fa-f
229
+ '&#0A;', // Must not have A-Fa-f
230
+ '&#9F;', // Must not have A-Fa-f
231
+ '&#0F;', // Must not have A-Fa-f
232
+ '&#9A;', // Must not have A-Fa-f
233
+ '&#:;', // Must be 0-9 (':' is a char after '9')
234
+ '&#x;', // Must have one or more xdigit
235
+ '&#x/;', // Must be 0-9A-Fa-f ('/' is a char before '0')
236
+ '&#x0', // Must end with ';'
237
+ '&#x9', // Must end with ';'
238
+ '&#xA', // Must end with ';'
239
+ '&#xF', // Must end with ';'
240
+ '&#xa', // Must end with ';'
241
+ '&#xf', // Must end with ';'
242
+ '&#x0:', // Must end with ';'
243
+ '&#x9:', // Must end with ';'
244
+ '&#xA:', // Must end with ';'
245
+ '&#xF:', // Must end with ';'
246
+ '&#xa:', // Must end with ';'
247
+ '&#xf:', // Must end with ';'
248
+ '&#x 0', // Must not have a space char
249
+ '&#x0 ', // Must not have a space char
250
+ '&#x 0 ', // Must not have space chars
251
+ '&#x:;', // Must be 0-9A-Fa-f (':' is a char after '9')
252
+ '&#x@;', // Must be 0-9A-Fa-f ('@' is a char before 'A')
253
+ '&#xG;', // Must be 0-9A-Fa-f
254
+ '&#x`;', // Must be 0-9A-Fa-f ('`' is a char before 'a')
255
+ '&#xg;' // Must be 0-9A-Fa-f
256
+ ];
257
+
258
+ var regexp = new RegExp(XML_CHAR_REF);
259
+ for (var i = 0; i < okCharRef.length; i++) {
260
+ assertOk('XML_CHAR_REF with ok #' + i, regexp,
261
+ okCharRef[i], okCharRef[i]);
262
+ }
263
+ for (var i = 0; i < ngCharRef.length; i++) {
264
+ assertNg('XML_CHAR_REF with ng #' + i, regexp,
265
+ ngCharRef[i]);
266
+ }
267
+ }
268
+
269
+ // Test XML10_ENTITY_REF and XML11_ENTITY_REF.
270
+ // Also test XML10_NAME and XML11_NAME a little bit.
271
+ function testXmlEntityRef() {
272
+ var okEntityRef = [
273
+ '&lt;', // XML predefined entity
274
+ '&gt;', // XML predefined entity
275
+ '&amp;', // XML predefined entity
276
+ '&aps;', // XML predefined entity
277
+ '&quot;', // XML predefined entity
278
+ '&nbsp;', // HTML entity (picked up as a real world example)
279
+ '&copy;', // HTML entity
280
+ '&reg;', // HTML entity
281
+ '&Agrave;', // HTML entity, starts with upper letter
282
+ '&ETH;', // HTML entity, all upper letter
283
+ '&lArr;', // HTML entity, starts with lower letter, has upper letter
284
+ '&there4;', // HTML entity, has digit
285
+ '&foo;', // Just an entity name
286
+ '&:foo;', // Entity name can start with ':'
287
+ '&_foo;', // Entity name can start with '_'
288
+ '&foo-bar.baz:quux_;', // Entity name can have '-', '.', ':' or '_'
289
+ '&\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u540d;' // Japanese entity name
290
+ ];
291
+ var ngEntityRef = [
292
+ 'lt;', // Must start with '&'
293
+ '&gt', // Must end with ';'
294
+ '& amp;', // Must not have a space char
295
+ '&aps ;', // Must not have a space char
296
+ '& quot ;', // Must not have space chars
297
+ '&-foo;', // Entity name must not start with '-'
298
+ '&.foo;' // Entity name must not start with '.'
299
+ ];
300
+ var edgeEntityRef = [ // Invalid XML10_ENTITY_REF but valid XML11_ENTITY_REF
301
+ '&\u0131\u0132;',
302
+ '&\u0132\u0133;',
303
+ '&\u0133\u0134;',
304
+ '&\u0131\u0132\u0133\u0134;',
305
+ '&\u3001\u3030\u4d00\u9fff\ufffd;'
306
+ ];
307
+
308
+ var regexp10 = new RegExp(XML10_ENTITY_REF);
309
+ for (var i = 0; i < okEntityRef.length; i++) {
310
+ assertOk('XML10_ENTITY_REF with ok #' + i, regexp10,
311
+ okEntityRef[i], okEntityRef[i]);
312
+ }
313
+ for (var i = 0; i < ngEntityRef.length; i++) {
314
+ assertNg('XML10_ENTITY_REF with ng #' + i, regexp10,
315
+ ngEntityRef[i]);
316
+ }
317
+
318
+ var regexp11 = new RegExp(XML11_ENTITY_REF);
319
+ for (var i = 0; i < okEntityRef.length; i++) {
320
+ assertOk('XML11_ENTITY_REF with ok #' + i, regexp11,
321
+ okEntityRef[i], okEntityRef[i]);
322
+ }
323
+ for (var i = 0; i < ngEntityRef.length; i++) {
324
+ assertNg('XML11_ENTITY_REF with ng #' + i, regexp11,
325
+ ngEntityRef[i]);
326
+ }
327
+
328
+ for (var i = 0; i < edgeEntityRef.length; i++) {
329
+ assertNg('XML10_ENTITY_REF with edge #' + i, regexp10,
330
+ edgeEntityRef[i]);
331
+ assertOk('XML11_ENTITY_REF with edge #' + i, regexp11,
332
+ edgeEntityRef[i], edgeEntityRef[i]);
333
+ }
334
+ }
335
+
336
+ // Test XML10_NAME including XML10_LETTER, XML10_NAME_CHAR, XML10_BASE_CHAR,
337
+ // XML10_IDEOGRAPHIC, XML10_DIGIT, XML10_COMBINING_CHAR and XML10_EXTENDER.
338
+ function testXml10Name() {
339
+ var okFirstChars = [
340
+ '\u003a', // ':'
341
+ '\u0041', // 'A' : XML10_BASE_CHAR
342
+ '\u005a', // 'Z' : XML10_BASE_CHAR
343
+ '\u005f', // '_'
344
+ '\u0061', // 'a' : XML10_BASE_CHAR
345
+ '\u007a', // 'z' : XML10_BASE_CHAR
346
+ '\u00c0', // XML10_BASE_CHAR
347
+ '\u00d6', // XML10_BASE_CHAR
348
+ '\u00d8', // XML10_BASE_CHAR
349
+ '\u00f6', // XML10_BASE_CHAR
350
+ '\u00f8', // XML10_BASE_CHAR
351
+ '\u00ff', // XML10_BASE_CHAR
352
+ '\u0100', // XML10_BASE_CHAR
353
+ '\u4e00', // XML10_IDEOGRAPHIC
354
+ '\u9fa5', // XML10_IDEOGRAPHIC
355
+ '\uac00', // XML10_BASE_CHAR
356
+ '\ud7a3' // XML10_BASE_CHAR
357
+ ];
358
+ var ngFirstChars = [
359
+ '\u002d', // '-'
360
+ '\u002e', // '.'
361
+ '\u0030', // '0' : First char of XML10_DIGIT
362
+ '\u0039', // '9' : XML10_DIGIT
363
+ '\u003b', // ';' : Non XML10_BASE_CHAR
364
+ '\u0040', // '@' : Non XML10_BASE_CHAR
365
+ '\u005b', // '[' : Non XML10_BASE_CHAR
366
+ '\u005e', // '^' : Non XML10_BASE_CHAR
367
+ '\u0060', // '`' : Non XML10_BASE_CHAR
368
+ '\u007b', // '{' : Non XML10_BASE_CHAR
369
+ '\u00b7', // First char of XML10_EXTENDER
370
+ '\u00bf', // Non XML10_BASE_CHAR
371
+ '\u00d7', // Non XML10_BASE_CHAR
372
+ '\u00f7', // Non XML10_BASE_CHAR
373
+ '\u0300', // First char of XML10_COMBINING_CHAR
374
+ '\u0660', // XML10_DIGIT
375
+ '\u0f29', // Last char of XML10_DIGIT
376
+ '\u309a', // Last char of XML10_COMBINING_CHAR
377
+ '\u30fe', // Last char of XML10_EXTENDER
378
+ '\u4dff', // Edge char for XML10_IDEOGRAPHIC
379
+ '\u9fa6', // Edge char for XML10_IDEOGRAPHIC
380
+ '\uabff', // Edge char for XML10_BASE_CHAR
381
+ '\ud7a4' // Edge char for XML10_BASE_CHAR
382
+ ];
383
+ var okSecondChars = [
384
+ '\u002d', // '-'
385
+ '\u002e', // '.'
386
+ '\u0030', // '0' : XML10_DIGIT
387
+ '\u0039', // '9' : XML10_DIGIT
388
+ '\u003a', // ':'
389
+ '\u0041', // 'A' : XML10_BASE_CHAR
390
+ '\u005a', // 'Z' : XML10_BASE_CHAR
391
+ '\u005f', // '_'
392
+ '\u0061', // 'a' : XML10_BASE_CHAR
393
+ '\u007a', // 'z' : XML10_BASE_CHAR
394
+ '\u00b7', // XML10_EXTENDER
395
+ '\u00c0', // XML10_BASE_CHAR
396
+ '\u00d6', // XML10_BASE_CHAR
397
+ '\u00d8', // XML10_BASE_CHAR
398
+ '\u00f6', // XML10_BASE_CHAR
399
+ '\u00f8', // XML10_BASE_CHAR
400
+ '\u00ff', // XML10_BASE_CHAR
401
+ '\u0100', // XML10_BASE_CHAR
402
+ '\u0300', // XML10_COMBINING_CHAR
403
+ '\u0660', // XML10_DIGIT
404
+ '\u0f29', // XML10_DIGIT
405
+ '\u309a', // XML10_COMBINING_CHAR
406
+ '\u30fe', // XML10_EXTENDER
407
+ '\u4e00', // XML10_IDEOGRAPHIC
408
+ '\u9fa5', // XML10_IDEOGRAPHIC
409
+ '\uac00', // XML10_BASE_CHAR
410
+ '\ud7a3' // XML10_BASE_CHAR
411
+ ];
412
+ var ngSecondChars = [
413
+ '\u0040', // '@' : Non XML10_BASE_CHAR
414
+ '\u005b', // '[' : Non XML10_BASE_CHAR
415
+ '\u0060', // '`' : Non XML10_BASE_CHAR
416
+ '\u007b', // '{' : Non XML10_BASE_CHAR
417
+ '\u00b6', // Edge char for XML10_EXTENDER
418
+ '\u00bf', // Non XML10_BASE_CHAR
419
+ '\u00d7', // Non XML10_BASE_CHAR
420
+ '\u00f7', // Non XML10_BASE_CHAR
421
+ '\u02ff', // Edge char for XML10_COMBINING_CHAR
422
+ '\u309b', // Edge char for XML10_COMBINING_CHAR
423
+ '\u30ff', // Edge char for XML10_EXTENDER
424
+ '\u4dff', // Edge char for XML10_IDEOGRAPHIC
425
+ '\u9fa6', // Edge char for XML10_IDEOGRAPHIC
426
+ '\uabff', // Edge char for XML10_BASE_CHAR
427
+ '\ud7a4' // Edge char for XML10_BASE_CHAR
428
+ ];
429
+
430
+ doTestXmlName('XML10_NAME', new RegExp(XML10_NAME),
431
+ okFirstChars, ngFirstChars, okSecondChars, ngSecondChars);
432
+ }
433
+
434
+ // Test strings for testXml10Attribute() and testXml11Attribute().
435
+ var okAttValues = [
436
+ '""',
437
+ '"foo"',
438
+ '"&lt;foobar"',
439
+ '"foo&lt;bar"',
440
+ '"foobar&lt;"',
441
+ '"&gt;foobar"',
442
+ '"foo&gt;bar"',
443
+ '"foobar&gt;"',
444
+ '"&amp;foobar"',
445
+ '"foo&amp;bar"',
446
+ '"foobar&amp;"',
447
+ '"&quot;foobar"',
448
+ '"foo&quot;bar"',
449
+ '"foobar&quot;"',
450
+ '"\'foobar"',
451
+ '"foo\'bar"',
452
+ '"foobar\'"',
453
+ '"&lt;&amp;&quot;&apos;\'"',
454
+ '"&#102;&#111;&#111;"', // "foo"
455
+ '"&#x66;&#x6f;&#x6f;"', // "foo"
456
+ '"&lt;f&#111;&#x6f;>"', // "<foo>"
457
+ '"&:foo;"',
458
+ '"&_foo;"',
459
+ '"&foo-bar.baz:quux_;"',
460
+ '"foo&\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u540d;bar"',
461
+ "''",
462
+ "'foo'",
463
+ "'&lt;foobar'",
464
+ "'foo&lt;bar'",
465
+ "'foobar&lt;'",
466
+ "'&gt;foobar'",
467
+ "'foo&gt;bar'",
468
+ "'foobar&gt;'",
469
+ "'&amp;foobar'",
470
+ "'foo&amp;bar'",
471
+ "'foobar&amp;'",
472
+ "'&apos;foobar'",
473
+ "'foo&apos;bar'",
474
+ "'foobar&apos;'",
475
+ "'\"foobar'",
476
+ "'foo\"bar'",
477
+ "'foobar\"'",
478
+ "'&lt;&gt;&amp;&quot;&apos;\"'",
479
+ "'&#102;&#111;&#111;'", // 'foo'
480
+ "'&#x66;&#x6f;&#x6f;'", // 'foo'
481
+ "'&lt;f&#111;&#x6f;>'", // '<foo>'
482
+ "'&:foo;'",
483
+ "'&_foo;'",
484
+ "'&foo-bar.baz:quux_;'",
485
+ "'foo&\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u540d;bar'"
486
+ ];
487
+ var ngAttValues = [
488
+ '',
489
+ 'foo', // Must start with '"', end with '"'
490
+ 'foo"', // Must start with '"'
491
+ '"foo', // Must end with '"'
492
+ '"foo\'', // Must end with '"'
493
+ '"<foobar"', // Must not have '<'
494
+ '"foo<bar"', // Must not have '<'
495
+ '"foobar<"', // Must not have '<'
496
+ '"&foobar"', // Must not have '&' that is not an entity ref or char ref
497
+ '"foo&bar"', // Must not have '&' that is not an entity ref or char ref
498
+ '"foobar&"', // Must not have '&' that is not an entity ref or char ref
499
+ '"&-foo;"', // Entity name must be a valid XML10_NAME
500
+ '"&.foo;"', // Entity name must be a valid XML10_NAME
501
+ "",
502
+ "foo", // Must start with "'", end with "'"
503
+ "foo'", // Must start with "'"
504
+ "'foo", // Must end with "'"
505
+ "'foo\"", // Must end with "'"
506
+ "'<foobar'", // Must not have "<"
507
+ "'foo<bar'", // Must not have "<"
508
+ "'foobar<'", // Must not have "<"
509
+ "'&foobar'", // Must not have "&" that is not an entity ref or char ref
510
+ "'foo&bar'", // Must not have "&" that is not an entity ref or char ref
511
+ "'foobar&'", // Must not have "&" that is not an entity ref or char ref
512
+ "'&-foo;'", // Entity name must be a valid XML10_NAME
513
+ "'&.foo;'" // Entity name must be a valid XML10_NAME
514
+ ];
515
+ var ngAttValues2 = [
516
+ '""foobar"', '""',
517
+ '"foo"bar"', '"foo"',
518
+ '"foobar""', '"foobar"',
519
+ "''foobar'", "''",
520
+ "'foo'bar'", "'foo'",
521
+ "'foobar''", "'foobar'"
522
+ ];
523
+ var edgeAttValues = [ // Invalid XML10_ATT_VALUE but valid XML11_ATT_VALUE
524
+ '"&\u0131\u0132;foo"',
525
+ '"f&\u0132\u0133;oo"',
526
+ '"fo&\u0133\u0134;o"',
527
+ '"foo&\u0131\u0132\u0133\u0134;bar"',
528
+ '"baz&\u3001\u3030\u4d00\u9fff;quux"',
529
+ "'&\u0131\u0132;foo'",
530
+ "'f&\u0132\u0133;oo'",
531
+ "'fo&\u0133\u0134;o'",
532
+ "'foo&\u0131\u0132\u0133\u0134;bar'",
533
+ "'baz&\u3001\u3030\u4d00\u9fff;quux'"
534
+ ];
535
+
536
+ // Test XML10_ATTRIBUTE including XML10_ATT_VALUE and XML10_REFERENCE.
537
+ // A difference from testXml11Attribute() is that tests with edge cases
538
+ // should fail here.
539
+ function testXml10Attribute() {
540
+ var regexp = new RegExp(XML10_ATT_VALUE);
541
+ for (var i = 0; i < okAttValues.length; i++) {
542
+ assertOk('XML10_ATT_VALUE with ok #' + i, regexp,
543
+ okAttValues[i], okAttValues[i]);
544
+ }
545
+ for (var i = 0; i < ngAttValues.length; i++) {
546
+ assertNg('XML10_ATT_VALUE with ng #' + i, regexp,
547
+ ngAttValues[i]);
548
+ }
549
+ for (var i = 0; i < ngAttValues2.length; i += 2) {
550
+ assertOk('XML10_ATT_VALUE with ng2 #' + (i / 2), regexp,
551
+ ngAttValues2[i], ngAttValues2[i + 1]);
552
+ }
553
+ for (var i = 0; i < edgeAttValues.length; i++) {
554
+ assertNg('XML10_ATT_VALUE with ng2 #' + i, regexp,
555
+ edgeAttValues[i]);
556
+ }
557
+ }
558
+
559
+ // Test XML11_NAME, including XML11_NAME_START_CHAR and XML11_NAME_CHAR.
560
+ function testXml11Name() {
561
+ var okFirstChars = [
562
+ '\u003a', // ':'
563
+ '\u0041', // 'A' : XML11_NAME_START_CHAR
564
+ '\u005a', // 'Z' : XML11_NAME_START_CHAR
565
+ '\u005f', // '_'
566
+ '\u0061', // 'a' : XML11_NAME_START_CHAR
567
+ '\u007a', // 'z' : XML11_NAME_START_CHAR
568
+ '\u00c0', // XML11_NAME_START_CHAR
569
+ '\u00d6', // XML11_NAME_START_CHAR
570
+ '\u00d8', // XML11_NAME_START_CHAR
571
+ '\u00f6', // XML11_NAME_START_CHAR
572
+ '\u00f8', // XML11_NAME_START_CHAR
573
+ '\u02ff', // XML11_NAME_START_CHAR
574
+ '\u0370', // XML11_NAME_START_CHAR
575
+ '\u037d', // XML11_NAME_START_CHAR
576
+ '\u037f', // XML11_NAME_START_CHAR
577
+ '\u1fff', // XML11_NAME_START_CHAR
578
+ '\u200c', // XML11_NAME_START_CHAR
579
+ '\u200d', // XML11_NAME_START_CHAR
580
+ '\u2070', // XML11_NAME_START_CHAR
581
+ '\u218f', // XML11_NAME_START_CHAR
582
+ '\u2c00', // XML11_NAME_START_CHAR
583
+ '\u2fef', // XML11_NAME_START_CHAR
584
+ '\u3001', // XML11_NAME_START_CHAR
585
+ '\ud7ff', // XML11_NAME_START_CHAR
586
+ '\uf900', // XML11_NAME_START_CHAR
587
+ '\ufdcf', // XML11_NAME_START_CHAR
588
+ '\ufdf0', // XML11_NAME_START_CHAR
589
+ '\ufffd' // XML11_NAME_START_CHAR
590
+ ];
591
+ var ngFirstChars = [
592
+ '\u002d', // '-' : XML11_NAME_CHAR
593
+ '\u002e', // '.' : XML11_NAME_CHAR
594
+ '\u0030', // '0' : XML11_NAME_CHAR
595
+ '\u0039', // '9' : XML11_NAME_CHAR
596
+ '\u003b', // ';' : Non XML11_NAME_START_CHAR
597
+ '\u0040', // '@' : Non XML11_NAME_START_CHAR
598
+ '\u005b', // '[' : Non XML11_NAME_START_CHAR
599
+ '\u005e', // '^' : Non XML11_NAME_START_CHAR
600
+ '\u0060', // '`' : Non XML11_NAME_START_CHAR
601
+ '\u007b', // '{' : Non XML11_NAME_START_CHAR
602
+ '\u00b7', // XML11_NAME_CHAR
603
+ '\u00bf', // Non XML11_NAME_START_CHAR
604
+ '\u00d7', // Non XML11_NAME_START_CHAR
605
+ '\u00f7', // Non XML11_NAME_START_CHAR
606
+ '\u0300', // Non XML11_NAME_START_CHAR / XML11_NAME_CHAR
607
+ '\u036f', // Non XML11_NAME_START_CHAR / XML11_NAME_CHAR
608
+ '\u037e', // Non XML11_NAME_START_CHAR
609
+ '\u2000', // Non XML11_NAME_START_CHAR
610
+ '\u200b', // Non XML11_NAME_START_CHAR
611
+ '\u200e', // Non XML11_NAME_START_CHAR
612
+ '\u203f', // XML11_NAME_CHAR
613
+ '\u2040', // XML11_NAME_CHAR
614
+ '\u206f', // Non XML11_NAME_START_CHAR
615
+ '\u2190', // Non XML11_NAME_START_CHAR
616
+ '\u2bff', // Non XML11_NAME_START_CHAR
617
+ '\u2ff0', // Non XML11_NAME_START_CHAR
618
+ '\u3000', // Non XML11_NAME_START_CHAR
619
+ '\ud800', // Non XML11_NAME_START_CHAR
620
+ '\uf8ff', // Non XML11_NAME_START_CHAR
621
+ '\ufdd0', // Non XML11_NAME_START_CHAR
622
+ '\ufdef', // Non XML11_NAME_START_CHAR
623
+ '\uffff' // Non XML11_NAME_START_CHAR
624
+ ];
625
+ var okSecondChars = [
626
+ '\u002d', // '-' : XML11_NAME_CHAR
627
+ '\u002e', // '.' : XML11_NAME_CHAR
628
+ '\u0030', // '0' : XML11_NAME_CHAR
629
+ '\u0039', // '9' : XML11_NAME_CHAR
630
+ '\u003a', // ':'
631
+ '\u0041', // 'A' : XML11_NAME_START_CHAR
632
+ '\u005a', // 'Z' : XML11_NAME_START_CHAR
633
+ '\u005f', // '_'
634
+ '\u0061', // 'a' : XML11_NAME_START_CHAR
635
+ '\u007a', // 'z' : XML11_NAME_START_CHAR
636
+ '\u00b7', // XML11_NAME_CHAR
637
+ '\u00c0', // XML11_NAME_START_CHAR
638
+ '\u00d6', // XML11_NAME_START_CHAR
639
+ '\u00d8', // XML11_NAME_START_CHAR
640
+ '\u00f6', // XML11_NAME_START_CHAR
641
+ '\u00f8', // XML11_NAME_START_CHAR
642
+ '\u02ff', // XML11_NAME_START_CHAR
643
+ '\u0300', // XML11_NAME_CHAR
644
+ '\u036f', // XML11_NAME_CHAR
645
+ '\u0370', // XML11_NAME_START_CHAR
646
+ '\u037d', // XML11_NAME_START_CHAR
647
+ '\u037f', // XML11_NAME_START_CHAR
648
+ '\u1fff', // XML11_NAME_START_CHAR
649
+ '\u200c', // XML11_NAME_START_CHAR
650
+ '\u200d', // XML11_NAME_START_CHAR
651
+ '\u203f', // XML11_NAME_CHAR
652
+ '\u2040', // XML11_NAME_CHAR
653
+ '\u2070', // XML11_NAME_START_CHAR
654
+ '\u218f', // XML11_NAME_START_CHAR
655
+ '\u2c00', // XML11_NAME_START_CHAR
656
+ '\u2fef', // XML11_NAME_START_CHAR
657
+ '\u3001', // XML11_NAME_START_CHAR
658
+ '\ud7ff', // XML11_NAME_START_CHAR
659
+ '\uf900', // XML11_NAME_START_CHAR
660
+ '\ufdcf', // XML11_NAME_START_CHAR
661
+ '\ufdf0', // XML11_NAME_START_CHAR
662
+ '\ufffd' // XML11_NAME_START_CHAR
663
+ ];
664
+ var ngSecondChars = [
665
+ '\u003b', // ';' : Non XML11_NAME_START_CHAR
666
+ '\u0040', // '@' : Non XML11_NAME_START_CHAR
667
+ '\u005b', // '[' : Non XML11_NAME_START_CHAR
668
+ '\u005e', // '^' : Non XML11_NAME_START_CHAR
669
+ '\u0060', // '`' : Non XML11_NAME_START_CHAR
670
+ '\u007b', // '{' : Non XML11_NAME_START_CHAR
671
+ '\u00bf', // Non XML11_NAME_START_CHAR
672
+ '\u00d7', // Non XML11_NAME_START_CHAR
673
+ '\u00f7', // Non XML11_NAME_START_CHAR
674
+ '\u037e', // Non XML11_NAME_START_CHAR
675
+ '\u2000', // Non XML11_NAME_START_CHAR
676
+ '\u200b', // Non XML11_NAME_START_CHAR
677
+ '\u200e', // Non XML11_NAME_START_CHAR
678
+ '\u206f', // Non XML11_NAME_START_CHAR
679
+ '\u2190', // Non XML11_NAME_START_CHAR
680
+ '\u2bff', // Non XML11_NAME_START_CHAR
681
+ '\u2ff0', // Non XML11_NAME_START_CHAR
682
+ '\u3000', // Non XML11_NAME_START_CHAR
683
+ '\ud800', // Non XML11_NAME_START_CHAR
684
+ '\uf8ff', // Non XML11_NAME_START_CHAR
685
+ '\ufdd0', // Non XML11_NAME_START_CHAR
686
+ '\ufdef', // Non XML11_NAME_START_CHAR
687
+ '\uffff' // Non XML11_NAME_START_CHAR
688
+ ];
689
+
690
+ doTestXmlName('XML11_NAME', new RegExp(XML11_NAME),
691
+ okFirstChars, ngFirstChars, okSecondChars, ngSecondChars);
692
+ }
693
+
694
+ // Test XML11_ATTRIBUTE including XML11_ATT_VALUE and XML11_REFERENCE.
695
+ // A difference from testXml10Attribute() is that tests with edge cases
696
+ // should succeed here.
697
+ function testXml11Attribute() {
698
+ var regexp = new RegExp(XML11_ATT_VALUE);
699
+ for (var i = 0; i < okAttValues.length; i++) {
700
+ assertOk('XML11_ATT_VALUE with ok #' + i, regexp,
701
+ okAttValues[i], okAttValues[i]);
702
+ }
703
+ for (var i = 0; i < ngAttValues.length; i++) {
704
+ assertNg('XML11_ATT_VALUE with ng #' + i, regexp,
705
+ ngAttValues[i]);
706
+ }
707
+ for (var i = 0; i < ngAttValues2.length; i += 2) {
708
+ assertOk('XML11_ATT_VALUE with ng2 #' + (i / 2), regexp,
709
+ ngAttValues2[i], ngAttValues2[i + 1]);
710
+ }
711
+ for (var i = 0; i < edgeAttValues.length; i++) {
712
+ assertOk('XML11_ATT_VALUE with ng2 #' + i, regexp,
713
+ edgeAttValues[i], edgeAttValues[i]);
714
+ }
715
+ }
716
+
717
+ // Test XML_NC_NAME including XML_NC_NAME_CHAR.
718
+ // One difference from testXml10Name() is that ':' is invalid here.
719
+ function testXmlNcName() {
720
+ var okFirstChars = [
721
+ '\u0041', // 'A' : XML10_BASE_CHAR
722
+ '\u005a', // 'Z' : XML10_BASE_CHAR
723
+ '\u005f', // '_'
724
+ '\u0061', // 'a' : XML10_BASE_CHAR
725
+ '\u007a', // 'z' : XML10_BASE_CHAR
726
+ '\u00c0', // XML10_BASE_CHAR
727
+ '\u00d6', // XML10_BASE_CHAR
728
+ '\u00d8', // XML10_BASE_CHAR
729
+ '\u00f6', // XML10_BASE_CHAR
730
+ '\u00f8', // XML10_BASE_CHAR
731
+ '\u00ff', // XML10_BASE_CHAR
732
+ '\u0100', // XML10_BASE_CHAR
733
+ '\u4e00', // XML10_IDEOGRAPHIC
734
+ '\u9fa5', // XML10_IDEOGRAPHIC
735
+ '\uac00', // XML10_BASE_CHAR
736
+ '\ud7a3' // XML10_BASE_CHAR
737
+ ];
738
+ var ngFirstChars = [
739
+ '\u002d', // '-'
740
+ '\u002e', // '.'
741
+ '\u0030', // '0' : First char of XML10_DIGIT
742
+ '\u0039', // '9' : XML10_DIGIT
743
+ '\u003a', // ':' : Valid in XML10_NAME but invalid in XML_NC_NAME
744
+ '\u0040', // '@' : Non XML10_BASE_CHAR
745
+ '\u005b', // '[' : Non XML10_BASE_CHAR
746
+ '\u0060', // '`' : Non XML10_BASE_CHAR
747
+ '\u007b', // '{' : Non XML10_BASE_CHAR
748
+ '\u00b7', // First char of XML10_EXTENDER
749
+ '\u00bf', // Non XML10_BASE_CHAR
750
+ '\u00d7', // Non XML10_BASE_CHAR
751
+ '\u00f7', // Non XML10_BASE_CHAR
752
+ '\u0660', // XML10_DIGIT
753
+ '\u0300', // First char of XML10_COMBINING_CHAR
754
+ '\u0f29', // Last char of XML10_DIGIT
755
+ '\u309a', // Last char of XML10_COMBINING_CHAR
756
+ '\u30fe', // Last char of XML10_EXTENDER
757
+ '\u4dff', // Edge char for XML10_IDEOGRAPHIC
758
+ '\u9fa6', // Edge char for XML10_IDEOGRAPHIC
759
+ '\uabff', // Edge char for XML10_BASE_CHAR
760
+ '\ud7a4' // Edge char for XML10_BASE_CHAR
761
+ ];
762
+ var okSecondChars = [
763
+ '\u002d', // '-'
764
+ '\u002e', // '.'
765
+ '\u0030', // '0' : XML10_DIGIT
766
+ '\u0039', // '9' : XML10_DIGIT
767
+ '\u0041', // 'A' : XML10_BASE_CHAR
768
+ '\u005a', // 'Z' : XML10_BASE_CHAR
769
+ '\u005f', // '_'
770
+ '\u0061', // 'a' : XML10_BASE_CHAR
771
+ '\u007a', // 'z' : XML10_BASE_CHAR
772
+ '\u00b7', // XML10_EXTENDER
773
+ '\u00c0', // XML10_BASE_CHAR
774
+ '\u00d6', // XML10_BASE_CHAR
775
+ '\u00d8', // XML10_BASE_CHAR
776
+ '\u00f6', // XML10_BASE_CHAR
777
+ '\u00f8', // XML10_BASE_CHAR
778
+ '\u00ff', // XML10_BASE_CHAR
779
+ '\u0100', // XML10_BASE_CHAR
780
+ '\u0300', // XML10_COMBINING_CHAR
781
+ '\u309a', // XML10_COMBINING_CHAR
782
+ '\u30fe', // XML10_EXTENDER
783
+ '\u0660', // XML10_DIGIT
784
+ '\u0f29', // XML10_DIGIT
785
+ '\u4e00', // XML10_IDEOGRAPHIC
786
+ '\u9fa5', // XML10_IDEOGRAPHIC
787
+ '\uac00', // XML10_BASE_CHAR
788
+ '\ud7a3' // XML10_BASE_CHAR
789
+ ];
790
+ var ngSecondChars = [
791
+ '\u003a', // ':' : Valid in XML10_NAME but invalid in XML_NC_NAME
792
+ '\u0040', // '@' : Non XML10_BASE_CHAR
793
+ '\u005b', // '[' : Non XML10_BASE_CHAR
794
+ '\u0060', // '`' : Non XML10_BASE_CHAR
795
+ '\u007b', // '{' : Non XML10_BASE_CHAR
796
+ '\u00b6', // Edge char for XML10_EXTENDER
797
+ '\u00bf', // Non XML10_BASE_CHAR
798
+ '\u00d7', // Non XML10_BASE_CHAR
799
+ '\u00f7', // Non XML10_BASE_CHAR
800
+ '\u02ff', // Edge char for XML10_COMBINING_CHAR
801
+ '\u309b', // Edge char for XML10_COMBINING_CHAR
802
+ '\u30ff', // Edge char for XML10_EXTENDER
803
+ '\u4dff', // Edge char for XML10_IDEOGRAPHIC
804
+ '\u9fa6', // Edge char for XML10_IDEOGRAPHIC
805
+ '\uabff', // Edge char for XML10_BASE_CHAR
806
+ '\ud7a4' // Edge char for XML10_BASE_CHAR
807
+ ];
808
+
809
+ doTestXmlName('XML_NC_NAME', new RegExp(XML_NC_NAME),
810
+ okFirstChars, ngFirstChars, okSecondChars, ngSecondChars);
811
+ }