blob: b7fa2e63aacafbb88cc1fcf63299dfe165a06e99 [file] [log] [blame]
<!DOCTYPE html>
<script src="/scroll-to-text-fragment/stash.js"></script>
<!-- This test is navigated to with the fragment #:~:text=foo -->
<div id=parentid>
<div id=childid>foo</div>
</div>
<script>
const results = {
beforematchFiredOnChild: false,
beforematchFiredOnParent: false
};
childid.addEventListener('beforematch', () => {
results.beforematchFiredOnChild = true;
});
parentid.addEventListener('beforematch', () => {
results.beforematchFiredOnParent = true;
});
requestAnimationFrame(() => {
requestAnimationFrame(() => {
const params = new URLSearchParams(window.location.search);
stashResultsThenClose(params.get('key'), results);
});
});
</script>