@samitouri / QOS-React-2 / commits / cc0233dd76

Don't try to detach a detached node

Test Plan: grunt test

Ben Alpert committed Apr 15, 2014 at 11:27 UTC cc0233dd761a27593b85224b9054cfa8b33f30b0
1 file changed +4 -1
src/browser/ui/dom/setInnerHTML.js
+4 -1
@@ -47,7 +47,10 @@ if (ExecutionEnvironment.canUseDOM) {
47 // nodes when processing innerHTML, innerHTML on updated nodes suffers
48 // from worse whitespace behavior. Re-adding a node like this triggers
49 // the initial and more favorable whitespace behavior.
50 - node.parentNode.replaceChild(node, node);
50 + // TODO: What to do on a detached node?
51 + if (node.parentNode) {
52 + node.parentNode.replaceChild(node, node);
53 + }
54
55 if (html.match(/^[ \r\n\t\f]/)) {
56 // Recover leading whitespace by temporarily prepending any character.