[whatwg] Pressing Enter in contenteditable: <p> or <br> or <div>?

Am 19.05.2011 01:48 schrieb Hallvord R. M. Steen:
> On Thu, 19 May 2011 03:09:39 +0900, Ojan Vafai <ojan at chromium.org> wrote:
>
>> The tricky bit here is what to do when the user copy-pastes. I think
>> we should convert P to DIV or vice versa as per whatever the
>> defaultblock value is. We should also give an execCommand to allow the
>> website to disable this behavior.
>
> With better and more cross-browser consistent access to HTML from the
> paste event I guess script authors will have this use case covered, so I
> don't think we need any execCommand. I agree with converting to the
> default block as a standard behaviour if scripts do not intercept the
> paste - presumably if a script handles it, it will do the work that will
> make sure the new content is consistent with the old one.

I don't think we should convert anything on paste by default. Some 
contentEditable applications are designed as full-page editors; full 
pages are likely to break if <div>s are converted to <p>s or vice versa. 
I don't think any algorithm can reliably figure out whether a <div> is 
part of the page structure, or part of a series of paragraphs in every 
case (this is also why I vote for using <p>s). Cleaning up the code is 
good and necessary, but it should be left to authors, and I agree that 
access to the paste event is crucial here.

Received on Thursday, 19 May 2011 00:39:03 UTC