Skip to content

Commit

Permalink
Further fix needed for knockout#287
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveSanderson committed Jan 25, 2012
1 parent 7da2a15 commit a2c35d2
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 26 deletions.
14 changes: 14 additions & 0 deletions build/output/knockout-latest.debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,20 @@ ko.utils.domNodeDisposal = new (function () {
// so notify it to tear down any resources associated with the node & descendants here.
if ((typeof jQuery == "function") && (typeof jQuery['cleanData'] == "function"))
jQuery['cleanData']([node]);

// Also clear any immediate-child comment nodes, as these wouldn't have been found by
// node.getElementsByTagName("*") in cleanNode() (comment nodes aren't elements)
if (cleanableNodeTypesWithDescendants[node.nodeType])
cleanImmediateCommentTypeChildren(node);
}

function cleanImmediateCommentTypeChildren(nodeWithChildren) {
var child, nextChild = nodeWithChildren.firstChild;
while (child = nextChild) {
nextChild = child.nextSibling;
if (child.nodeType === 8)
cleanSingleNode(child);
}
}

return {
Expand Down
Loading

0 comments on commit a2c35d2

Please sign in to comment.