/**
* @Datei computed-style.js
* @modul berechneter-stil
* /
import window from 'global/window';
/**
* Ein sicheres getComputedStyle.
*
* Dies ist erforderlich, weil in Firefox, wenn der Player in einem Iframe mit
* display:none`, dann gibt `getComputedStyle` `null` zurück, also machen wir eine
* null-check, um sicherzustellen, dass der Player in diesen Fällen nicht abbricht.
*
* @Funktion
* @param {Element} el
* Das Element, für das Sie den berechneten Stil
*
* @param {string} prop
* Der gewünschte Eigenschaftsname
*
* @see https://bugzilla.mozilla.org/show_bug.cgi?id=548397
* /
function computedStyle(el, prop) {
if (!el || !prop) {
zurückgeben '';
}
if (typeof window.getComputedStyle === 'function') {
let computedStyleValue;
Versuchen {
computedStyleValue = window.getComputedStyle(el);
} catch (e) {
zurückgeben '';
}
return computedStyleValue ? computedStyleValue.getPropertyValue(prop) || computedStyleValue[prop] : '';
}
zurückgeben '';
}
export default computedStyle;