-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fixed custom elements patching, Added El::is_custom() #328
Conversation
5c89657
to
f0d7b97
Compare
5d5b4dd
to
f0d7b97
Compare
61c95cb
to
68323d9
Compare
@David-OConnor |
Yeah; I think it's |
@akhilman Yes, resetting internal state was basically a workaround for badly written custom elements and some other weird behavior which I don't remember. I had to resolve it quickly because it was breaking Seed website (seed-rs/seed-rs.org#19). Line 30 in 5e61a6e
and web component in seed-rs.org repo should be rewritten to get source code from its attribute instead of its content, so Seed is able to patch it correctly - https://github.com/seed-rs/seed-rs.org/blob/master/web_components/code-block.ts. (I've already rewritten it into JS so rewritting to TS should be enough - https://gist.github.com/MartinKavik/713dd5251330e565128b443058d2a5e8)
|
I think I have a better solution then pushing code to element's attribute. Take a look at https://stackblitz.com/edit/r1xj6g. Here I use a mutation observer to detect if inner html of the custom element has changed. |
Can be, I chose the first and the simplest/shortest solution. And attribute observer is built-in + you get property accessors for free so there is small chance to introduce bugs. P.S. You can delete fallback for IE, because IE doesn't support WASM. |
#325
Custom elements (like
code-block
onseed-rs.org
) have to be recreated, we cannot manage their content directly (i.e. we can't patch them like the built-in elements).We should try to find a better solution and write tests once there is a solid Rust wrapper for WebComponents.
Tested with
seed-rs.org
project connected to modified local Seed repository.