Nested <noscript> renders invalid HTML
See original GitHub issueWhile it doesn’t really make sense to nest <noscript />
, there are instances where it can happen unintentionally: https://github.com/callemall/material-ui/issues/3586
In this case, React renders invalid HTML: http://codepen.io/anon/pen/BKjVpZ?editors=1010
In a setup with HMR, this ends up causing invariant violations. It might be worth adding a warning for this case.
React Version: 0.14.7 (should be fixed in 15.0 due to the changes to <noscript />
)
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Fix Invalid HTML Syntax to Avoid Component Loading Errors
An additional list of invalid HTML syntax in LWC now results in a warning. ... nested-noscript-in-head —Unexpected noscript tag within another noscript tag ......
Read more ><head> contains a <noscript> tag, which includes an image
As such, including an <img> tag is invalid. This can be problematic for search engines crawlers that do not render JavaScript (i.e. most...
Read more >Why are the html-tags inside <noscript> shown as text
This is an issue with chrome where it is not rendered the first time the browser loads the page with JavaScript disabled.
Read more >Using Javascript to Render Invalid HTML - Notesnook Blog
There's nothing really wrong with this code syntactically. But browsers can't render it as it is, because ideally, <pre> tags should not be ......
Read more >13.2 Parsing HTML documents - HTML Standard - WhatWG
To handle these cases, parsers have a script nesting level , which must be initially set to zero, ... non-void-html-element-start-tag-with-trailing-solidus.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@spicyj: Okay—that makes sense that the parse tree changing confuses React.
But if React never emits nested
noscript
s (as I’m suggesting) then there’s nothing to be confused by, right? (And if it does then it gets confused and the page looks totally wrong.)Maybe. I could go either way. It could also be surprising to ask to render a
<noscript>
tag and have one not appear. Plus we don’t have an easy way in the code to make this happen right now even if we wanted to.I am happy to make validateDOMNesting warn about nested noscripts if it doesn’t already – send a PR?