Function: getStyleProps()
ts
function getStyleProps(element, propName?): string | StyleProps;Get the style properties of an element.
Parameters
| Parameter | Type | Description |
|---|---|---|
element | HTMLElement | The element to get the style properties of. |
propName? | string | The name of the property to get. |
Returns
string | StyleProps
If propName is specified, returns the value of that property. Otherwise, returns an object containing all style properties and their values.
Example
ts
const element = document.createElement('div')
element.style.color = 'red'
document.body.appendChild(element)
console.log(getStyleProps(element, 'color'))Since
1.0.0