| CSS 3 Module | <== Test # ==> | |
|---|---|---|
| W3C Selectors | 2 of 4 of the dynamic tests category | |
| Testing | Date | Revision | 
| Dynamic handling of :empty (ID #d1b) | 2006-03-03 | 1.1 | 
NOTE: The UA must support ECMA-262 and DOM Level 2 Core for this test.
The following two bars should be green.
   #test1 { background: red; display: block; padding: 1em; margin: 1em; }
   #test1:empty { background: lime; }
   #test2 { background: lime; display: block; padding: 1em; margin: 1em; }
   #test2:empty { background: red; }
   
 <div>
  <script type="text/javascript">
   
    function test() {
      document.getElementById('test1').appendChild(document.createTextNode(''));
      document.getElementById('test2').appendChild(document.createTextNode(' '));
    }
    window.setTimeout("test()", 100);
   
  </script>
  <p> The following two bars should be green. </p>
  <div id="test1"></div>
  <div id="test2"></div>
 </div>