mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-27 05:00:48 +08:00
15 lines
362 B
JavaScript
15 lines
362 B
JavaScript
/**
|
|
* Get CSS computed property of the given element
|
|
* @method
|
|
* @param {Eement} element
|
|
* @param {String} property
|
|
*/
|
|
export default function getStyleComputedProperty (element, property) {
|
|
if (element.nodeType !== 1) {
|
|
return []
|
|
}
|
|
// NOTE: 1 DOM access here
|
|
const css = getComputedStyle(element, null)
|
|
return property ? css[property] : css
|
|
}
|