mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Add shadow root support. (tests broken)
This commit is contained in:
parent
6c4f5d5d65
commit
4b7da35738
@ -73,7 +73,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
},
|
},
|
||||||
|
|
||||||
detached: function() {
|
detached: function() {
|
||||||
if (!this.parentNode || this.parentNode.nodeType == Node.DOCUMENT_FRAGMENT_NODE) {
|
if (!this.parentNode ||
|
||||||
|
(this.parentNode.nodeType == Node.DOCUMENT_FRAGMENT_NODE &&
|
||||||
|
(!Polymer.Settings.hasShadow ||
|
||||||
|
!(this.parentNode instanceof ShadowRoot)))) {
|
||||||
this._teardownInstance();
|
this._teardownInstance();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -657,14 +657,40 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
|
|
||||||
test('move into doc fragment', function(done) {
|
test('move into doc fragment', function(done) {
|
||||||
var el = shouldBeRemoved;
|
var el = shouldBeRemoved;
|
||||||
|
assert.equal(el.parentNode, removalContainer);
|
||||||
var frag = document.createDocumentFragment();
|
var frag = document.createDocumentFragment();
|
||||||
Polymer.dom(frag).appendChild(toBeRemoved);
|
Polymer.dom(frag).appendChild(toBeRemoved);
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
assert.equal(el.parentNode, null);
|
assert.equal(el.parentNode, null);
|
||||||
done();
|
Polymer.dom(removalContainer).appendChild(frag);
|
||||||
|
setTimeout(function() {
|
||||||
|
assert.equal(shouldBeRemoved.parentNode, removalContainer);
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('move into shadow root', function(done) {
|
||||||
|
if (Polymer.Settings.hasShadow) {
|
||||||
|
var el = shouldBeRemoved;
|
||||||
|
assert.equal(el.parentNode, removalContainer);
|
||||||
|
var div = document.createElement('div');
|
||||||
|
document.body.appendChild(div);
|
||||||
|
var frag = div.createShadowRoot();
|
||||||
|
Polymer.dom(frag).appendChild(toBeRemoved);
|
||||||
|
setTimeout(function() {
|
||||||
|
assert.equal(el.parentNode, null);
|
||||||
|
Polymer.dom(removalContainer).appendChild(frag);
|
||||||
|
setTimeout(function() {
|
||||||
|
assert.equal(shouldBeRemoved.parentNode, removalContainer);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user