Skip to content

Commit

Permalink
fix: position, lineAlign, positionAlign (#36)
Browse files Browse the repository at this point in the history
Also, increase backwards compatibility and compatibility with native vttcue implementations.
  • Loading branch information
gkatsev authored and evanfarina committed May 11, 2019
1 parent 49e7547 commit a7b0694
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/vtt.js
Original file line number Diff line number Diff line change
Expand Up @@ -561,16 +561,16 @@ function StyleBox() {
StyleBox.prototype.applyStyles = function(styles, div, inlineStyles, onapplystyles) {
div = div || this.div;

if (inlineStyles) {
if (this.inlineStyles) {
for (var prop in styles) {
if (styles.hasOwnProperty(prop)) {
div.style[prop] = styles[prop];
}
}
} else {
if (typeof onapplyStyles === 'function') {
onapplystyles(styles, div);
}
}

if (typeof this.onapplystyles === 'function') {
this.onapplystyles(styles, div);
}
};

Expand All @@ -583,6 +583,8 @@ StyleBox.prototype.formatStyle = function(val, unit) {
function CueStyleBox(window, cue, styleOptions, inlineStyles, onapplystyles) {
StyleBox.call(this);
this.cue = cue;
this.inlineStyles = inlineStyles;
this.onapplystyles = onapplystyles;

// Parse our cue's text into a DOM tree rooted at 'cueDiv'. This div will
// have inline positioning and will function as the cue background box.
Expand Down

0 comments on commit a7b0694

Please sign in to comment.