mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:47:34 +00:00
LibWeb: Implement Element.getAttributeNode
This commit is contained in:
parent
469ef22a22
commit
8066a67da2
3 changed files with 12 additions and 0 deletions
|
@ -93,6 +93,13 @@ String Element::get_attribute(FlyString const& name) const
|
|||
return attribute->value();
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-element-getattributenode
|
||||
JS::GCPtr<Attr> Element::get_attribute_node(FlyString const& name) const
|
||||
{
|
||||
// The getAttributeNode(qualifiedName) method steps are to return the result of getting an attribute given qualifiedName and this.
|
||||
return m_attributes->get_attribute(name);
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-element-setattribute
|
||||
WebIDL::ExceptionOr<void> Element::set_attribute(FlyString const& name, String const& value)
|
||||
{
|
||||
|
|
|
@ -72,6 +72,8 @@ public:
|
|||
NamedNodeMap const* attributes() const { return m_attributes.ptr(); }
|
||||
Vector<String> get_attribute_names() const;
|
||||
|
||||
JS::GCPtr<Attr> get_attribute_node(FlyString const& name) const;
|
||||
|
||||
DOMTokenList* class_list();
|
||||
|
||||
WebIDL::ExceptionOr<bool> matches(StringView selectors) const;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#import <CSS/CSSStyleDeclaration.idl>
|
||||
#import <DOM/Attr.idl>
|
||||
#import <DOM/ChildNode.idl>
|
||||
#import <DOM/DOMTokenList.idl>
|
||||
#import <DOM/InnerHTML.idl>
|
||||
|
@ -38,6 +39,8 @@ interface Element : Node {
|
|||
[SameObject] readonly attribute NamedNodeMap attributes;
|
||||
sequence<DOMString> getAttributeNames();
|
||||
|
||||
Attr? getAttributeNode(DOMString qualifiedName);
|
||||
|
||||
HTMLCollection getElementsByTagName(DOMString tagName);
|
||||
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
|
||||
HTMLCollection getElementsByClassName(DOMString className);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue