Review 12.4 Merged

80212[TASK] Reactivate usage of constructable stylesheets for icon element

Benjamin Franzke CR +2 V +2 Easy +4 −5 updated 07/28/23, 17:22

Commit message

With #100270 stylesheets in icon elements have been inlined instead of
using the style abstraction of lit which uses constructable stylesheets
if available.

Inline stylesheets need to be parsed over and over again, whenever a
web component is used multiple times.
The icon element is supposed to be used very often, which is why this
matters. Constructable stylesheets are cached and therefore do only
need to be parsed once, regardless how often a web component is used.

Per issue description this has been done because browsers throw a
DOMException in some (probably cross-iframe usage) situations:
> Failed to set the 'adoptedStyleSheets' property on 'ShadowRoot':
> Sharing constructed stylesheets in multiple documents is not allowed

These situations can not be reproduced right now and web components
that use shadow dom with constructable stylesheets will continue
having to cope with this limitation, which is why we need to load the
javascript modules into the document (frame) where the component
is supposed to be used and define it in there.
We've got API like `topLevelModuleImport` to do so; also see the
following upstream comment for a similar suggestion:
https://github.com/lit/lit/issues/2068#issuecomment-906671997)

Review

  • Code review CR +2

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V +2

    Imported before Forger kept the single votes, the next import adds them.

Issues 2

Files 2