Skip to content

Commit

Permalink
feat: remove closest fallback (videojs#7853)
Browse files Browse the repository at this point in the history
  • Loading branch information
mister-ben authored and edirub committed Jun 8, 2023
1 parent 38145b7 commit cd56e24
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions src/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}

Expand Down

0 comments on commit cd56e24

Please sign in to comment.