From ec43103b1df0af8cf8305e9c080bf124d615ebc0 Mon Sep 17 00:00:00 2001 From: Nick Burris Date: Mon, 2 Sep 2019 13:43:59 +0000 Subject: [PATCH] Bug 1576987 [wpt PR 18705] - Implement fallback to element anchor, a=testonly Automatic update from web-platform-tests Implement fallback to element anchor If we parse a TextFragmentAnchor but don't find a match, we should fallback to matching the element anchor, if there is one. Example: https://spaceplace.nasa.gov/blue-sky/en/#similar##targetText=notamatch Bug: 992522 Change-Id: Ie6dd2a4f5b35a612d563a3acb81392df756ce1d2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1746210 Commit-Queue: Nick Burris Reviewed-by: David Bokan Cr-Commit-Position: refs/heads/master@{#690845} -- wpt-commits: 29beb469ba8e5e611225061d3bc5d1c9d94082d7 wpt-pr: 18705 --- .../scroll-to-text-fragment-target.html | 5 +++++ .../scroll-to-text-fragment/scroll-to-text-fragment.html | 1 + 2 files changed, 6 insertions(+) diff --git a/testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment-target.html b/testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment-target.html index 724132fab29bf..fa229dd032f29 100644 --- a/testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment-target.html +++ b/testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment-target.html @@ -16,7 +16,12 @@ position: absolute; top: 3000px; } + #element { + position: absolute; + top: 2000px; + } +
Element

This is a test page

diff --git a/testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment.html b/testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment.html index eaab18437063d..db1b1ded30657 100644 --- a/testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment.html +++ b/testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment.html @@ -18,6 +18,7 @@ { fragment: '##targetText=this&targetText=test,page', expect_scroll: true }, { fragment: '#pagestate##targetText=test', expect_scroll: true }, { fragment: '#pagestate##targetText=nomatch', expect_scroll: false }, + { fragment: '#element##targetText=nomatch', expect_scroll: true }, ]; for (const test_case of test_cases) {