Skip to content
This repository
Browse code

added some basic level2 stuff

  • Loading branch information...
commit fc1c8dd2d016eb220e3d01ca66f7140f26cd6ee3 1 parent 5c0f31f
Elijah Insua authored jos3000 committed

Showing 1 changed file with 38 additions and 246 deletions. Show diff stats Hide diff stats

  1. +38 246 lib/level2/core.js
284 lib/level2/core.js
... ... @@ -1,10 +1,10 @@
1 1 var core = require(__dirname + "/../level1/core").dom.level1.core;
2 2
3   -core.INVALID_STATE_ERR = 11;
4   -core.SYNTAX_ERR = 12
5   -core.INVALID_MODIFICATION_ERR = 13;
6   -core.NAMESPACE_ERR = 14;
7   -core.INVALID_ACCESS_ERR = 15;
  3 +var INVALID_STATE_ERR = core.INVALID_STATE_ERR = 11;
  4 +var SYNTAX_ERR = core.SYNTAX_ERR = 12
  5 +var INVALID_MODIFICATION_ERR = core.INVALID_MODIFICATION_ERR = 13;
  6 +var NAMESPACE_ERR = core.NAMESPACE_ERR = 14;
  7 +var INVALID_ACCESS_ERR = core.INVALID_ACCESS_ERR = 15;
8 8
9 9 core.DOMImplementation.prototype.createDocumentType = function(/* String */ qualifiedName,
10 10 /* String */ publicId,
@@ -62,202 +62,56 @@ core.Element.prototype.getElementsByTagNameNS = function(/* String */ namespaceU
62 62 }
63 63 };
64 64
65   -/*
66   -// File: dom.idl
67   -
68   -#ifndef _DOM_IDL_
69   -#define _DOM_IDL_
70   -
71   -#pragma prefix "w3c.org"
72   -module dom
73   -{
74   -
75   - valuetype DOMString sequence<unsigned short>;
76   -
77   - typedef unsigned long long DOMTimeStamp;
78 65
79   - interface DocumentType;
80   - interface Document;
81   - interface NodeList;
82   - interface NamedNodeMap;
83   - interface Element;
84   -
85   - exception DOMException {
86   - unsigned short code;
87   - };
88   - // ExceptionCode
89   - const unsigned short INDEX_SIZE_ERR = 1;
90   - const unsigned short DOMSTRING_SIZE_ERR = 2;
91   - const unsigned short HIERARCHY_REQUEST_ERR = 3;
92   - const unsigned short WRONG_DOCUMENT_ERR = 4;
93   - const unsigned short INVALID_CHARACTER_ERR = 5;
94   - const unsigned short NO_DATA_ALLOWED_ERR = 6;
95   - const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7;
96   - const unsigned short NOT_FOUND_ERR = 8;
97   - const unsigned short NOT_SUPPORTED_ERR = 9;
98   - const unsigned short INUSE_ATTRIBUTE_ERR = 10;
99   - // Introduced in DOM Level 2:
100   - const unsigned short INVALID_STATE_ERR = 11;
101   - // Introduced in DOM Level 2:
102   - const unsigned short SYNTAX_ERR = 12;
103   - // Introduced in DOM Level 2:
104   - const unsigned short INVALID_MODIFICATION_ERR = 13;
105   - // Introduced in DOM Level 2:
106   - const unsigned short NAMESPACE_ERR = 14;
107   - // Introduced in DOM Level 2:
108   - const unsigned short INVALID_ACCESS_ERR = 15;
  66 +core.Node.prototype.__defineGetter__("ownerDocument", function() {
  67 +
  68 +});
109 69
  70 +core.Node.prototype.isSupported = function(/* string */ feature, /* string */ version) {
  71 +
  72 +
  73 +};
110 74
111   - interface DOMImplementation {
112   - boolean hasFeature(in DOMString feature,
113   - in DOMString version);
114   - // Introduced in DOM Level 2:
115   - DocumentType createDocumentType(in DOMString qualifiedName,
116   - in DOMString publicId,
117   - in DOMString systemId)
118   - raises(DOMException);
119   - // Introduced in DOM Level 2:
120   - Document createDocument(in DOMString namespaceURI,
121   - in DOMString qualifiedName,
122   - in DocumentType doctype)
123   - raises(DOMException);
124   - };
  75 +core.Node.prototype.__defineGetter__("namespaceURI", function() {
  76 +
  77 +});
125 78
126   - interface Node {
  79 +core.Node.prototype.__defineGetter__("prefix", function() {
  80 +
  81 +});
127 82
128   - // NodeType
129   - const unsigned short ELEMENT_NODE = 1;
130   - const unsigned short ATTRIBUTE_NODE = 2;
131   - const unsigned short TEXT_NODE = 3;
132   - const unsigned short CDATA_SECTION_NODE = 4;
133   - const unsigned short ENTITY_REFERENCE_NODE = 5;
134   - const unsigned short ENTITY_NODE = 6;
135   - const unsigned short PROCESSING_INSTRUCTION_NODE = 7;
136   - const unsigned short COMMENT_NODE = 8;
137   - const unsigned short DOCUMENT_NODE = 9;
138   - const unsigned short DOCUMENT_TYPE_NODE = 10;
139   - const unsigned short DOCUMENT_FRAGMENT_NODE = 11;
140   - const unsigned short NOTATION_NODE = 12;
  83 +core.Node.prototype.__defineSetter__("prefix", function() {
  84 + throw new core.DOMException();
  85 +});
141 86
142   - readonly attribute DOMString nodeName;
143   - attribute DOMString nodeValue;
144   - // raises(DOMException) on setting
145   - // raises(DOMException) on retrieval
  87 +core.Node.prototype.__defineGetter__("localName", function() {
  88 +
  89 +});
146 90
147   - readonly attribute unsigned short nodeType;
148   - readonly attribute Node parentNode;
149   - readonly attribute NodeList childNodes;
150   - readonly attribute Node firstChild;
151   - readonly attribute Node lastChild;
152   - readonly attribute Node previousSibling;
153   - readonly attribute Node nextSibling;
154   - readonly attribute NamedNodeMap attributes;
155   - // Modified in DOM Level 2:
156   - readonly attribute Document ownerDocument;
157   - Node insertBefore(in Node newChild,
158   - in Node refChild)
159   - raises(DOMException);
160   - Node replaceChild(in Node newChild,
161   - in Node oldChild)
162   - raises(DOMException);
163   - Node removeChild(in Node oldChild)
164   - raises(DOMException);
165   - Node appendChild(in Node newChild)
166   - raises(DOMException);
167   - boolean hasChildNodes();
168   - Node cloneNode(in boolean deep);
169   - // Modified in DOM Level 2:
170   - void normalize();
171   - // Introduced in DOM Level 2:
172   - boolean isSupported(in DOMString feature,
173   - in DOMString version);
174   - // Introduced in DOM Level 2:
175   - readonly attribute DOMString namespaceURI;
176   - // Introduced in DOM Level 2:
177   - attribute DOMString prefix;
178   - // raises(DOMException) on setting
  91 +/* return boolean */
  92 +core.Node.prototype.hasAttributes = function() {
  93 +
  94 +};
179 95
180   - // Introduced in DOM Level 2:
181   - readonly attribute DOMString localName;
182   - // Introduced in DOM Level 2:
183   - boolean hasAttributes();
184   - };
185 96
186   - interface NodeList {
187   - Node item(in unsigned long index);
188   - readonly attribute unsigned long length;
189   - };
  97 +core.NamedNodeMap.prototype.getNamedItemNS = function(/* string */ namespaceURI,/* string */ localName) {
190 98
191   - interface NamedNodeMap {
192   - Node getNamedItem(in DOMString name);
193   - Node setNamedItem(in Node arg)
194   - raises(DOMException);
195   - Node removeNamedItem(in DOMString name)
196   - raises(DOMException);
197   - Node item(in unsigned long index);
198   - readonly attribute unsigned long length;
199   - // Introduced in DOM Level 2:
200   - Node getNamedItemNS(in DOMString namespaceURI,
201   - in DOMString localName);
202   - // Introduced in DOM Level 2:
203   - Node setNamedItemNS(in Node arg)
204   - raises(DOMException);
205   - // Introduced in DOM Level 2:
206   - Node removeNamedItemNS(in DOMString namespaceURI,
207   - in DOMString localName)
208   - raises(DOMException);
209   - };
  99 +};
210 100
211   - interface CharacterData : Node {
212   - attribute DOMString data;
213   - // raises(DOMException) on setting
214   - // raises(DOMException) on retrieval
  101 +core.NamedNodeMap.prototype.setNamedItemNS = function(/* Node */ arg) { // raises(DOMException)
215 102
216   - readonly attribute unsigned long length;
217   - DOMString substringData(in unsigned long offset,
218   - in unsigned long count)
219   - raises(DOMException);
220   - void appendData(in DOMString arg)
221   - raises(DOMException);
222   - void insertData(in unsigned long offset,
223   - in DOMString arg)
224   - raises(DOMException);
225   - void deleteData(in unsigned long offset,
226   - in unsigned long count)
227   - raises(DOMException);
228   - void replaceData(in unsigned long offset,
229   - in unsigned long count,
230   - in DOMString arg)
231   - raises(DOMException);
232   - };
  103 +};
233 104
234   - interface Attr : Node {
235   - readonly attribute DOMString name;
236   - readonly attribute boolean specified;
237   - attribute DOMString value;
238   - // raises(DOMException) on setting
  105 +core.NamedNodeMap.prototype.removeNamedItemNS = function(/*string */ namespaceURI, /* string */ localName) {
  106 +};
239 107
240   - // Introduced in DOM Level 2:
241   - readonly attribute Element ownerElement;
242   - };
  108 +core.Attr.prototype.__defineGetter__("ownerElement", function() {
243 109
  110 +});
  111 +/*
244 112 interface Element : Node {
245   - readonly attribute DOMString tagName;
246   - DOMString getAttribute(in DOMString name);
247   - void setAttribute(in DOMString name,
248   - in DOMString value)
249   - raises(DOMException);
250   - void removeAttribute(in DOMString name)
251   - raises(DOMException);
252   - Attr getAttributeNode(in DOMString name);
253   - Attr setAttributeNode(in Attr newAttr)
254   - raises(DOMException);
255   - Attr removeAttributeNode(in Attr oldAttr)
256   - raises(DOMException);
257   - NodeList getElementsByTagName(in DOMString name);
258 113 // Introduced in DOM Level 2:
259   - DOMString getAttributeNS(in DOMString namespaceURI,
260   - in DOMString localName);
  114 + DOMString getAttributeNS(in DOMString namespaceURI, in DOMString localName);
261 115 // Introduced in DOM Level 2:
262 116 void setAttributeNS(in DOMString namespaceURI,
263 117 in DOMString qualifiedName,
@@ -283,21 +137,7 @@ module dom
283 137 in DOMString localName);
284 138 };
285 139
286   - interface Text : CharacterData {
287   - Text splitText(in unsigned long offset)
288   - raises(DOMException);
289   - };
290   -
291   - interface Comment : CharacterData {
292   - };
293   -
294   - interface CDATASection : Text {
295   - };
296   -
297 140 interface DocumentType : Node {
298   - readonly attribute DOMString name;
299   - readonly attribute NamedNodeMap entities;
300   - readonly attribute NamedNodeMap notations;
301 141 // Introduced in DOM Level 2:
302 142 readonly attribute DOMString publicId;
303 143 // Introduced in DOM Level 2:
@@ -306,49 +146,7 @@ module dom
306 146 readonly attribute DOMString internalSubset;
307 147 };
308 148
309   - interface Notation : Node {
310   - readonly attribute DOMString publicId;
311   - readonly attribute DOMString systemId;
312   - };
313   -
314   - interface Entity : Node {
315   - readonly attribute DOMString publicId;
316   - readonly attribute DOMString systemId;
317   - readonly attribute DOMString notationName;
318   - };
319   -
320   - interface EntityReference : Node {
321   - };
322   -
323   - interface ProcessingInstruction : Node {
324   - readonly attribute DOMString target;
325   - attribute DOMString data;
326   - // raises(DOMException) on setting
327   -
328   - };
329   -
330   - interface DocumentFragment : Node {
331   - };
332   -
333 149 interface Document : Node {
334   - readonly attribute DocumentType doctype;
335   - readonly attribute DOMImplementation implementation;
336   - readonly attribute Element documentElement;
337   - Element createElement(in DOMString tagName)
338   - raises(DOMException);
339   - DocumentFragment createDocumentFragment();
340   - Text createTextNode(in DOMString data);
341   - Comment createComment(in DOMString data);
342   - CDATASection createCDATASection(in DOMString data)
343   - raises(DOMException);
344   - ProcessingInstruction createProcessingInstruction(in DOMString target,
345   - in DOMString data)
346   - raises(DOMException);
347   - Attr createAttribute(in DOMString name)
348   - raises(DOMException);
349   - EntityReference createEntityReference(in DOMString name)
350   - raises(DOMException);
351   - NodeList getElementsByTagName(in DOMString tagname);
352 150 // Introduced in DOM Level 2:
353 151 Node importNode(in Node importedNode,
354 152 in boolean deep)
@@ -368,14 +166,8 @@ module dom
368 166 Element getElementById(in DOMString elementId);
369 167 };
370 168 };
371   -
372   -#endif // _DOM_IDL_
373   -
374   -
375 169 */
376 170
377   -
378   -
379 171 exports.dom =
380 172 {
381 173 level2 : {

0 comments on commit fc1c8dd

Please sign in to comment.
Something went wrong with that request. Please try again.