4 ms·
• <noscript> doesn’t work in XML syntax. From the spec comes this description of why <https://html.spec.whatwg.org/multipage/scripting.html#the-noscript-element
by chrismorgan 2y ago
• <noscript> doesn’t work in XML syntax. From the spec comes this description of why <https://html.spec.whatwg.org/multipage/scripting.html#the-noscript-element https://html.spec.whatwg.org/multipage/scripting.html#the-no...>:
> The noscript element is only effective in the HTML syntax, it has no effect in the XML syntax. This is because the way it works is by essentially "turning off" the parser when scripts are enabled, so that the contents of the element are treated as pure text and not as real elements. XML does not define a mechanism by which to do this.
That’s the sense in which I say it doesn’t work. In the way people most commonly use it, to add a “JS disabled so this won’t work” message in the body, you’re saved by the user agent stylesheet including `@media (scripting) { noscript { display: none !important; } }`. But if you try doing things like varying styles via <noscript>, that won’t work. And that’s why <noscript> is (nominally, as ever) disallowed in XML syntax.
• As for <nobr> seeming presentational: it can be used presentationally, but so can <strong>, and often is. If I think to places where I’ve used it, most of the time perception of the content would have been materially harmed by line breaks. And that’s the real test of whether something is presentation; framed another way, in a Reader Mode, should it remain or disappear? I expect inline styles and spans may be stripped by a Reader Mode, including <span style="white-space:nowrap">, but I say <nobr> should remain. Drawing connections to Unicode may be helpful too; most things there are Unicode characters for, if there are HTML things for they should be preserved as likely content semantics: I wouldn’t expect a Reader Mode to mangle my Unicode NO-BREAK SPACE to SPACE or my NARROW NO-BREAK SPACE to THIN SPACE or SPACE—they can be presentational (or even stenographic!), but they’re used for content semantics. And <nobr> is content semantics.
• <wbr> can be expressed in CSS easily: <span style="display:inline-block"></span>.