aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/location.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/components/script/dom/location.rs b/components/script/dom/location.rs
index 9fff2a45837..72361193aa3 100644
--- a/components/script/dom/location.rs
+++ b/components/script/dom/location.rs
@@ -66,7 +66,10 @@ impl LocationMethods for Location {
}
// https://html.spec.whatwg.org/multipage/#dom-location-hash
- fn SetHash(&self, value: USVString) {
+ fn SetHash(&self, mut value: USVString) {
+ if value.0.is_empty() {
+ value = USVString("#".to_owned());
+ }
self.set_url_component(value, UrlHelper::SetHash);
}