Bug 57149 - Ending a list in contentEditable/designMode with enter produces a div
: Ending a list in contentEditable/designMode with enter produces a div
Status: NEW
: WebKit
HTML Editing
: 528+ (Nightly build)
: All All
: P2 Normal
Assigned To:
: http://tinymce.moxiecode.com/safari/e...
:
:
: 6627
  Show dependency treegraph
 
Reported: 2011-03-26 07:33 PST by
Modified: 2011-08-19 09:03 PST (History)


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2011-03-26 07:33:20 PST
Description:
Ending a list in contentEditable/designMode with enter produces a div it should produce a BR element like Gecko.

Steps to reproduce:
1. Open the attached url.
2. Place caret behind the X inside editable area below.
3. Press enter twice.
4. Click the Dump HTML link observe the HTML produced.

Expected result:
<ul><li>X</li></li><br>

Actual result:
<ul><li>X</li></li><div><br></div>
------- Comment #1 From 2011-05-18 17:57:38 PST -------
Generally when the user presses enter WebKit uses <div> to separate lines, instead of <br> like Gecko. Are you asking to change it just in this specific case, or in all cases? If it's just this case, what's the reasoning?

FYI, there is a thread about the html that is generated when pressing enter on the whatwg mailing list: http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2011-May/031577.html
------- Comment #2 From 2011-08-19 09:03:16 PST -------
The result of that discussion was that we should converge on the behavior of IE/Opera, which is to use <p>'s; and to wrap every line in a <p>, even the first (see bug 31678).  That's what I wrote in the spec:

http://aryeh.name/spec/editing/editing.html#the-insertparagraph-command

In practice, this is one of the most annoying interop issues with contenteditable: IE/Opera uses <p>, Gecko uses <br>, WebKit uses <div>.  The big issue here is that this affects even authors who don't use execCommand() at all, which lots of authors don't because it's too unreliable.  They still have to use contenteditable, and this is one of the biggest differences between browsers for contenteditable.  They also behave differently for delete and so on, but this difference affects every contenteditable region where the user ever pressed Enter, which is almost all of them.

So IMO, this would be a good thing to prioritize.  That way at least browsers would produce similar markup for the case where the user just types text in contenteditable without running execCommand().