Permalink
Browse files

merging Aria's changes

  • Loading branch information...
2 parents 53f5763 + 20e006f commit 8fbb5e4ef35192eec0d99d1895ca47a9d4e358b5 @tmpvar committed Sep 8, 2010
Showing with 975 additions and 378 deletions.
  1. +7 −1 lib/jsdom/browser/htmltodom.js
  2. +1 −1 lib/jsdom/browser/index.js
  3. +39 −9 lib/jsdom/level1/core.js
  4. +253 −76 lib/jsdom/level2/core.js
  5. +12 −23 test/level2/core.js
  6. +159 −0 test/level2/core/files/hc_staff.xml.js
  7. BIN test/level2/core/files/{ → orig}/back.gif
  8. BIN test/level2/core/files/{ → orig}/blank.gif
  9. 0 test/level2/core/files/{ → orig}/hc_staff.html
  10. 0 test/level2/core/files/{ → orig}/hc_staff.html.1
  11. 0 test/level2/core/files/{ → orig}/hc_staff.svg
  12. 0 test/level2/core/files/{ → orig}/hc_staff.xhtml
  13. 0 test/level2/core/files/{ → orig}/hc_staff.xhtml.1
  14. 0 test/level2/core/files/{ → orig}/hc_staff.xml
  15. BIN test/level2/core/files/{ → orig}/image2.gif
  16. 0 test/level2/core/files/{ → orig}/index.html
  17. 0 test/level2/core/files/{ → orig}/index.html.1
  18. 0 test/level2/core/files/{ → orig}/index.html?C=D;O=A
  19. 0 test/level2/core/files/{ → orig}/index.html?C=M;O=A
  20. 0 test/level2/core/files/{ → orig}/index.html?C=N;O=D
  21. 0 test/level2/core/files/{ → orig}/index.html?C=S;O=A
  22. 0 test/level2/core/files/{ → orig}/internalSubset01.js
  23. 0 test/level2/core/files/{ → orig}/nodtdstaff.svg
  24. 0 test/level2/core/files/{ → orig}/nodtdstaff.svg.1
  25. 0 test/level2/core/files/{ → orig}/nodtdstaff.xml
  26. 0 test/level2/core/files/{ → orig}/nodtdstaff.xml.1
  27. 0 test/level2/core/files/{ → orig}/robots.txt
  28. 0 test/level2/core/files/{ → orig}/staff.dtd
  29. 0 test/level2/core/files/{ → orig}/staff.dtd.1
  30. 0 test/level2/core/files/{ → orig}/staff.svg
  31. 0 test/level2/core/files/{ → orig}/staff.svg.1
  32. 0 test/level2/core/files/{ → orig}/staff.xml
  33. 0 test/level2/core/files/{ → orig}/staff.xml.1
  34. 0 test/level2/core/files/{ → orig}/staff2.dtd
  35. 0 test/level2/core/files/{ → orig}/staff2.svg
  36. 0 test/level2/core/files/{ → orig}/staff2.xml
  37. 0 test/level2/core/files/{ → orig}/staff2.xml.1
  38. 0 test/level2/core/files/{ → orig}/staffNS.dtd
  39. 0 test/level2/core/files/{ → orig}/staffNS.dtd.1
  40. 0 test/level2/core/files/{ → orig}/staffNS.svg
  41. 0 test/level2/core/files/{ → orig}/staffNS.svg.1
  42. +9 −0 test/level2/core/files/{ → orig}/staffNS.xml
  43. 0 test/level2/core/files/{ → orig}/svgtest.js
  44. 0 test/level2/core/files/{ → orig}/svgunit.js
  45. BIN test/level2/core/files/{ → orig}/text.gif
  46. BIN test/level2/core/files/{ → orig}/unknown.gif
  47. 0 test/level2/core/files/{ → orig}/xhtml-lat1.ent
  48. 0 test/level2/core/files/{ → orig}/xhtml-special.ent
  49. 0 test/level2/core/files/{ → orig}/xhtml-symbol.ent
  50. 0 test/level2/core/files/{ → orig}/xhtml1-frameset.dtd
  51. 0 test/level2/core/files/{ → orig}/xhtml1-strict.dtd
  52. 0 test/level2/core/files/{ → orig}/xhtml1-transitional.dtd
  53. +159 −0 test/level2/core/files/staff.xml.js
  54. +159 −0 test/level2/core/files/staff2.xml.js
  55. +0 −59 test/level2/core/files/staffNS.xml.1
  56. +173 −206 test/level2/core/files/staffNS.xml.js
  57. +4 −3 test/runner.js
@@ -74,7 +74,13 @@ var HtmlToDom = function(parser){
}
-
+ } else if(parser && parser.moduleName == 'HTML5') { /* HTML5 parser */
+ this.appendHtmlToElement = function(html, element) {
+ if(typeof html !== 'string') html += '';
+ var p = new parser.Parser({document: element.ownerDocument});
+ var tree = p.parse_fragment(html, element);
+ throw new Error("Fixme!");
+ }
} else {
this.appendHtmlToElement = function(){
@@ -56,7 +56,7 @@ exports.windowAugmentation = function(dom, options) {
Window.document.documentElement.appendChild(Window.document.createElement('head'));
Window.document.documentElement.appendChild(Window.document.createElement('body'));
- Window.document.getElementsByTagName('head')[0].appendChild(Window.document.createElement('title'));
+ Window.document.getElementsByTagName('head').item(0).appendChild(Window.document.createElement('title'));
Window.document.documentElement.style = {};
Window.document.documentElement.hasAttribute = true;
View
@@ -50,7 +50,9 @@ var sys = require("sys");
core.DOMException = function(code, msg) {
this._code = code;
- this._msg = msg || ""
+ Error.call(this, messages[code]);
+ this.message = messages[code];
+ if(Error.captureStackTrace) Error.captureStackTrace(this, core.DOMException);
};
core.DOMException.prototype = {
@@ -72,6 +74,18 @@ var NOT_FOUND_ERR = core.NOT_FOUND_ERR = 8;
var NOT_SUPPORTED_ERR = core.NOT_SUPPORTED_ERR = 9;
var INUSE_ATTRIBUTE_ERR = core.INUSE_ATTRIBUTE_ERR = 10;
+var messages = {}
+messages[INDEX_SIZE_ERR] = "Index size error";
+messages[DOMSTRING_SIZE_ERR] = "DOMString size error";
+messages[HIERARCHY_REQUEST_ERR] = "Heirarchy request error";
+messages[WRONG_DOCUMENT_ERR] = "Wrong document";
+messages[INVALID_CHARACTER_ERR] = "Invalid character";
+messages[NO_DATA_ALLOWED_ERR] = "No data allowed";
+messages[NO_MODIFICATION_ALLOWED_ERR] = "No modification allowed";
+messages[NOT_FOUND_ERR] = "Not found";
+messages[NOT_SUPPORTED_ERR] = "Not supported";
+messages[INUSE_ATTRIBUTE_ERR] = "Attribute in use";
+
core.NodeList = function(document, element, tagName) {
this._document = document;
this._element = element;
@@ -101,10 +115,10 @@ core.LiveNodeList = function(document, element, callback) {
this._callback = callback;
this._element = element;
this._document = document || element;
- var results = core.mapDOMNodes(this._element, true, this._callback);
+/* var results = core.mapDOMNodes(this._element, true, this._callback);
for (var i = 0;i < results.length;i++) {
this[i] = results[i];
- }
+ }*/
};
core.LiveNodeList.prototype = {
@@ -128,22 +142,36 @@ core.DOMImplementation = function(document, /* Object */ features) {
this._ownerDocument = document;
this._features = features;
};
+
core.DOMImplementation.prototype = {
get ownerDocument() { return this._ownerDocument;},
hasFeature: function(/* string */ feature, /* string */ version) {
for (var i in this._features) {
- if (this._features.hasOwnProperty(i) &&
- i.toLowerCase() === feature.toLowerCase() &&
- (this._features[i] === version || !version))
+ if (this._features.hasOwnProperty(i) &&
+ i.toLowerCase() === feature.toLowerCase())
{
- return true;
+ if (!version) {
+ return true;
+ }
+ var versions = this._features[i];
+
+ if (typeof versions === 'string' && versions === version) {
+ return true;
+ } else {
+ var j=0, l=versions.length;
+ for (j; j<l; j++)
+ {
+ if (versions[j] === version) {
+ return true;
+ }
+ }
+ }
}
}
return false;
}
};
-
core.Node = function (ownerDocument) {
this._children = new core.NodeList();
this._nodeValue = null;
@@ -449,6 +477,7 @@ core.Node.prototype = {
if (newChild.ownerDocument &&
this.ownerDocument &&
newChild.ownerDocument !== this.ownerDocument) {
+
throw new core.DOMException(WRONG_DOCUMENT_ERR);
}
@@ -681,7 +710,7 @@ core.NamedNodeMap.prototype = {
}
// arg is from a different document
- if (arg && arg.ownerDocument !== this._ownerDocument) {
+ if (arg && arg._ownerDocument !== this._ownerDocument) {
throw new core.DOMException(WRONG_DOCUMENT_ERR);
}
@@ -976,6 +1005,7 @@ core.DocumentFragment.prototype = {
core.DocumentFragment.prototype.__proto__ = core.Element.prototype;
core.ProcessingInstruction = function (document, target, data) {
+ this._ownerDocument = document;
core.Node.call(this, document);
this._nodeName = target;
this._tagName = target;
Oops, something went wrong.

0 comments on commit 8fbb5e4

Please sign in to comment.