Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/browsers/browsing-the-web/scroll-to-fragid/target-pseudo-after-reinsertion.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<link rel=author href="mailto:jarhar@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=target>target</div>
<script>
test(() => {
const target = document.getElementById('target');
window.location.href = '#target';
assert_equals(document.querySelector(':target'), target,
':target should match before reinsertion.');
target.remove();
document.body.appendChild(target);
assert_equals(document.querySelector(':target'), target,
':target should match after reinsertion.');
}, ':target should match the target element even after it is removed and reinserted.');
</script>