fragment-and-encoding-2.html (1203B)
1 <!doctype html> 2 <meta charset=windows-1252> 3 <title>Fragment navigation: encoding</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <div id="log"></div> 7 <div style=height:10000px></div> 8 <div id=�></div> 9 <div id=�></div> 10 <script> 11 function goToTop() { 12 location.hash = "top"; 13 assert_equals(self.scrollY, 0, "#top"); 14 } 15 16 test(() => { 17 assert_equals(location.hash, "", "Page must be loaded with no hash"); 18 19 location.hash = "%C2"; 20 assert_equals(location.hash, "#%C2"); 21 assert_greater_than(self.scrollY, 1000, "#%C2"); 22 }, "Invalid percent-encoded UTF-8 byte should decode as U+FFFD"); 23 24 test(() => { 25 goToTop(); 26 27 location.hash = "%EF%BB%BF%C2"; 28 assert_equals(location.hash, "#%EF%BB%BF%C2"); 29 assert_greater_than(self.scrollY, 1000, "#%EF%BB%BF%C2"); 30 }, "Percent-encoded UTF-8 BOM followed by invalid UTF-8 byte should decode as U+FEFF U+FFFD"); 31 32 test(() => { 33 goToTop(); 34 35 location.hash = "%EF%BF%BD"; 36 assert_equals(location.hash, "#%EF%BF%BD"); 37 assert_greater_than(self.scrollY, 1000, "#%EF%BF%BD"); 38 39 goToTop(); 40 }, "Percent-encoded UTF-8 byte sequence for U+FFFD should decode as U+FFFD"); 41 </script>