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 @@ -208,13 +208,14 @@ pub fn hash(url: &Url) -> &str {
208
208
209
209
/// Setter for https://url.spec.whatwg.org/#dom-url-hash
210
210
pub fn set_hash ( url : & mut Url , new_hash : & str ) {
211
- if url. scheme ( ) != "javascript" {
212
- url. set_fragment ( match new_hash {
213
- "" => None ,
214
- _ if new_hash. starts_with ( '#' ) => Some ( & new_hash[ 1 ..] ) ,
215
- _ => Some ( new_hash) ,
216
- } )
217
- }
211
+ url. set_fragment ( match new_hash {
212
+ // If the given value is the empty string,
213
+ // then set context object’s url’s fragment to null and return.
214
+ "" => None ,
215
+ // Let input be the given value with a single leading U+0023 (#) removed, if any.
216
+ _ if new_hash. starts_with ( '#' ) => Some ( & new_hash[ 1 ..] ) ,
217
+ _ => Some ( new_hash) ,
218
+ } )
218
219
}
219
220
220
221
fn trim ( s : & str ) -> & str {
You can’t perform that action at this time.
0 commit comments