function extractSizeFromElement(element, styleProperty, htmlProperty) {
        if (styleProperty && element.style[styleProperty] && element.style[styleProperty].match('px')) {
            return parseInt(element.style[styleProperty]);
        } else {
            return String(element[htmlProperty]).match('px') ? parseInt(element[htmlProperty]) : element[htmlProperty];
        }
    }
Extracts size from an element checking multiple element properties

@param {HTMLElement} element
@param {'width'|'height'|null} styleProperty
@param {'clientWidth'|'clientHeight'|'width'|'height'} htmlProperty
@returns {number}