Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Small patch for id's on addChild - Not sure how this worked before..

  • Loading branch information...
commit 724aec3d50fa761db6242d55621c9b10be438eb4 1 parent 913b55c
@davglass authored
Showing with 9 additions and 6 deletions.
  1. +9 −6 lib/jsdom/level1/core.js
View
15 lib/jsdom/level1/core.js
@@ -526,11 +526,11 @@ core.Node.prototype = {
newChild._parentNode = this;
this._children.push(newChild);
- if (this.id) {
+ if (newChild.id) {
if (!this._ownerDocument._ids) {
this._ownerDocument._ids = {};
}
- this._ownerDocument._ids[this.id] = this;
+ this._ownerDocument._ids[newChild.id] = newChild;
}
}
@@ -892,7 +892,7 @@ core.Element.prototype = {
if (this._attributes === null) {
this._attributes = new core.AttrNodeMap(this.ownerDocument, this);
}
-
+
if (this.ownerDocument) {
var attr = this.ownerDocument.createAttribute(name);
attr.value = value;
@@ -901,9 +901,12 @@ core.Element.prototype = {
this._attributes.removeNamedItem(name);
}
this._attributes.setNamedItem(attr);
- if (name === 'id') {
- this._ownerDocument._ids[value] = this;
- }
+ }
+ if (name === 'id') {
+ if (!this._ownerDocument._ids) {
+ this._ownerDocument._ids = {};
+ }
+ this._ownerDocument._ids[value] = this;
}
return value;
}, //raises: function(DOMException) {},

1 comment on commit 724aec3

@tmpvar

thanks! applied in 2ab312f

Please sign in to comment.
Something went wrong with that request. Please try again.