1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2024-10-17 09:42:45 +02:00
TweetDuck/resources/Content/tweetdeck/globals/get_class_style_property.js

18 lines
534 B
JavaScript

/**
* Retrieves the actual value of a CSS property of an element with the specified class.
* @param {string} elementClass
* @param {string} cssProperty
* @returns {string}
*/
export function getClassStyleProperty(elementClass, cssProperty) {
const column = document.createElement("div");
column.classList.add(elementClass);
column.style.display = "none";
document.body.appendChild(column);
const value = window.getComputedStyle(column).getPropertyValue(cssProperty);
document.body.removeChild(column);
return value;
}