@@ -11,7 +11,7 @@ Previous Version: https://www.w3.org/TR/2014/WD-css-scoping-1-20140403/
1111Editor : Tab Atkins Jr., Google, http://xanthir.com/contact/
1212Editor : Elika J Etemad / fantasai, Invited Expert, http://fantasai.inkedblade.net/contact
1313Abstract : This specification defines various scoping/encapsulation mechanisms for CSS, including scoped styles and the ''@scope'' rule, Shadow DOM selectors, and page/region-based styling.
14- Ignored Terms : inherit, slot
14+ Ignored Terms : inherit, slot, custom elements, stylesheets
1515Ignored Vars : root elements
1616Issue Tracking : Bugzilla https://www.w3.org/Bugs/Public/buglist.cgi?component=Scoping&list_id=47685&product=CSS&resolution=---
1717</pre>
@@ -232,6 +232,65 @@ Selecting Outside the Scope: '':scope-context()'' pseudo-class</h4>
232232 This functionality would replace ''@global'' , which is a poor excuse for a selector.
233233 </div>
234234
235+ <!--
236+ ████████ ████████ ████████ ███ ██ ██ ██ ████████
237+ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
238+ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
239+ ██ ██ ██████ ██████ ██ ██ ██ ██ ██ ██
240+ ██ ██ ██ ██ █████████ ██ ██ ██ ██
241+ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
242+ ████████ ████████ ██ ██ ██ ███████ ████████ ██
243+ -->
244+
245+ <h2 id=''>
246+ Default Styles for Custom Elements</h2>
247+
248+ When defining <a>custom elements</a> ,
249+ one often wants to set up "default" styles for them,
250+ akin to the user-agent styles that apply to built-in elements.
251+ This is, unfortunately, hard to do in vanilla CSS,
252+ due to issues of scoping and specificity--
253+ the element in question might be used in <a>shadow trees</a> ,
254+ and thus is unreachable by any selector targeting it in the outermost document;
255+ and selectors, even low-specificity ones like simple <a>type selectors</a> ,
256+ can accidentally override author-level styles meant to target the element.
257+
258+ To aid in this, this section defines a way
259+ to create a stylesheet of "default element styles" for a given element.
260+ This stylesheet applies across the entire document,
261+ in all <a>shadow trees</a> ,
262+ and the rules in it apply at the <a>user agent origin</a> ,
263+ so author-level rules automatically win.
264+
265+ {{Window}} s gain a private slot <dfn attribute for=Window>\[[defaultElementStylesMap]]</dfn>
266+ which is a map of <a for="Element">local names</a> to <a>stylesheets</a> .
267+
268+ These stylesheets must apply to every document in the window.
269+ They must be interpreted as user agent stylesheets.
270+
271+ Note: This implies, in particular,
272+ that they apply to all <a>shadow trees</a> in every document,
273+ and that the declarations in them are from the <a>user agent origin</a> .
274+
275+ For the purpose of the <a>cascade</a> ,
276+ these stylesheets are ordered after the user agent's own stylesheets;
277+ their relative ordering doesn't matter as it is not observable.
278+
279+ Within these stylesheets, <a>complex selectors</a> must be treated as invalid.
280+ Every <a>compound selector</a> must be treated as containing an additional <a>type selector</a>
281+ that selects elements with the <a for=Element>local name</a>
282+ that the stylesheet is keyed with.
283+
284+ Issue: Do we need to restrict the <a>at-rules</a> that can be used in these sheets?
285+ For example, do we allow an ''@font-face'' ?
286+ I'm going to leave it as allowed unless/until I hear complaints.
287+
288+ This specification does not define how to add to, remove from, or generally manipulate
289+ the {{[[defaultElementStylesMap]]}} .
290+ It is expected that other specifications,
291+ such as [[DOM]] ,
292+ will define ways to do so.
293+
235294<!--
236295 ██████ ██ ██ ███ ████████ ███████ ██ ██
237296██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
@@ -606,7 +665,15 @@ Shadow Trees and the Cascade</h3>
606665
607666 Note: This is the <em> opposite</em> of how scoped styles work.
608667
609- <!-- Big Text: Flat Tree -->
668+ <!--
669+ ████████ ██ ███ ████████ ████████ ████████ ████████ ████████
670+ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
671+ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
672+ ██████ ██ ██ ██ ██ ██ ████████ ██████ ██████
673+ ██ ██ █████████ ██ ██ ██ ██ ██ ██
674+ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
675+ ██ ████████ ██ ██ ██ ██ ██ ██ ████████ ████████
676+ -->
610677
611678<h3 id='flattening' algorithm>
612679Flattening the DOM into an Element Tree</h3>
0 commit comments