Debian Codegraph @

packages/popper/src/utils/getStyleComputedProperty.js

raw
1 /**
2 * Get CSS computed property of the given element
3 * @method
4 * @memberof Popper.Utils
5 * @argument {Eement} element
6 * @argument {String} property
7 */
8 export default function getStyleComputedProperty(element, property) {
9 if (element.nodeType !== 1) {
10 return [];
11 }
12 // NOTE: 1 DOM access here
13 const window = element.ownerDocument.defaultView;
14 const css = window.getComputedStyle(element, null);
15 return property ? css[property] : css;
16 }