Re: Pressing Enter in contenteditable: <p> or <br> or <div>?

On Wed, Jan 11, 2012 at 1:00 AM, Simon Pieters <> wrote:

> On Tue, 10 Jan 2012 21:50:34 +0100, Ryosuke Niwa <> wrote:
>  On Tue, Jan 10, 2012 at 12:46 PM, Aryeh Gregor <> wrote:
>>>  On Tue, Jan 10, 2012 at 3:40 PM, Ryosuke Niwa <> wrote:
>>> > Single br tag is shorter than pairs of div tags when serialized.
>>> True, but only slightly, and the difference is even smaller if you use
>>> <p> instead of <div>.  This isn't enough of a reason by itself to
>>> justify the extra complexity of another mode.  Are there other
>>> reasons?
>> p has default margins.
> This is why we implemented opera-defaultblock. Apps were manually
> converting our output to use divs because they didn't want margins, which
> is non-trivial to do and often leaves bugs in edge cases.

Right. I think that's a good idea.

 That alone is enough for us not to adopt p as
>> the default paragraph separator. Also, unfortunately, there are many
>> legacy
>> contents that rely on the fact webkit uses div as the paragraph separator
>> so we need a global or per editing-host switch regardless.
> Do you suggest that all browsers adopt <div> as default separator by
> default? Or that it will be impossible to reach interop? Or something else?
> :-)

It might be possible eventually once we introduce commands
like defaultblock and everyone starts using that since at that point, the
default doesn't really matter. On the other hand, at that point, the
default doesn't really matter so not sure if it's really worth converging.

 I almost want a global switch to toggle between legacy UA-specific behavior
>> and new spec-compliant behavior.
> That would rather miss the point of having the spec IMHO. If we all
> implement a global switch to opt in to a different behavior, let's design a
> new, sane editing API instead. But I think the editing spec should try to
> reach interop for the legacy feature first.

That makes sense but I think we need to make sure we don't break the
existing contents during the transition. I really wish we can all converge
on one behavior but not at the cost of backward compatibility.

- Ryosuke

Received on Wednesday, 11 January 2012 09:15:58 UTC