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,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 + ']*';
|
data/src/xslt/COPYING
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
-*- mode: text -*-
|
2
|
+
|
3
|
+
Copyright (c) 2005,2006 Google Inc.
|
4
|
+
All rights reserved.
|
5
|
+
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
7
|
+
modification, are permitted provided that the following conditions are
|
8
|
+
met:
|
9
|
+
|
10
|
+
* Redistributions of source code must retain the above copyright
|
11
|
+
notice, this list of conditions and the following disclaimer.
|
12
|
+
|
13
|
+
* Redistributions in binary form must reproduce the above copyright
|
14
|
+
notice, this list of conditions and the following disclaimer in the
|
15
|
+
documentation and/or other materials provided with the
|
16
|
+
distribution.
|
17
|
+
|
18
|
+
* Neither the name of Google Inc. nor the names of its contributors
|
19
|
+
may be used to endorse or promote products derived from this
|
20
|
+
software without specific prior written permission.
|
21
|
+
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
23
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
24
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
25
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
26
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
27
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
28
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
29
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
30
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
31
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
32
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
33
|
+
|
34
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
Contact the author at: <opensource@google.com>.
|
@@ -0,0 +1,136 @@
|
|
1
|
+
2007-11-16 Google Inc. <opensource@google.com>
|
2
|
+
|
3
|
+
* Version 0.8
|
4
|
+
* Released as http://ajaxslt.googlecode.com/svn/tags/release-0-8/
|
5
|
+
|
6
|
+
* Fixed a bug in parsing XPaths that end with "//qname" (Issue 17)
|
7
|
+
|
8
|
+
* Added feature to optionally allow case-insensitive node name
|
9
|
+
comparisons; this is useful when using XPaths on HTML, where
|
10
|
+
node names are not consistent across browsers.
|
11
|
+
|
12
|
+
* Improved performance by relying on getElementsByTagName where
|
13
|
+
possible
|
14
|
+
|
15
|
+
* Workaround IE bug where "javascript:" href attribute is URL
|
16
|
+
encoded. (Issue 19)
|
17
|
+
|
18
|
+
2006-12-28 Google Inc. <opensource@google.com>
|
19
|
+
|
20
|
+
* Version 0.7
|
21
|
+
* Released as http://ajaxslt.googlecode.com/svn/tags/release-0-7/
|
22
|
+
|
23
|
+
* Fixed a bug that semicolons are dropped by the XML parser when a
|
24
|
+
text nodes also contains an entity.
|
25
|
+
|
26
|
+
* Fixed a bug that xsl:variable definitions with a node set value
|
27
|
+
encountered at the root level of the input document would throw an
|
28
|
+
exception.
|
29
|
+
|
30
|
+
* Fixed a bug that XPath expression @* always evaluated to the
|
31
|
+
empty node set.
|
32
|
+
|
33
|
+
* Fixed a bug that xsl:copy would copy only attribute and element
|
34
|
+
nodes.
|
35
|
+
|
36
|
+
* Fixed a bug that if xsl:apply-templates matches multiple
|
37
|
+
templates, the output is sorted according to the order of the
|
38
|
+
matching templates, and not according to the sort order defined
|
39
|
+
for the selected node set to which templates are applied.
|
40
|
+
|
41
|
+
* Added unittests for all fixed bugs.
|
42
|
+
|
43
|
+
* Added wrapper function xmlOwnerDocument() to uniformly access
|
44
|
+
the document on both document nodes and other nodes and use it
|
45
|
+
throughout the xslt processor.
|
46
|
+
|
47
|
+
2006-12-14 Google Inc. <opensource@google.com>
|
48
|
+
|
49
|
+
* Version 0.6
|
50
|
+
* Released as http://ajaxslt.googlecode.com/svn/tags/release-0-6/
|
51
|
+
* Fixes infinite loops in evaluation of XPath axes "ancestor",
|
52
|
+
"ancestor-or-self", "preceding-sibling", "following-sibling".
|
53
|
+
* Fixes evaluation of XPath axes "preceding", "following".
|
54
|
+
* Added unittests for both.
|
55
|
+
* Fixed xmlEscape*() functions to escape *all* markup characters
|
56
|
+
not just the first.
|
57
|
+
* Fixed xsl:copy-of to also copy CDATA and COMMENT nodes.
|
58
|
+
|
59
|
+
2006-09-10 Google Inc. <opensource@google.com>
|
60
|
+
|
61
|
+
* Version 0.5
|
62
|
+
* Released on http://code.google.com/hosting/
|
63
|
+
* General changes:
|
64
|
+
- remove all uses of for-in iteration
|
65
|
+
- rename misc.js to util.js
|
66
|
+
- log window is now in simplelog.js
|
67
|
+
* XPath changes:
|
68
|
+
- fixed id() function
|
69
|
+
- fixed UnionExpr::evaluate()
|
70
|
+
- added support for Unicode chracters
|
71
|
+
* XSLT changes:
|
72
|
+
- fixed xsl:sort in xsl:for-each (again)
|
73
|
+
* DOM changes:
|
74
|
+
- added a few methods
|
75
|
+
* XML parser changes:
|
76
|
+
- parses CDATA sections
|
77
|
+
- parses comments
|
78
|
+
- parses XML declaration
|
79
|
+
- parses Unicode XML markup
|
80
|
+
* Test changes:
|
81
|
+
- added several jsunit tests
|
82
|
+
|
83
|
+
2005-10-19 Google Inc. <opensource@google.com>
|
84
|
+
|
85
|
+
* Version 0.4
|
86
|
+
* XPath changes:
|
87
|
+
- Optimize parsing of very common and simple expressions.
|
88
|
+
- Fix use of XPath operator names -- div, mod, and, or --
|
89
|
+
as node names in abbreviated step expressions.
|
90
|
+
- Fix root node -- it is now set to ownerDocument.
|
91
|
+
* XSLT changes:
|
92
|
+
- Fix xsl:sort in xsl:for-each.
|
93
|
+
* DOM changes:
|
94
|
+
- Add replaceChild(), insertBefore(), removeChild().
|
95
|
+
These are still not needed in XSLT processing, but
|
96
|
+
in another client of the DOM implementation.
|
97
|
+
- DOM nodes are recycled instead of garbage collected,
|
98
|
+
in order to improve performance in some browsers.
|
99
|
+
* Test changes:
|
100
|
+
- Add many more test cases to the XPath tests.
|
101
|
+
- Add a note mentioning jsunit in the README.
|
102
|
+
- Add a DOM unittest file.
|
103
|
+
|
104
|
+
2005-08-27 Google Inc. <opensource@google.com>
|
105
|
+
|
106
|
+
* Version 0.3 (not released on sourceforge)
|
107
|
+
* XPath changes:
|
108
|
+
- Fix implementation of the * node test.
|
109
|
+
- Fix implementation of the substring() function.
|
110
|
+
- Fix non-abbreviated axis names.
|
111
|
+
- Fix filter expressions.
|
112
|
+
* XSLT changes:
|
113
|
+
- Fix xsl:sort.
|
114
|
+
* DOM changes:
|
115
|
+
- Avoid using String.split() that breaks in IE.
|
116
|
+
- Coerce nodeType to number and nodeName and nodeValue to string.
|
117
|
+
- Fix SGML entity replacement of single quotes in attribute values.
|
118
|
+
* Test changes:
|
119
|
+
- Fix end tags of script elements in test HTML files.
|
120
|
+
- Add jsunit tests for xpath.js.
|
121
|
+
|
122
|
+
|
123
|
+
2005-06-29 Google Inc. <opensource@google.com>
|
124
|
+
|
125
|
+
* Version 0.2
|
126
|
+
* Add more missing code
|
127
|
+
- XML parser and simple DOM implementation in dom.js
|
128
|
+
- miscellaneous functions in misc.js.
|
129
|
+
* Add simple test pages that serve as examples.
|
130
|
+
- test-xpath.html tests and demonstrates the XPath parser.
|
131
|
+
- test-xslt.html tests and demonstrates the XSLT processor.
|
132
|
+
- output methods for debugging of XPath expressions added
|
133
|
+
in xpathdebug.js.
|
134
|
+
* Some additions and corrections in README and TODO
|
135
|
+
- renamed XSL-T to XSLT, because that's more common.
|
136
|
+
- miscellaneous updates.
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# Currently, this Makefile has only a "dist" target.
|
2
|
+
|
3
|
+
PACKAGE = ajaxslt
|
4
|
+
VERSION = 0.8
|
5
|
+
|
6
|
+
DIST_FILES = \
|
7
|
+
AUTHORS \
|
8
|
+
ChangeLog \
|
9
|
+
COPYING \
|
10
|
+
Makefile \
|
11
|
+
README \
|
12
|
+
TODO \
|
13
|
+
dom.js \
|
14
|
+
dom_unittest.html \
|
15
|
+
dom_unittest.js \
|
16
|
+
simplelog.js \
|
17
|
+
test/xpath.html \
|
18
|
+
test/xpath_script.js \
|
19
|
+
test/xslt.html \
|
20
|
+
test/xslt_script.js \
|
21
|
+
unittestsuite.html \
|
22
|
+
util.js \
|
23
|
+
xmltoken.js \
|
24
|
+
xmltoken_unittest.html \
|
25
|
+
xmltoken_unittest.js \
|
26
|
+
xpathdebug.js \
|
27
|
+
xpath.js \
|
28
|
+
xpath_unittest.html \
|
29
|
+
xpath_unittest.js \
|
30
|
+
xslt.js \
|
31
|
+
xslt_unittest.html \
|
32
|
+
xslt_unittest.js \
|
33
|
+
|
34
|
+
DIST_NAME = $(PACKAGE)-$(VERSION)
|
35
|
+
DIST_DIR = /tmp/$(DIST_NAME)
|
36
|
+
|
37
|
+
dist: clobber $(DIST_FILES)
|
38
|
+
rm -rf $(DIST_DIR)
|
39
|
+
mkdir $(DIST_DIR)
|
40
|
+
cp -pr $(DIST_FILES) $(DIST_DIR)
|
41
|
+
chmod -R a+r $(DIST_DIR)
|
42
|
+
chmod -R u+w $(DIST_DIR)
|
43
|
+
chmod -R go-w $(DIST_DIR)
|
44
|
+
cd $(DIST_DIR)/.. ; tar cvf $(DIST_NAME).tar $(DIST_NAME) ; gzip $(DIST_NAME).tar
|
45
|
+
mv $(DIST_DIR).tar.gz .
|
46
|
+
rm -rf $(DIST_DIR)
|
47
|
+
|
48
|
+
|
49
|
+
clobber:
|
@@ -0,0 +1,102 @@
|
|
1
|
+
-*- mode: text -*-
|
2
|
+
|
3
|
+
AJAXSLT -- AN XSLT PROCESSOR LIBRARY FOR AJAX APPLICATIONS
|
4
|
+
|
5
|
+
|
6
|
+
INTRODUCTION
|
7
|
+
|
8
|
+
AJAXSLT is an implementation of XSLT in JavaScript. Because XSLT uses
|
9
|
+
XPath, it is also an implementation of XPath that can be used
|
10
|
+
independently of XSLT. This implementation has the advantange that it
|
11
|
+
makes XSLT uniformly available on more browsers than natively provide
|
12
|
+
it, and that it can be extended to still more browsers if
|
13
|
+
necessary.
|
14
|
+
|
15
|
+
AJAXSLT is interesting for developers who strive aggressively for
|
16
|
+
cross browser compatibility of their advanced web applications.
|
17
|
+
|
18
|
+
This implementation of XSLT operates at the DOM level on its input
|
19
|
+
documents. It internally uses a DOM implementation to create the
|
20
|
+
output document, but usually returns the output document as text
|
21
|
+
stream. The DOM to construct the output document can be supplied by
|
22
|
+
the application, or else an internal minimal DOM implementation is
|
23
|
+
used. This DOM comes with a minimal XML parser that can be used to
|
24
|
+
generate a suitable DOM representation of the input documents if they
|
25
|
+
are present as text.
|
26
|
+
|
27
|
+
|
28
|
+
TESTS AND USAGE EXAMPLES
|
29
|
+
|
30
|
+
The files ending in _unittest.html are jsunit test pages. See
|
31
|
+
<http://www.jsunit.net/>. There is a test runner online at
|
32
|
+
<http://www.jsunit.net/runner/testRunner.html>.
|
33
|
+
|
34
|
+
The files xslt.html and xpath.html in the directory test are
|
35
|
+
interactive tests. They can be run directly from the file system; no
|
36
|
+
HTTP server is needed.
|
37
|
+
|
38
|
+
Both unit tests and interactive tests demonstrate the use of the
|
39
|
+
library functions. There is not much more documentation so far.
|
40
|
+
|
41
|
+
CONFORMANCE
|
42
|
+
|
43
|
+
A few features that are required by the XSLT and XPath standards were
|
44
|
+
left out. They are marked in the source code using alert()
|
45
|
+
statements. See xslt.js.
|
46
|
+
|
47
|
+
The DOM implementation is minimal so as to support the XSLT
|
48
|
+
processing, and not intended to be complete.
|
49
|
+
|
50
|
+
The implementation is all agnostic about namespaces. It just expects
|
51
|
+
XSLT elements to have tags that carry the xsl: prefix, but we
|
52
|
+
disregard all namespace declaration for them.
|
53
|
+
|
54
|
+
There are a few nonstandard XPath functions. Grep xpath.js for "ext-"
|
55
|
+
to see their definitions.
|
56
|
+
|
57
|
+
|
58
|
+
BROWSER COMPATIBILITY
|
59
|
+
|
60
|
+
The library works in these browsers:
|
61
|
+
|
62
|
+
- Firefox/1.0, Firefox/1.5
|
63
|
+
|
64
|
+
- Internet Explorer/6.0
|
65
|
+
|
66
|
+
- Safari/1.2, Safari/1.3, Safari/2.0
|
67
|
+
|
68
|
+
- Opera/8.0, Opera/8.5
|
69
|
+
|
70
|
+
- Omniweb TODO(mesch): verify this.
|
71
|
+
|
72
|
+
|
73
|
+
Remarks:
|
74
|
+
|
75
|
+
Safari/1.2 JavaScript is very slow, and apply larger stylesheets
|
76
|
+
usually results in Safari freezing for a few seconds, and showing
|
77
|
+
the beach ball.
|
78
|
+
|
79
|
+
Safari/2.0 has XSLT built in, but it is not exposed to JavaScript,
|
80
|
+
but is only applied to XML documents that have a stylesheet
|
81
|
+
declaration when they are loaded.
|
82
|
+
|
83
|
+
Internet Explorer exposes XSLT via the transformNode() method on the
|
84
|
+
XML DOM. However, this is not avaiable if ActiveX is disabled.
|
85
|
+
|
86
|
+
Firefox exposes XSLT via the XSLTProcessor() object, and XPath in the
|
87
|
+
document object in the DOM, so we don't need all this there.
|
88
|
+
|
89
|
+
The library probably still works in Opera/7.5, but we don't
|
90
|
+
explicitly support this browser version anymore.
|
91
|
+
|
92
|
+
|
93
|
+
REFERENCES
|
94
|
+
|
95
|
+
[XPATH] XPath Specification
|
96
|
+
<http://www.w3.org/TR/1999/REC-xpath-19991116>.
|
97
|
+
[XSLT] XSLT Specification
|
98
|
+
<http://www.w3.org/TR/1999/REC-xslt-19991116>.
|
99
|
+
[DOM] W3C DOM Level 3 Core Specification
|
100
|
+
<http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/>.
|
101
|
+
[ECMA] ECMAScript Language Specification
|
102
|
+
<http://www.ecma-international.org/publications/standards/Ecma-262.htm>.
|