Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix for dealing with document.innerHTML = ''; #59

Merged
1 commit merged into from

1 participant

@davglass

Added ownerDocument check to the level2 removeChild wrapper. If the node that is being removed is a document, this will error. Since a document doesn't have an ownerDocument.

@davglass davglass Added ownerDocument check to the level2 removeChild wrapper. If the n…
…ode that is being removed is a document, this will error. Since a document doesn't have an ownerDocument.
90e60d3
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 22, 2010
  1. @davglass

    Added ownerDocument check to the level2 removeChild wrapper. If the n…

    davglass authored
    …ode that is being removed is a document, this will error. Since a document doesn't have an ownerDocument.
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/jsdom/level2/events.js
View
8 lib/jsdom/level2/events.js
@@ -299,9 +299,11 @@ core.Node.prototype.__proto__ = events.EventTarget.prototype;
// Wrap the level-1 implementation of removeChild() to dispatch a DOMNodeRemoved event
(function(level1) {
core.Node.prototype.removeChild = function(oldChild) {
- var ev = this.ownerDocument.createEvent("MutationEvents");
- ev.initMutationEvent("DOMNodeRemoved", true, false, this, null, null, null, null);
- oldChild.dispatchEvent(ev);
+ if (this.ownerDocument) {
+ var ev = this.ownerDocument.createEvent("MutationEvents");
+ ev.initMutationEvent("DOMNodeRemoved", true, false, this, null, null, null, null);
+ oldChild.dispatchEvent(ev);
+ }
return level1.call(this, oldChild);
};
})(core.Node.prototype.removeChild);
Something went wrong with that request. Please try again.