mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-01 16:58:52 +00:00
LibWeb/HTML: Only trim single '#' on Location.hash setter
This commit is contained in:
parent
d01ee20b67
commit
f1d79483b7
Notes:
github-actions[bot]
2025-04-23 07:25:29 +00:00
Author: https://github.com/shannonbooth
Commit: f1d79483b7
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4426
Reviewed-by: https://github.com/tcl3 ✅
2 changed files with 3 additions and 3 deletions
|
@ -486,7 +486,7 @@ WebIDL::ExceptionOr<String> Location::hash() const
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-location-hash
|
||||
WebIDL::ExceptionOr<void> Location::set_hash(String const& value)
|
||||
WebIDL::ExceptionOr<void> Location::set_hash(StringView value)
|
||||
{
|
||||
// 1. If this's relevant Document is null, then return.
|
||||
auto const relevant_document = this->relevant_document();
|
||||
|
@ -504,7 +504,7 @@ WebIDL::ExceptionOr<void> Location::set_hash(String const& value)
|
|||
auto this_url_fragment = copy_url.fragment().has_value() ? *copy_url.fragment() : String {};
|
||||
|
||||
// 5. Let input be the given value with a single leading "#" removed, if any.
|
||||
auto input = value.bytes_as_string_view().trim("#"sv, TrimMode::Left);
|
||||
auto input = value.substring_view(value.starts_with('#'));
|
||||
|
||||
// 6. Set copyURL's fragment to the empty string.
|
||||
copy_url.set_fragment(String {});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue