3 p { background-color: red; width:
100px; height:
100px; }
4 p:empty { display: none; }
8 <p id=
"test1"><a></a></p>
10 <p id=
"test2">	</p>
17 if (window
.testRunner
)
18 window
.testRunner
.dumpAsText();
20 function allElementsHaveDisplayNone(elements
)
22 for (var styles
= "", i
= 0; i
< elements
.length
; ++i
)
23 styles
+= getComputedStyle(elements
.item(i
), null).display
+ ",";
24 return styles
.match(/none,/g).length
== elements
.length
;
27 window
.onload = function() {
28 var log = function(text
) { document
.querySelector("pre").textContent
= text
};
30 var elements
= document
.getElementsByTagName("p");
31 for (var i
= 0; i
< elements
.length
; ++i
) {
32 var element
= elements
.item(i
);
35 if (element
.offsetWidth
!= 100)
36 return log("FAIL:initial-width-" + element
.offsetWidth
);
37 element
.textContent
= "";
40 log(allElementsHaveDisplayNone(elements
) ? "PASS" : "FAIL");