orchidmap-front/src/utils/dom.ts
2019-03-28 14:12:00 +07:00

9 lines
377 B
TypeScript

export const getStyle = (oElm: any, strCssRule: string): string => {
if(document.defaultView && document.defaultView.getComputedStyle){
return document.defaultView.getComputedStyle(oElm, '').getPropertyValue(strCssRule);
} else if(oElm.currentStyle){
return oElm.currentStyle[strCssRule.replace(/\-(\w)/g, (strMatch, p1) => p1.toUpperCase())];
}
return '';
};