1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
jellyfin-web/src/legacy/vendorStyles.js

35 lines
1,015 B
JavaScript
Raw Normal View History

2020-08-29 19:44:05 +03:00
// Polyfill for vendor prefixed style properties
(function () {
const vendorProperties = {
'transform': ['webkitTransform'],
'transition': ['webkitTransition']
};
const elem = document.createElement('div');
function polyfillProperty(name) {
if (!(name in elem.style)) {
2020-08-29 20:10:23 +03:00
(vendorProperties[name] || []).every((vendorName) => {
2020-08-29 19:44:05 +03:00
if (vendorName in elem.style) {
console.debug(`polyfill '${name}' with '${vendorName}'`);
Object.defineProperty(CSSStyleDeclaration.prototype, name, {
get: function () { return this[vendorName]; },
set: function (val) { this[vendorName] = val; }
});
2020-08-29 20:10:23 +03:00
return false;
2020-08-29 19:44:05 +03:00
}
2020-08-29 20:10:23 +03:00
return true;
});
2020-08-29 19:44:05 +03:00
}
}
if (elem.style instanceof CSSStyleDeclaration) {
polyfillProperty('transform');
polyfillProperty('transition');
}
})();