Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Intent to Prototype: Local Style References in Link Tags

131 views
Skip to first unread message

Kurt Catti-Schmidt (SCHMIDT)

unread,
Apr 29, 2025, 8:15:00 PMApr 29
to blin...@chromium.org
Contact emails
Explainer
Specification
This will be added to the HTML5 specification.

Summary
Extends the ability of the <link> tag to support fragment identifier references to inline style tags. This is only supported when the <link> tag is used to include a stylesheet (<link rel="stylesheet">). This feature is useful for shadow DOM, allowing developers to selectively share inline styles between the light DOM and shadow DOM. Without this feature, the only declarative options for sharing styles with shadow DOM nodes are to either duplicate <style> tags or use external CSS files.


Blink component
Motivation
Shadow DOM provides style isolation, but developers often want to share some set of styles between shadow DOM subtrees and the light DOM. Existing solutions either require external files or duplicated styles. There are more options available when scripting is involved (e.g. adoptedStylesheets), but fully declarative options are limited. This feature provides an additional option for sharing styles declaratively without duplicated markup or external resource requests.


Initial public proposal
TAG review
None - this will be started soon

TAG review status
Pending

Risks


Interoperability and Compatibility
None


Gecko: No signal

WebKit: No signal

Web developers: No signals

Other signals

WebView application risks
Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?
None


Debuggability
None


Is this feature fully tested by web-platform-tests?
Will be added upon implementation.

Flag name on about://flags
None

Finch feature name
None

Non-finch justification
None

Requires code in //chrome?
False

Estimated milestones
No milestones specified


Link to entry on the Chrome Platform Status
This intent message was generated by Chrome Platform Status.

Noam Rosenthal

unread,
Apr 30, 2025, 3:12:34 AMApr 30
to Kurt Catti-Schmidt (SCHMIDT), blin...@chromium.org
On Wed, Apr 30, 2025 at 3:14 AM 'Kurt Catti-Schmidt (SCHMIDT)' via blink-dev <blin...@chromium.org> wrote:
Contact emails
Explainer
Specification
This will be added to the HTML5 specification.

Summary
Extends the ability of the <link> tag to support fragment identifier references to inline style tags. This is only supported when the <link> tag is used to include a stylesheet (<link rel="stylesheet">). This feature is useful for shadow DOM, allowing developers to selectively share inline styles between the light DOM and shadow DOM. Without this feature, the only declarative options for sharing styles with shadow DOM nodes are to either duplicate <style> tags or use external CSS files.

As a co-author of the explainer I'm a bit confused that we're ready to prototype this...
The WHATWG meeting brought up a major backwards compat issue around this proposed solution: it would load the whole document and treat it as a stylesheet in browsers that don't support this feature. I see now that this drawback is not defined in the explainer. I'm sure that this issue is solvable (e.g. with an explicit `type` attribute? a new rel?) but perhaps we should solve that before implementing?
 

Kurt Catti-Schmidt (SCHMIDT)

unread,
Apr 30, 2025, 2:11:01 PMApr 30
to Noam Rosenthal, blin...@chromium.org
You're right that there are a few ongoing discussions which specific attribute to use, but I don't think this blocks implementing the core feature behind a flag.

I'll update the explainer to reflect the fetch behavior, thanks for pointing that out. I don't think it's a dealbreaker because 1) it makes polyfilling easy by just adding an onerror handler, and 2) the current page should always be in the cache so this should't hit the network and will return immediately.


From: Noam Rosenthal <nrose...@chromium.org>
Sent: Wednesday, April 30, 2025 12:12 AM
To: Kurt Catti-Schmidt (SCHMIDT) <ksc...@microsoft.com>
Cc: blin...@chromium.org <blin...@chromium.org>
Subject: [EXTERNAL] Re: [blink-dev] Intent to Prototype: Local Style References in Link Tags
 
Reply all
Reply to author
Forward
0 new messages