Intent to Prototype and Ship: Don't clear adoptedStyleSheets on adoption to/from <template>

Skip to first unread message

Rakina Zata Amni

Oct 18, 2020, 11:35:45 PM10/18/20
to blink-dev

Contact emails

Explainer - no explainer as this is a small improvement, and spec change is pending due to the dependency on moving to the DOM & CSSOM specs (but should be simple).


When adopting a shadow root into a <template> document from a document that the <template> is in (or vice versa), we will no longer clear its adoptedStyleSheets.


Currently we always clear adoptedStyleSheets when the shadow root containing it is adopted into a different document. The main reason for this is to ensure constructed stylesheets are not used across <iframe>s, but this also covers adopting into/from <template>s, causing some confusion to web developers (see

We recently assessed that there should be no problem with keeping adoptedStyleSheets on adoption for the <template> case, as the lifetime of a <template> is bounded by the lifetime of the document containing it. For more details, see


Interoperability and Compatibility

The risk for this change should be low as the behavior change is small (and more intuitive) and Chrome is the only browser that has shipped adoptedStyleSheets (Firefox implementation is pending).

Edge: No signals

Firefox: No signals

Safari: No signals

Web / Framework developers: Positive (see bug)

Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?


Is this feature fully tested by web-platform-tests?

Yes (tests added in

Link to entry on the feature dashboard 

Requesting approval to ship?


Alex Russell

Oct 22, 2020, 3:20:04 PM10/22/20
to blink-dev, Rakina Zata Amni
Hey Rakina!

It's great to see sharp edges being rounded off for constructable stylesheets. The current usage looks very high, however:

Do we have a way to know if we'll cause breakage with this? Do we know if cross-document template cloning is rare?


Rakina Zata Amni

Oct 22, 2020, 8:28:59 PM10/22/20
to Alex Russell, blink-dev,, Kevin Schaaf, Gray Norton
Thanks Alex,
I don't think we have data on cross-document template cloning + adoptedStyleSheets is used, we can try to gather some data if we need to. However, I think that the current behavior (clearing on adoption) is very much a footgun and is unexpected to web developers though (see comment), and I doubt many developers depend on the current behavior (and if they do, they can have a quick fix for this by clearing manually). Additionally, nothing other than adoptedStyleSheets is currently cleared on adoption (see adopt, adopting steps, adoptedStyleSheets adopting steps).

Chris Harrelson

Oct 28, 2020, 1:57:17 PM10/28/20
to Rakina Zata Amni, Alex Russell, blink-dev, Mason Freed, Kevin Schaaf, Gray Norton

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
To view this discussion on the web visit


Oct 28, 2020, 10:26:30 PM10/28/20
to Rakina Zata Amni, blink-dev, Mason Freed, Kevin Schaaf, Gray Norton

Software Engineer, Google

Yoav Weiss

Oct 29, 2020, 3:58:57 AM10/29/20
to TAMURA, Kent, Rakina Zata Amni, blink-dev, Mason Freed, Kevin Schaaf, Gray Norton
Reply all
Reply to author
0 new messages