Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
If parentNode is not correct check for child in childNodes
Browse files Browse the repository at this point in the history
  • Loading branch information
arv committed Oct 31, 2013
1 parent 589410b commit f6e5d43
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/wrappers/Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,20 @@
removeChild: function(childWrapper) {
assertIsNodeWrapper(childWrapper);
if (childWrapper.parentNode !== this) {
// TODO(arv): DOMException
throw new Error('NotFoundError');
// IE has invalid DOM trees at times.
var found = false;
var childNodes = this.childNodes;
for (var ieChild = this.firstChild; ieChild;
ieChild = ieChild.nextSibling) {
if (ieChild === childWrapper) {
found = true;
break;
}
}
if (!found) {
// TODO(arv): DOMException
throw new Error('NotFoundError');
}
}

var childNode = unwrap(childWrapper);
Expand Down

0 comments on commit f6e5d43

Please sign in to comment.