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
|
// find the element with the "data-path" attribute set
|
||||||
for (var i = 0; i < noscriptElements.length; ++i) {
|
for (var i = 0; i < noscriptElements.length; ++i) {
|
||||||
if (noscriptElements[i].getAttribute("data-path")) {
|
if (noscriptElements[i].getAttribute("data-path")) {
|
||||||
// noscriptElements[i].innerHTML contains encoded HTML
|
// noscriptElements[i].innerHTML contains encoded HTML, so we need to access
|
||||||
if (noscriptElements[i].childNodes.length > 0) {
|
// the childNodes instead. Browsers seem to split very long content into multiple
|
||||||
mainElement.innerHTML = noscriptElements[i].childNodes[0].nodeValue;
|
// text childNodes.
|
||||||
break;
|
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