You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
''p:empty'' is a valid representation of the following fragment:
2711
-
2712
-
<pre><p></p></pre>
2713
-
2714
-
''foo:empty'' is not a valid representation for the
2715
-
following fragments:
2716
-
2717
-
<pre><foo>bar</foo></pre>
2718
-
2719
-
<pre><foo><bar>bla</bar></foo></pre>
2720
-
2721
-
<pre><foo>this is not <bar>:empty</bar></foo></pre>
2722
-
</div>
2723
-
2724
-
Issue: The WG is considering whether to allow elements containing only white space to match this selector.
2725
-
The advantage would be that--
2726
-
as white space is largely collapsible in HTML and is therefore used for source code formatting, and especially because elements with omitted end tags are likely to absorb such white space into their DOM text contents--
2727
-
many elements which authors perceive of as empty would be selected by this selector, as they expect.
2728
-
The disadvantages are a potential conflict with Web-compat if there exist pages that depend on this selector excluding white space;
2729
-
and that one might consider uncollapsed white space to be significant content, but the selector cannot change its behavior based on the 'white-space' property.
2730
-
See <a href="https://github.com/w3c/csswg-drafts/issues/1967">discussion</a>.
2731
-
2732
-
2733
-
<h3 id='the-blank-pseudo'>
2734
-
'':blank'' pseudo-class</h3>
2735
-
2736
-
The <dfn id='blank-pseudo'>:blank</dfn> pseudo-class is like the '':empty'' pseudo-class,
2737
-
except that it additionally matches elements that only contain
2738
-
<a href="https://www.w3.org/TR/css3-text/#white-space-rules">code points affected by whitespace processing</a>. [[!CSS3TEXT]]
2732
+
''p:empty'' is a valid representation of the <{p}> elements
2733
+
in the following HTML fragment:
2734
+
2735
+
<pre class="html">
2736
+
<p></p>
2737
+
<p>
2738
+
<p> </p>
2739
+
<p><!-- comment --></p>
2740
+
</pre>
2739
2741
2740
-
<div class='example'>
2741
-
For example, the following element matches '':blank'',
2742
-
but not '':empty'',
2743
-
because it contains at least one linebreak, and possibly other whitespace:
2742
+
''div:empty'' is not a valid representation of the <code><div></code> elements
2743
+
in the following fragment:
2744
2744
2745
-
<pre><p><br></p></pre>
2745
+
<pre class="html">
2746
+
<div>text</div>
2747
+
<div><p></p></div>
2748
+
<div>&nbsp;</div>
2749
+
<div><p>bla</p></div>
2750
+
<div>this is not <p>:empty</p></div>
2751
+
</pre>
2746
2752
</div>
2747
2753
2748
-
Issue: The WG is considering whether to rename this or file its definition under the existing '':empty'' pseudo-class.
2749
-
See <a href="https://github.com/w3c/csswg-drafts/issues/1967">discussion</a>.
2750
-
There's also a <a href="https://github.com/w3c/csswg-drafts/issues/1283">related issue</a> on a selector for empty input fields which might legitimately steal this name.
2751
-
2754
+
Note: In Level 2 and Level 3 of Selectors,
2755
+
'':empty'' did not match elements that contained only white space.
2756
+
This was changed so that that--
2757
+
given white space is largely collapsible in HTML
2758
+
and is therefore used for source code formatting,
2759
+
and especially because elements with omitted end tags
2760
+
are likely to absorb such white space into their DOM text contents--
2761
+
elements which authors perceive of as empty
2762
+
can be selected by this selector, as they expect.
2752
2763
2753
2764
<h3 id='child-index'>
2754
2765
Child-indexed Pseudo-classes</h3>
@@ -3897,6 +3908,13 @@ Appendix B: Obsolete but Required Parsing Quirks for Web Compat</h2>
3897
3908
<h2 id="changes">
3898
3909
Changes</h2>
3899
3910
3911
+
Significant changes since the <a href="https://www.w3.org/TR/2018/WD-selectors-4-20180202/">2 February 2018 Working Draft</a>:
3912
+
3913
+
<ul>
3914
+
<li>Removed '':blank'' and defined '':empty'' to ignored white-space–only nodes.
0 commit comments