aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/ui.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js/ui.js')
-rw-r--r--src/js/ui.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/js/ui.js b/src/js/ui.js
index c7553c72..c9ad7d90 100644
--- a/src/js/ui.js
+++ b/src/js/ui.js
@@ -264,6 +264,26 @@ const ui = {
);
}
},
+
+ // Migrate any custom properties from the media to the parent
+ migrateStyles() {
+ // Loop through values (as they are the keys when the object is spread 🤔)
+ Object.values({ ...this.media.style })
+ // We're only fussed about Plyr specific properties
+ .filter(key => key.startsWith('--plyr'))
+ .forEach(key => {
+ // Set on the container
+ this.elements.container.style.setProperty(key, this.media.style.getPropertyValue(key));
+
+ // Clean up from media element
+ this.media.style.removeProperty(key);
+ });
+
+ // Remove attribute if empty
+ if (is.empty(this.media.style)) {
+ this.media.removeAttribute('style');
+ }
+ },
};
export default ui;