mirror of
https://github.com/videojs/video.js.git
synced 2024-12-04 10:34:51 +02:00
fix: Add lang attribute to player el, so that css :lang() is correct (#4046)
This commit is contained in:
parent
7ab52d1a59
commit
17143fd9fe
@ -586,6 +586,10 @@ class Player extends Component {
|
||||
Dom.prependTo(tag, el);
|
||||
this.children_.unshift(tag);
|
||||
|
||||
// Set lang attr on player to ensure CSS :lang() in consistent with player
|
||||
// if it's been set to something different to the doc
|
||||
this.el_.setAttribute('lang', this.language_);
|
||||
|
||||
this.el_ = el;
|
||||
|
||||
return el;
|
||||
|
@ -1160,6 +1160,23 @@ QUnit.test('inherits language from parent element', function(assert) {
|
||||
}
|
||||
});
|
||||
|
||||
QUnit.test('sets lang attribute on player el', function(assert) {
|
||||
const fixture = document.getElementById('qunit-fixture');
|
||||
const oldLang = fixture.getAttribute('lang');
|
||||
|
||||
fixture.setAttribute('lang', 'x-attr-test');
|
||||
const player = TestHelpers.makePlayer();
|
||||
|
||||
assert.equal(player.el().getAttribute('lang'), 'x-attr-test', 'player sets lang attribute on self');
|
||||
|
||||
player.dispose();
|
||||
if (oldLang) {
|
||||
fixture.setAttribute('lang', oldLang);
|
||||
} else {
|
||||
fixture.removeAttribute('lang');
|
||||
}
|
||||
});
|
||||
|
||||
QUnit.test('should return correct values for canPlayType', function(assert) {
|
||||
const player = TestHelpers.makePlayer();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user