handle empty hashes in Location

This commit is contained in:
Muki Kiboigo
2025-11-10 06:52:14 -08:00
parent 19b9ba8601
commit 16e7c0841d
2 changed files with 21 additions and 6 deletions

View File

@@ -15,6 +15,10 @@
</script>
<script id=location_hash>
location.hash = "";
testing.expectEqual("", location.hash);
testing.expectEqual('http://localhost:9582/src/tests/html/location.html', location.href);
location.hash = "#abcdef";
testing.expectEqual("#abcdef", location.hash);
testing.expectEqual('http://localhost:9582/src/tests/html/location.html#abcdef', location.href);
@@ -22,4 +26,8 @@
location.hash = "xyzxyz";
testing.expectEqual("#xyzxyz", location.hash);
testing.expectEqual('http://localhost:9582/src/tests/html/location.html#xyzxyz', location.href);
location.hash = "";
testing.expectEqual("", location.hash);
testing.expectEqual('http://localhost:9582/src/tests/html/location.html', location.href);
</script>