New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 639847 link

Starred by 3 users

Issue metadata

Status: WontFix
Owner:
Last visit > 30 days ago
Closed: Oct 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

Custom elements v1 - can't get CE children in connectedCallback()

Reported by cont...@julien-gras.fr, Aug 22 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.70 Safari/537.36

Steps to reproduce the problem:
 - Case 1 :  KO

#-- custom elements defintions --#
<elmt-container>
    <div>1</div>
    <elmt-test>2</elmt-test>
</elmt-container>

Result : i just get the first div when i call this.children in the connectedCallback of elmt-container.

JsFiddle: https://jsfiddle.net/mcd7bd82/ in canary

 - Case 2 : OK

<elmt-container>
    <div>1</div>
    <elmt-test>2</elmt-test>
</elmt-container>
#-- custom elements defintions --#

result : i get all children when i call this.children in the connectedCallback of elmt-container.

JsFiddle: https://jsfiddle.net/4uw0a7yk/ in canary

What is the expected behavior?
It should return all children including CE and not only native elements.

What went wrong?
I think connectedCallback() is called too soon: before the nested CE are initialized ? 

Did this work before? No 

Chrome version: 54.0.2836.0  Channel: canary
OS Version: 10.0
Flash Version: Shockwave Flash 23.0 r0
 

Comment 1 by junov@chromium.org, Aug 22 2016

Components: -Blink Blink>WebComponents

Comment 2 by hayato@chromium.org, Aug 23 2016

Cc: kojii@chromium.org
Owner: dominicc@chromium.org
Status: Assigned (was: Unconfirmed)
dominicc@ (or kojii@), could you triage this?

Comment 3 by kojii@chromium.org, Aug 23 2016

Cc: domenic@chromium.org
Labels: -OS-Windows OS-All
Case 1 is what the spec defines as "create", and case 2 is "upgrade". For upgrade, I read the spec the same way as you.

For case 1 (create, by the document parser), it reads to me that the Blink behavior matches to what the spec says, but I understand it's not very friendly,  and I can't find good alternative web developers can take.

Filed https://github.com/w3c/webcomponents/issues/551 for a spec discussion. Please point out if you see I read the spec incorrectly, or any other opinions, here or there.

Comment 4 by hayato@chromium.org, Oct 12 2016

Components: -Blink>WebComponents Blink>HTML>CustomElements
Status: WontFix (was: Assigned)
It sounds like this is working as intended. In the future it may make sense to add more callbacks, etc. but the idea is that connected is not the single right place to poll the child list. It might be useful as part of a lazy strategy, in combination with MutationObservers, requestAnimationFrame, etc.

Sign in to add a comment