Skip to content

Commit

Permalink
fix: null check closest.getAttribute (#4763)
Browse files Browse the repository at this point in the history
If the HTML element doesn't have a lang attribute, Edge throws an exception when calling closest.getAttribute because tag.closest('[lang]') returns an empty object (which will be coerced to true) instead of null.
  • Loading branch information
emkayy authored and gkatsev committed Dec 4, 2017
1 parent 63bb3c0 commit 0f1b260
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ class Player extends Component {
if (typeof tag.closest === 'function') {
const closest = tag.closest('[lang]');

if (closest) {
if (closest && closest.getAttribute) {
options.language = closest.getAttribute('lang');
}
} else {
Expand Down

0 comments on commit 0f1b260

Please sign in to comment.