Skip to content

Commit

Permalink
more fixing for staffNS.xml.js and readonly NameNodeMap stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
tmpvar committed Jan 30, 2011
1 parent b02faf7 commit 7246b08
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/jsdom/level2/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ core.AttrNodeMap.prototype.setNamedItem = function(/* Node */ arg) {

core.NamedNodeMap.prototype.setNamedItemNS = function(/* Node */ arg)
{
if (this._readonly) {
throw new core.DOMException(core.NO_MODIFICATION_ALLOWED_ERR);
}

var owner = this._ownerDocument;
if (this._parentNode &&
this._parentNode._parentNode &&
Expand All @@ -190,6 +194,11 @@ core.NamedNodeMap.prototype.setNamedItemNS = function(/* Node */ arg)
throw new core.DOMException(core.HIERARCHY_REQUEST_ERR);
}

if (this._parentNode._ownerDocument !== arg.ownerDocument) {
throw new core.DOMException(core.WRONG_DOCUMENT_ERR);
}


if (arg._parentNode) {
throw new core.DOMException(core.INUSE_ATTRIBUTE_ERR);
}
Expand Down
1 change: 1 addition & 0 deletions test/level2/core/files/staffNS.xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ exports.staffNS = function() {
staff.appendChild(employee);

employee.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns", "http://www.nist.gov");
employee.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:dmstc", "http://www.usa.com");

id.appendChild(doc.createTextNode("EMP0001"));
salary.appendChild(doc.createTextNode("56,000"));
Expand Down

0 comments on commit 7246b08

Please sign in to comment.