mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Implement Element::hasAttributes
This commit is contained in:
parent
6f801e3f3f
commit
47f43d45a7
6 changed files with 55 additions and 9 deletions
|
@ -1335,6 +1335,11 @@ impl ElementMethods for Element {
|
|||
self.attr_list.or_init(|| NamedNodeMap::new(&window_from_node(self), self))
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-element-hasattributes
|
||||
fn HasAttributes(&self) -> bool {
|
||||
!self.attrs.borrow().is_empty()
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-element-getattributenames
|
||||
fn GetAttributeNames(&self) -> Vec<DOMString> {
|
||||
self.attrs.borrow().iter().map(|attr| attr.Name()).collect()
|
||||
|
|
|
@ -35,6 +35,8 @@ interface Element : Node {
|
|||
[Pure]
|
||||
sequence<DOMString> getAttributeNames();
|
||||
[Pure]
|
||||
boolean hasAttributes();
|
||||
[Pure]
|
||||
DOMString? getAttribute(DOMString name);
|
||||
[Pure]
|
||||
DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue