Skip to content

Commit

Permalink
feat: remove closest fallback (#7853)
Browse files Browse the repository at this point in the history
  • Loading branch information
mister-ben authored and misteroneill committed Nov 23, 2022
1 parent f46b830 commit 63a2d02
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 63a2d02

Please sign in to comment.