mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Ensure dom-if moved into doc fragment is torn down. Fixes #3324
This commit is contained in:
parent
55b91b3db7
commit
6c4f5d5d65
@ -73,7 +73,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
},
|
||||
|
||||
detached: function() {
|
||||
if (!this.parentNode) {
|
||||
if (!this.parentNode || this.parentNode.nodeType == Node.DOCUMENT_FRAGMENT_NODE) {
|
||||
this._teardownInstance();
|
||||
}
|
||||
},
|
||||
|
@ -67,6 +67,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="removalContainer">
|
||||
<template is="dom-if" if id="toBeRemoved"><div id="shouldBeRemoved"></div></template>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
suite('nested pre-configured dom-if', function() {
|
||||
@ -651,6 +655,16 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
});
|
||||
});
|
||||
|
||||
test('move into doc fragment', function(done) {
|
||||
var el = shouldBeRemoved;
|
||||
var frag = document.createDocumentFragment();
|
||||
Polymer.dom(frag).appendChild(toBeRemoved);
|
||||
setTimeout(function() {
|
||||
assert.equal(el.parentNode, null);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user