envjs 0.1.7 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.jslintrbrc +29 -0
- data/.project +17 -0
- data/CHANGELOG.rdoc +3 -0
- data/DTD/xhtml-lat1.ent +196 -0
- data/DTD/xhtml-special.ent +80 -0
- data/DTD/xhtml-symbol.ent +237 -0
- data/DTD/xhtml.soc +14 -0
- data/DTD/xhtml1-frameset.dtd +1235 -0
- data/DTD/xhtml1-strict.dtd +978 -0
- data/DTD/xhtml1-transitional.dtd +1201 -0
- data/DTD/xhtml1.dcl +192 -0
- data/Makefile +7 -0
- data/Manifest.txt +287 -0
- data/{README → README.rdoc} +24 -3
- data/Rakefile +196 -0
- data/Wakefile +24 -0
- data/build.properties +9 -0
- data/build.xml +247 -0
- data/gm/jquery.js +6002 -0
- data/gm/mainx.js +2648 -0
- data/gm/sensx.js +135 -0
- data/gm/t.js +6 -0
- data/gm/x.html +76 -0
- data/htmlparser/BrowserTreeBuilder.java +456 -0
- data/htmlparser/README +34 -0
- data/htmlparser/build.sh +38 -0
- data/jsl/jsl +0 -0
- data/jsl/jsl.default.conf +129 -0
- data/jsl/jsl.exe +0 -0
- data/lib/envjs.rb +2 -0
- data/lib/envjs/env.js +22 -3
- data/lib/envjs/event_loop.js +2 -0
- data/lib/envjs/static.js +155 -21
- data/licenses/GPL-LICENSE.txt +278 -0
- data/licenses/MIT-LICENSE.txt +20 -0
- data/src/base64.js +80 -0
- data/src/build.js +6 -0
- data/src/cruft/bad.html +24 -0
- data/src/cruft/dom.js +606 -0
- data/src/cruft/element.js +297 -0
- data/src/cruft/good.html +30 -0
- data/src/cruft/good.js +32 -0
- data/src/cruft/internal.js +81 -0
- data/src/cruft/parser.js +458 -0
- data/src/css/properties.js +293 -0
- data/src/css/rule.js +22 -0
- data/src/css/sizzle.js +717 -0
- data/src/css/stylesheet.js +52 -0
- data/src/dom/attr.js +55 -0
- data/src/dom/cdatasection.js +31 -0
- data/src/dom/characterdata.js +119 -0
- data/src/dom/comment.js +30 -0
- data/src/dom/doctype.js +9 -0
- data/src/dom/document.js +553 -0
- data/src/dom/dom.js +134 -0
- data/src/dom/element.js +217 -0
- data/src/dom/entities.js +273 -0
- data/src/dom/exception.js +28 -0
- data/src/dom/fragment.js +37 -0
- data/src/dom/implementation.js +602 -0
- data/src/dom/instruction.js +51 -0
- data/src/dom/namednodemap.js +374 -0
- data/src/dom/namespace.js +50 -0
- data/src/dom/node.js +618 -0
- data/src/dom/nodelist.js +195 -0
- data/src/dom/parser.js +1207 -0
- data/src/dom/text.js +73 -0
- data/src/event/event.js +39 -0
- data/src/event/mouseevent.js +4 -0
- data/src/event/uievent.js +8 -0
- data/src/html/a.js +110 -0
- data/src/html/anchor.js +80 -0
- data/src/html/area.js +57 -0
- data/src/html/base.js +26 -0
- data/src/html/blockquote-q.js +19 -0
- data/src/html/body.js +19 -0
- data/src/html/button.js +21 -0
- data/src/html/canvas.js +14 -0
- data/src/html/col-colgroup.js +49 -0
- data/src/html/collection.js +72 -0
- data/src/html/cookie.js +151 -0
- data/src/html/del-ins.js +25 -0
- data/src/html/div.js +28 -0
- data/src/html/document.js +359 -0
- data/src/html/element.js +380 -0
- data/src/html/fieldset.js +19 -0
- data/src/html/form.js +484 -0
- data/src/html/frame.js +89 -0
- data/src/html/frameset.js +25 -0
- data/src/html/head.js +44 -0
- data/src/html/html.js +0 -0
- data/src/html/htmlparser.js +340 -0
- data/src/html/iframe.js +26 -0
- data/src/html/image.js +0 -0
- data/src/html/img.js +62 -0
- data/src/html/input-elements.js +307 -0
- data/src/html/input.js +65 -0
- data/src/html/label.js +26 -0
- data/src/html/legend.js +19 -0
- data/src/html/link.js +82 -0
- data/src/html/map.js +22 -0
- data/src/html/meta.js +37 -0
- data/src/html/object.js +89 -0
- data/src/html/optgroup.js +25 -0
- data/src/html/option.js +97 -0
- data/src/html/param.js +38 -0
- data/src/html/script.js +122 -0
- data/src/html/select.js +129 -0
- data/src/html/style.js +31 -0
- data/src/html/table.js +199 -0
- data/src/html/tbody-thead-tfoot.js +91 -0
- data/src/html/td-th.js +18 -0
- data/src/html/textarea.js +25 -0
- data/src/html/title.js +20 -0
- data/src/html/tr.js +114 -0
- data/src/intro.js +141 -0
- data/src/outro.js +70 -0
- data/src/parser/html5.detailed.js +10762 -0
- data/src/parser/html5.min.js +503 -0
- data/src/parser/html5.pretty.js +10815 -0
- data/src/parser/intro.js +42 -0
- data/src/parser/outro.js +9 -0
- data/src/platform/core.js +323 -0
- data/src/platform/johnson.js +479 -0
- data/src/platform/rhino.js +327 -0
- data/src/platform/static/intro.js +41 -0
- data/src/platform/static/outro.js +30 -0
- data/src/profile/aop.js +238 -0
- data/src/profile/profile.js +402 -0
- data/src/serializer/xml.js +21 -0
- data/src/svg/animatedstring.js +25 -0
- data/src/svg/document.js +25 -0
- data/src/svg/element.js +22 -0
- data/src/svg/locatable.js +17 -0
- data/src/svg/rect.js +18 -0
- data/src/svg/rectelement.js +24 -0
- data/src/svg/stylable.js +49 -0
- data/src/svg/svgelement.js +22 -0
- data/src/svg/transformable.js +15 -0
- data/src/window/css.js +15 -0
- data/src/window/dialog.js +16 -0
- data/src/window/document.js +28 -0
- data/src/window/event.js +262 -0
- data/src/window/history.js +62 -0
- data/src/window/location.js +138 -0
- data/src/window/navigator.js +48 -0
- data/src/window/screen.js +53 -0
- data/src/window/timer.js +21 -0
- data/src/window/window.js +284 -0
- data/src/window/xhr.js +127 -0
- data/src/xpath/expression.js +49 -0
- data/src/xpath/implementation.js +2482 -0
- data/src/xpath/result.js +67 -0
- data/src/xpath/util.js +551 -0
- data/src/xpath/xmltoken.js +149 -0
- data/src/xslt/COPYING +34 -0
- data/src/xslt/ajaxslt-0.8.1/AUTHORS +1 -0
- data/src/xslt/ajaxslt-0.8.1/ChangeLog +136 -0
- data/src/xslt/ajaxslt-0.8.1/Makefile +49 -0
- data/src/xslt/ajaxslt-0.8.1/README +102 -0
- data/src/xslt/ajaxslt-0.8.1/TODO +15 -0
- data/src/xslt/ajaxslt-0.8.1/dom.js +566 -0
- data/src/xslt/ajaxslt-0.8.1/dom_unittest.html +24 -0
- data/src/xslt/ajaxslt-0.8.1/dom_unittest.js +131 -0
- data/src/xslt/ajaxslt-0.8.1/simplelog.js +79 -0
- data/src/xslt/ajaxslt-0.8.1/test/xpath.html +18 -0
- data/src/xslt/ajaxslt-0.8.1/test/xpath_script.js +45 -0
- data/src/xslt/ajaxslt-0.8.1/test/xslt.html +58 -0
- data/src/xslt/ajaxslt-0.8.1/test/xslt_script.js +33 -0
- data/src/xslt/ajaxslt-0.8.1/unittestsuite.html +26 -0
- data/src/xslt/ajaxslt-0.8.1/xmltoken.js +149 -0
- data/src/xslt/ajaxslt-0.8.1/xmltoken_unittest.html +18 -0
- data/src/xslt/ajaxslt-0.8.1/xmltoken_unittest.js +811 -0
- data/src/xslt/ajaxslt-0.8.1/xpath_unittest.html +39 -0
- data/src/xslt/ajaxslt-0.8.1/xpath_unittest.js +557 -0
- data/src/xslt/ajaxslt-0.8.1/xpathdebug.js +234 -0
- data/src/xslt/ajaxslt-0.8.1/xslt_unittest.html +138 -0
- data/src/xslt/ajaxslt-0.8.1/xslt_unittest.js +68 -0
- data/src/xslt/implementation.js +625 -0
- data/src/xslt/processor.js +37 -0
- data/src/xslt/util.js +449 -0
- data/test/foo.html +8 -0
- data/test/foo.js +40 -0
- data/test/jquery.js +6002 -0
- data/test/x.js +1 -0
- data/test/y.js +1 -0
- metadata +245 -14
@@ -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
|
+
'�',
|
175
|
+
'	',
|
176
|
+
' ', // ' '
|
177
|
+
'"', // '"'
|
178
|
+
'&', // '&'
|
179
|
+
''', // "'"
|
180
|
+
'<', // "<"
|
181
|
+
'>', // ">"
|
182
|
+
'A', // "A"
|
183
|
+
'd',
|
184
|
+
'✏',
|
185
|
+
'𐀀',
|
186
|
+
'�',
|
187
|
+
'�',
|
188
|
+
'�', // Pi, until all 0-9 appears
|
189
|
+
'�',
|
190
|
+
'	',
|
191
|
+
'
',
|
192
|
+
'',
|
193
|
+
'
',
|
194
|
+
'',
|
195
|
+
' ', // ' '
|
196
|
+
'"', // '"'
|
197
|
+
'&', // '&'
|
198
|
+
''', // "'"
|
199
|
+
'<', // "<"
|
200
|
+
'>', // ">"
|
201
|
+
'A', // "A"
|
202
|
+
'ª', // Both upper letter
|
203
|
+
'»', // Start with upper letter, end with lower letter
|
204
|
+
'Ì', // Start with lower letter, end with upper letter
|
205
|
+
'Ý', // Both lower letter
|
206
|
+
'Ā',
|
207
|
+
'香',
|
208
|
+
'ꪪ',
|
209
|
+
'',
|
210
|
+
'�',
|
211
|
+
'�',
|
212
|
+
'�'
|
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
|
+
'�', // Must end with ';'
|
221
|
+
'	', // Must end with ';'
|
222
|
+
'�:', // Must end with ';'
|
223
|
+
'	:', // Must end with ';'
|
224
|
+
'&# 0;', // Must not have a space char
|
225
|
+
'� ;', // 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
|
+
'�A;', // Must not have A-Fa-f
|
230
|
+
'	F;', // Must not have A-Fa-f
|
231
|
+
'�F;', // Must not have A-Fa-f
|
232
|
+
'	A;', // 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
|
+
'�', // Must end with ';'
|
237
|
+
'	', // Must end with ';'
|
238
|
+
'
', // Must end with ';'
|
239
|
+
'', // Must end with ';'
|
240
|
+
'
', // Must end with ';'
|
241
|
+
'', // Must end with ';'
|
242
|
+
'�:', // Must end with ';'
|
243
|
+
'	:', // Must end with ';'
|
244
|
+
'
:', // Must end with ';'
|
245
|
+
':', // Must end with ';'
|
246
|
+
'
:', // Must end with ';'
|
247
|
+
':', // Must end with ';'
|
248
|
+
'&#x 0', // Must not have a space char
|
249
|
+
'� ', // 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
|
+
'<', // XML predefined entity
|
274
|
+
'>', // XML predefined entity
|
275
|
+
'&', // XML predefined entity
|
276
|
+
'&aps;', // XML predefined entity
|
277
|
+
'"', // XML predefined entity
|
278
|
+
' ', // HTML entity (picked up as a real world example)
|
279
|
+
'©', // HTML entity
|
280
|
+
'®', // HTML entity
|
281
|
+
'À', // HTML entity, starts with upper letter
|
282
|
+
'Ð', // HTML entity, all upper letter
|
283
|
+
'⇐', // HTML entity, starts with lower letter, has upper letter
|
284
|
+
'∴', // 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
|
+
'>', // 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
|
+
'"<foobar"',
|
439
|
+
'"foo<bar"',
|
440
|
+
'"foobar<"',
|
441
|
+
'">foobar"',
|
442
|
+
'"foo>bar"',
|
443
|
+
'"foobar>"',
|
444
|
+
'"&foobar"',
|
445
|
+
'"foo&bar"',
|
446
|
+
'"foobar&"',
|
447
|
+
'""foobar"',
|
448
|
+
'"foo"bar"',
|
449
|
+
'"foobar""',
|
450
|
+
'"\'foobar"',
|
451
|
+
'"foo\'bar"',
|
452
|
+
'"foobar\'"',
|
453
|
+
'"<&"'\'"',
|
454
|
+
'"foo"', // "foo"
|
455
|
+
'"foo"', // "foo"
|
456
|
+
'"<foo>"', // "<foo>"
|
457
|
+
'"&:foo;"',
|
458
|
+
'"&_foo;"',
|
459
|
+
'"&foo-bar.baz:quux_;"',
|
460
|
+
'"foo&\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u540d;bar"',
|
461
|
+
"''",
|
462
|
+
"'foo'",
|
463
|
+
"'<foobar'",
|
464
|
+
"'foo<bar'",
|
465
|
+
"'foobar<'",
|
466
|
+
"'>foobar'",
|
467
|
+
"'foo>bar'",
|
468
|
+
"'foobar>'",
|
469
|
+
"'&foobar'",
|
470
|
+
"'foo&bar'",
|
471
|
+
"'foobar&'",
|
472
|
+
"''foobar'",
|
473
|
+
"'foo'bar'",
|
474
|
+
"'foobar''",
|
475
|
+
"'\"foobar'",
|
476
|
+
"'foo\"bar'",
|
477
|
+
"'foobar\"'",
|
478
|
+
"'<>&"'\"'",
|
479
|
+
"'foo'", // 'foo'
|
480
|
+
"'foo'", // 'foo'
|
481
|
+
"'<foo>'", // '<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
|
+
}
|