diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp index 9c279e8266c..e009eb0f7f4 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp @@ -41,7 +41,7 @@ static bool is_wrappable_type(Type const& type) return true; if (type.name() == "Selection") return true; - if (type.name() == "Attribute") + if (type.name() == "Attr") return true; if (type.name() == "NamedNodeMap") return true; diff --git a/Userland/Libraries/LibWeb/Bindings/WindowObjectHelper.h b/Userland/Libraries/LibWeb/Bindings/WindowObjectHelper.h index 36fc5208a9a..2eb176c02da 100644 --- a/Userland/Libraries/LibWeb/Bindings/WindowObjectHelper.h +++ b/Userland/Libraries/LibWeb/Bindings/WindowObjectHelper.h @@ -14,8 +14,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include @@ -402,7 +402,7 @@ ADD_WINDOW_OBJECT_INTERFACE(AbortController) \ ADD_WINDOW_OBJECT_INTERFACE(AbortSignal) \ ADD_WINDOW_OBJECT_INTERFACE(AbstractRange) \ - ADD_WINDOW_OBJECT_INTERFACE(Attribute) \ + ADD_WINDOW_OBJECT_INTERFACE(Attr) \ ADD_WINDOW_OBJECT_INTERFACE(Blob) \ ADD_WINDOW_OBJECT_INTERFACE(CDATASection) \ ADD_WINDOW_OBJECT_INTERFACE(CSSConditionRule) \ diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt index 223afed183b..dcd150f97ed 100644 --- a/Userland/Libraries/LibWeb/CMakeLists.txt +++ b/Userland/Libraries/LibWeb/CMakeLists.txt @@ -74,8 +74,8 @@ set(SOURCES DOM/AbortController.cpp DOM/AbortSignal.cpp DOM/AbstractRange.cpp - DOM/Attribute.cpp - DOM/Attribute.idl + DOM/Attr.cpp + DOM/Attr.idl DOM/CDATASection.cpp DOM/CharacterData.cpp DOM/CharacterData.idl diff --git a/Userland/Libraries/LibWeb/DOM/Attribute.cpp b/Userland/Libraries/LibWeb/DOM/Attr.cpp similarity index 71% rename from Userland/Libraries/LibWeb/DOM/Attribute.cpp rename to Userland/Libraries/LibWeb/DOM/Attr.cpp index 36e8c931777..076f5381140 100644 --- a/Userland/Libraries/LibWeb/DOM/Attribute.cpp +++ b/Userland/Libraries/LibWeb/DOM/Attr.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include #include #include @@ -12,43 +12,43 @@ namespace Web::DOM { -JS::NonnullGCPtr Attribute::create(Document& document, FlyString local_name, String value, Element const* owner_element) +JS::NonnullGCPtr Attr::create(Document& document, FlyString local_name, String value, Element const* owner_element) { - return *document.heap().allocate(document.realm(), document, move(local_name), move(value), owner_element); + return *document.heap().allocate(document.realm(), document, move(local_name), move(value), owner_element); } -Attribute::Attribute(Document& document, FlyString local_name, String value, Element const* owner_element) +Attr::Attr(Document& document, FlyString local_name, String value, Element const* owner_element) : Node(document, NodeType::ATTRIBUTE_NODE) , m_qualified_name(move(local_name), {}, {}) , m_value(move(value)) , m_owner_element(owner_element) { - set_prototype(&window().cached_web_prototype("Attribute")); + set_prototype(&window().cached_web_prototype("Attr")); } -void Attribute::visit_edges(Cell::Visitor& visitor) +void Attr::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); visitor.visit(m_owner_element.ptr()); } -Element* Attribute::owner_element() +Element* Attr::owner_element() { return m_owner_element.ptr(); } -Element const* Attribute::owner_element() const +Element const* Attr::owner_element() const { return m_owner_element.ptr(); } -void Attribute::set_owner_element(Element const* owner_element) +void Attr::set_owner_element(Element const* owner_element) { m_owner_element = owner_element; } // https://dom.spec.whatwg.org/#set-an-existing-attribute-value -void Attribute::set_value(String value) +void Attr::set_value(String value) { // 1. If attribute’s element is null, then set attribute’s value to value. if (!owner_element()) { @@ -66,7 +66,7 @@ void Attribute::set_value(String value) } // https://dom.spec.whatwg.org/#handle-attribute-changes -void Attribute::handle_attribute_changes(Element& element, String const& old_value, [[maybe_unused]] String const& new_value) +void Attr::handle_attribute_changes(Element& element, String const& old_value, [[maybe_unused]] String const& new_value) { // 1. Queue a mutation record of "attributes" for element with attribute’s local name, attribute’s namespace, oldValue, « », « », null, and null. element.queue_mutation_record(MutationType::attributes, local_name(), namespace_uri(), old_value, StaticNodeList::create(window(), {}), StaticNodeList::create(window(), {}), nullptr, nullptr); diff --git a/Userland/Libraries/LibWeb/DOM/Attribute.h b/Userland/Libraries/LibWeb/DOM/Attr.h similarity index 75% rename from Userland/Libraries/LibWeb/DOM/Attribute.h rename to Userland/Libraries/LibWeb/DOM/Attr.h index 4f9787fb0b5..41410b44565 100644 --- a/Userland/Libraries/LibWeb/DOM/Attribute.h +++ b/Userland/Libraries/LibWeb/DOM/Attr.h @@ -14,13 +14,13 @@ namespace Web::DOM { // https://dom.spec.whatwg.org/#attr -class Attribute final : public Node { - WEB_PLATFORM_OBJECT(Attribute, Node); +class Attr final : public Node { + WEB_PLATFORM_OBJECT(Attr, Node); public: - static JS::NonnullGCPtr create(Document&, FlyString local_name, String value, Element const* = nullptr); + static JS::NonnullGCPtr create(Document&, FlyString local_name, String value, Element const* = nullptr); - virtual ~Attribute() override = default; + virtual ~Attr() override = default; virtual FlyString node_name() const override { return name(); } @@ -42,7 +42,7 @@ public: void handle_attribute_changes(Element&, String const& old_value, String const& new_value); private: - Attribute(Document&, FlyString local_name, String value, Element const*); + Attr(Document&, FlyString local_name, String value, Element const*); virtual void visit_edges(Cell::Visitor&) override; @@ -52,8 +52,8 @@ private: }; template<> -inline bool Node::fast_is() const { return is_attribute(); } +inline bool Node::fast_is() const { return is_attribute(); } } -WRAPPER_HACK(Attribute, Web::DOM) +WRAPPER_HACK(Attr, Web::DOM) diff --git a/Userland/Libraries/LibWeb/DOM/Attribute.idl b/Userland/Libraries/LibWeb/DOM/Attr.idl similarity index 92% rename from Userland/Libraries/LibWeb/DOM/Attribute.idl rename to Userland/Libraries/LibWeb/DOM/Attr.idl index e5ecb4d40d8..3b5993e7e08 100644 --- a/Userland/Libraries/LibWeb/DOM/Attribute.idl +++ b/Userland/Libraries/LibWeb/DOM/Attr.idl @@ -2,7 +2,7 @@ #import [Exposed=Window] -interface Attribute : Node { +interface Attr : Node { readonly attribute DOMString? namespaceURI; readonly attribute DOMString? prefix; readonly attribute DOMString localName; diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index 95591634464..a65dc23c565 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -98,7 +98,7 @@ ExceptionOr Element::set_attribute(FlyString const& name, String const& va // 4. If attribute is null, create an attribute whose local name is qualifiedName, value is value, and node document is this’s node document, then append this attribute to this, and then return. if (!attribute) { - auto new_attribute = Attribute::create(document(), insert_as_lowercase ? name.to_lowercase() : name, value); + auto new_attribute = Attr::create(document(), insert_as_lowercase ? name.to_lowercase() : name, value); m_attributes->append_attribute(new_attribute); attribute = new_attribute.ptr(); @@ -208,7 +208,7 @@ DOM::ExceptionOr Element::toggle_attribute(FlyString const& name, Optional if (!attribute) { // 1. If force is not given or is true, create an attribute whose local name is qualifiedName, value is the empty string, and node document is this’s node document, then append this attribute to this, and then return true. if (!force.has_value() || force.value()) { - auto new_attribute = Attribute::create(document(), insert_as_lowercase ? name.to_lowercase() : name, ""); + auto new_attribute = Attr::create(document(), insert_as_lowercase ? name.to_lowercase() : name, ""); m_attributes->append_attribute(new_attribute); parse_attribute(new_attribute->local_name(), ""); diff --git a/Userland/Libraries/LibWeb/DOM/Element.h b/Userland/Libraries/LibWeb/DOM/Element.h index ab4ffce2f71..020fea56b14 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.h +++ b/Userland/Libraries/LibWeb/DOM/Element.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Userland/Libraries/LibWeb/DOM/NamedNodeMap.cpp b/Userland/Libraries/LibWeb/DOM/NamedNodeMap.cpp index 42c8b3d3fa7..52419021843 100644 --- a/Userland/Libraries/LibWeb/DOM/NamedNodeMap.cpp +++ b/Userland/Libraries/LibWeb/DOM/NamedNodeMap.cpp @@ -5,7 +5,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include #include #include @@ -63,7 +63,7 @@ Vector NamedNodeMap::supported_property_names() const } // https://dom.spec.whatwg.org/#dom-namednodemap-item -Attribute const* NamedNodeMap::item(u32 index) const +Attr const* NamedNodeMap::item(u32 index) const { // 1. If index is equal to or greater than this’s attribute list’s size, then return null. if (index >= m_attributes.size()) @@ -74,19 +74,19 @@ Attribute const* NamedNodeMap::item(u32 index) const } // https://dom.spec.whatwg.org/#dom-namednodemap-getnameditem -Attribute const* NamedNodeMap::get_named_item(StringView qualified_name) const +Attr const* NamedNodeMap::get_named_item(StringView qualified_name) const { return get_attribute(qualified_name); } // https://dom.spec.whatwg.org/#dom-namednodemap-setnameditem -ExceptionOr NamedNodeMap::set_named_item(Attribute& attribute) +ExceptionOr NamedNodeMap::set_named_item(Attr& attribute) { return set_attribute(attribute); } // https://dom.spec.whatwg.org/#dom-namednodemap-removenameditem -ExceptionOr NamedNodeMap::remove_named_item(StringView qualified_name) +ExceptionOr NamedNodeMap::remove_named_item(StringView qualified_name) { // 1. Let attr be the result of removing an attribute given qualifiedName and element. auto const* attribute = remove_attribute(qualified_name); @@ -100,13 +100,13 @@ ExceptionOr NamedNodeMap::remove_named_item(StringView qualifi } // https://dom.spec.whatwg.org/#concept-element-attributes-get-by-name -Attribute* NamedNodeMap::get_attribute(StringView qualified_name, size_t* item_index) +Attr* NamedNodeMap::get_attribute(StringView qualified_name, size_t* item_index) { - return const_cast(const_cast(this)->get_attribute(qualified_name, item_index)); + return const_cast(const_cast(this)->get_attribute(qualified_name, item_index)); } // https://dom.spec.whatwg.org/#concept-element-attributes-get-by-name -Attribute const* NamedNodeMap::get_attribute(StringView qualified_name, size_t* item_index) const +Attr const* NamedNodeMap::get_attribute(StringView qualified_name, size_t* item_index) const { if (item_index) *item_index = 0; @@ -133,7 +133,7 @@ Attribute const* NamedNodeMap::get_attribute(StringView qualified_name, size_t* } // https://dom.spec.whatwg.org/#concept-element-attributes-set -ExceptionOr NamedNodeMap::set_attribute(Attribute& attribute) +ExceptionOr NamedNodeMap::set_attribute(Attr& attribute) { // 1. If attr’s element is neither null nor element, throw an "InUseAttributeError" DOMException. if ((attribute.owner_element() != nullptr) && (attribute.owner_element() != &associated_element())) @@ -162,7 +162,7 @@ ExceptionOr NamedNodeMap::set_attribute(Attribute& attribute) } // https://dom.spec.whatwg.org/#concept-element-attributes-replace -void NamedNodeMap::replace_attribute(Attribute& old_attribute, Attribute& new_attribute, size_t old_attribute_index) +void NamedNodeMap::replace_attribute(Attr& old_attribute, Attr& new_attribute, size_t old_attribute_index) { // 1. Handle attribute changes for oldAttr with oldAttr’s element, oldAttr’s value, and newAttr’s value. VERIFY(old_attribute.owner_element()); @@ -180,7 +180,7 @@ void NamedNodeMap::replace_attribute(Attribute& old_attribute, Attribute& new_at } // https://dom.spec.whatwg.org/#concept-element-attributes-append -void NamedNodeMap::append_attribute(Attribute& attribute) +void NamedNodeMap::append_attribute(Attr& attribute) { // 1. Handle attribute changes for attribute with element, null, and attribute’s value. attribute.handle_attribute_changes(associated_element(), {}, attribute.value()); @@ -195,7 +195,7 @@ void NamedNodeMap::append_attribute(Attribute& attribute) // https://dom.spec.whatwg.org/#concept-element-attributes-remove void NamedNodeMap::remove_attribute_at_index(size_t attribute_index) { - JS::NonnullGCPtr attribute = m_attributes.at(attribute_index); + JS::NonnullGCPtr attribute = m_attributes.at(attribute_index); // 1. Handle attribute changes for attribute with attribute’s element, attribute’s value, and null. VERIFY(attribute->owner_element()); @@ -209,7 +209,7 @@ void NamedNodeMap::remove_attribute_at_index(size_t attribute_index) } // https://dom.spec.whatwg.org/#concept-element-attributes-remove-by-name -Attribute const* NamedNodeMap::remove_attribute(StringView qualified_name) +Attr const* NamedNodeMap::remove_attribute(StringView qualified_name) { size_t item_index = 0; diff --git a/Userland/Libraries/LibWeb/DOM/NamedNodeMap.h b/Userland/Libraries/LibWeb/DOM/NamedNodeMap.h index 7cc33a63b68..9744bd3f51e 100644 --- a/Userland/Libraries/LibWeb/DOM/NamedNodeMap.h +++ b/Userland/Libraries/LibWeb/DOM/NamedNodeMap.h @@ -33,18 +33,18 @@ public: bool is_empty() const { return m_attributes.is_empty(); } // Methods defined by the spec for JavaScript: - Attribute const* item(u32 index) const; - Attribute const* get_named_item(StringView qualified_name) const; - ExceptionOr set_named_item(Attribute& attribute); - ExceptionOr remove_named_item(StringView qualified_name); + Attr const* item(u32 index) const; + Attr const* get_named_item(StringView qualified_name) const; + ExceptionOr set_named_item(Attr& attribute); + ExceptionOr remove_named_item(StringView qualified_name); // Methods defined by the spec for internal use: - Attribute* get_attribute(StringView qualified_name, size_t* item_index = nullptr); - Attribute const* get_attribute(StringView qualified_name, size_t* item_index = nullptr) const; - ExceptionOr set_attribute(Attribute& attribute); - void replace_attribute(Attribute& old_attribute, Attribute& new_attribute, size_t old_attribute_index); - void append_attribute(Attribute& attribute); - Attribute const* remove_attribute(StringView qualified_name); + Attr* get_attribute(StringView qualified_name, size_t* item_index = nullptr); + Attr const* get_attribute(StringView qualified_name, size_t* item_index = nullptr) const; + ExceptionOr set_attribute(Attr& attribute); + void replace_attribute(Attr& old_attribute, Attr& new_attribute, size_t old_attribute_index); + void append_attribute(Attr& attribute); + Attr const* remove_attribute(StringView qualified_name); private: explicit NamedNodeMap(Element&); @@ -57,7 +57,7 @@ private: void remove_attribute_at_index(size_t attribute_index); JS::NonnullGCPtr m_element; - Vector> m_attributes; + Vector> m_attributes; }; } diff --git a/Userland/Libraries/LibWeb/DOM/NamedNodeMap.idl b/Userland/Libraries/LibWeb/DOM/NamedNodeMap.idl index eee7762de3e..b5230735d08 100644 --- a/Userland/Libraries/LibWeb/DOM/NamedNodeMap.idl +++ b/Userland/Libraries/LibWeb/DOM/NamedNodeMap.idl @@ -1,16 +1,16 @@ -#import +#import [Exposed=Window, LegacyUnenumerableNamedProperties] interface NamedNodeMap { readonly attribute unsigned long length; - getter Attribute? item(unsigned long index); - getter Attribute? getNamedItem(DOMString qualifiedName); - // Attribute? getNamedItemNS(DOMString? namespace, DOMString localName); + getter Attr? item(unsigned long index); + getter Attr? getNamedItem(DOMString qualifiedName); + // Attr? getNamedItemNS(DOMString? namespace, DOMString localName); - [CEReactions] Attribute? setNamedItem(Attribute attr); - // [CEReactions] Attribute? setNamedItemNS(Attribute attr); + [CEReactions] Attr? setNamedItem(Attr attr); + // [CEReactions] Attr? setNamedItemNS(Attr attr); - [CEReactions] Attribute removeNamedItem(DOMString qualifiedName); - // [CEReactions] Attribute removeNamedItemNS(DOMString? namespace, DOMString localName); + [CEReactions] Attr removeNamedItem(DOMString qualifiedName); + // [CEReactions] Attr removeNamedItemNS(DOMString? namespace, DOMString localName); }; diff --git a/Userland/Libraries/LibWeb/DOM/Node.cpp b/Userland/Libraries/LibWeb/DOM/Node.cpp index 66fe1a0f6f2..2f4f2572aa6 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.cpp +++ b/Userland/Libraries/LibWeb/DOM/Node.cpp @@ -188,8 +188,8 @@ String Node::node_value() const // The nodeValue getter steps are to return the following, switching on the interface this implements: // If Attr, return this’s value. - if (is(this)) { - return verify_cast(this)->value(); + if (is(this)) { + return verify_cast(this)->value(); } // If CharacterData, return this’s data. @@ -208,8 +208,8 @@ void Node::set_node_value(String const& value) // and then do as described below, switching on the interface this implements: // If Attr, set an existing attribute value with this and the given value. - if (is(this)) { - verify_cast(this)->set_value(value); + if (is(this)) { + verify_cast(this)->set_value(value); } else if (is(this)) { // If CharacterData, replace data with node this, offset 0, count this’s length, and data the given value. verify_cast(this)->set_data(value); @@ -733,7 +733,7 @@ JS::NonnullGCPtr Node::clone_node(Document* document, bool clone_children) document_type_copy->set_public_id(document_type->public_id()); document_type_copy->set_system_id(document_type->system_id()); copy = move(document_type_copy); - } else if (is(this)) { + } else if (is(this)) { // FIXME: // Attr // Set copy’s namespace, namespace prefix, local name, and value to those of node. @@ -898,19 +898,19 @@ u16 Node::compare_document_position(JS::GCPtr other) Node* node2 = this; // 3. Let attr1 and attr2 be null. - Attribute* attr1; - Attribute* attr2; + Attr* attr1; + Attr* attr2; // 4. If node1 is an attribute, then set attr1 to node1 and node1 to attr1’s element. - if (is(node1)) { - attr1 = verify_cast(node1); + if (is(node1)) { + attr1 = verify_cast(node1); node1 = const_cast(attr1->owner_element()); } // 5. If node2 is an attribute, then: - if (is(node2)) { + if (is(node2)) { // 1. Set attr2 to node2 and node2 to attr2’s element. - attr2 = verify_cast(node2); + attr2 = verify_cast(node2); node2 = const_cast(attr2->owner_element()); // 2. If attr1 and node1 are non-null, and node2 is node1, then: diff --git a/Userland/Libraries/LibWeb/DOM/StaticRange.cpp b/Userland/Libraries/LibWeb/DOM/StaticRange.cpp index 287856db7a6..f5adac85efa 100644 --- a/Userland/Libraries/LibWeb/DOM/StaticRange.cpp +++ b/Userland/Libraries/LibWeb/DOM/StaticRange.cpp @@ -6,7 +6,7 @@ */ #include -#include +#include #include #include #include @@ -26,10 +26,10 @@ StaticRange::~StaticRange() = default; ExceptionOr StaticRange::create_with_global_object(HTML::Window& window, StaticRangeInit& init) { // 1. If init["startContainer"] or init["endContainer"] is a DocumentType or Attr node, then throw an "InvalidNodeTypeError" DOMException. - if (is(*init.start_container) || is(*init.start_container)) + if (is(*init.start_container) || is(*init.start_container)) return DOM::InvalidNodeTypeError::create(window, "startContainer cannot be a DocumentType or Attribute node."); - if (is(*init.end_container) || is(*init.end_container)) + if (is(*init.end_container) || is(*init.end_container)) return DOM::InvalidNodeTypeError::create(window, "endContainer cannot be a DocumentType or Attribute node."); // 2. Set this’s start to (init["startContainer"], init["startOffset"]) and end to (init["endContainer"], init["endOffset"]). diff --git a/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp b/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp index e792b0b863b..f2f8711472b 100644 --- a/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp +++ b/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp @@ -204,7 +204,7 @@ DOM::ExceptionOr serialize_node_to_xml_string_impl(JS::NonnullGCPtr(*root), require_well_formed); } - if (is(*root)) { + if (is(*root)) { // -> An Attr object // Return an empty string. return String::empty(); diff --git a/Userland/Libraries/LibWeb/Forward.h b/Userland/Libraries/LibWeb/Forward.h index d6057d5beea..95173ca931c 100644 --- a/Userland/Libraries/LibWeb/Forward.h +++ b/Userland/Libraries/LibWeb/Forward.h @@ -129,7 +129,7 @@ namespace Web::DOM { class AbstractRange; class AbortController; class AbortSignal; -class Attribute; +class Attr; class CDATASection; class CharacterData; class Comment; diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp index 919070a5959..7ec96151e99 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include @@ -96,7 +96,7 @@ Optional extract_character_encoding_from_meta_element(String const& return TextCodec::get_standardized_encoding(encoding); } -JS::GCPtr prescan_get_attribute(DOM::Document& document, ByteBuffer const& input, size_t& position) +JS::GCPtr prescan_get_attribute(DOM::Document& document, ByteBuffer const& input, size_t& position) { if (!prescan_skip_whitespace_and_slashes(input, position)) return {}; @@ -111,7 +111,7 @@ JS::GCPtr prescan_get_attribute(DOM::Document& document, ByteBuf } else if (input[position] == '\t' || input[position] == '\n' || input[position] == '\f' || input[position] == '\r' || input[position] == ' ') goto spaces; else if (input[position] == '/' || input[position] == '>') - return *DOM::Attribute::create(document, attribute_name.to_string(), ""); + return *DOM::Attr::create(document, attribute_name.to_string(), ""); else attribute_name.append_as_lowercase(input[position]); ++position; @@ -123,7 +123,7 @@ spaces: if (!prescan_skip_whitespace_and_slashes(input, position)) return {}; if (input[position] != '=') - return DOM::Attribute::create(document, attribute_name.to_string(), ""); + return DOM::Attr::create(document, attribute_name.to_string(), ""); ++position; value: @@ -136,13 +136,13 @@ value: ++position; for (; !prescan_should_abort(input, position); ++position) { if (input[position] == quote_character) - return DOM::Attribute::create(document, attribute_name.to_string(), attribute_value.to_string()); + return DOM::Attr::create(document, attribute_name.to_string(), attribute_value.to_string()); else attribute_value.append_as_lowercase(input[position]); } return {}; } else if (input[position] == '>') - return DOM::Attribute::create(document, attribute_name.to_string(), ""); + return DOM::Attr::create(document, attribute_name.to_string(), ""); else attribute_value.append_as_lowercase(input[position]); @@ -152,7 +152,7 @@ value: for (; !prescan_should_abort(input, position); ++position) { if (input[position] == '\t' || input[position] == '\n' || input[position] == '\f' || input[position] == '\r' || input[position] == ' ' || input[position] == '>') - return DOM::Attribute::create(document, attribute_name.to_string(), attribute_value.to_string()); + return DOM::Attr::create(document, attribute_name.to_string(), attribute_value.to_string()); else attribute_value.append_as_lowercase(input[position]); } diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.h b/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.h index 0bda305d169..fd400ea21e7 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.h +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.h @@ -16,7 +16,7 @@ bool prescan_should_abort(ByteBuffer const& input, size_t const& position); bool prescan_is_whitespace_or_slash(u8 const& byte); bool prescan_skip_whitespace_and_slashes(ByteBuffer const& input, size_t& position); Optional extract_character_encoding_from_meta_element(String const&); -JS::GCPtr prescan_get_attribute(DOM::Document&, ByteBuffer const& input, size_t& position); +JS::GCPtr prescan_get_attribute(DOM::Document&, ByteBuffer const& input, size_t& position); Optional run_prescan_byte_stream_algorithm(DOM::Document&, ByteBuffer const& input); String run_encoding_sniffing_algorithm(DOM::Document&, ByteBuffer const& input); diff --git a/Userland/Libraries/LibWeb/idl_files.cmake b/Userland/Libraries/LibWeb/idl_files.cmake index 9e91f119fd5..b0ef6c9f050 100644 --- a/Userland/Libraries/LibWeb/idl_files.cmake +++ b/Userland/Libraries/LibWeb/idl_files.cmake @@ -21,7 +21,7 @@ libweb_js_wrapper(CSS/Screen) libweb_js_wrapper(CSS/StyleSheet) libweb_js_wrapper(CSS/StyleSheetList) libweb_js_wrapper(DOM/AbstractRange) -libweb_js_wrapper(DOM/Attribute) +libweb_js_wrapper(DOM/Attr) libweb_js_wrapper(DOM/AbortController) libweb_js_wrapper(DOM/AbortSignal) libweb_js_wrapper(DOM/CDATASection)