-
Notifications
You must be signed in to change notification settings - Fork 740
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: use getHTML
in the shadow root expansion
#2587
Conversation
I would still go with the |
Well, the I'll play with the problematic page a tiny bit more and try to replicate the issue locally, so we can debug and test better. |
And this solution will work regardless of that?
I don't see this as a problem really (outside of the fact that latest playwright breaks that one test with firefox, that's a different story). Anyway, I don't want to block this at all, once the CI is green we can merge and release, its just that it feels more future proof to use the new method, which does exactly what we need, instead of baking in our own implementation. |
Yep, e.g. the new tests from this PR are not passing with I guess we can have a bunch of fallbacks, both for the existence of the method ( I still feel like W3C could have handled this somehow better, but well, here we are. 🤷🏽♂️ |
277f1c8
to
3a1d17b
Compare
getHTML
in the shadow root expansion
What about this option, the description sounds like you can use that to disregard the serializable property. Or did I misunderstand what it's about? https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/getHTML#shadowroots Btw are we sure this is not "a good thing"? I mean in the cases we know about, were there some that disabled the serialization on the actual content we care about? Now I am just curious, the implementation is fine by me, feel free to merge and go ahead with the release if it works correctly in WCC. |
I think both of the options are about child shadow roots of the shadow root instance you are calling the method on. Looking into Firefox source code (9694-9695 here), it indeed seems that the You're right that we haven't noticed any issues with the shadow DOMs whatsoever (except for the current issue in WCC). I say we merge and release this (the WCC website works and it's not breaking). As a bonus, we still have a better understanding of what's happening in case some other issue pops up. |
expandShadowRoots
now does not replace the original content but creates a separate (non-shadow) subtree as a sibling of the original one.Note that this doesn't duplicate content$^{[1]}$ , as the original shadow roots are inaccessible from JS by design.
document.documentElement.outerHTML
returns only the contents of (new) regular DOM elements. The page also still looks the same, as a shadow DOM tree masks any "light" DOM sibling.Closes #2583
shadowRoot
property, the content of which is still accessible from JS(???). This is likely coming from the ancient web framework they are using.Either way, double the content is probably better than none (so far we have only noticed this issue on this page).