1
0
mirror of https://github.com/videojs/video.js.git synced 2025-01-02 06:32:07 +02:00

feat: remove closest fallback (#7853)

This commit is contained in:
mister-ben 2022-08-02 18:39:50 +02:00 committed by Pat O'Neill
parent f46b83002e
commit 63a2d027f4

View File

@ -330,22 +330,10 @@ class Player extends Component {
// If language is not set, get the closest lang attribute
if (!options.language) {
if (typeof tag.closest === 'function') {
const closest = tag.closest('[lang]');
const closest = tag.closest('[lang]');
if (closest && closest.getAttribute) {
options.language = closest.getAttribute('lang');
}
} else {
let element = tag;
while (element && element.nodeType === 1) {
if (Dom.getAttributes(element).hasOwnProperty('lang')) {
options.language = element.getAttribute('lang');
break;
}
element = element.parentNode;
}
if (closest) {
options.language = closest.getAttribute('lang');
}
}