This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 9349 - Make <nobr> element conforming
Summary: Make <nobr> element conforming
Status: RESOLVED WONTFIX
Alias: None
Product: HTML WG
Classification: Unclassified
Component: pre-LC1 HTML5 spec (editor: Ian Hickson) (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-27 21:52 UTC by Maciej Stachowiak
Modified: 2010-10-04 14:30 UTC (History)
6 users (show)

See Also:


Attachments

Description Maciej Stachowiak 2010-03-27 21:52:56 UTC
The <nobr> element is obsolete in HTML5, with the indication that authors should "Use appropriate elements and/or CSS instead.".
http://dev.w3.org/html5/spec/Overview.html#nobr

In the rendering section, <nobr> is recommended to be rendered as if with a CSS property of "white-space: nowrap":
http://dev.w3.org/html5/spec/Overview.html#punctuation-and-decorations

There is no other element that has the same default rendering, so there is no more appropriate element to use. CSS could be used instead. However, the <pre> element, which results in rendering as "white-space: pre", is conforming and considered a semantic element. Its semantics are "a block of preformatted text". <br> is also conforming, with the semantic meaning of "a line break".

<nobr> should be considered just as semantic as <pre> or <br>, with a semantic of "a block of text with preformatted line breaks."

Also, the usual arguments against presentational markup do not apply. Use of <nobr> does not harm accessibility, or necessarily result in less compact or less maintainable markup. Text placed in <nobr> is likely to have special semantics that make the in-text line breaks essential, just as for text in <pre> all whitespace is semantically essential.

In addition, <nobr> is commonly used on popular sites. At time of writing, it is known to be used on at least 4 of the top 15 Alexa sites: <http://www.w3.org/html/wg/wiki/ConformanceErrorStudy>.

It would be preferable to make this common error into a non-error, if there is no material benefit to banning <nobr>.
Comment 1 Maciej Stachowiak 2010-03-28 01:09:14 UTC
Correct, I misunderstood what "white-space: nowrap" does. It doesn't preserve exactly the specifies line breaks, but rather it inhibits all line breaking. So it would represent "a run of text intended to be presented as a single line, without any line breaks." I think the rest of my argument still applies.
Comment 2 Ian 'Hixie' Hickson 2010-04-02 06:45:47 UTC
> <nobr> should be considered just as semantic as <pre> or <br>

<br> has virtually no use cases (just two that I know of, poems and postal addresses). I've been seriously tempted to drop it.

<pre> is even worse; all its use cases (visual poetry, rendering computer code in a visual fashion, ASCII art, showing text from other formats such as HTTP headers, etc) are visual in nature. It is easy to argue that they would be more correctly handled by using an <iframe> that points to a resource of an appropriate MIME type (e.g. message/rfc822 when quoting an e-mail, or text/python when quoting python code), since at least in those cases a non-visual UA could maybe make sense of the data.

However, both <br> and <pre> have something that <nobr> does not: they convey a semantic that is otherwise not available in HTML. There's no way other than <br> or <pre> to convey that a newline in HTML is meaningful. There's no way other than <pre> to convey that multiple spaces in a row are meaningful. While it's not clear what this really means for non-visual media, one can at least imagine that in some cases it would make sense to indicate this information.

What are the _semantic_ use cases for <nobr>? Sure, it can be used as a presentational element equivalent to <span style="white-space: nowrap">, but what does it mean? When would you use it in a fashion that is not redundant with something else? (For example, "inline computer code" is not a valid answer, since <code> can be used for that and can easily be styled with white-space: nowrap.) When would you use it in a fashion that would never make sense to override in an alternative style sheet?

Sure, it's used a lot, but then so are <font> and tables for layout. It's also common to omit alt="" attributes. This doesn't mean that we should allow it. It means we should work out why people are using it, and address that problem. It might be that there's a limitation in CSS. Or it might be that there's a real semantic in HTML for which it makes sense to have <nobr>, the same way as one can argue for having <br> and <pre>.

There is a material benefit to all omissions: it makes the language simpler, which makes teaching it simpler, and makes learning it simpler. There is a material benefit to all omissions of presentational markup: it increases the chances that authors will use the mindset of separation of concerns referenced by our design principles, intentionally separating their presentation rules from their semantic information.

Currently, this bug does not have enough information to convince me that this element is needed.


EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Rejected
Change Description: no spec change
Rationale: See above.