Permalink
Browse files

level2 is complete, how about that.

  • Loading branch information...
1 parent 2433222 commit a29a344bc7aff881c70ac365ac8e7b68112875d1 @tmpvar tmpvar committed Feb 7, 2011
Showing with 11 additions and 5 deletions.
  1. +11 −5 lib/jsdom/level2/core.js
View
@@ -181,6 +181,14 @@ core.AttrNodeMap.prototype.setNamedItemNS = function(/* Node */ arg) {
return core.NamedNodeMap.prototype.setNamedItemNS.call(this, arg);
};
+core.AttrNodeMap.prototype.setNamedItem = 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);
+};
+
core.NamedNodeMap.prototype.setNamedItemNS = function(/* Node */ arg)
{
@@ -236,7 +244,7 @@ core.NamedNodeMap.prototype.removeNamedItemNS = function(/*string */ namespaceUR
var parent = this._parentNode,
- found,
+ found = null,
defaults = parent.ownerDocument.doctype._attributes,
clone,
defaultEl,
@@ -248,9 +256,7 @@ core.NamedNodeMap.prototype.removeNamedItemNS = function(/*string */ namespaceUR
{
throw new core.DOMException(core.NO_MODIFICATION_ALLOWED_ERR);
}
-
defaultEl = defaults.getNamedItemNS(parent._namespaceURI, parent._localName);
- var found = null;
if (this._nsStore[namespaceURI] &&
this._nsStore[namespaceURI][localName])
@@ -274,7 +280,7 @@ core.NamedNodeMap.prototype.removeNamedItemNS = function(/*string */ namespaceUR
clone._nodeName = found.name;
clone._localName = found._localName;
clone._prefix = found._prefix
- this._nodes[clone._nodeName] = clone;
+ this.setNamedItemNS(clone);
clone._created = true;
clone._specified = false;
}
@@ -415,7 +421,7 @@ core.Element.prototype.setAttributeNodeNS = function(/* Attr */ newAttr)
} catch (e) { /* noop */}
newAttr._ownerElement = this;
- return this._attributes.setNamedItemNS(newAttr);
+ return this._attributes.setNamedItemNS(newAttr) || existing;
};
core.Element.prototype.getElementsByTagNameNS = function(/* String */ namespaceURI,

0 comments on commit a29a344

Please sign in to comment.