Skip to content

Commit 0f41712

Browse files
authored
Define "part-like pseudo-element", from w3c#10083. (w3c#10199)
* [css-pseudo] Define part-like pseudo-element. w3c#10083 * [css-pseudo] Merge definitions into one section, and add example.
1 parent 42213b0 commit 0f41712

File tree

1 file changed

+39
-9
lines changed

1 file changed

+39
-9
lines changed

css-pseudo-4/Overview.bs

+39-9
Original file line numberDiff line numberDiff line change
@@ -1140,13 +1140,39 @@ Security and Privacy Considerations</h3>
11401140
the styling of such highlighted segments.
11411141

11421142
<h2 id="treelike">
1143-
Tree-Abiding Pseudo-elements</h2>
1143+
Tree-Abiding and Part-Like Pseudo-elements</h2>
11441144

11451145
<dfn export lt="tree-abiding|tree-abiding pseudo-element">Tree-abiding pseudo-elements</dfn> always fit within the box tree.
11461146
They <a lt="inheritance">inherit</a> any inheritable properties from their <a>originating element</a>;
11471147
non-inheritable properties take their <a>initial values</a> as usual.
11481148
[[CSS-CASCADE-4]]
11491149

1150+
A subset of [=tree-abiding pseudo-elements=],
1151+
the <dfn>part-like pseudo-elements</dfn>,
1152+
have slightly stronger requirements:
1153+
they act as if they have a well-defined location in the document tree.
1154+
This enables them to interact with some other platform features
1155+
as if they were real elements.
1156+
1157+
<div class=example>
1158+
For example, a [=part-like pseudo-element=]
1159+
can be used in the <{html-global/exportparts}> attribute,
1160+
to masquerade as a ''::part()''
1161+
for the component it's in:
1162+
1163+
<xmp class=html>
1164+
<template id=custom-element-template>
1165+
<p exportparts="::before : preceding-text">
1166+
You can style my ::before pseudo-element
1167+
by using ::part(preceding-text), too!
1168+
</template>
1169+
</xmp>
1170+
</div>
1171+
1172+
Unless otherwise specified,
1173+
any CSS property that applies to elements
1174+
applies to [=part-like pseudo-elements=].
1175+
11501176
<h3 id="generated-content">
11511177
Generated Content Pseudo-elements: ''::before'' and ''::after''</h3>
11521178

@@ -1165,10 +1191,9 @@ Generated Content Pseudo-elements: ''::before'' and ''::after''</h3>
11651191
immediately after the <a>originating element</a>'s actual content.
11661192
</dl>
11671193

1168-
These pseudo-elements can be styled
1169-
exactly like any normal document-sourced element in the document tree;
1170-
all properties that apply to a normal element
1171-
likewise apply to ''::before'' and ''::after''.
1194+
Both ''::before'' and ''::after''
1195+
are [=part-like pseudo-elements=];
1196+
there is no restriction on what properties apply to them.
11721197

11731198
<div class="example">
11741199
For example, the following rule inserts the string “Note: ”
@@ -1206,7 +1231,9 @@ List Markers: the ''::marker'' pseudo-element</h3>
12061231

12071232
ISSUE: Interaction of ''::marker'' and ''::first-line'' is currently under discussion in <a href='https://github.com/w3c/csswg-drafts/issues/4506'>Issue 4506</a>.
12081233

1209-
Only a limited set of properties can be used on the ''::marker'' pseudo-element.
1234+
''::marker'' is a [=tree-abiding pseudo-element=],
1235+
but not [=part-like pseudo-element|part-like=];
1236+
only a limited set of properties can be used on the ''::marker'' pseudo-element.
12101237
This list is defined in [[css-lists-3#marker-properties]].
12111238

12121239
The ''::before::marker'' or ''::after::marker'' selectors
@@ -1229,6 +1256,7 @@ Placeholder Input: the ''::placeholder'' pseudo-element</h3>
12291256
For example, a date-input field
12301257
might have the placeholder text “YYYY/MM/DD”
12311258
to clarify that numeric dates are to be entered in year-month-day order.
1259+
It is a [=tree-abiding pseudo-element=].
12321260

12331261
<div class="example">
12341262
For example, according to the semantics of [[HTML]]
@@ -1266,9 +1294,11 @@ Placeholder Input: the ''::placeholder'' pseudo-element</h3>
12661294
<h3 id="file-selector-button-pseudo">
12671295
File Selector Button: the ''::file-selector-button'' pseudo-element</h3>
12681296

1269-
The <dfn>::file-selector-button</dfn> pseudo-element targets the ''&lt;button>''
1270-
inside an ''&lt;input>'' element with <code>type=file</code>, if the UA
1271-
renders such a button.
1297+
The <dfn>::file-selector-button</dfn> pseudo-element
1298+
targets the ''&lt;button>''
1299+
inside an ''&lt;input>'' element with <code>type=file</code>,
1300+
if the UA renders such a button.
1301+
It is a [=part-like pseudo-element=].
12721302

12731303
There is no restriction on which properties apply to the
12741304
''::file-selector-button'' pseudo-element.

0 commit comments

Comments
 (0)