mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
script: Fix the scroll to top behavior
When finding the indicated fragment, do not use the document element to indicate the top of the Document, and when scrolling to the frament and we do not find a element, scrolling the top if the fragment is empty or equal to "top".
This commit is contained in:
parent
a2babd6db8
commit
74fa801b03
3 changed files with 54 additions and 38 deletions
|
@ -14690,6 +14690,12 @@
|
|||
"url": "/_mozilla/mozilla/scrollTo.html"
|
||||
}
|
||||
],
|
||||
"mozilla/scroll_top_null_target.html": [
|
||||
{
|
||||
"path": "mozilla/scroll_top_null_target.html",
|
||||
"url": "/_mozilla/mozilla/scroll_top_null_target.html"
|
||||
}
|
||||
],
|
||||
"mozilla/send-arraybuffer.htm": [
|
||||
{
|
||||
"path": "mozilla/send-arraybuffer.htm",
|
||||
|
|
21
tests/wpt/mozilla/tests/mozilla/scroll_top_null_target.html
Normal file
21
tests/wpt/mozilla/tests/mozilla/scroll_top_null_target.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<a id="test"></a>
|
||||
</body>
|
||||
<script>
|
||||
test(function() {
|
||||
location.hash = "test";
|
||||
assert_equals(document.querySelector(":target"), document.getElementById("test"),
|
||||
"Target shoud be the same with the test anchor!");
|
||||
location.hash = "";
|
||||
assert_equals(document.querySelector(":target"), null, "Target should be null!");
|
||||
});
|
||||
</script>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue