mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 00:15:08 +00:00
AK: Port URL::m_fragment from DeprecatedString to String
This commit is contained in:
parent
5663a2d3b4
commit
9d60f23abc
21 changed files with 68 additions and 76 deletions
|
@ -378,11 +378,11 @@ DeprecatedString HTMLHyperlinkElementUtils::hash() const
|
|||
// 2. Let url be this element's url.
|
||||
|
||||
// 3. If url is null, or url's fragment is either null or the empty string, return the empty string.
|
||||
if (!m_url.has_value() || m_url->fragment().is_null() || m_url->fragment().is_empty())
|
||||
if (!m_url.has_value() || !m_url->fragment().has_value() || m_url->fragment()->is_empty())
|
||||
return DeprecatedString::empty();
|
||||
|
||||
// 4. Return "#", followed by url's fragment.
|
||||
return DeprecatedString::formatted("#{}", m_url->fragment());
|
||||
return DeprecatedString::formatted("#{}", *m_url->fragment());
|
||||
}
|
||||
|
||||
void HTMLHyperlinkElementUtils::set_hash(DeprecatedString hash)
|
||||
|
@ -406,7 +406,7 @@ void HTMLHyperlinkElementUtils::set_hash(DeprecatedString hash)
|
|||
|
||||
// 2. Set url's fragment to the empty string.
|
||||
auto url_copy = m_url; // We copy the URL here to follow other browser's behavior of reverting the hash change if the parse failed.
|
||||
url_copy->set_fragment(DeprecatedString::empty());
|
||||
url_copy->set_fragment(String {});
|
||||
|
||||
// 3. Basic URL parse input, with url as url and fragment state as state override.
|
||||
auto result_url = URLParser::basic_parse(input, {}, move(url_copy), URLParser::State::Fragment);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue