mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 18:37:36 +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();
|
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
|
// https://dom.spec.whatwg.org/#dom-element-setattribute
|
||||||
WebIDL::ExceptionOr<void> Element::set_attribute(FlyString const& name, String const& value)
|
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(); }
|
NamedNodeMap const* attributes() const { return m_attributes.ptr(); }
|
||||||
Vector<String> get_attribute_names() const;
|
Vector<String> get_attribute_names() const;
|
||||||
|
|
||||||
|
JS::GCPtr<Attr> get_attribute_node(FlyString const& name) const;
|
||||||
|
|
||||||
DOMTokenList* class_list();
|
DOMTokenList* class_list();
|
||||||
|
|
||||||
WebIDL::ExceptionOr<bool> matches(StringView selectors) const;
|
WebIDL::ExceptionOr<bool> matches(StringView selectors) const;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#import <CSS/CSSStyleDeclaration.idl>
|
#import <CSS/CSSStyleDeclaration.idl>
|
||||||
|
#import <DOM/Attr.idl>
|
||||||
#import <DOM/ChildNode.idl>
|
#import <DOM/ChildNode.idl>
|
||||||
#import <DOM/DOMTokenList.idl>
|
#import <DOM/DOMTokenList.idl>
|
||||||
#import <DOM/InnerHTML.idl>
|
#import <DOM/InnerHTML.idl>
|
||||||
|
@ -38,6 +39,8 @@ interface Element : Node {
|
||||||
[SameObject] readonly attribute NamedNodeMap attributes;
|
[SameObject] readonly attribute NamedNodeMap attributes;
|
||||||
sequence<DOMString> getAttributeNames();
|
sequence<DOMString> getAttributeNames();
|
||||||
|
|
||||||
|
Attr? getAttributeNode(DOMString qualifiedName);
|
||||||
|
|
||||||
HTMLCollection getElementsByTagName(DOMString tagName);
|
HTMLCollection getElementsByTagName(DOMString tagName);
|
||||||
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
|
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
|
||||||
HTMLCollection getElementsByClassName(DOMString className);
|
HTMLCollection getElementsByClassName(DOMString className);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue