Skip to content

[Local References In <link> Tags] Explainer introduction section misstates current styling preferences of elements #1242

@justinfagnani

Description

@justinfagnani

The explainer includes this section in the introduction:

The current preferred approach for styling elements under a Shadow DOM is through <link> tags, but these tags have several downsides, namely that they must be an external file or a dataURI. The performance of an external file and developer ergonomics of generating a dataURI make both of these options difficult to use. Because of that, developers using Custom Elements have expressed strong interest in addressing these issues.

I think this is pretty inaccurate. I believe the vast majority of elements in the wild use adoptedStyleSheets to style their shadow roots. <link> tags are impractical for most reusable components because they do not control the URL space that the link's href would point into - that's an app concern.

Any cross-shadow style sharing proposal that doesn't work for adoptedStyleSheets will also be as impractical.

I wonder where the claim that the current preferred approach is <link> tags comes from? Was there any survey of elements to back this up? I know of many web components projects and can't remember seeing a link tag used in that way. If you kept this section, could you point to any real world examples?

I think the section would be more accurately stated something like:

The current preferred approach for styling elements under a Shadow DOM is through adoptedStyleSheets, but adoptedStyleSheets do not have a serialized form in HTML. Because of that, developers using Custom Elements have expressed strong interest in addressing these issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions