envjs19 0.3.8.20101029121421
Sign up to get free protection for your applications and to get access to all the features.
- data/.jslintrbrc +30 -0
- data/.project +17 -0
- data/CHANGELOG.rdoc +57 -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 +280 -0
- data/README.rdoc +65 -0
- data/Rakefile +196 -0
- data/Wakefile +11 -0
- data/bin/envjsrb +257 -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 +35 -0
- data/lib/envjs/event_loop.js +206 -0
- data/lib/envjs/net.rb +3 -0
- data/lib/envjs/net/cgi.rb +94 -0
- data/lib/envjs/net/file.rb +69 -0
- data/lib/envjs/options.rb +11 -0
- data/lib/envjs/runtime.rb +346 -0
- data/lib/envjs/tempfile.rb +24 -0
- 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 +1023 -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 +140 -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 +47 -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 +153 -0
- data/src/html/del-ins.js +25 -0
- data/src/html/div.js +28 -0
- data/src/html/document.js +364 -0
- data/src/html/element.js +382 -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 +103 -0
- data/src/html/param.js +38 -0
- data/src/html/script.js +122 -0
- data/src/html/select.js +132 -0
- data/src/html/style.js +31 -0
- data/src/html/table.js +199 -0
- data/src/html/tbody-thead-tfoot.js +92 -0
- data/src/html/td-th.js +18 -0
- data/src/html/textarea.js +31 -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 +484 -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 +265 -0
- data/src/window/history.js +62 -0
- data/src/window/location.js +156 -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 +135 -0
- data/src/xpath/expression.js +49 -0
- data/src/xpath/implementation.js +2505 -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/base64.js +80 -0
- data/test/call-load-test.js +15 -0
- data/test/data.js +45 -0
- data/test/debug.js +53 -0
- data/test/firebug/errorIcon.png +0 -0
- data/test/firebug/firebug.css +209 -0
- data/test/firebug/firebug.html +23 -0
- data/test/firebug/firebug.js +672 -0
- data/test/firebug/firebugx.js +10 -0
- data/test/firebug/infoIcon.png +0 -0
- data/test/firebug/warningIcon.png +0 -0
- data/test/fixtures/html/events.html +171 -0
- data/test/fixtures/html/iframe1.html +46 -0
- data/test/fixtures/html/iframe1a.html +46 -0
- data/test/fixtures/html/iframe2.html +45 -0
- data/test/fixtures/html/iframe3.html +28 -0
- data/test/fixtures/html/iframeN.html +57 -0
- data/test/fixtures/html/malformed.html +181 -0
- data/test/fixtures/html/scope.html +81 -0
- data/test/fixtures/html/trivial.html +19 -0
- data/test/fixtures/html/with_js.html +26 -0
- data/test/fixtures/images/icon-blue.png +0 -0
- data/test/fixtures/js/external_script.js +1 -0
- data/test/fixtures/js/script.js +1 -0
- data/test/fixtures/js/script_error.js +2 -0
- data/test/foo.html +8 -0
- data/test/foo.js +40 -0
- data/test/html/events.html +171 -0
- data/test/html/iframe1.html +46 -0
- data/test/html/iframe1a.html +46 -0
- data/test/html/iframe2.html +45 -0
- data/test/html/iframe3.html +30 -0
- data/test/html/iframeN.html +57 -0
- data/test/html/malformed.html +181 -0
- data/test/html/scope.html +87 -0
- data/test/html/script.js +1 -0
- data/test/html/trivial.html +19 -0
- data/test/html/with_js.html +26 -0
- data/test/index.html +328 -0
- data/test/java-prototype.js +9 -0
- data/test/jquery.js +6002 -0
- data/test/primary-tests.js +26 -0
- data/test/prototype-test.js +13 -0
- data/test/qunit.js +61 -0
- data/test/qunit/qunit/qunit.css +17 -0
- data/test/qunit/qunit/qunit.js +997 -0
- data/test/scope.html +19 -0
- data/test/scope.rb +24 -0
- data/test/smp/dmathieu/index.html +8 -0
- data/test/specs/dist/env.spec.js +1534 -0
- data/test/specs/envjs.spec.css +46 -0
- data/test/specs/parser/html.js +31 -0
- data/test/specs/parser/spec.html +40 -0
- data/test/specs/parser/xml.js +31 -0
- data/test/specs/qunit.bdd.js +210 -0
- data/test/specs/qunit.css +17 -0
- data/test/specs/qunit.js +997 -0
- data/test/specs/template/spec-0.js +31 -0
- data/test/specs/template/spec-1.js +31 -0
- data/test/specs/template/spec.html +40 -0
- data/test/specs/window/css.js +23 -0
- data/test/specs/window/dialog.js +25 -0
- data/test/specs/window/document.js +23 -0
- data/test/specs/window/event.js +25 -0
- data/test/specs/window/history.js +34 -0
- data/test/specs/window/location.js +34 -0
- data/test/specs/window/navigator.js +71 -0
- data/test/specs/window/screen.js +42 -0
- data/test/specs/window/spec.html +48 -0
- data/test/specs/window/timer.js +26 -0
- data/test/specs/window/window.js +53 -0
- data/test/specs/xhr/spec.html +47 -0
- data/test/specs/xhr/xhr.js +31 -0
- data/test/test.js +10 -0
- data/test/unit/dom.js +44 -0
- data/test/unit/elementmembers.js +92 -0
- data/test/unit/events.js +195 -0
- data/test/unit/fixtures/external_script.js +1 -0
- data/test/unit/form.js +40 -0
- data/test/unit/iframe.js +234 -0
- data/test/unit/insertion.js +23 -0
- data/test/unit/multi-window.js +212 -0
- data/test/unit/nu.validator.js +34 -0
- data/test/unit/onload.js +90 -0
- data/test/unit/parser.js +122 -0
- data/test/unit/prototypecompat.js +22 -0
- data/test/unit/proxy.js +6 -0
- data/test/unit/scope.js +209 -0
- data/test/unit/timer.js +115 -0
- data/test/unit/window.js +57 -0
- data/test/x.js +1 -0
- data/test/y.js +1 -0
- metadata +367 -0
data/src/dom/dom.js
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
// =========================================================================
|
2
|
+
//
|
3
|
+
// xmlw3cdom.js - a W3C compliant DOM parser for XML for <SCRIPT>
|
4
|
+
//
|
5
|
+
// version 3.1
|
6
|
+
//
|
7
|
+
// =========================================================================
|
8
|
+
//
|
9
|
+
// Copyright (C) 2002, 2003, 2004 Jon van Noort (jon@webarcana.com.au), David Joham (djoham@yahoo.com) and Scott Severtson
|
10
|
+
//
|
11
|
+
// This library is free software; you can redistribute it and/or
|
12
|
+
// modify it under the terms of the GNU Lesser General Public
|
13
|
+
// License as published by the Free Software Foundation; either
|
14
|
+
// version 2.1 of the License, or (at your option) any later version.
|
15
|
+
|
16
|
+
// This library is distributed in the hope that it will be useful,
|
17
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
19
|
+
// Lesser General Public License for more details.
|
20
|
+
|
21
|
+
// You should have received a copy of the GNU Lesser General Public
|
22
|
+
// License along with this library; if not, write to the Free Software
|
23
|
+
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
24
|
+
//
|
25
|
+
// visit the XML for <SCRIPT> home page at xmljs.sourceforge.net
|
26
|
+
//
|
27
|
+
// Contains text (used within comments to methods) from the
|
28
|
+
// XML Path Language (XPath) Version 1.0 W3C Recommendation
|
29
|
+
// Copyright © 16 November 1999 World Wide Web Consortium,
|
30
|
+
// (Massachusetts Institute of Technology,
|
31
|
+
// European Research Consortium for Informatics and Mathematics, Keio University).
|
32
|
+
// All Rights Reserved.
|
33
|
+
// (see: http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/)
|
34
|
+
|
35
|
+
/**
|
36
|
+
* @function addClass - add new className to classCollection
|
37
|
+
*
|
38
|
+
* @author Jon van Noort (jon@webarcana.com.au)
|
39
|
+
*
|
40
|
+
* @param classCollectionStr : string - list of existing class names
|
41
|
+
* (separated and top and tailed with '|'s)
|
42
|
+
* @param newClass : string - new class name to add
|
43
|
+
*
|
44
|
+
* @return : string - the new classCollection, with new className appended,
|
45
|
+
* (separated and top and tailed with '|'s)
|
46
|
+
*/
|
47
|
+
function addClass(classCollectionStr, newClass) {
|
48
|
+
if (classCollectionStr) {
|
49
|
+
if (classCollectionStr.indexOf("|"+ newClass +"|") < 0) {
|
50
|
+
classCollectionStr += newClass + "|";
|
51
|
+
}
|
52
|
+
}
|
53
|
+
else {
|
54
|
+
classCollectionStr = "|"+ newClass + "|";
|
55
|
+
}
|
56
|
+
|
57
|
+
return classCollectionStr;
|
58
|
+
}
|
59
|
+
|
60
|
+
///////////////////////
|
61
|
+
// NOT IMPLEMENTED //
|
62
|
+
///////////////////////
|
63
|
+
DOMEntity = function() { alert("DOMEntity.constructor(): Not Implemented" ); };
|
64
|
+
DOMEntityReference = function() { alert("DOMEntityReference.constructor(): Not Implemented"); };
|
65
|
+
DOMNotation = function() { alert("DOMNotation.constructor(): Not Implemented" ); };
|
66
|
+
|
67
|
+
|
68
|
+
Strings = new Object()
|
69
|
+
Strings.WHITESPACE = " \t\n\r";
|
70
|
+
Strings.QUOTES = "\"'";
|
71
|
+
|
72
|
+
Strings.isEmpty = function Strings_isEmpty(strD) {
|
73
|
+
return (strD == null) || (strD.length == 0);
|
74
|
+
};
|
75
|
+
Strings.indexOfNonWhitespace = function Strings_indexOfNonWhitespace(strD, iB, iE) {
|
76
|
+
if(Strings.isEmpty(strD)) return -1;
|
77
|
+
iB = iB || 0;
|
78
|
+
iE = iE || strD.length;
|
79
|
+
|
80
|
+
for(var i = iB; i < iE; i++)
|
81
|
+
if(Strings.WHITESPACE.indexOf(strD.charAt(i)) == -1) {
|
82
|
+
return i;
|
83
|
+
}
|
84
|
+
return -1;
|
85
|
+
};
|
86
|
+
Strings.lastIndexOfNonWhitespace = function Strings_lastIndexOfNonWhitespace(strD, iB, iE) {
|
87
|
+
if(Strings.isEmpty(strD)) return -1;
|
88
|
+
iB = iB || 0;
|
89
|
+
iE = iE || strD.length;
|
90
|
+
|
91
|
+
for(var i = iE - 1; i >= iB; i--)
|
92
|
+
if(Strings.WHITESPACE.indexOf(strD.charAt(i)) == -1)
|
93
|
+
return i;
|
94
|
+
return -1;
|
95
|
+
};
|
96
|
+
Strings.indexOfWhitespace = function Strings_indexOfWhitespace(strD, iB, iE) {
|
97
|
+
if(Strings.isEmpty(strD)) return -1;
|
98
|
+
iB = iB || 0;
|
99
|
+
iE = iE || strD.length;
|
100
|
+
|
101
|
+
for(var i = iB; i < iE; i++)
|
102
|
+
if(Strings.WHITESPACE.indexOf(strD.charAt(i)) != -1)
|
103
|
+
return i;
|
104
|
+
return -1;
|
105
|
+
};
|
106
|
+
Strings.replace = function Strings_replace(strD, iB, iE, strF, strR) {
|
107
|
+
if(Strings.isEmpty(strD)) return "";
|
108
|
+
iB = iB || 0;
|
109
|
+
iE = iE || strD.length;
|
110
|
+
|
111
|
+
return strD.substring(iB, iE).split(strF).join(strR);
|
112
|
+
};
|
113
|
+
Strings.getLineNumber = function Strings_getLineNumber(strD, iP) {
|
114
|
+
if(Strings.isEmpty(strD)) return -1;
|
115
|
+
iP = iP || strD.length;
|
116
|
+
|
117
|
+
return strD.substring(0, iP).split("\n").length
|
118
|
+
};
|
119
|
+
Strings.getColumnNumber = function Strings_getColumnNumber(strD, iP) {
|
120
|
+
if(Strings.isEmpty(strD)) return -1;
|
121
|
+
iP = iP || strD.length;
|
122
|
+
|
123
|
+
var arrD = strD.substring(0, iP).split("\n");
|
124
|
+
var strLine = arrD[arrD.length - 1];
|
125
|
+
arrD.length--;
|
126
|
+
var iLinePos = arrD.join("\n").length;
|
127
|
+
|
128
|
+
return iP - iLinePos;
|
129
|
+
};
|
130
|
+
|
131
|
+
|
132
|
+
StringBuffer = function() {this._a=new Array();};
|
133
|
+
StringBuffer.prototype.append = function StringBuffer_append(d){this._a[this._a.length]=d;};
|
134
|
+
StringBuffer.prototype.toString = function StringBuffer_toString(){return this._a.join("");};
|
data/src/dom/element.js
ADDED
@@ -0,0 +1,217 @@
|
|
1
|
+
$debug("Defining Element");
|
2
|
+
/**
|
3
|
+
* @class DOMElement - By far the vast majority of objects (apart from text) that authors encounter
|
4
|
+
* when traversing a document are Element nodes.
|
5
|
+
* @extends DOMNode
|
6
|
+
* @author Jon van Noort (jon@webarcana.com.au) and David Joham (djoham@yahoo.com)
|
7
|
+
* @param ownerDocument : DOMDocument - The Document object associated with this node.
|
8
|
+
*/
|
9
|
+
var DOMElement = function(ownerDocument) {
|
10
|
+
this.DOMNode = DOMNode;
|
11
|
+
this.DOMNode(ownerDocument);
|
12
|
+
//this.id = null; // the ID of the element
|
13
|
+
};
|
14
|
+
DOMElement.prototype = new DOMNode;
|
15
|
+
__extend__(DOMElement.prototype, {
|
16
|
+
// The name of the element.
|
17
|
+
get tagName(){
|
18
|
+
return this.nodeName;
|
19
|
+
},
|
20
|
+
set tagName(name){
|
21
|
+
this.nodeName = name;
|
22
|
+
},
|
23
|
+
|
24
|
+
addEventListener : function(type, fn, phase){
|
25
|
+
this.ownerDocument._parentWindow.$envx.
|
26
|
+
__addEventListener__(this, type, fn);
|
27
|
+
},
|
28
|
+
removeEventListener : function(type){
|
29
|
+
this.ownerDocument._parentWindow.$envx.
|
30
|
+
__removeEventListener__(this, type);
|
31
|
+
},
|
32
|
+
dispatchEvent : function(event, bubbles){
|
33
|
+
this.ownerDocument._parentWindow.$envx.
|
34
|
+
__dispatchEvent__(this, event, bubbles);
|
35
|
+
},
|
36
|
+
|
37
|
+
getAttribute: function(name) {
|
38
|
+
var ret = null;
|
39
|
+
// if attribute exists, use it
|
40
|
+
var attr = this.attributes.getNamedItem(name);
|
41
|
+
if (attr) {
|
42
|
+
ret = attr.value;
|
43
|
+
}
|
44
|
+
return ret; // if Attribute exists, return its value, otherwise, return null
|
45
|
+
},
|
46
|
+
setAttribute : function (name, value) {
|
47
|
+
// if attribute exists, use it
|
48
|
+
var attr = this.attributes.getNamedItem(name);
|
49
|
+
|
50
|
+
//I had to add this check becuase as the script initializes
|
51
|
+
//the id may be set in the constructor, and the html element
|
52
|
+
//overrides the id property with a getter/setter.
|
53
|
+
if(__ownerDocument__(this)){
|
54
|
+
if (attr===null||attr===undefined) {
|
55
|
+
attr = __ownerDocument__(this).createAttribute(name); // otherwise create it
|
56
|
+
}
|
57
|
+
|
58
|
+
|
59
|
+
// test for exceptions
|
60
|
+
if (__ownerDocument__(this).implementation.errorChecking) {
|
61
|
+
// throw Exception if Attribute is readonly
|
62
|
+
if (attr._readonly) {
|
63
|
+
throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
|
64
|
+
}
|
65
|
+
|
66
|
+
// throw Exception if the value string contains an illegal character
|
67
|
+
if (!__isValidString__(value)) {
|
68
|
+
throw(new DOMException(DOMException.INVALID_CHARACTER_ERR));
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
/*if (__isIdDeclaration__(name)) {
|
73
|
+
this.id = value; // cache ID for getElementById()
|
74
|
+
}*/
|
75
|
+
|
76
|
+
// assign values to properties (and aliases)
|
77
|
+
attr.value = value + '';
|
78
|
+
|
79
|
+
// add/replace Attribute in NamedNodeMap
|
80
|
+
this.attributes.setNamedItem(attr);
|
81
|
+
}else{
|
82
|
+
$warn('Element has no owner document '+this.tagName+'\n\t cant set attribute ' + name + ' = '+value );
|
83
|
+
}
|
84
|
+
},
|
85
|
+
removeAttribute : function removeAttribute(name) {
|
86
|
+
// delegate to DOMNamedNodeMap.removeNamedItem
|
87
|
+
return this.attributes.removeNamedItem(name);
|
88
|
+
},
|
89
|
+
getAttributeNode : function getAttributeNode(name) {
|
90
|
+
// delegate to DOMNamedNodeMap.getNamedItem
|
91
|
+
return this.attributes.getNamedItem(name);
|
92
|
+
},
|
93
|
+
setAttributeNode: function(newAttr) {
|
94
|
+
// if this Attribute is an ID
|
95
|
+
if (__isIdDeclaration__(newAttr.name)) {
|
96
|
+
this.id = newAttr.value; // cache ID for getElementById()
|
97
|
+
}
|
98
|
+
// delegate to DOMNamedNodeMap.setNamedItem
|
99
|
+
return this.attributes.setNamedItem(newAttr);
|
100
|
+
},
|
101
|
+
removeAttributeNode: function(oldAttr) {
|
102
|
+
// throw Exception if Attribute is readonly
|
103
|
+
if (__ownerDocument__(this).implementation.errorChecking && oldAttr._readonly) {
|
104
|
+
throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
|
105
|
+
}
|
106
|
+
|
107
|
+
// get item index
|
108
|
+
var itemIndex = this.attributes._findItemIndex(oldAttr._id);
|
109
|
+
|
110
|
+
// throw Exception if node does not exist in this map
|
111
|
+
if (__ownerDocument__(this).implementation.errorChecking && (itemIndex < 0)) {
|
112
|
+
throw(new DOMException(DOMException.NOT_FOUND_ERR));
|
113
|
+
}
|
114
|
+
|
115
|
+
return this.attributes._removeChild(itemIndex);
|
116
|
+
},
|
117
|
+
getAttributeNS : function(namespaceURI, localName) {
|
118
|
+
var ret = "";
|
119
|
+
// delegate to DOMNAmedNodeMap.getNamedItemNS
|
120
|
+
var attr = this.attributes.getNamedItemNS(namespaceURI, localName);
|
121
|
+
if (attr) {
|
122
|
+
ret = attr.value;
|
123
|
+
}
|
124
|
+
return ret; // if Attribute exists, return its value, otherwise return ""
|
125
|
+
},
|
126
|
+
setAttributeNS : function(namespaceURI, qualifiedName, value) {
|
127
|
+
// call DOMNamedNodeMap.getNamedItem
|
128
|
+
var attr = this.attributes.getNamedItem(namespaceURI, qualifiedName);
|
129
|
+
|
130
|
+
if (!attr) { // if Attribute exists, use it
|
131
|
+
// otherwise create it
|
132
|
+
attr = __ownerDocument__(this).createAttributeNS(namespaceURI, qualifiedName);
|
133
|
+
}
|
134
|
+
|
135
|
+
var value = value+'';
|
136
|
+
|
137
|
+
// test for exceptions
|
138
|
+
if (__ownerDocument__(this).implementation.errorChecking) {
|
139
|
+
// throw Exception if Attribute is readonly
|
140
|
+
if (attr._readonly) {
|
141
|
+
throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
|
142
|
+
}
|
143
|
+
|
144
|
+
// throw Exception if the Namespace is invalid
|
145
|
+
if (!__isValidNamespace__(namespaceURI, qualifiedName)) {
|
146
|
+
throw(new DOMException(DOMException.NAMESPACE_ERR));
|
147
|
+
}
|
148
|
+
|
149
|
+
// throw Exception if the value string contains an illegal character
|
150
|
+
if (!__isValidString__(value)) {
|
151
|
+
throw(new DOMException(DOMException.INVALID_CHARACTER_ERR));
|
152
|
+
}
|
153
|
+
}
|
154
|
+
|
155
|
+
// if this Attribute is an ID
|
156
|
+
/* if (__isIdDeclaration__(name)) {
|
157
|
+
this.id = value; // cache ID for getElementById()
|
158
|
+
} */
|
159
|
+
|
160
|
+
// assign values to properties (and aliases)
|
161
|
+
attr.value = value;
|
162
|
+
attr.nodeValue = value;
|
163
|
+
|
164
|
+
// delegate to DOMNamedNodeMap.setNamedItem
|
165
|
+
this.attributes.setNamedItemNS(attr);
|
166
|
+
},
|
167
|
+
removeAttributeNS : function(namespaceURI, localName) {
|
168
|
+
// delegate to DOMNamedNodeMap.removeNamedItemNS
|
169
|
+
return this.attributes.removeNamedItemNS(namespaceURI, localName);
|
170
|
+
},
|
171
|
+
getAttributeNodeNS : function(namespaceURI, localName) {
|
172
|
+
// delegate to DOMNamedNodeMap.getNamedItemNS
|
173
|
+
return this.attributes.getNamedItemNS(namespaceURI, localName);
|
174
|
+
},
|
175
|
+
setAttributeNodeNS : function(newAttr) {
|
176
|
+
// if this Attribute is an ID
|
177
|
+
if ((newAttr.prefix == "") && __isIdDeclaration__(newAttr.name)) {
|
178
|
+
this.id = newAttr.value+''; // cache ID for getElementById()
|
179
|
+
}
|
180
|
+
|
181
|
+
// delegate to DOMNamedNodeMap.setNamedItemNS
|
182
|
+
return this.attributes.setNamedItemNS(newAttr);
|
183
|
+
},
|
184
|
+
hasAttribute : function(name) {
|
185
|
+
// delegate to DOMNamedNodeMap._hasAttribute
|
186
|
+
return __hasAttribute__(this.attributes,name);
|
187
|
+
},
|
188
|
+
hasAttributeNS : function(namespaceURI, localName) {
|
189
|
+
// delegate to DOMNamedNodeMap._hasAttributeNS
|
190
|
+
return __hasAttributeNS__(this.attributes, namespaceURI, localName);
|
191
|
+
},
|
192
|
+
get nodeType(){
|
193
|
+
return DOMNode.ELEMENT_NODE;
|
194
|
+
},
|
195
|
+
get xml() {
|
196
|
+
var ret = "";
|
197
|
+
|
198
|
+
// serialize namespace declarations
|
199
|
+
var ns = this._namespaces.xml;
|
200
|
+
if (ns.length > 0) ns = " "+ ns;
|
201
|
+
|
202
|
+
// serialize Attribute declarations
|
203
|
+
var attrs = this.attributes.xml;
|
204
|
+
|
205
|
+
// serialize this Element
|
206
|
+
ret += "<" + this.nodeName.toLowerCase() + ns + attrs +">";
|
207
|
+
ret += this.childNodes.xml;
|
208
|
+
ret += "</" + this.nodeName.toLowerCase() + ">";
|
209
|
+
|
210
|
+
return ret;
|
211
|
+
},
|
212
|
+
toString : function(){
|
213
|
+
return "Element #"+this._id + " "+ this.tagName + (this.id?" => "+this.id:'');
|
214
|
+
}
|
215
|
+
});
|
216
|
+
|
217
|
+
// $w.Element = DOMElement;
|
data/src/dom/entities.js
ADDED
@@ -0,0 +1,273 @@
|
|
1
|
+
/**
|
2
|
+
* @author Glen Ivey (gleneivey@wontology.org)
|
3
|
+
*/
|
4
|
+
|
5
|
+
$debug("Instantiating list of HTML4 standard entities");
|
6
|
+
/*
|
7
|
+
* $w.$entityDefinitions
|
8
|
+
*/
|
9
|
+
|
10
|
+
var $entityDefinitions = {
|
11
|
+
// content taken from W3C "HTML 4.01 Specification"
|
12
|
+
// "W3C Recommendation 24 December 1999"
|
13
|
+
|
14
|
+
nbsp: "\u00A0",
|
15
|
+
iexcl: "\u00A1",
|
16
|
+
cent: "\u00A2",
|
17
|
+
pound: "\u00A3",
|
18
|
+
curren: "\u00A4",
|
19
|
+
yen: "\u00A5",
|
20
|
+
brvbar: "\u00A6",
|
21
|
+
sect: "\u00A7",
|
22
|
+
uml: "\u00A8",
|
23
|
+
copy: "\u00A9",
|
24
|
+
ordf: "\u00AA",
|
25
|
+
laquo: "\u00AB",
|
26
|
+
not: "\u00AC",
|
27
|
+
shy: "\u00AD",
|
28
|
+
reg: "\u00AE",
|
29
|
+
macr: "\u00AF",
|
30
|
+
deg: "\u00B0",
|
31
|
+
plusmn: "\u00B1",
|
32
|
+
sup2: "\u00B2",
|
33
|
+
sup3: "\u00B3",
|
34
|
+
acute: "\u00B4",
|
35
|
+
micro: "\u00B5",
|
36
|
+
para: "\u00B6",
|
37
|
+
middot: "\u00B7",
|
38
|
+
cedil: "\u00B8",
|
39
|
+
sup1: "\u00B9",
|
40
|
+
ordm: "\u00BA",
|
41
|
+
raquo: "\u00BB",
|
42
|
+
frac14: "\u00BC",
|
43
|
+
frac12: "\u00BD",
|
44
|
+
frac34: "\u00BE",
|
45
|
+
iquest: "\u00BF",
|
46
|
+
Agrave: "\u00C0",
|
47
|
+
Aacute: "\u00C1",
|
48
|
+
Acirc: "\u00C2",
|
49
|
+
Atilde: "\u00C3",
|
50
|
+
Auml: "\u00C4",
|
51
|
+
Aring: "\u00C5",
|
52
|
+
AElig: "\u00C6",
|
53
|
+
Ccedil: "\u00C7",
|
54
|
+
Egrave: "\u00C8",
|
55
|
+
Eacute: "\u00C9",
|
56
|
+
Ecirc: "\u00CA",
|
57
|
+
Euml: "\u00CB",
|
58
|
+
Igrave: "\u00CC",
|
59
|
+
Iacute: "\u00CD",
|
60
|
+
Icirc: "\u00CE",
|
61
|
+
Iuml: "\u00CF",
|
62
|
+
ETH: "\u00D0",
|
63
|
+
Ntilde: "\u00D1",
|
64
|
+
Ograve: "\u00D2",
|
65
|
+
Oacute: "\u00D3",
|
66
|
+
Ocirc: "\u00D4",
|
67
|
+
Otilde: "\u00D5",
|
68
|
+
Ouml: "\u00D6",
|
69
|
+
times: "\u00D7",
|
70
|
+
Oslash: "\u00D8",
|
71
|
+
Ugrave: "\u00D9",
|
72
|
+
Uacute: "\u00DA",
|
73
|
+
Ucirc: "\u00DB",
|
74
|
+
Uuml: "\u00DC",
|
75
|
+
Yacute: "\u00DD",
|
76
|
+
THORN: "\u00DE",
|
77
|
+
szlig: "\u00DF",
|
78
|
+
agrave: "\u00E0",
|
79
|
+
aacute: "\u00E1",
|
80
|
+
acirc: "\u00E2",
|
81
|
+
atilde: "\u00E3",
|
82
|
+
auml: "\u00E4",
|
83
|
+
aring: "\u00E5",
|
84
|
+
aelig: "\u00E6",
|
85
|
+
ccedil: "\u00E7",
|
86
|
+
egrave: "\u00E8",
|
87
|
+
eacute: "\u00E9",
|
88
|
+
ecirc: "\u00EA",
|
89
|
+
euml: "\u00EB",
|
90
|
+
igrave: "\u00EC",
|
91
|
+
iacute: "\u00ED",
|
92
|
+
icirc: "\u00EE",
|
93
|
+
iuml: "\u00EF",
|
94
|
+
eth: "\u00F0",
|
95
|
+
ntilde: "\u00F1",
|
96
|
+
ograve: "\u00F2",
|
97
|
+
oacute: "\u00F3",
|
98
|
+
ocirc: "\u00F4",
|
99
|
+
otilde: "\u00F5",
|
100
|
+
ouml: "\u00F6",
|
101
|
+
divide: "\u00F7",
|
102
|
+
oslash: "\u00F8",
|
103
|
+
ugrave: "\u00F9",
|
104
|
+
uacute: "\u00FA",
|
105
|
+
ucirc: "\u00FB",
|
106
|
+
uuml: "\u00FC",
|
107
|
+
yacute: "\u00FD",
|
108
|
+
thorn: "\u00FE",
|
109
|
+
yuml: "\u00FF",
|
110
|
+
fnof: "\u0192",
|
111
|
+
Alpha: "\u0391",
|
112
|
+
Beta: "\u0392",
|
113
|
+
Gamma: "\u0393",
|
114
|
+
Delta: "\u0394",
|
115
|
+
Epsilon: "\u0395",
|
116
|
+
Zeta: "\u0396",
|
117
|
+
Eta: "\u0397",
|
118
|
+
Theta: "\u0398",
|
119
|
+
Iota: "\u0399",
|
120
|
+
Kappa: "\u039A",
|
121
|
+
Lambda: "\u039B",
|
122
|
+
Mu: "\u039C",
|
123
|
+
Nu: "\u039D",
|
124
|
+
Xi: "\u039E",
|
125
|
+
Omicron: "\u039F",
|
126
|
+
Pi: "\u03A0",
|
127
|
+
Rho: "\u03A1",
|
128
|
+
Sigma: "\u03A3",
|
129
|
+
Tau: "\u03A4",
|
130
|
+
Upsilon: "\u03A5",
|
131
|
+
Phi: "\u03A6",
|
132
|
+
Chi: "\u03A7",
|
133
|
+
Psi: "\u03A8",
|
134
|
+
Omega: "\u03A9",
|
135
|
+
alpha: "\u03B1",
|
136
|
+
beta: "\u03B2",
|
137
|
+
gamma: "\u03B3",
|
138
|
+
delta: "\u03B4",
|
139
|
+
epsilon: "\u03B5",
|
140
|
+
zeta: "\u03B6",
|
141
|
+
eta: "\u03B7",
|
142
|
+
theta: "\u03B8",
|
143
|
+
iota: "\u03B9",
|
144
|
+
kappa: "\u03BA",
|
145
|
+
lambda: "\u03BB",
|
146
|
+
mu: "\u03BC",
|
147
|
+
nu: "\u03BD",
|
148
|
+
xi: "\u03BE",
|
149
|
+
omicron: "\u03BF",
|
150
|
+
pi: "\u03C0",
|
151
|
+
rho: "\u03C1",
|
152
|
+
sigmaf: "\u03C2",
|
153
|
+
sigma: "\u03C3",
|
154
|
+
tau: "\u03C4",
|
155
|
+
upsilon: "\u03C5",
|
156
|
+
phi: "\u03C6",
|
157
|
+
chi: "\u03C7",
|
158
|
+
psi: "\u03C8",
|
159
|
+
omega: "\u03C9",
|
160
|
+
thetasym: "\u03D1",
|
161
|
+
upsih: "\u03D2",
|
162
|
+
piv: "\u03D6",
|
163
|
+
bull: "\u2022",
|
164
|
+
hellip: "\u2026",
|
165
|
+
prime: "\u2032",
|
166
|
+
Prime: "\u2033",
|
167
|
+
oline: "\u203E",
|
168
|
+
frasl: "\u2044",
|
169
|
+
weierp: "\u2118",
|
170
|
+
image: "\u2111",
|
171
|
+
real: "\u211C",
|
172
|
+
trade: "\u2122",
|
173
|
+
alefsym: "\u2135",
|
174
|
+
larr: "\u2190",
|
175
|
+
uarr: "\u2191",
|
176
|
+
rarr: "\u2192",
|
177
|
+
darr: "\u2193",
|
178
|
+
harr: "\u2194",
|
179
|
+
crarr: "\u21B5",
|
180
|
+
lArr: "\u21D0",
|
181
|
+
uArr: "\u21D1",
|
182
|
+
rArr: "\u21D2",
|
183
|
+
dArr: "\u21D3",
|
184
|
+
hArr: "\u21D4",
|
185
|
+
forall: "\u2200",
|
186
|
+
part: "\u2202",
|
187
|
+
exist: "\u2203",
|
188
|
+
empty: "\u2205",
|
189
|
+
nabla: "\u2207",
|
190
|
+
isin: "\u2208",
|
191
|
+
notin: "\u2209",
|
192
|
+
ni: "\u220B",
|
193
|
+
prod: "\u220F",
|
194
|
+
sum: "\u2211",
|
195
|
+
minus: "\u2212",
|
196
|
+
lowast: "\u2217",
|
197
|
+
radic: "\u221A",
|
198
|
+
prop: "\u221D",
|
199
|
+
infin: "\u221E",
|
200
|
+
ang: "\u2220",
|
201
|
+
and: "\u2227",
|
202
|
+
or: "\u2228",
|
203
|
+
cap: "\u2229",
|
204
|
+
cup: "\u222A",
|
205
|
+
intXX: "\u222B",
|
206
|
+
there4: "\u2234",
|
207
|
+
sim: "\u223C",
|
208
|
+
cong: "\u2245",
|
209
|
+
asymp: "\u2248",
|
210
|
+
ne: "\u2260",
|
211
|
+
equiv: "\u2261",
|
212
|
+
le: "\u2264",
|
213
|
+
ge: "\u2265",
|
214
|
+
sub: "\u2282",
|
215
|
+
sup: "\u2283",
|
216
|
+
nsub: "\u2284",
|
217
|
+
sube: "\u2286",
|
218
|
+
supe: "\u2287",
|
219
|
+
oplus: "\u2295",
|
220
|
+
otimes: "\u2297",
|
221
|
+
perp: "\u22A5",
|
222
|
+
sdot: "\u22C5",
|
223
|
+
lceil: "\u2308",
|
224
|
+
rceil: "\u2309",
|
225
|
+
lfloor: "\u230A",
|
226
|
+
rfloor: "\u230B",
|
227
|
+
lang: "\u2329",
|
228
|
+
rang: "\u232A",
|
229
|
+
loz: "\u25CA",
|
230
|
+
spades: "\u2660",
|
231
|
+
clubs: "\u2663",
|
232
|
+
hearts: "\u2665",
|
233
|
+
diams: "\u2666",
|
234
|
+
quot: "\u0022",
|
235
|
+
amp: "\u0026",
|
236
|
+
lt: "\u003C",
|
237
|
+
gt: "\u003E",
|
238
|
+
OElig: "\u0152",
|
239
|
+
oelig: "\u0153",
|
240
|
+
Scaron: "\u0160",
|
241
|
+
scaron: "\u0161",
|
242
|
+
Yuml: "\u0178",
|
243
|
+
circ: "\u02C6",
|
244
|
+
tilde: "\u02DC",
|
245
|
+
ensp: "\u2002",
|
246
|
+
emsp: "\u2003",
|
247
|
+
thinsp: "\u2009",
|
248
|
+
zwnj: "\u200C",
|
249
|
+
zwj: "\u200D",
|
250
|
+
lrm: "\u200E",
|
251
|
+
rlm: "\u200F",
|
252
|
+
ndash: "\u2013",
|
253
|
+
mdash: "\u2014",
|
254
|
+
lsquo: "\u2018",
|
255
|
+
rsquo: "\u2019",
|
256
|
+
sbquo: "\u201A",
|
257
|
+
ldquo: "\u201C",
|
258
|
+
rdquo: "\u201D",
|
259
|
+
bdquo: "\u201E",
|
260
|
+
dagger: "\u2020",
|
261
|
+
Dagger: "\u2021",
|
262
|
+
permil: "\u2030",
|
263
|
+
lsaquo: "\u2039",
|
264
|
+
rsaquo: "\u203A",
|
265
|
+
euro: "\u20AC",
|
266
|
+
|
267
|
+
// non-standard entities
|
268
|
+
apos: "'"
|
269
|
+
};
|
270
|
+
|
271
|
+
|
272
|
+
// $w.$entityDefinitions = $entityDefinitions;
|
273
|
+
|