2 <title>Entities in attributes
</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
= "<span title='&" + entity
+ "X'></span>";
769 result
= elm
.firstChild
.title
.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 (/;$/.test(entity
)) {
775 if (result
!= character
)
776 log
+= entity
+ " (was: " + result
+ resultCode
+ ", expected: " + character
+ characterCode
+ ")\n";
778 if (result
!= "&" + entity
)
779 log
+= entity
+ " (was: " + result
+ resultCode
+ ", expected: &" + entity
+ ")\n";
783 elm
.innerHTML
= "PASS";
785 document
.body
.innerHTML
= "<plaintext>FAIL:\n\n" + log
;
788 <p>FAIL (script didn't run)
</p>