Make clearNode screaming-fast-er

Reviewers: xymostech

Reviewed By: xymostech

Differential Revision: http://phabricator.benalpert.com/D35
This commit is contained in:
Ben Alpert
2013-07-05 21:24:39 -07:00
parent 8f26740010
commit 29949b500a

View File

@@ -87,9 +87,10 @@ var MJLite = (function() {
}; };
var clearNode = function(node) { var clearNode = function(node) {
var children = node.childNodes; if ("textContent" in node) {
for (var i = children.length - 1; i >= 0; i--) { node.textContent = "";
node.removeChild(children[i]); } else {
node.innerText = "";
} }
}; };