We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 311ceb8 commit 59b6962Copy full SHA for 59b6962
src/quirks.rs
@@ -270,13 +270,14 @@ pub fn hash(url: &Url) -> &str {
270
271
/// Setter for https://url.spec.whatwg.org/#dom-url-hash
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
- }
+ url.set_fragment(match new_hash {
+ // If the given value is the empty string,
+ // then set context object’s url’s fragment to null and return.
+ "" => None,
+ // Let input be the given value with a single leading U+0023 (#) removed, if any.
+ _ if new_hash.starts_with('#') => Some(&new_hash[1..]),
+ _ => Some(new_hash),
280
+ })
281
}
282
283
fn trim(s: &str) -> &str {
0 commit comments