2 <script src=
"../../resources/js-test.js"></script>
4 Test that innerHTML/outerHTML does not mangle javascript: urls.
6 <div id=jsurltest
><a href='javascript:test(
&37;3C!--D--
&37;3E)'
>link
</a></div>
8 var r
= document
.getElementById('jsurltest');
10 r
.innerHTML
= r
.innerHTML
.replace('&37;3C!--D--&37;3E', 123);
11 shouldBeEqualToString('r.innerHTML', '<a href="javascript:test(123)">link</a>');
13 r
.firstChild
.setAttribute('href', 'javascript:test(\"text<\")');
14 shouldBeEqualToString('r.innerHTML', '<a href=\'javascript:test("text<")\'>link</a>');
16 r
.firstChild
.setAttribute('href', 'javascript:test(\'text>\')');
17 shouldBeEqualToString("r.innerHTML", '<a href="javascript:test(\'text>\')">link</a>');
19 testString
= 'javascript:test(\'text&\',"test2&")';
20 r
.firstChild
.setAttribute('href', testString
);
21 shouldBeEqualToString('r.innerHTML', '<a href="javascript:test(\'text&\',"test2&")">link</a>');
23 r
.firstChild
.href
= 'javascript:window.location=\'?x&y\'';
24 shouldBeEqualToString("r.firstChild.outerHTML", '<a href="javascript:window.location=\'?x&y\'">link</a>');
26 // Behavior is same as FF
27 r
.firstChild
.href
= 'javascript:window.location=\'?x&y\'';
28 shouldBeEqualToString('r.firstChild.outerHTML', '<a href="javascript:window.location=\'?x&amp;y\'">link</a>');
29 r
.innerHTML
= '<a href="javascript:window.location=\'?x&y\'">link</a>';
30 shouldBeEqualToString('r.firstChild.outerHTML', '<a href="javascript:window.location=\'?x&y\'">link</a>');