Methods
(static) getElementGeometry(node, additionalProps) → {object}
- Source:
- Since:
- 0.1.0
Return an object derived from getComputedStyle(domNode) with values converted to numbers.
It extracts values for width
, height
and all keys in additionalProps
.
Note that additionalProps
are CSS selectors with the hyphen removed (if any) and camel cased:
for example font-size
-> fontSize
.
Example
> getElementGeometry(node)
{width: 200, height: 100}
> getElementGeometry(node, ['fontSize'])
{width: 200, height: 100, 'fontSize': 12}
Parameters:
Name | Type | Description |
---|---|---|
node |
object | DOM element |
additionalProps |
array |
Returns:
- Type
- object