link-rel-attribute-tokenization.html (1367B)
1 <!DOCTYPE html> 2 <script src=/resources/testharness.js></script> 3 <script src=/resources/testharnessreport.js></script> 4 5 <link id=light-link rel=stylesheet href=resources/link-rel-attribute.css> 6 <div id=light-div class=green></div> 7 8 <script> 9 10 function testLinkRelModification(testDiv, testLink) { 11 assert_equals(getComputedStyle(testDiv).color, "rgb(0, 128, 0)"); 12 testLink.setAttribute("rel", "test\u000Bstylesheet"); 13 assert_equals(getComputedStyle(testDiv).color, "rgb(0, 0, 0)"); 14 testLink.setAttribute("rel", "test\u000Cstylesheet"); 15 assert_equals(getComputedStyle(testDiv).color, "rgb(0, 128, 0)"); 16 testLink.removeAttribute("rel"); 17 assert_equals(getComputedStyle(testDiv).color, "rgb(0, 0, 0)"); 18 testLink.setAttribute("rel", "\u0009\u000A\u000C\u000D\u0020stylesheet"); 19 assert_equals(getComputedStyle(testDiv).color, "rgb(0, 128, 0)"); 20 testLink.removeAttribute("rel"); 21 assert_equals(getComputedStyle(testDiv).color, "rgb(0, 0, 0)"); 22 testLink.setAttribute("rel", "\u0009\u000A\u000C\u000D\u0020stylesheet\u0009\u000A\u000C\u000D\u0020††††"); 23 assert_equals(getComputedStyle(testDiv).color, "rgb(0, 128, 0)"); 24 } 25 26 test (() => { 27 testLinkRelModification(document.querySelector("#light-div"), 28 document.querySelector("#light-link")); 29 }, "The rel attribute needs to handle ASCII whitespace correctly"); 30 31 </script>