Expand description
Element operations: attributes, classList, innerHTML, scoped matching.
Upstream: blitz-script/src/dom/element.rs. See MAPPING.md.
Tolerance is copied from upstream: an operation naming a node that is not
an element behaves as though the attribute were simply absent, rather than
raising. blitz-script has no NotAnElement case and neither does this.
Functionsยง
- class_
list_ add element.classList.add(...tokens).- class_
list_ contains element.classList.contains(token).- class_
list_ remove element.classList.remove(...tokens).- class_
list_ toggle element.classList.toggle(token, force), returning whether the token is present afterwards.- closest
element.closest(selector): this node or the nearest ancestor that matches.- get_
attribute element.getAttribute(name).- get_
attribute_ into element.getAttribute(name), written into a caller-supplied buffer.- has_
attribute element.hasAttribute(name).- inner_
html element.innerHTML, serialised from the children.- matches
element.matches(selector).- remove_
attribute element.removeAttribute(name).- set_
attribute element.setAttribute(name, value).- set_
inner_ html element.innerHTML = html.- tag_
name element.tagName, upper-cased as the DOM specifies.