Files
MoonPro.net/MP-MON/Scripts/src/utils/getStyleComputedProperty.js
T
Samuele E. Locatelli 4b8ed3219b Update popper packages
2020-01-31 16:44:33 +01:00

17 lines
455 B
JavaScript

/**
* Get CSS computed property of the given element
* @method
* @memberof Popper.Utils
* @argument {Eement} element
* @argument {String} property
*/
export default function getStyleComputedProperty(element, property) {
if (element.nodeType !== 1) {
return [];
}
// NOTE: 1 DOM access here
const window = element.ownerDocument.defaultView;
const css = window.getComputedStyle(element, null);
return property ? css[property] : css;
}