question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nested <noscript> renders invalid HTML

See original GitHub issue

While 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:closed
  • Created 8 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
wchargincommented, Sep 12, 2016

@spicyj: Okay—that makes sense that the parse tree changing confuses React.

But if React never emits nested noscripts (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.)

0reactions
sophiebitscommented, Sep 12, 2016

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?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found