Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improper ordering of the ready events in v2 in some scenarios #4447

Closed
1 of 6 tasks
justincy opened this issue Mar 20, 2017 · 2 comments
Closed
1 of 6 tasks

Improper ordering of the ready events in v2 in some scenarios #4447

justincy opened this issue Mar 20, 2017 · 2 comments

Comments

@justincy
Copy link

justincy commented Mar 20, 2017

Description

Element's ready callback is called after the parent elements ready callback when the parent is rendered in another element's light dom and there is a binding between the parent it's containing element. I think.

Live Demo

http://jsbin.com/komavinoza/edit?html,console,output

Steps to Reproduce

I've done my best to narrow it down in the linked JS Bin. There's a lot required for the setup. I'll do my best to explain:

There are three elements: parent-element --> child-element --> grandchild-element. The child is rendered inside a dom-repeat and a property rendered by the child is bound to the parent. The child renders the grandchild element in it's local dom.

Rendering the child in the parent's local dom, removing the rendering of the property in the child, or removing the binding between the child and the parent will solve the problem.

Expected Results

The ready event of grandchild-element is fired before the ready event of child-element.

Actual Results

The ready event of child-element is fired before the ready event of grandchild-element.

Browsers Affected

  • Chrome
  • Firefox
  • Edge
  • Safari 9
  • Safari 8
  • IE 11

Versions

  • Polymer: v2.0.0-rc.3

Polymer v1.x does not exhibit this issue.

@justincy justincy changed the title Improper ordering of the ready events in v1 in some scenarios Improper ordering of the ready events in v2 in some scenarios Mar 20, 2017
@dfreedm
Copy link
Member

dfreedm commented Mar 20, 2017

Fixed 404s: http://jsbin.com/qukifaw/edit?html,console,output
Polymer v1: http://jsbin.com/voquhek/edit?html,console,output

It looks like the 1.x order was also a little bizarre, but I'm not sure if that matters.

@sorvell
Copy link
Contributor

sorvell commented Mar 21, 2017

Can confirm this issue. Currently we rely on the ordering of the connectedCallback to maintain the guarantee that client dom "readies" before a host. Because templatized content flushes before being inserted into the document, client dom is not connected at this time and therefore does not flush/ready.

To address this, we could avoid flushing template instances until their content has been inserted into dom. This makes the usage of templatize a bit tricky so we may want to consider a different fix.

sorvell pushed a commit that referenced this issue Apr 4, 2017
…nstances. This api should be used to insert instances into the dom.
kevinpschaaf added a commit that referenced this issue Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants