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 @@ -259,13 +259,14 @@ pub fn hash(url: &Url) -> &str {
259
259
260
260
/// Setter for https://url.spec.whatwg.org/#dom-url-hash
261
261
pub fn set_hash ( url : & mut Url , new_hash : & str ) {
262
- if url. scheme ( ) != "javascript" {
263
- url. set_fragment ( match new_hash {
264
- "" => None ,
265
- _ if new_hash. starts_with ( '#' ) => Some ( & new_hash[ 1 ..] ) ,
266
- _ => Some ( new_hash) ,
267
- } )
268
- }
262
+ url. set_fragment ( match new_hash {
263
+ // If the given value is the empty string,
264
+ // then set context object’s url’s fragment to null and return.
265
+ "" => None ,
266
+ // Let input be the given value with a single leading U+0023 (#) removed, if any.
267
+ _ if new_hash. starts_with ( '#' ) => Some ( & new_hash[ 1 ..] ) ,
268
+ _ => Some ( new_hash) ,
269
+ } )
269
270
}
270
271
271
272
fn trim ( s : & str ) -> & str {
You can’t perform that action at this time.
0 commit comments