mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 09:12:45 +08:00
FIX: Make browser-update work with IE<11 (#10868)
- classList is not available in IE<10 - noscript has no content in IE<8
This commit is contained in:
parent
5157e3b6e3
commit
c91c6006db
|
@ -18,17 +18,20 @@ var $buo = function() {
|
|||
return;
|
||||
}
|
||||
|
||||
document.getElementsByTagName('body')[0].classList.add("crawler");
|
||||
document.getElementsByTagName('body')[0].className += " crawler";
|
||||
var mainElement = document.getElementById("main");
|
||||
var noscriptElements = document.getElementsByTagName("noscript");
|
||||
// find the element with the "data-path" attribute set
|
||||
for (var i = 0; i < noscriptElements.length; ++i) {
|
||||
if (noscriptElements[i].getAttribute("data-path")) {
|
||||
// noscriptElements[i].innerHTML contains encoded HTML
|
||||
mainElement.innerHTML = noscriptElements[i].childNodes[0].nodeValue;
|
||||
break;
|
||||
if (noscriptElements[i].childNodes.length > 0) {
|
||||
mainElement.innerHTML = noscriptElements[i].childNodes[0].nodeValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// retrieve localized browser upgrade text
|
||||
var t = <%= "'" + I18n.t('js.browser_update') + "'" %>;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user