Skip to content

Commit 86bb487

Browse files
committed
rewrite and heavily simplify paired cascade text
1 parent 4eb95b0 commit 86bb487

File tree

1 file changed

+34
-40
lines changed

1 file changed

+34
-40
lines changed

css-pseudo-4/Overview.bs

+34-40
Original file line numberDiff line numberDiff line change
@@ -696,12 +696,11 @@ Styling Highlights</h3>
696696

697697
Issue: Are there any other properties that should be included here?
698698

699-
In particular,
700-
'color' and 'background-color' are known as <dfn>highlight colors</dfn>,
701-
and their [=used values=] are handled specially (see [[#paired-cascade]]).
699+
'color' and 'background-color'
700+
are known as <dfn>highlight colors</dfn>.
702701
Because this concept exists for compatibility reasons,
703702
other similar properties
704-
like 'fill-color'
703+
like 'fill-color' or 'stroke-color'
705704
must not be treated as highlight colors.
706705

707706
<!-- Add this back if for some reason someone wants to implement 'outline'?
@@ -716,7 +715,7 @@ Styling Highlights</h3>
716715
-->
717716

718717
Note: Historically (and at the time of writing)
719-
only the [=highlight colors=] have been interoperably supported.
718+
only the highlight colors have been interoperably supported.
720719

721720
<h3 id=highlight-ua-styles>
722721
Default UA Styles</h3>
@@ -894,44 +893,39 @@ Painting the Highlight</h3>
894893
<h4 id="paired-cascade">
895894
Highlight Colors</h4>
896895

897-
With the exception of ''revert'' (see below),
896+
For compatibility reasons,
898897
[=default highlight colors=]
899-
for a given [=highlight pseudo-element=]
900898
must only be [=used value|used=]
901-
instead of [=initial values=]
902-
when neither the originating element’s [=cascade=],
903-
nor those of any of the originating element’s ancestors,
904-
yield any highlight colors
899+
when neither of the [=highlight colors=]
900+
yield a [=cascaded value=]
901+
or [=specified value=]
905902
of the [=author origin=].
906-
In other words,
907-
when the author sets one “custom” highlight color,
908-
defaults for the other highlight color are suppressed.
909-
910-
Note: 'stroke-color' and 'fill-color' have their usual effects
911-
on the foreground color,
912-
but unlike 'color',
913-
they do not suppress the default 'background-color'.
914-
915-
When a highlight color is ''revert'',
916-
[=default highlight colors=] are suppressed
917-
if and only if the cascade is “rolled back”
918-
to one of the origins listed above.
919-
For example,
920-
''revert'' in an [=author-origin=] rule
921-
rolls back the cascade to the [=user origin=],
922-
so defaults are not suppressed.
923-
924-
Note: all other explicit defaults,
925-
including ''unset'',
926-
suppress [=default highlight colors=] like any ordinary value.
927-
This happens to be consistent with
928-
how [=explicit defaulting=] is defined:
929-
it affects [=specified values=]
930-
based on [=cascaded values=].
931-
Even though the outcome is <em>as if</em>
932-
the [=cascade=] was modified in some way,
933-
the [=cascade=] is already done,
934-
so they exist unchanged as [=cascaded values=].
903+
When a highlight color is ''revert'' or ''revert-layer'',
904+
the origin <em>after</em> rolling back the cascade
905+
determines whether this is the case.
906+
907+
<div class="example">
908+
For example,
909+
given the following markup:
910+
<pre class="lang-markup">
911+
&lt;p>Highlight this &lt;em>and this&lt;/em>.&lt;/p>
912+
</pre>
913+
Any of the following rules
914+
would suppress the default 'background-color'
915+
for ''::selection''
916+
in the <code>&lt;em></code> element
917+
if given by the author:
918+
<pre class="lang-css">
919+
/* cascaded value is author origin */
920+
em::selection { color: initial; }
921+
em::selection { color: inherit; }
922+
em::selection { color: unset; }
923+
em::selection { color: green; }
924+
925+
/* specified value is author origin */
926+
p::selection { color: green; }
927+
</pre>
928+
</div>
935929

936930
<h4 id="highlight-backgrounds">
937931
Backgrounds</h4>

0 commit comments

Comments
 (0)