Skip to content

Commit 02005de

Browse files
committed
Merge pull request #1 from PolymerElements/fix-async-attached-detached
Sprinkle some of that magic polyfill dust on it.
2 parents d17ee6b + 1c535b5 commit 02005de

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

test-fixture.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
);
4040
}, this);
4141

42+
this.forcePolyfillAttachedStateSynchrony();
43+
4244
if (generatedDoms.length < 2) {
4345
return generatedDoms[0];
4446
}
@@ -89,6 +91,17 @@
8991
this.generatedDomStack = [];
9092

9193
this._elementsFixtured = false;
94+
95+
this.forcePolyfillAttachedStateSynchrony();
96+
},
97+
98+
forcePolyfillAttachedStateSynchrony: function () {
99+
// Force synchrony in attachedCallback and detachedCallback where
100+
// implemented, in the event that we are dealing with the async Web
101+
// Components Polyfill.
102+
if (window.CustomElements && window.CustomElements.takeRecords) {
103+
window.CustomElements.takeRecords();
104+
}
92105
},
93106

94107
collectElementChildren: function (parent) {

test/test-fixture.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,7 @@
9191
attachedFixture.restore();
9292
});
9393

94-
// TODO(cdata): Make this test pass somehow. Currently it fails in
95-
// not-Chrome due to an implementation detail of the Web Components
96-
// polyfill.
97-
xit('detaches the fixtured DOM when it is restored', function () {
94+
it('detaches the fixtured DOM when it is restored', function () {
9895
var detached = false;
9996

10097
element.onDetached = function () {

0 commit comments

Comments
 (0)