anchor-remove-href.html (937B)
1 <!DOCTYPE html> 2 <link rel=author href="mailto:jarhar@chromium.org"> 3 <link rel=help href="https://issues.chromium.org/issues/443585794"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 7 <a href="#">anchor tag</a> 8 9 <script> 10 promise_test(async () => { 11 const anchor = document.querySelector('a'); 12 anchor.focus(); 13 assert_equals(document.activeElement, anchor, 14 'anchor should be focused at the start of the test.'); 15 16 anchor.removeAttribute('href'); 17 anchor.setAttribute('tabindex', '0'); 18 assert_equals(document.activeElement, anchor, 19 'anchor should be focused after removing href.'); 20 21 await new Promise(requestAnimationFrame); 22 await new Promise(requestAnimationFrame); 23 24 assert_equals(document.activeElement, anchor, 25 'anchor should still be focused after a double rAF.'); 26 }, 'anchor element should remain focused after removing href attribute.'); 27 </script>