mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:18:11 +00:00
LibWeb: Port HTMLBaseElement interface from DeprecatedString to String
This commit is contained in:
parent
2a732e6ddd
commit
c405ba6b08
3 changed files with 8 additions and 10 deletions
|
@ -80,15 +80,13 @@ void HTMLBaseElement::set_the_frozen_base_url()
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/semantics.html#dom-base-href
|
||||
DeprecatedString HTMLBaseElement::href() const
|
||||
String HTMLBaseElement::href() const
|
||||
{
|
||||
// 1. Let document be element's node document.
|
||||
auto& document = this->document();
|
||||
auto const& document = this->document();
|
||||
|
||||
// 2. Let url be the value of the href attribute of this element, if it has one, and the empty string otherwise.
|
||||
auto url = DeprecatedString::empty();
|
||||
if (has_attribute(AttributeNames::href))
|
||||
url = deprecated_attribute(AttributeNames::href);
|
||||
auto url = attribute(AttributeNames::href).value_or(String {});
|
||||
|
||||
// 3. Let urlRecord be the result of parsing url with document's fallback base URL, and document's character encoding. (Thus, the base element isn't affected by other base elements or itself.)
|
||||
// FIXME: Pass in document's character encoding.
|
||||
|
@ -99,11 +97,11 @@ DeprecatedString HTMLBaseElement::href() const
|
|||
return url;
|
||||
|
||||
// 5. Return the serialization of urlRecord.
|
||||
return url_record.to_deprecated_string();
|
||||
return MUST(url_record.to_string());
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/semantics.html#dom-base-href
|
||||
WebIDL::ExceptionOr<void> HTMLBaseElement::set_href(DeprecatedString const& href)
|
||||
WebIDL::ExceptionOr<void> HTMLBaseElement::set_href(String const& href)
|
||||
{
|
||||
// The href IDL attribute, on setting, must set the href content attribute to the given new value.
|
||||
return set_attribute(AttributeNames::href, href);
|
||||
|
|
|
@ -16,8 +16,8 @@ class HTMLBaseElement final : public HTMLElement {
|
|||
public:
|
||||
virtual ~HTMLBaseElement() override;
|
||||
|
||||
DeprecatedString href() const;
|
||||
WebIDL::ExceptionOr<void> set_href(DeprecatedString const& href);
|
||||
String href() const;
|
||||
WebIDL::ExceptionOr<void> set_href(String const& href);
|
||||
|
||||
AK::URL const& frozen_base_url() const { return m_frozen_base_url; }
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/semantics.html#htmlbaseelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLBaseElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue