-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Soft navigations - handle hash-based navigations
Currently soft navigation heuristics don't include hash-based soft navigatons. This CL fixes that. Bug: 1376597 Change-Id: Id8848ec71fd12dc6dbd7d5f9b7416d241e02a0a5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4020675 Reviewed-by: Ian Clelland <iclelland@chromium.org> Commit-Queue: Yoav Weiss <yoavweiss@chromium.org> Cr-Commit-Position: refs/heads/main@{#1073368}
- Loading branch information
1 parent
3421aaf
commit dbcd308
Showing
3 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Detect hashchange event.</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/resources/testdriver.js"></script> | ||
<script src="/resources/testdriver-vendor.js"></script> | ||
<script src="resources/soft-navigation-helper.js"></script> | ||
</head> | ||
<body> | ||
<main id=main> | ||
<div> | ||
<a id=link>Click me!</a> | ||
</div> | ||
</main> | ||
<script> | ||
const link = document.getElementById("link"); | ||
testSoftNavigation({ | ||
addContent: () => { | ||
addTextToDivOnMain(); | ||
}, | ||
link: link, | ||
pushState: (url)=>{location.hash=url;}, | ||
test: "Location hash changes properly works with SoftNavigationHeuristics"}); | ||
</script> | ||
</body> | ||
</html> |
28 changes: 28 additions & 0 deletions
28
soft-navigation-heuristics/navigation-api-hash.tentative.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Detect intercepted navigate event.</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/resources/testdriver.js"></script> | ||
<script src="/resources/testdriver-vendor.js"></script> | ||
<script src="resources/soft-navigation-helper.js"></script> | ||
</head> | ||
<body> | ||
<main id=main> | ||
<a href="#foobar.html" id=link>Click me!</a> | ||
</main> | ||
<script> | ||
const link = document.getElementById("link"); | ||
testNavigationApi("Test soft navigation with the Navigation API", e => { | ||
timestamps[counter]["eventStart"] = performance.now(); | ||
e.intercept({handler: async () => { | ||
await addImageToMain(); | ||
main.appendChild(img); | ||
}}); | ||
}, link); | ||
</script> | ||
</body> | ||
</html> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters