mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add vendor styles polyfill
This commit is contained in:
parent
ac0fdd8059
commit
f915ecd400
2 changed files with 34 additions and 0 deletions
32
src/legacy/vendorStyles.js
Normal file
32
src/legacy/vendorStyles.js
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
// 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)) {
|
||||||
|
for (const vendorName of vendorProperties[name] || []) {
|
||||||
|
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; }
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (elem.style instanceof CSSStyleDeclaration) {
|
||||||
|
polyfillProperty('transform');
|
||||||
|
polyfillProperty('transition');
|
||||||
|
}
|
||||||
|
})();
|
|
@ -222,6 +222,7 @@ function initClient() {
|
||||||
});
|
});
|
||||||
require(['mouseManager']);
|
require(['mouseManager']);
|
||||||
require(['focusPreventScroll']);
|
require(['focusPreventScroll']);
|
||||||
|
require(['vendorStyles']);
|
||||||
require(['autoFocuser'], function(autoFocuser) {
|
require(['autoFocuser'], function(autoFocuser) {
|
||||||
autoFocuser.enable();
|
autoFocuser.enable();
|
||||||
});
|
});
|
||||||
|
@ -655,6 +656,7 @@ function initClient() {
|
||||||
});
|
});
|
||||||
define('slideshow', [componentsPath + '/slideshow/slideshow'], returnFirstDependency);
|
define('slideshow', [componentsPath + '/slideshow/slideshow'], returnFirstDependency);
|
||||||
define('focusPreventScroll', ['legacy/focusPreventScroll'], returnFirstDependency);
|
define('focusPreventScroll', ['legacy/focusPreventScroll'], returnFirstDependency);
|
||||||
|
define('vendorStyles', ['legacy/vendorStyles'], returnFirstDependency);
|
||||||
define('userdataButtons', [componentsPath + '/userdatabuttons/userdatabuttons'], returnFirstDependency);
|
define('userdataButtons', [componentsPath + '/userdatabuttons/userdatabuttons'], returnFirstDependency);
|
||||||
define('listView', [componentsPath + '/listview/listview'], returnFirstDependency);
|
define('listView', [componentsPath + '/listview/listview'], returnFirstDependency);
|
||||||
define('indicators', [componentsPath + '/indicators/indicators'], returnFirstDependency);
|
define('indicators', [componentsPath + '/indicators/indicators'], returnFirstDependency);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue