1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
\r
5 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
\r
6 <title>:empty</title>
\r
8 <style type='text/css'>
\r
11 body { background: #fff; color: 000; font-family: Arial, Helvetica, sans-serif; }
\r
12 pre { background: #fff; padding: 0.5em; }
\r
13 li { background: #aaa; padding: 1em; width: 80%; margin: 0 0 3em; }
\r
14 .test { display: block; padding: 0.75em; }
\r
15 .base, .defaultgreen { background-color: #090; }
\r
16 .defaultred { background-color: #900; }
\r
18 .defaultred :empty {
\r
19 background-color: #090;
\r
22 .defaultgreen :empty {
\r
23 background-color: #900;
\r
35 <p>This page is part of the <a href="http://www.css3.info">CSS3.info</a> <a href="http://www.css3.info/selectors-test/">CSS selectors test</a>. See more info on <a href="http://www.css3.info/preview/attribute-selectors.html">CSS3 selectors</a>.</p>
\r
37 <div class='base'></div>
\r
42 <div class='defaultred'>
\r
43 <div class='test required'></div>
\r
49 <div></div></pre>
\r
52 The CSS selector should match the div element, because it is empty
\r
57 <div class='defaultred'>
\r
58 <div class='test'><!-- Just a comment --></div>
\r
64 <div><!-- Just a comment --></div></pre>
\r
67 The CSS selector should match the div element, because it is empty
\r
72 <div class='defaultgreen'>
\r
73 <div class='test default'> </div>
\r
79 <div> </div></pre>
\r
82 The CSS selector should not match the div element, because it is not empty
\r
87 <div class='defaultgreen'>
\r
88 <div class='test default'>
\r
97 How about regular text...
\r
101 The CSS selector should not match the div element, because it is not empty
\r
106 <div class='defaultgreen'>
\r
107 <div class='test default required'><blockquote></blockquote></div>
\r
113 <div><blockquote></blockquote></div></pre>
\r
116 The CSS selector should not match the div element, because it is not empty
\r
121 <div class='defaultgreen'>
\r
122 <div id='appendChild' class='test default'></div>
\r
125 <script type="text/javascript">
\r
128 var ib = document.getElementById('appendChild');
\r
129 ib.appendChild(document.createElement("div"));
\r
137 <div id='appendChild'></div>
\r
139 var ib = document.getElementById('appendChild');
\r
140 ib.appendChild(document.createElement("div"));</pre>
\r
143 The CSS selector should not match the orignal div element, because it will not be empty
\r
144 anymore after the Javascript code appends a child element to it.
\r