MainThread.Element
represents an element. You can access or modify the element's properties in main thread scripts.
Element.getAttribute()
Get the specified attribute value of the element. If the element does not have the specified attribute, returns undefined
.
Element.getAttributeNames()
Get an array of the element's attribute names.
Element.invoke()
Asynchronously invoke the element's UI method. Returns a Promise
. When the UI method completes successfully, the Promise
is resolved and returns the UI method's return value. If an exception occurs during the UI method call, the Promise
is rejected and returns an Error
object, with its message
describing the error in detail.
Element.setAttribute()
Set the specified attribute of the element.
Element.setStyleProperty()
Set the specified style of the element. The style name must be in kebab-case.
Element.setStyleProperties()
Set the specified styles of the element using an object that can contain multiple "styleName: styleValue" records. The style names must be in kebab-case.
Element.querySelector()
Find the first element within the element's child elements that matches the specified selector. Returns a MainThread.Element
. If no matching element is found, returns null
. For a list of supported selectors, see selector.
Element.querySelectorAll()
Find all elements within the element's child elements that match the specified selector. Returns an array of MainThread.Element
. If no matching elements are found, returns an empty array. For a list of supported selectors, see selector.