FIX: Ensure legacy browser handling uses full <noscript> content
If the noscript tag contains a lot of data, browsers seem to split it across multiple `text` nodes, so we need to concatenate them.
This commit is contained in:
parent
e9c1e3d022
commit
e16f8a5ee6
|
@ -29,11 +29,16 @@
|
|||
// 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
|
||||
if (noscriptElements[i].childNodes.length > 0) {
|
||||
mainElement.innerHTML = noscriptElements[i].childNodes[0].nodeValue;
|
||||
break;
|
||||
// noscriptElements[i].innerHTML contains encoded HTML, so we need to access
|
||||
// the childNodes instead. Browsers seem to split very long content into multiple
|
||||
// text childNodes.
|
||||
var result = "";
|
||||
for (var j = 0; j < noscriptElements[i].childNodes.length; j++) {
|
||||
result += noscriptElements[i].childNodes[j].nodeValue;
|
||||
}
|
||||
|
||||
mainElement.innerHTML = result;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue