FIX: Find noscript element with crawler content (PR #10834)

There can be more than one noscript element on a page (from various plugins), but only the one with data-path attribute as set in application.html.erb contains the crawler content.


This seems to be updating a vendored script. Would this not put us at risk for overwriting it in the future?

How is this a find? Looks like you’re just iterating over all the items?

Should we exit the loop once we’ve found what we were looking for or are there more than one possible match?

Temporary variable is not really necessary here

      mainElement.innerHTML = noscriptElements[i].childNodes[0].nodeValue;

There is one match and in general there are 1-2 noscript tags.

I know you didn’t touch that part of the code but why does it contain encoded HTML?

The noscript element must contain only text and it is treated as such.

Are you sure about that? That’s not what I understand/read and what I’ve experienced.

It is true in IE and document.getElementsByTagName("noscript")[0].innerHTML is always encoded.