-
Notifications
You must be signed in to change notification settings - Fork 679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-pseudo-4] Define the behavior when custom properties must be taken from the root #9279
Changes from 3 commits
45f7907
9d29ee0
576230d
9ff1cba
35ce8fc
e805570
d117c2e
74b5c74
5fc11c6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -936,6 +936,49 @@ Cascading and Per-Element Highlight Styles</h3> | |
css/css-pseudo/cascade-highlight-002.html | ||
</wpt> | ||
|
||
<h4 id="highlight-custom-properties"> | ||
Custom Properties in Highlight Styles</h3> | ||
|
||
A [=custom property=] used in highlight styles uses the | ||
first custom property value found in the highlight cascade. | ||
schenney-chromium marked this conversation as resolved.
Show resolved
Hide resolved
|
||
However, if a custom property value cannot be resolved | ||
through the highlight cascade, the property value is taken from | ||
the root element. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of adding this sentence, I would take this existing sentence:
Split it out into a list item like this:
|
||
|
||
<div class="example"> | ||
For example, if an author specified | ||
<pre class="lang-css"> | ||
:root { | ||
--background-color: green; | ||
--decoration-thickness: 10px; | ||
--decoration-color: purple; | ||
} | ||
::selection { | ||
--decoration-thickness: 1px; | ||
--decoration-color: green; | ||
} | ||
div::selection { | ||
--decoration-color: blue; | ||
background-color: var(--background-color, red); | ||
text-decoration-line: underline; | ||
text-decoration-style: line; | ||
text-decoration-thickness: var(--decoration-thickness, 5px); | ||
text-decoration-color: var(--decoration-color, red); | ||
} | ||
</pre> | ||
A div's selection highlight would be a green background to the | ||
selected content, with a 1px thick blue underline. The | ||
''--background-color'' custom property is not found on the | ||
''div::selection'' nor ''::selection'' so it is taken from the | ||
''::root'' custom property match. The ''--decoration-thickness'' | ||
property is inherited from ''::selection'' via the highlight | ||
cascade and ''--decoration-color'' is found in | ||
''div::selection'' itself. | ||
</div> | ||
|
||
This behavior is intended to accomodate the standard practice of | ||
schenney-chromium marked this conversation as resolved.
Show resolved
Hide resolved
|
||
defining document-wide custom properties on '':root''. | ||
|
||
<h3 id="highlight-painting"> | ||
Painting the Highlight</h3> | ||
|
||
|
@@ -1468,6 +1511,9 @@ Changes</h2> | |
and {{CSSPseudoElement/pseudo()}} method | ||
to address [=sub-pseudo-elements=]. | ||
(<a href="https://github.com/w3c/csswg-drafts/issues/3836">Issue 3836</a>) | ||
<li>Defined the behavior when custom property values are not found in the | ||
highlight cascade; they are taken from the root. | ||
(<a href="https://github.com/w3c/csswg-drafts/issues/6641">Issue 6641</a>) | ||
</ul> | ||
|
||
Significant changes since the <a href="https://www.w3.org/TR/2019/WD-css-pseudo-4-20190225/">25 February 2019 Working Draft</a> include: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would merge this section with 3.5. Cascading and Per-Element Highlight Styles