Permalink
Browse files

Further fix needed for #287

  • Loading branch information...
1 parent 7da2a15 commit a2c35d230794d1d54729d93edc037d2622ccddf7 @SteveSanderson SteveSanderson committed Jan 25, 2012
Showing with 54 additions and 26 deletions.
  1. +14 −0 build/output/knockout-latest.debug.js
  2. +26 −26 build/output/knockout-latest.js
  3. +14 −0 src/utils.domNodeDisposal.js
@@ -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 {
Oops, something went wrong.

0 comments on commit a2c35d2

Please sign in to comment.