Selector API properties
All properties are returned as a Promise.
Promise: Represents the completion of an asynchronous operation
Property | Type | Description |
---|---|---|
id | string | String representing the id of the element. |
tagName | string | String with the name of the tag for the given element. |
nodeType | number | Number matching the node type. |
namespaceURI | string / null | Namespace URI of the element, or null if it is no namespace. |
className | string | String representing the class of the element. |
classNames | string[] | Array of string representing the class of the element. |
focused | boolean | Returns true if element is focused. |
visible | boolean | Returns true if element is visible. |
attached | boolean | Returns true if element is attached. |
stable | boolean | Returns true if element is stable. |
editable | boolean | Returns true if element is editable. |
clickable | boolean | Returns true if element is clickable. |
inViewport | boolean | Returns true if element is in viewport. |
inViewportPartially | boolean | Returns true if element is partially in viewport. |
enabled | boolean | Returns true if element is enabled. |
disabled | boolean | Returns true if element is disabled. |
exists | boolean | Returns true if element exists. |
count | number | Number of elements matching this selector. |
checked | boolean / undefined | Returns true if element is checked or undefined if element does not have such property. |
selected | boolean / undefined | Returns true if element is selected or undefined if element does not have such property. |
selectedIndex | number / undefined | Index of the currently selected option. |
value | string / undefined | Selector value or undefined if no value. |
nodeValue | string / null | Value of the current node or null if no value. |
textContent | string | Text content of the node and its descendants. |
innerText | string | Rendered text content of a node and its descendants. |
innerHTML | string | String representing the markup of the element's content. |
outerHTML | string | String representing the markup of the element including its content. |
style | [prop: string]: string | Inline style of an element in the form of an array that contains a list of all styles properties for that element with values assigned for the attributes. |
childElementCount | number | Number of child elements of this element. |
childNodeCount | number | Number of child nodes of the given element. |
hasChildElements | boolean | Returns true if element has child elements. |
hasChildNodes | boolean | Returns true if element has child nodes. |
attributes | [name: string]: string | Array of all attribute nodes registered to the specified node. |
clientHeight | number | Inner height of an element in pixels. |
clientLeft | number | Inner height of an element in pixels. |
clientTop | number | Width of the left border of an element in pixels. |
clientWidth | number | Inner width of an element in pixels |
offsetHeight | number | Height of an element, including vertical padding and borders, as an integer. |
offsetLeft | number | Number of pixels that the upper left corner of the current element is offset to the left within the closest positioned ancestor element. |
offsetTop | number | Distance of the outer border of the current element relative to the inner border of the top of the closest positioned ancestor element. |
offsetWidth | number | Layout width of an element as an integer |
scrollHeight | number | Measurement of the height of an element's content, including content not visible on the screen due to overflow. |
scrollLeft | number | Number of pixels that an element's content is scrolled from its left edge. |
scrollTop | number | Number of pixels that an element's content is scrolled vertically. |
scrollWidth | number | Measurement of the width of an element's content, including content not visible on the screen due to overflow. |
boundingClientRect | TextRectangle | Returns a TextRectangle object providing information about the size of an element and its position relative to the viewport. |
TextRectangle
interface TextRectangle {
bottom: number;
left: number;
right: number;
top: number;
width: number;
height: number;
}