-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Currently, with CSS counters, elements that are underneath a "contain: style" element do not consider counter values above such elements. In other words the counters are contained to the subtree of the "contain: style" element.
This, however, currently does not apply to LIs under OL, since they are not using CSS counters and are defined (as far as I can tell) in terms of DOM structure.
Should those also respect style containment and not consider LI counts outside of a style contained elements?
For instance,
<ol>
<li></li>
<li></li>
<div style="contain: style;">
<li></li>
<li></li>
</div>
<li></li>
<li></li>
</ol>This is currently
1.
2.
3.
4.
5.
6.
If style containment is respected, then presumably these counts would be
1.
2.
1.
2.
3.
4.
One issue is that the LIs under a style contained elements should still be aware that they are descendants of an OL element, as opposed a UL element, which peeks outside of the style contained element, but I think that's acceptable.
Without containment considerations, it may be difficult for UAs to skip some optimizations that would otherwise not be user visible. As an example, the layout or maybe even DOM manipulations of an offscreen element, with "sufficient" containment, can normally be skipped if the UA can prove that this work will not affect the visual output of the page. If LIs are present though under an OL element, we can't satisfy this guarantee since the counts outside of the contained elements consider counts inside the contained element, so work can't be skipped.