- From: Ian Hickson <ian@hixie.ch>
- Date: Fri, 12 Oct 2007 22:15:09 +0000 (UTC)
- To: Alex Mogilevsky <alexmog@exchange.microsoft.com>
- Cc: fantasai <fantasai.lists@inkedblade.net>, "www-style@w3.org" <www-style@w3.org>, Markus Mielke <mmielke@windows.microsoft.com>, Saloni Mira Rai <salonir@microsoft.com>, Arron Eicholz <Arron.Eicholz@microsoft.com>
On Fri, 12 Oct 2007, Alex Mogilevsky wrote:
>
> I don't think this is just about BR.
>
> My reasoning for defining BR behavior is like this:
> * BR is defined in HTML as an empty element. It can't have any content.
That's just an authoring requirement. It's trivial to add content to a
<br> element, either using XML, or via the DOM:
var br = document.createElement('br');
br.appendChild(document.createTextNode('test'));
> * Then a rule like
> br:before { content:'\A' }
> puts content inside BR.
>
> * But at this point I don't know what to do with it, since BR must be
> empty. It is not valid to have content inside it, and if it manages to
> get some what is it supposed to do with it?
Just treat BR elements the same as any random inline element. The fact
that <br> elements can't have content is the same as the way that <ul>
elements can only contain <li> elements -- but that doesn't stop browsers
handling arbitrary content in <ul> elements. From a CSS point of view, all
elements apart from replaced elements are the same.
> Same issue applies to all other elements which either empty or have
> special rendering rules, e.g.
>
> <img>, <hr>, <tr> or <iframe>.
<img> in CSS3 could be similar to <br>:
img { content: attr(src, url), attr(alt); }
br { content: "\A"; white-space: pre; }
<tr> is not special at all, it just has display: table-row and renders
according to the table model.
<hr> and <iframe> are special from a CSS point of view. <hr> is especially
special. <iframe> is just a replaced element whose content comes from a
DOM property (contentWindow) instead of an attribute. Note that <iframe>
in HTML does contain contents, you just ignore them when rendering.
> Try the attached example with different browsers and you'll see wildly
> different effect.
Generated content's interaction with form controls is underdefined.
However, generated content's interaction with table elements is well
defined, and I see no reason why its interaction with <img> and <br> can't
be well-defined too, especially if we go the proposed route with defining
those elements using 'content' on the elements.
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 12 October 2007 22:15:25 UTC