Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

FIXED: error handling in level1

  • Loading branch information...
commit e47c3833e6188b188eb948199836c8f67b50368d 1 parent 991de23
Elijah Insua tmpvar authored
Showing with 9 additions and 6 deletions.
  1. +9 −6 lib/jsdom/level1/core.js
15 lib/jsdom/level1/core.js
View
@@ -781,7 +781,7 @@ core.Node.prototype = {
if (this._attributes && this._attributes.length) {
for (i=0;i<this._attributes.length;i++)
{
- if (attr = this._attributes.item(i).normalize) {
+ if (this._attributes.item(i)) {
attr = this._attributes.item(i).normalize();
}
}
@@ -1270,12 +1270,15 @@ core.Document.prototype = {
if (attrElement && attrElement._childNodes) {
attrs = attrElement.attributes;
- var attr, len = attrs.length;
+ var attr, len = attrs.length, defaultAttr;
for (var i = 0; i < len; i++) {
- attr = this.createAttribute(attrs.item(i).name);
- attr.value = attrs.item(i).value;
- element.setAttributeNode(attr);
- attr._specified = false;
+ defaultAttr = attrs.item(i);
+ if (defaultAttr) {
+ attr = this.createAttribute(defaultAttr.name);
+ attr.value = defaultAttr.value;
+ element.setAttributeNode(attr);
+ attr._specified = false;
+ }
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.