-
Notifications
You must be signed in to change notification settings - Fork 10k
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
[Blazor] Attributes of HTML custom elements not yet initialized when connectedCallback() is invoked #6218
Comments
Thanks for contacting us, @ranabuelo. |
@ranabuelo could you also share details about what you are trying to do? How would you use such a feature? |
My use cases are straightforward:
When I used the same custom HTML element in a plain HTML/Javascript project, it worked fine. But it didn't work with Blazor because the I'll try to test with a recent preview version and provide a PR for it. Unfortunately, I don't get preview 3 running with VS 2019 because of issue #8384. So I probably need to wait for preview 4. |
Did you get a chance to try it out @ranabuelo? Like you I’m interested in using Web Components within Blazor apps. |
i am also interested in similar scenarios as discussed here by @ranabuelo. it would be nice to have blazor playing well with html custom elements |
For the reference, some component libraries: https://open-wc.org/faq/component-libraries.html. From the referenced #10170, though this might be achieavable via JS interop -- looks like it -- a good experience with Web APIs and ability to author web components with Blazor would be nice. Extending to the improbable, but to make this more complete, maybe also doing rendering like lit-html, hyperHTML and other string templating engines are doing (yes, there is RenderTree). Some more consideration to this in the linked #10170. |
@SteveSandersonMS Picking this one up for the Blazor July sprint. |
Custom HTLM elements are usually initialized from the
connectedCallback
using the attributes from the DOM. Browsers therefore set all attributes at the custom element before the callback gets invoked.In Blazor, however, element attributes are set after invoking the
connectedCallback
. This seems to happen in theBrowserRenderer.insertElement
function whereinsertLogicalChild
is called before the attributes are actually being applied. Moving theinsertLogicalChild()
call to the end of the function seems to solve the issue.Occurred with Blazor 0.7.0.
The text was updated successfully, but these errors were encountered: