web: Avoid TypeError when instantiating polyfill (fix #607)
Co-authored-by: JustinCB <JustinCB@opmbx.org>
This commit is contained in:
parent
1582584be8
commit
cbc2f6a03a
|
@ -57,29 +57,37 @@ exports.RufflePlayer = class RufflePlayer extends HTMLElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
update_styles() {
|
update_styles() {
|
||||||
for (var i = 0; i < this.dynamic_styles.sheet.rules.length; i += 1) {
|
if (this.dynamic_styles.sheet) {
|
||||||
this.dynamic_styles.sheet.deleteRule(i);
|
if (this.dynamic_styles.sheet.rules) {
|
||||||
}
|
for (
|
||||||
|
var i = 0;
|
||||||
if (this.attributes.width) {
|
i < this.dynamic_styles.sheet.rules.length;
|
||||||
let width = RufflePlayer.html_dimension_to_css_dimension(
|
i++
|
||||||
this.attributes.width.value
|
) {
|
||||||
);
|
this.dynamic_styles.sheet.deleteRule(i);
|
||||||
if (width !== null) {
|
}
|
||||||
this.dynamic_styles.sheet.insertRule(
|
|
||||||
`:host { width: ${width}; }`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (this.attributes.height) {
|
if (this.attributes.width) {
|
||||||
let height = RufflePlayer.html_dimension_to_css_dimension(
|
let width = RufflePlayer.html_dimension_to_css_dimension(
|
||||||
this.attributes.height.value
|
this.attributes.width.value
|
||||||
);
|
|
||||||
if (height !== null) {
|
|
||||||
this.dynamic_styles.sheet.insertRule(
|
|
||||||
`:host { height: ${height}; }`
|
|
||||||
);
|
);
|
||||||
|
if (width !== null) {
|
||||||
|
this.dynamic_styles.sheet.insertRule(
|
||||||
|
`:host { width: ${width}; }`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.attributes.height) {
|
||||||
|
let height = RufflePlayer.html_dimension_to_css_dimension(
|
||||||
|
this.attributes.height.value
|
||||||
|
);
|
||||||
|
if (height !== null) {
|
||||||
|
this.dynamic_styles.sheet.insertRule(
|
||||||
|
`:host { height: ${height}; }`
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue