Open Bug 459771 Opened 12 years ago Updated 6 years ago

Break paragraph bugs in contenteditable

Categories

(Core :: DOM: Editor, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

UNCONFIRMED

People

(Reporter: tuom.larsen, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) 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="http://www.w3.org/1999/xhtml">AAA<a href="tew"></a></p>BBB<p xmlns="http://www.w3.org/1999/xhtml" _moz_dirty=""><a href="tew" _moz_dirty="">CCC<br _moz_dirty=""/></a></p>

Expected Results:  
<p xmlns="http://www.w3.org/1999/xhtml">AAA<a href="tew">BBB</a></p><p xmlns="http://www.w3.org/1999/xhtml">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: http://jsfiddle.net/w4angztq/3/
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.