Skip to content

Commit

Permalink
level2 is complete, how about that.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmpvar committed Feb 7, 2011
1 parent 2433222 commit a29a344
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lib/jsdom/level2/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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,
Expand All @@ -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])
Expand All @@ -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;
}
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit a29a344

Please sign in to comment.