You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spec/imports/index.html
+22-1Lines changed: 22 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -487,7 +487,28 @@ <h2 id="style-imports">Style processing with Imports</h2>
487
487
the external resources of the <code><ahref="http://www.whatwg.org/specs/web-apps/current-work/#the-link-element">link</a></code> elements in <ahref="#dfn-import">imports</a><strong>must</strong> be considered as input sources of the <ahref="http://www.w3.org/TR/CSS21/intro.html#processing-model">style processing model</a> of the <ahref="#dfn-master-document">master document</a>.</p>
488
488
489
489
<divclass="fixme">
490
-
<p>Between declarations from different documents, the document order in terms of <ahref="http://www.w3.org/TR/css3-cascade/#cascade-order">order of appearance</a> is defined based on the document order of the <code><ahref="http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#the-link-element">link</a></code> elements of their <ahref="#dfn-import-referrer-ancestor">import referrer ancestors</a> which are in the same document. If there are more than one of such documents, the comparison result in the first document, in the document order, wins.</p>
490
+
<p>Between declarations from different documents, the document order in terms of <ahref="http://www.w3.org/TR/css3-cascade/#cascade-order">order of appearance</a> is defined by comparing two elements <var>x</var>, whose owner document is <var>Dx</var>, and <var>y</var>, whose owner document is <var>Dy</var>, as follows:</p>
491
+
492
+
<ul>
493
+
<li>If there is a document <var>Da</var> which is a common <ahref="#dfn-import-referrer-ancestor">import referrer ancestor</a> of both <var>Dx</var> and <var>Dy</var>, use the document order order of <var>Lx</var>, the first import <code>link</code> element in <var>Da</var> that links to <var>Dx</var> or <var>Dx</var>'s <ahref="#dfn-import-referrer-ancestor">import referrer ancestor</a>, and <var>Ly</var>, a <code>link</code> that imports <var>Dy</var> respectivly. The <var>x</var> element wins if <var>Lx</var> wins, or <var>y</var> wins otehrwise.
494
+
495
+
<li>If <var>Dx</var> is a <ahref="#dfn-import-referrer-ancestor">import referrer ancestor</a> of <var>Dy</var>, compare the document order of <var>x</var> and a <var>Ly</var>, the first import <code>link</code> in <var>Dx</var> which links to <var>Dy</var> or <var>Dy</var>'s <ahref="#dfn-import-referrer-ancestor">import referrer ancestor</a>. If <var>x</var> wins over <var>Ly</var> it wins over <var>y</var> as well.
496
+
497
+
<li>If <var>Dy</var> is a <ahref="#dfn-import-referrer-ancestor">import referrer ancestor</a> of <var>Dx</var>, compare the document order of <var>y</var> and a <var>Lx</var> respectivly.
498
+
</ul>
499
+
500
+
<divclass="informative">
501
+
<p>Here is an illustrative document order of an import tree.</p>
502
+
<p>In this example, the master document has two <var>link</var> elements which import <var>B</var>'s <ahref="#dfn-import-referrer-ancestor">import referrer ancestors</a>. When comparing <var>b1</var> and <var>m2</var>, <var>b1</var> wins over <var>m2</var> because the first <code>link</code>, which is used to the comparison, appears before <var>m2</var> in the master document.</code></p>
An example of document order of styles in different documents in an import tree.
507
+
</figcaption>
508
+
509
+
<p>The comparison uses the notion of <ahref="#dfn-import-referrer-ancestor">import referrer ancestors</a> instead of <ahref="#dfn-import-import-ancestor">import ancestor</a>. This implies that moving import <code>link</code> through DOM mutation affect the ordering. It follows how <code>style</code> elements and <code>link</code> element for stylesheets work.</p>
0 commit comments