-
Notifications
You must be signed in to change notification settings - Fork 78
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
Fix custom element initialization #394
Conversation
@maier49 FYI, this seems to be failing CI. |
child = document.createTextNode('bar'); | ||
element!.appendChild(child); | ||
|
||
waitFor( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious, do you need to return this to ensure that the test waits for the promise to be resolved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes 🤦♂ . This is actually broken in IE. Looking into it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@agubler Ok it was still the test that was broken I just didn't fix it properly. Should be good now (pending CI)
e028563
to
ccfa3f8
Compare
ccfa3f8
to
b5a20b6
Compare
@agubler A problem with the approach I was using is that if no children are appended it might never call the ready callback. I've updated it to use |
@agubler Testing against the v5 custom elements showcase everything worked properly out of the box. But there were was an issue with the setup being called too many times when I put the element scripts in the head. Have that fixed now, here's the showcase with the scripts in the head: |
Type: bug
The following has been addressed in the PR:
prettier
as per the readme code style guidelinesDescription:
It's evidently not guaranteed that a custom element's children will be available when it is connected (see discussion here), but our
connectedCallback
was setup as if it was. I've setup a mutation observer so that the element will wait till the document is loaded or an element after it in the HTML hierarchy is present to perform setup logic.Resolves #342