Skip to content

Conversation

@meyerweb
Copy link
Contributor

@meyerweb meyerweb commented Dec 3, 2025

Summary

Adds the new referencetarget attribute to <template> and property to the ShadowRoot API.

Supporting details

@github-actions github-actions bot added data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API data:html Compat data for HTML elements. https://developer.mozilla.org/docs/Web/HTML size:m [PR only] 25-100 LoC changed labels Dec 3, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 10, 2025

Tip: Review these changes grouped by change (recommended for most PRs), or grouped by feature (for large PRs).

@caugner caugner changed the title Add ShadowRoot referencetarget Chrome 133 supports ShadowRoot referenceTarget Dec 10, 2025
Copy link
Contributor

@caugner caugner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to https://chromestatus.com/feature/5188237101891584, this feature was only in Origin Trial from Chrome 133 to 135. Can you clarify if these features landed unconditionally in Chrome Stable?

@meyerweb
Copy link
Contributor Author

According to https://chromestatus.com/feature/5188237101891584, this feature was only in Origin Trial from Chrome 133 to 135. Can you clarify if these features landed unconditionally in Chrome Stable?

They’re in current Chrome (143) behind the experimental web platform features flag. I’m not certain, but my understanding is that the feature was never backed out.

@github-actions github-actions bot added size:l [PR only] 101-1000 LoC changed and removed size:m [PR only] 25-100 LoC changed labels Dec 19, 2025
@meyerweb meyerweb changed the title Chrome 133 supports ShadowRoot referenceTarget Chrome 133 and Safari 26 support ShadowRoot referenceTarget behind flags Dec 19, 2025
@meyerweb
Copy link
Contributor Author

There’s also experimental implementation in Safari as of 26. I added in the flags information for both Chrome and Safari.

A Firefox implementation is also currently being reviewed, though it hasn’t landed yet, so don’t have a version number to add yet.

@github-actions github-actions bot added the data:css Compat data for CSS features. https://developer.mozilla.org/docs/Web/CSS label Jan 9, 2026
Copy link
Contributor

@caugner caugner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like these landed unconditionally in Firefox 144.

"flags": [
{
"type": "preference",
"name": "Experimental web platform features",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"name": "Experimental web platform features",
"name": "#enable-experimental-web-platform-features",

Comment on lines +733 to +735
"firefox": {
"version_added": false
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like this landed in Firefox 144, see: https://bugzilla.mozilla.org/show_bug.cgi?id=1981341

Suggested change
"firefox": {
"version_added": false
},
"firefox": {
"version_added": "144"
},

(There seems to be a related bug though: https://bugzilla.mozilla.org/show_bug.cgi?id=1989323)

"flags": [
{
"type": "preference",
"name": "Experimental web platform features",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"name": "Experimental web platform features",
"name": "#enable-experimental-web-platform-features",

Comment on lines -108 to -110
"ie": {
"version_added": false
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I would have expected this to have been removed automatically before. 🤔

Comment on lines +171 to +173
"firefox": {
"version_added": false
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dito

Suggested change
"firefox": {
"version_added": false
},
"firefox": {
"version_added": "144"
},

@mrego
Copy link
Contributor

mrego commented Jan 19, 2026

It looks like these landed unconditionally in Firefox 144.

This is behind a runtime flag in Firefox: dom.shadowdom.referenceTarget.enabled
In the patch from the bug you link you can see it's behind the flag: mozilla-firefox/firefox@e5cf85c1e4ee#diff-3e8d687f469c6af2120accb01e7664b85d57467e9b1aa0d65fd9ad916c1c5a21

Also you can check this test https://wpt.live/shadow-dom/reference-target/tentative/reference-target-basics.html with the flag enabled and disabled, to see what happens.

The Firefox prototype implementation for this feature has been completed a few days ago, so people can start playing with it there (the same than chromium and webkit). All of them behind a runtime flag.
The Firefox version would be 149 if you see the latest bugs closed related to this feature (e.g. https://bugzilla.mozilla.org/show_bug.cgi?id=2008915).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API data:css Compat data for CSS features. https://developer.mozilla.org/docs/Web/CSS data:html Compat data for HTML elements. https://developer.mozilla.org/docs/Web/HTML size:l [PR only] 101-1000 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants