Last active
August 30, 2015 07:54
-
-
Save bofrede/110433 to your computer and use it in GitHub Desktop.
function for getting the lang attribute of an element or that of it's ancestors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getLanguage(elm) { | |
if (elm) { | |
return elm.getAttribute('lang') || getLanguage(elm.parentNode); | |
} else { | |
// TODO: find <meta http-equiv="Content-Language" content="da"> | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment