@@ -35,6 +35,13 @@ spec:css-pseudo-4; type:selector;
35
35
text: ::first-line
36
36
text: ::before
37
37
text: ::after
38
+ spec: svg2;
39
+ type:dfn;
40
+ text: container element
41
+ text: text content child element
42
+ text: renderable element
43
+ text: non-rendered element
44
+ text: rendered element
38
45
</pre>
39
46
40
47
<h2 id="intro">
@@ -1160,34 +1167,57 @@ HTML Elements {#unbox-html}
1160
1167
SVG Elements {#unbox-svg}
1161
1168
---------------------------
1162
1169
1163
- : Root <{svg}>
1170
+ : An <{svg}> element that has CSS box layout
1171
+ (this includes all <{svg}> whose parent is an HTML element,
1172
+ as well as document root elements)
1164
1173
::
1165
1174
''display: contents'' behaves as ''display: none'' .
1166
1175
1167
- : Nested <{svg}>
1168
- : <{a}>
1169
- : <{g}>
1170
- : <{use}> (treated as a Shadow DOM container)
1171
- : <{tspan}>
1172
- : <{textPath}>
1173
- : unknown elements
1176
+ : All other SVG [=container elements=] that are also [=renderable elements=]
1177
+ : SVG [=text content child elements=]
1178
+ : <{use}>
1174
1179
::
1175
1180
''display: contents'' strips the element from the formatting tree,
1176
1181
and hoists its contents up to display in its place.
1182
+ These contents include the shadow-DOM content for <{use}> .
1177
1183
1178
1184
: any other SVG elements
1179
1185
::
1180
1186
''display: contents'' behaves as ''display: none'' .
1187
+
1188
+ <div class="note">
1189
+
1190
+ The intention here is that
1191
+ the ''display: none'' behavior applies
1192
+ whenever the "rendering context" inside the element
1193
+ is different than the context outside of it.
1194
+ If the element's child elements would not be valid children
1195
+ of the element's parent,
1196
+ you cannot simply hoist them up the formatting tree.
1197
+
1198
+ For example, text content and text formatting elements in SVG
1199
+ require a <{text}> element context;
1200
+ if you remove a <{text}> ,
1201
+ its child text content and elements are no longer valid.
1202
+ For that reason, ''display: contents'' on <{text}>
1203
+ prevents the entire text element from being rendered.
1204
+ In contrast, any content inside a <{tspan}> or <{textPath}>
1205
+ is also valid content inside the parent text formatting context,
1206
+ so the hoisting behavior applies for these elements.
1207
+
1208
+ Similarly, if hoisting would convert the children from
1209
+ [=non-rendered elements=]
1210
+ (e.g., a shape inside a <{pattern}> or <{symbol}> )
1211
+ to [=rendered elements=]
1212
+ (e.g., a shape that is a direct child of the <{svg}> ),
1213
+ that is an invalid change of rendering context.
1214
+ Never-rendered container elements therefore cannot be "un-boxed"
1215
+ by ''display: contents'' .
1216
+ (Also, authors cannot override the 'display' property on these elements:
1217
+ it is forced to ''none'' by an ''!important'' user agent style rule.)
1218
+
1219
+ </div>
1181
1220
1182
- Note: The intention here is that "nested container" elements--
1183
- elements which have the same sort of "rendering context"
1184
- both outside and inside themselves,
1185
- such that it's <em> meaningful</em> to put their contents
1186
- into the context of their parents--
1187
- get stripped and hoist their contents like normal for ''display: contents'' .
1188
- Anything else,
1189
- where their contents are handled in a totally separate context from their parent,
1190
- just removes itself entirely.
1191
1221
1192
1222
MathML Elements {#unbox-mathml}
1193
1223
-------------------------------
0 commit comments