forgeplus-react/node_modules/dom-lib/es/style/getStyle.js

20 lines
512 B
JavaScript

import camelizeStyleName from './camelizeStyleName';
import getComputedStyle from './getComputedStyle';
import hyphenateStyleName from './hyphenateStyleName';
export default (function (node, property) {
if (property) {
var value = node.style[camelizeStyleName(property)];
if (value) {
return value;
}
var styles = getComputedStyle(node);
if (styles) {
return styles.getPropertyValue(hyphenateStyleName(property));
}
}
return node.style || getComputedStyle(node);
});