Permalink
Browse files

3 level2 tests remain

  • Loading branch information...
1 parent 66ff77a commit 2433222487032dd46c9b035dd139cb3e948f3184 @tmpvar tmpvar committed Feb 7, 2011
Showing with 13 additions and 16 deletions.
  1. +1 −1 lib/jsdom/level1/core.js
  2. +8 −10 lib/jsdom/level2/core.js
  3. +0 −1 test/level2/core.js
  4. +4 −4 test/level2/core/files/staffNS.xml.js
@@ -1706,7 +1706,7 @@ core.DocumentType = function DocumentType(document, name, entities, notations, a
core.markTreeReadonly(this._notations);
- this._attributes = attributes || new core.NamedNodeMap(document);
+ this._attributes = attributes || new core.AttrNodeMap(document);
};
core.DocumentType.prototype = {
nodeType : DOCUMENT_TYPE_NODE,
@@ -173,14 +173,15 @@ core.NamedNodeMap.prototype.getNamedItemNS = function(/* string */ namespaceURI,
})[0] || null;
};
-core.AttrNodeMap.prototype.setNamedItem = function(/* Node */ arg) {
+core.AttrNodeMap.prototype.setNamedItemNS = function(/* Node */ arg) {
if (arg.nodeType !== this._ownerDocument.ATTRIBUTE_NODE) {
throw new core.DOMException(core.HIERARCHY_REQUEST_ERR);
}
- return core.NamedNodeMap.prototype.setNamedItem.call(this, arg);
+ return core.NamedNodeMap.prototype.setNamedItemNS.call(this, arg);
};
+
core.NamedNodeMap.prototype.setNamedItemNS = function(/* Node */ arg)
{
if (this._readonly) {
@@ -195,11 +196,7 @@ core.NamedNodeMap.prototype.setNamedItemNS = function(/* Node */ arg)
throw new core.DOMException(core.NO_MODIFICATION_ALLOWED_ERR);
}
- if (arg.nodeType !== owner.ATTRIBUTE_NODE) {
- throw new core.DOMException(core.HIERARCHY_REQUEST_ERR);
- }
-
- if (this._parentNode._ownerDocument !== arg.ownerDocument) {
+ if (this._ownerDocument !== arg.ownerDocument) {
throw new core.DOMException(core.WRONG_DOCUMENT_ERR);
}
@@ -375,14 +372,15 @@ core.Element.prototype.removeAttributeNS = function(/* string */ namespaceURI,
throw new core.DOMException(core.NO_MODIFICATION_ALLOWED_ERR);
}
- var defaults = this.ownerDocument.doctype._attributes, clone,
+ var defaults = this.ownerDocument.doctype._attributes,
+ clone,
found,
- defaultEl = defaults.getNamedItemNS(namespaceURI, localName),
+ defaultEl = defaults.getNamedItemNS(namespaceURI, this.localName),
defaultAttr,
clone;
if (defaultEl) {
- defaultAttr = defaultEl._attributes.getNamedItemNS(namespaceURI, localName);
+ defaultAttr = defaultEl.getAttributeNodeNS(namespaceURI, localName);
}
found = this._attributes.removeNamedItemNS(namespaceURI, localName);
View
@@ -4392,7 +4392,6 @@ elementhasattributens02 : function () {
element = doc.createElementNS("http://www.w3.org/DOM","address");
attribute = doc.createAttributeNS("http://www.w3.org/DOM","domestic");
newAttribute = element.setAttributeNode(attribute);
- console.log(element.attributes._nsStore);
state = element.hasAttributeNS("http://www.w3.org/DOM","domestic");
assertTrue("hasDomesticAttr",state);
@@ -49,20 +49,20 @@ exports.staffNS = function() {
var entElement = doc.createElementNS("http://www.w3.org/2000/xmlns/","entElement");
entElement.setAttribute("attr1", "Attr").specified = false;
entElement.setAttribute("domestic", "MALE").specified = false;
- defaultAttributes.setNamedItem(entElement);
+ defaultAttributes.setNamedItemNS(entElement);
var defaultAddress = doc.createElement("address");
- defaultAddress.setAttribute("street", "Yes").specified = false;
+ defaultAddress.setAttributeNS("http://www.w3.org/2000/xmlns/", "street", "Yes").specified = false;
defaultAttributes.setNamedItem(defaultAddress);
var defaultEmpAddress = doc.createElementNS("http://www.nist.gov", 'emp:address');
defaultEmpAddress.setAttributeNS("http://www.nist.gov", "emp:district", "DISTRICT").specified = false;
defaultEmpAddress.setAttributeNS("http://www.nist.gov", "emp:local1", "FALSE").specified = false;
- defaultAttributes.setNamedItem(defaultEmpAddress);
+ defaultAttributes.setNamedItemNS(defaultEmpAddress);
var defaultEmpEmployee = doc.createElementNS("http://www.nist.gov", 'emp:employee');
defaultEmpEmployee.setAttributeNS(null, 'defaultAttr', 'defaultVal').specified = false;
- defaultAttributes.setNamedItem(defaultEmpEmployee);
+ defaultAttributes.setNamedItemNS(defaultEmpEmployee);
doc.doctype = new dom.DocumentType(doc, "staff", entities, notations, defaultAttributes);
doc.doctype._systemId = "staffNS.dtd";

0 comments on commit 2433222

Please sign in to comment.