can-stache
Advanced tools
Comparing version 4.17.5 to 4.17.6
@@ -115,3 +115,2 @@ var QUnit = require("steal-qunit"); | ||
test("Doesn't do anything if there isn't a place to put the content", function() { | ||
var el = document.createElement("div"); | ||
var view = stache("{{#portal(root)}}<span>two</span>{{/portal}}"); | ||
@@ -121,4 +120,2 @@ var vm = new DefineMap({ root: null }); | ||
console.log(frag.firstChild, el.firstChild); | ||
QUnit.equal(frag.firstChild.nodeType, 8, "Only rendered the comment node"); | ||
@@ -144,1 +141,22 @@ }); | ||
}); | ||
test("Works when DOM nodes are removed outside of stache", function() { | ||
var view = stache("{{#if(show)}}{{#portal(root)}} <span>tests</span> {{/portal}}{{/if}}"); | ||
var root = document.createElement("div"); | ||
var vm = new DefineMap({ root: root, show: true }); | ||
view(vm); | ||
var badScript = function() { | ||
domMutateNode.removeChild.call(root, root.firstChild); | ||
}; | ||
badScript(); | ||
try { | ||
vm.show = false; | ||
QUnit.ok(true, "Did not throw"); | ||
} catch(e) { | ||
QUnit.ok(false, e); | ||
} | ||
}); |
@@ -31,2 +31,3 @@ var canReflect = require("can-reflect"); | ||
function teardown() { | ||
var root = el; | ||
if(el) { | ||
@@ -38,3 +39,7 @@ canReflect.offValue(elementObservable, getElementAndRender); | ||
if(nodeList) { | ||
nodeLists.remove(nodeList); | ||
canReflect.eachListLike(nodeList, function(node) { | ||
if(root === node.parentNode) { | ||
domMutateNode.removeChild.call(root, node); | ||
} | ||
}); | ||
nodeList = null; | ||
@@ -41,0 +46,0 @@ } |
{ | ||
"name": "can-stache", | ||
"version": "4.17.5", | ||
"version": "4.17.6", | ||
"description": "Live binding handlebars templates", | ||
@@ -5,0 +5,0 @@ "homepage": "https://canjs.com/doc/can-stache.html", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
574707
11273