Skip to content

Truly independent web browser

815 B
Raw Blame
<!doctype html>
<meta charset="utf-8">
<title>Text fragment matching across a line break</title>
<link rel="help" href="https://wicg.github.io/scroll-to-text-fragment/#find-a-range-from-a-node-list">
<script src="wpt-import/resources/testharness.js"></script>
<script src="wpt-import/resources/testharnessreport.js"></script>

<style>
    #target { margin-top: 2000px; }
</style>

<p id="target">alpha<br>beta</p>

<script>
promise_test(async () => {
    await new Promise(resolve => addEventListener("load", resolve, { once: true }));

    location.href = "#:~:text=alpha%20beta";
    await new Promise(resolve => requestAnimationFrame(resolve));
    assert_greater_than(scrollY, 0, "the words on both sides of the line break matched");
}, "A line break with no white space next to it separates words");
</script>