2 <title>Entities in content
</title>
5 testRunner
.dumpAsText();
7 window
.onload = function() {
762 var elm
= document
.getElementsByTagName("p")[0];
763 var entity
, character
, characterCode
, result
, resultCode
;
764 for (var i
= 0, len
= entities
.length
; i
< len
; ++i
) {
765 entity
= entities
[i
];
766 character
= characters
[i
];
767 resultCode
= characterCode
= "";
768 elm
.innerHTML
= "&" + entity
+ "X ";
769 result
= elm
.firstChild
.data
.split("X")[0];
770 if (result
.length
== 1)
771 resultCode
= " (\\u" + result
.charCodeAt(0).toString(16) + ")";
772 if (character
.length
== 1)
773 characterCode
= " (\\u" + character
.charCodeAt(0).toString(16) + ")";
774 if (result
!= character
)
775 log
+= entity
+ " (was: " + result
+ resultCode
+ ", expected: " + character
+ characterCode
+ ")\n";
778 elm
.innerHTML
= "PASS";
780 document
.body
.innerHTML
= "<plaintext>FAIL:\n\n" + log
;
783 <p>FAIL (script didn't run)
</p>