Open Bug 459771 Opened 12 years ago Updated 6 years ago

Break paragraph bugs in contenteditable


(Core :: DOM: Editor, defect)

Windows XP
Not set





(Reporter: tuom.larsen, Unassigned)


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/2008092417 Firefox/3.0.3
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/2008092417 Firefox/3.0.3

Currently the paragraph breaking in contenteditable results in very ... rich DOM. This makes serializing more challenging.

Reproducible: Always

Steps to Reproduce:
1. create <div contenteditable="true"><p>AAA<a href="tew">BBB</a></p></div>
2. put caret just after "BBB" and hit enter
3. type CCC

Actual Results:  
This is the resulting DOM of the paragraph:

<p xmlns="">AAA<a href="tew"></a></p>BBB<p xmlns="" _moz_dirty=""><a href="tew" _moz_dirty="">CCC<br _moz_dirty=""/></a></p>

Expected Results:  
<p xmlns="">AAA<a href="tew">BBB</a></p><p xmlns="">CCC</p>

There are 3 differences:
- _moz_dirty="" (not in specs)
- <a> flows into the second paragraph (enter was pressed just at the end of the link)
- redundant <br> (<p> break should result in another <p>)
Also, when deleting "AAA", "BBB" and "CCC", it shouldn't delete the last <p> (so when entering completely another text, it stays in <p>)
Component: General → Editor
Product: Firefox → Core
QA Contact: general → editor
Here is fiddle which shows the problem:
place carret just after "test" and hit enter twice - new empty <a href="test"><br></a> will be added.
You need to log in before you can comment on or make changes to this bug.