[whatwg] More HTML Editing Commands questions
bzbarsky at MIT.EDU
Wed May 18 19:32:41 PDT 2011
On 5/18/11 6:57 PM, Tim Down wrote:
> On 18 May 2011 19:32, Aryeh Gregor<Simetrical+w3c at gmail.com> wrote:
>>> Another argument against wrapping whitespace is that it can have an
>>> unwelcome visual effect if, for example, the wrapping elements have a
>>> CSS border applied.
>> Borders only apply to boxes, and collapsed whitespace generates no
>> boxes, so it will generate no border. Nor backgrounds, margins,
>> padding, etc.
> That may be what the CSS spec says
The collapsed whitespace generates no box, but the inline element sure
generates a box per spec. And that box can have padding, borders,
margins, the works. Aryeh, I suggest actually trying this in your
favorite browser. Just make sure to not use a WebKit-based one, since
WebKit is buggy here. Any Presto, Trident, or Gecko-based browser
should do the trick, on the other hand. Minimal testcase:
<span style="border: 1px solid green; padding: 5px; background: yellow">
That should give you a nice yellow box about 10px wide and 10px +
(default font size) high with a green border around it.
Note that the presence or absence of whitespace is completely irrelevant
here; the rendering is the same if the whitespace is deleted.... except
in WebKit, which suddenly renders like every other browser if you delete
the whitespace. Buggy, like I said.
>> I'm not sure why. DOM mutation events in their current form (i.e.,
>> synchronous) should work, no? And if the selection change event is
>> not synchronous, you might not be able to use it anyway, because maybe
>> by the time the handler runs all sorts of changes happened
That can happen even if it's synchronous.
More information about the whatwg