File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -270,13 +270,14 @@ pub fn hash(url: &Url) -> &str {
270
270
271
271
/// Setter for https://url.spec.whatwg.org/#dom-url-hash
272
272
pub fn set_hash ( url : & mut Url , new_hash : & str ) {
273
- if url. scheme ( ) != "javascript" {
274
- url. set_fragment ( match new_hash {
275
- "" => None ,
276
- _ if new_hash. starts_with ( '#' ) => Some ( & new_hash[ 1 ..] ) ,
277
- _ => Some ( new_hash) ,
278
- } )
279
- }
273
+ url. set_fragment ( match new_hash {
274
+ // If the given value is the empty string,
275
+ // then set context object’s url’s fragment to null and return.
276
+ "" => None ,
277
+ // Let input be the given value with a single leading U+0023 (#) removed, if any.
278
+ _ if new_hash. starts_with ( '#' ) => Some ( & new_hash[ 1 ..] ) ,
279
+ _ => Some ( new_hash) ,
280
+ } )
280
281
}
281
282
282
283
fn trim ( s : & str ) -> & str {
You can’t perform that action at this time.
0 commit comments