-
Notifications
You must be signed in to change notification settings - Fork 491
[ShadowDOM]: Filtered insertion points inside nested roots fail to distribute based on dom changes #316
Comments
fascinating. taking a look at it ... seems very mysterious |
well, that was easy with your notes to start from! I think this is the fix: diff --git a/src/ShadowDOM/ShadowRenderer.js b/src/ShadowDOM/ShadowRenderer.js
index cd3d22e..ace0b82 100644
--- a/src/ShadowDOM/ShadowRenderer.js
+++ b/src/ShadowDOM/ShadowRenderer.js
@@ -340,9 +340,10 @@
var shadowTrees = getShadowTrees(shadowHost);
// 1.2
+ var renderer = getRendererForHost(shadowHost);
for (var i = 0; i < shadowTrees.length; i++) {
// 1.2.1
- this.poolDistribution(shadowTrees[i], pool);
+ renderer.poolDistribution(shadowTrees[i], pool);
}
// 1.3 tellingly, the one other place we check isShadowHost and mutate a field on renderer: if (isShadowHost(node)) {
var renderer = getRendererForHost(node);
renderer.dirty = false;
} In contrast, attributes were breaking the invariant that the current ShadowRenderer matches the host. working on a test case, but that's probably the fix. |
oops, and I should've noticed this was assigned. Sorry @garlicnation ! if you want to take this up and land it, feel free. Otherwise I was going to adapt @sorvell 's test case to be standalone (just setting up the shadow roots and such) so we can add to tests/ShadowDOM/... |
But the fix above does seem to fix the problem without breaking any of the existing SD tests (tried chrome/safari/firefox). |
Pretty sure @garlicnation hasn't had a chance to look. Re-assigned so @jmesserly can get full credit! |
update: either something's wrong with my test or I seem to have found another problem (not sure if related). Digging ... |
It seems unrelated, even rolling back my fix shows some really busted behavior in the test. After setting things up like your jsbin, ShadowDOM's innerHTML reports (newlines mine): <x-host id="host">
<child foo="">~Foo~</child>
<child foo="" bar="">~Foo+Bar~</child>
<child id="test" bar="">~Bar~</child>
</x-host>
<br> Looks good right? Now after rendering (with or without a fix for the attribute issue): <x-host id="host">
<child foo="">~Foo~</child>
<child foo="" bar="">~Foo+Bar~</child>
] Bar: [
<content select="[bar]"></content>
]
</x-host>
<br> that's like totally busted. Strangely, the visual HTML tree is correct, but SD's internal tracking seems sufficiently off it can't re-render properly. It looks like the (virtual) nextSibling pointer from the |
Wow, figured it out. On a hunch, I added whitespace nodes where they would usually be inside the |
u rox... thx! |
…ateAttrs fixes #316, attribute deps were not recorded on the correct ShadowRenderer
Reverted via f94ca5e. This change broke some Polymer tests (https://github.com/Polymer/polymer/blob/master/test/unit/polymer-dom.js#L101 which can be run via https://github.com/Polymer/polymer/blob/master/test/unit/polymer-dom-shadow.html). It's not clear why this change broke these tests, but they also make changes to attributes to affect distribution. @jmesserly would you mind taking a look? |
I don't think this is an issue any longer. |
Here's a repro: http://jsbin.com/naboya/1/edit.
Clicking the
Test
button toggles an attribute on the#test
node and should cause it to toggle between the insertion points contained in its parent's shadowRoot. This fails.Clicking the
Test2
button removes/adds the#test
node. This appears to function correctly.There's a clue in the fact that an incorrect distribution caused by clicking
Test
can be corrected by clickingTest2
2x to remove and re-add the node.After some debugging, it appears that the renderer found for the
x-host
element does not properly report that it should invalidate based on thefoo
andbar
attributes changing on children. Strangely, thex-outer
element renderer does report that it should invalidate onfoo
andbar
which is also incorrect .The text was updated successfully, but these errors were encountered: