Version: M53
What steps will reproduce the problem?
(1) Create a page with this HTML:
<div id="test">
<noscript>
<span>text in noscript</span>
</noscript>
<p>normal text</p>
</div>
<div id="test2" style="display: none">
<noscript>
<span>text in noscript</span>
</noscript>
<p>normal text</p>
</div>
(2) Disable JavaScript, and run this code in console:
console.debug(document.getElementById('test').innerText)
console.debug(document.getElementById('test2').innerText)
(3) Enable JavaScript, and rerun the code
What is the expected output?
innerText is not well defined in the spec, so it's hard to say what the expected behavior is.
However, escaping the the content in <noscript> seems wrong.
Regarding <noscript> in .innerText when JS is enabled, there are a few possibilities:
- Ignore this element
- Show its .innerText as if JS is disabled
- Show its .textContent (current behavior)
Either one of the first two possibilities is better than the current behavior.
What do you see instead?
With JavaScript disabled, the output is:
<pre>
text in noscript
normal text
text in noscript
normal text
</pre>
This is expected.
With JavaScript enabled, the output is:
<pre>
normal text
<span>text in noscript</span>
normal text
</pre>
Seeing escaped <span> is not expected.
Comment 1 by wychen@chromium.org
, Aug 12 2016