Skip to content

Commit ebe01b5

Browse files
shannonboothawesomekling
authored andcommitted
LibWeb: Add a non-DeprecatedString version of Element::prefix()
Renaming the old DeprecatedString version of this function to deprecated_prefix().
1 parent e5e4920 commit ebe01b5

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

Userland/Libraries/LibWeb/DOM/Element.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ class Element
8383
// NOTE: This is for the JS bindings
8484
DeprecatedString const& tag_name() const { return html_uppercased_qualified_name(); }
8585

86-
DeprecatedFlyString prefix() const { return m_qualified_name.deprecated_prefix(); }
86+
Optional<FlyString> const& prefix() const { return m_qualified_name.prefix(); }
87+
DeprecatedFlyString deprecated_prefix() const { return m_qualified_name.deprecated_prefix(); }
88+
8789
void set_prefix(DeprecatedFlyString const& value);
8890

8991
DeprecatedFlyString namespace_() const { return m_qualified_name.deprecated_namespace_(); }

Userland/Libraries/LibWeb/DOM/Element.idl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ dictionary ScrollIntoViewOptions : ScrollOptions {
2424
[Exposed=Window, UseDeprecatedAKString]
2525
interface Element : Node {
2626
readonly attribute DOMString? namespaceURI;
27-
readonly attribute DOMString? prefix;
27+
[ImplementedAs=deprecated_prefix] readonly attribute DOMString? prefix;
2828
readonly attribute DOMString localName;
2929
readonly attribute DOMString tagName;
3030

Userland/Libraries/LibWeb/DOM/Node.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ JS::NonnullGCPtr<Node> Node::clone_node(Document* document, bool clone_children)
809809
if (is<Element>(this)) {
810810
// 1. Let copy be the result of creating an element, given document, node’s local name, node’s namespace, node’s namespace prefix, and node’s is value, with the synchronous custom elements flag unset.
811811
auto& element = *verify_cast<Element>(this);
812-
auto element_copy = DOM::create_element(*document, element.local_name(), element.namespace_(), element.prefix(), element.is_value(), false).release_value_but_fixme_should_propagate_errors();
812+
auto element_copy = DOM::create_element(*document, element.local_name(), element.namespace_(), element.deprecated_prefix(), element.is_value(), false).release_value_but_fixme_should_propagate_errors();
813813

814814
// 2. For each attribute in node’s attribute list:
815815
element.for_each_attribute([&](auto& name, auto& value) {

Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ static WebIDL::ExceptionOr<DeprecatedString> serialize_element(DOM::Element cons
549549
// 12. Otherwise, inherited ns is not equal to ns (the node's own namespace is different from the context namespace of its parent). Run these sub-steps:
550550
else {
551551
// 1. Let prefix be the value of node's prefix attribute.
552-
auto prefix = element.prefix();
552+
auto prefix = element.deprecated_prefix();
553553

554554
// 2. Let candidate prefix be the result of retrieving a preferred prefix string prefix from map given namespace ns.
555555
auto candidate_prefix = retrieve_a_preferred_prefix_string(prefix, map, ns);

0 commit comments

Comments
 (0)