W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2010

[whatwg] [br] element should not be a line break

From: Aryeh Gregor <Simetrical+w3c@gmail.com>
Date: Wed, 4 Aug 2010 17:31:02 -0400
Message-ID: <AANLkTi=P8re03ZZEF4g6bzWE2JftJc438tiBwqTZE2M7@mail.gmail.com>
On Wed, Aug 4, 2010 at 8:56 AM, Thomas Koetter
<thomas.koetter at id-script.de> wrote:
> What strikes me though is that according to the spec "The br element represents a line break". A *line* break is presentational in nature. The break is structural, but restricting it to a certain presentation of that break lacks the desired separation of structure and presentation.

Anything else is impossible in this case.  <b> and <i> are also
presentational, but the presentation cannot be separated from the
semantics.

> Wouldn't it make more sense to consider the br element to be just a minor logical break inside a paragraph? Just like hr represents a thematic break on the paragraph-level. How the break would be rendered is a different matter and should be left to the designer.

Line breaks are not used for minor logical breaks inside paragraphs.
Those are typically represented by a period.

> Consider this:
> <p>P. Sherman<br>
> 42 Wallaby Way<br>
> Sydney</p>
>
> There's no reason why line breaks should be part of an address. I've seen many addresses on one line with their parts separated just by dots or pipes. Given the inherent structure of an address, a definition list with name/value pairs would also be more semantically fitting than a paragraph of text with line breaks.

That would either be incorrect use of <dl>, or would not display as
desired, or would require hiding some elements arbitrarily.

> <address>
> ? ? ? ?<dl>
> ? ? ? ? ? ? ? ?<dt>Name</dt><dd>P. Sherman</dd>
> ? ? ? ? ? ? ? ?<dt>Street</dt><dd>42 Wallaby Way</dd>
> ? ? ? ? ? ? ? ?<dt>City</dt><dd>Sydney</dd>
> ? ? ? ?</dl>
> </address>

That requires hiding all the <dt> elements to achieve the same
display, which is kind of ridiculous.

> <address>
> ? ? ? ?<dl>
> ? ? ? ? ? ? ? ?<dd>P. Sherman</dd>
> ? ? ? ? ? ? ? ?<dd>42 Wallaby Way</dd>
> ? ? ? ? ? ? ? ?<dd>Sydney</dd>
> ? ? ? ?</dl>
> </address>

That's invalid markup.  The first child of a <dl> (if any) must be a
<dt>.  I don't know what the semantics of <dl> are supposed to be with
no <dt>.  <ul> would work, if you really wanted, but I don't see how
it's any more semantic.

> So, in summary, I suggest changing the br element to just be a logical break element with the default rendition of a line break, but which could be adjusted via a new style property.

It should already be adjustable using existing style properties, so no
change is needed except possibly saying it represents a logical break
instead of a line break.  This is basically wrong, though, since there
are lots of ways to mark up minor logical breaks, and <br> refers to
one particular way, no other.

Look at it this way: <br> is just a workaround for the fact that HTML
ignores newlines in markup.  It could have just been &#10; in an
alternate history.  It's presentational, yes, but so are periods and
commas.  When I type a period, I don't want the browser to interpret
that as some generic separator that it might hopefully decide to
render as a period, I want *a period*.  Exactly that, nothing else.
Likewise for newlines.  We don't need to impose some abstract semantic
meaning on *everything*.  Some presentation is so closely tied to the
meaning of the document that it can't reasonably be abstracted away.
This is true for <b>, <i>, <sup>, <sub>, and <br>, among others.
Received on Wednesday, 4 August 2010 14:31:02 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:25 UTC