Skip to content

Commit

Permalink
Merge pull request #1264 from liorchamla/fix/detecting-lang-when-attr…
Browse files Browse the repository at this point in the history
…ibute-is-empty

fix(tarteaucitron.js): adds a conditionnal for empty lang attribute
  • Loading branch information
AmauriC authored Aug 9, 2024
2 parents 19d3b4f + cac0e28 commit bc1f1ae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tarteaucitron.js
Original file line number Diff line number Diff line change
Expand Up @@ -2077,7 +2077,7 @@ var tarteaucitron = {
}

// get the html lang
if (document.documentElement.getAttribute("lang") !== undefined && document.documentElement.getAttribute("lang") !== null) {
if (document.documentElement.getAttribute("lang") !== undefined && document.documentElement.getAttribute("lang") !== null && documentElement.getAttribute("lang") !== "") {
if (availableLanguages.indexOf(document.documentElement.getAttribute("lang").substr(0, 2)) !== -1) {
return document.documentElement.getAttribute("lang").substr(0, 2);
}
Expand Down

0 comments on commit bc1f1ae

Please sign in to comment.