A new attribute on ElementInternals, 'shadowRoot', allows custom elements to access their own ShadowRoot, regardless of open/closed status. Additionally, further restrictions are added to the attachInternals() API to ensure that custom elements get the first chance to attach the ElementInternals interface. With this change, the attachInternals() function will throw an exception if called prior to the custom element constructor being run.
There is a very small potential compat issue, specifically with the change to attachInternals() not being allowed prior to the custom element constructor. However, use counters indicate almost no usage that would be broken by this change: The overall usage of the attachInternals() API is quite low by itself, around 0.001%: https://chromestatus.com/metrics/feature/timeline/popularity/3435 The to-be-disallowed usage of attachInternals() *prior* to the constructor shows no measurable usage (0%): https://chromestatus.com/metrics/feature/timeline/popularity/3470 Based on these use counters, the risk here is quite low. As for interoperability risk, there is multi-implementer support, and the spec has been approved and landed. So the interop risk should be low also.
This feature will likely be used more often by components taking advantage of the declarative Shadow DOM feature. However, this feature is also useful on its own. There should be no ergonomic risks to adding this API.
Polyfills could be developed for ElementInternals.shadowRoot, by patching attachShadow. It is unclear whether development of a polyfill will take place. It is likely not worth significant documentation or outreach for this feature.
The only real security concern that was taken into account was the change to attachInternals() to prevent access prior to the custom element constructor running. This change should protect closed shadow roots references from being accessed prior to custom element upgrades.
This is a JS only change/feature, and should be supported by the DevTools console.
LGTM1Excited to see this moving forward!
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAM%3DNeDg65viABDrApHa9JugfiGuut7qwuQ8O1s1bGWE-3bPh-g%40mail.gmail.com.
LGTM2. The risk looks very low.
Have we asked for a signal in Mozilla standards positions? [*]
> WebKit: Positive
> (https://github.com/w3c/webcomponents/issues/871#issuecomment-692383222)
> The landed spec was reviewed and assisted by rniwa@ from WebKit.
This is not an official signal [*] and the comment ends with "There is
still a pending question of whether we support the declarative Shadow
DOM at conceptual level. I need to get back to you on that.". Is that
question resolved?
Maybe we should ask for an official signal in webkit-dev too.
To unsubscribe from this group and stop receiving emails from it, send an email to blin...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAM%3DNeDg65viABDrApHa9JugfiGuut7qwuQ8O1s1bGWE-3bPh-g%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/b8cc96c2-1e53-4644-91ce-a4ffaffdbddfo%40chromium.org.