WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
31678
contentEditable doesn't wrap elements around content until after the first line
https://bugs.webkit.org/show_bug.cgi?id=31678
Summary
contentEditable doesn't wrap elements around content until after the first line
Tim McConnell
Reported
2009-11-19 12:16:23 PST
For a new contentEditable region, only the second line will be wrapped in a container element (e.g. div or p). Repro steps: 1) Navigate to
http://www.mozilla.org/editor/midasdemo/
2) Click into the CE region and type a line 3) Hit enter and type another line 4) Click "View HTML Source" Actual: You will see that the first line is not contained in the relevant line element. Expected: The first line, like the second line, has been wrapped in the editor's line element. Problem: Because content is not uniformly wrapped, operations that should apply to the current line/block will fail on the first line. Any attempt to walk the DOM to find the parent will reach the contentEditable root.
Attachments
Add attachment
proposed patch, testcase, etc.
Aryeh Gregor
Comment 1
2011-08-19 09:08:35 PDT
I specced IE/Opera's behavior, which is to wrap every line in a <p>, including the current one as soon as the user hits enter:
http://aryeh.name/spec/editing/editing.html#the-insertparagraph-command
The relevant case is "If container is not editable or not in the same editing host as node or is not a single-line container:". This basically wraps the current line in a <p>, although admittedly that's unlikely to be clear on a casual read. I specced it this way because I agree that it's useful for every line to have a wrapper, so that they can be handled consistently.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug