Bug 127690 - execCommand('insertHTML', ...) creates nested paragraphs under very specific circumstances
Summary: execCommand('insertHTML', ...) creates nested paragraphs under very specific ...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.9
: P2 Normal
Assignee: Nobody
URL: http://jsbin.com/OKuXiCA/1/edit
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-27 11:02 PST by Tim Molendijk
Modified: 2014-01-27 11:15 PST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Molendijk 2014-01-27 11:02:20 PST
Steps to reproduce the problem:
1. Open provided URL
2. Click button to execute code as described on its label
3. Notice how a nested paragraph structure has been created (and the first inserted paragraphs ends up last in the created DOM tree - but that's probably related)

What is the expected behavior?
What Firefox does: create a DOM tree that looks like this:
<p>1st inserted</p>
<p><br></p>
<p><br></p>

What went wrong?
Instead it creates a DOM tree that looks like this:
<p><p></p></p>
<p>1st inserted</p>

Does it occur on multiple sites: Yes

Is it a problem with a plugin? No 

Did this work before? N/A 

Does this work in other browsers? No Safari (verified v7.0.1)

Chrome version: 34.0.1797.2  Channel: dev
OS Version: OS X 10.9.1
Flash Version: Shockwave Flash 12.0 r0

As soon as a layout is applied to all paragraphs, this misbehavior disappears. Or when the br element is removed from the initial contenteditable, this misbehavior disappears. And probably several more subtle requirements that I haven't discovered.
Comment 1 Tim Molendijk 2014-01-27 11:15:00 PST
I'm not sure whether "layout is applied" in the last paragraph is correct. I _am_ sure that when you apply min-height to every p (in CSS), the problem goes away.