scroll-to-text-fragment-api.html (1186B)
1 <!doctype html> 2 <title>Fragment directive API</title> 3 <meta charset=utf-8> 4 <link rel="help" href="https://wicg.github.io/ScrollToTextFragment/"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/resources/testdriver.js"></script> 8 <script src="/resources/testdriver-vendor.js"></script> 9 <script> 10 test(t => { 11 assert_equals(typeof(document.fragmentDirective), 'object', 'document.fragmentDirective is defined'); 12 }, 'Scroll to text is feature detectable via document.fragmentDirective'); 13 14 test(t =>{ 15 document.fragmentDirective = 'text=test'; 16 assert_equals(window.scrollY, 0, 'Setting document.fragmentDirective did not have an effect on scroll position'); 17 assert_equals(typeof(document.fragmentDirective), 'object', 'document.fragmentDirective is still an object type'); 18 assert_equals(Object.keys(document.fragmentDirective).length, 0, 'document.fragmentDirective has no properties'); 19 }, 'Setting document.fragmentDirective has no effect'); 20 </script> 21 <style> 22 body { 23 height: 3200px; 24 } 25 #text { 26 position: absolute; 27 top: 3000px; 28 } 29 </style> 30 <body> 31 <p id="text">This is a test page</p> 32 </body>