zero.html (3848B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <title></title> 4 <script src=/resources/testharness.js></script> 5 <script src=/resources/testharnessreport.js></script> 6 <body> 7 <div></div> 8 <script> 9 test(function() { 10 var div = document.getElementsByTagName("div")[0]; 11 div.innerHTML = "<!-\u0000>"; 12 assert_equals(div.firstChild.data, "-\uFFFD"); 13 }, "U+0000 should get replaced with U+FFFD after markup declaration hyphen"); 14 15 16 17 test(function() { 18 var div = document.getElementsByTagName("div")[0]; 19 div.innerHTML = "&\u0000auml;"; 20 assert_equals(div.firstChild.data, "ä"); 21 }, "U+0000 should vanish after ampersand"); 22 23 test(function() { 24 var div = document.getElementsByTagName("div")[0]; 25 div.innerHTML = "&a\u0000uml;"; 26 assert_equals(div.firstChild.data, "ä"); 27 }, "U+0000 should vanish after ampersand and one letter of entity prefix"); 28 29 test(function() { 30 var div = document.getElementsByTagName("div")[0]; 31 div.innerHTML = "&au\u0000ml;"; 32 assert_equals(div.firstChild.data, "ä"); 33 }, "U+0000 should vanish after ampersand and two letters of entity prefix"); 34 35 test(function() { 36 var div = document.getElementsByTagName("div")[0]; 37 div.innerHTML = "&aum\u0000l;"; 38 assert_equals(div.firstChild.data, "ä"); 39 }, "U+0000 should vanish after ampersand and three letters of entity prefix"); 40 41 test(function() { 42 var div = document.getElementsByTagName("div")[0]; 43 div.innerHTML = "ä\u0000;"; 44 assert_equals(div.firstChild.data, "\u00E4;"); 45 }, "U+0000 should vanish after semicolonless entity"); 46 47 test(function() { 48 var div = document.getElementsByTagName("div")[0]; 49 div.innerHTML = "¬in\u0000;"; 50 assert_equals(div.firstChild.data, "\u00ACin;"); 51 }, "U+0000 should vanish before required semicolon"); 52 53 54 55 test(function() { 56 var div = document.getElementsByTagName("div")[0]; 57 div.innerHTML = "a\u0000b"; 58 assert_equals(div.firstChild.data, "ab"); 59 }, "U+0000 should be dropped in body"); 60 61 62 63 test(function() { 64 var div = document.getElementsByTagName("div")[0]; 65 div.innerHTML = "<span title='&\u0000auml;'>"; 66 assert_equals(div.firstChild.title, "&\uFFFDauml;"); 67 }, "U+0000 should get replaced with U+FFFD after ampersand"); 68 69 test(function() { 70 var div = document.getElementsByTagName("div")[0]; 71 div.innerHTML = "<span title='&a\u0000uml;'>"; 72 assert_equals(div.firstChild.title, "&a\uFFFDuml;"); 73 }, "U+0000 should get replaced with U+FFFD after ampersand and one letter of entity prefix"); 74 75 test(function() { 76 var div = document.getElementsByTagName("div")[0]; 77 div.innerHTML = "<span title='&au\u0000ml;'>"; 78 assert_equals(div.firstChild.title, "&au\uFFFDml;"); 79 }, "U+0000 should get replaced with U+FFFD after ampersand and two letters of entity prefix"); 80 81 test(function() { 82 var div = document.getElementsByTagName("div")[0]; 83 div.innerHTML = "<span title='&aum\u0000l;'>"; 84 assert_equals(div.firstChild.title, "&aum\uFFFDl;"); 85 }, "U+0000 should get replaced with U+FFFD after ampersand and three letters of entity prefix"); 86 87 test(function() { 88 var div = document.getElementsByTagName("div")[0]; 89 div.innerHTML = "<span title='ä\u0000;'>"; 90 assert_equals(div.firstChild.title, "\u00E4\uFFFD;"); 91 }, "U+0000 should get replaced with U+FFFD after semicolonless entity"); 92 93 test(function() { 94 var div = document.getElementsByTagName("div")[0]; 95 div.innerHTML = "<span title='¬in\u0000;'>"; 96 assert_equals(div.firstChild.title, "¬in\uFFFD;"); 97 }, "U+0000 should get replaced with U+FFFD before required semicolon"); 98 99 100 101 </script>