Skip to content

Instantly share code, notes, and snippets.

@bofrede
Last active August 30, 2015 07:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bofrede/110433 to your computer and use it in GitHub Desktop.
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
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