Pressing enter in div w/ contenteditable = true causes text nodes to move unexpectedly

RESOLVED FIXED in mozilla1.9

Status

()

Core
Editor
P2
normal
RESOLVED FIXED
10 years ago
10 years ago

People

(Reporter: Robbie Paplin, Assigned: peterv)

Tracking

({testcase})

Trunk
mozilla1.9
testcase
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 1 obsolete attachment)

(Reporter)

Description

10 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5
Build Identifier: 

In the attached document, pressing enter twice causes the semicolons (a/k/a text nodes) to move between the Peyton Manning & Eli Manning span, instead of remaining in place between each span.

Reproducible: Always

Steps to Reproduce:
1.  Set the caret to the left of the semicolon between Tom Brady & Matt Hasselbeck
2.  Press the Enter key twice

Actual Results:  
The semi-colons between the contenteditable=false spans to migrate to text node between Peyton & Eli.


Expected Results:  
The semi-colons between the contenteditable=false spans should not move (other than the ones effected by the line breaks).

On Safari 3.1.1 pressing enter causes the browser to insert <div> wrapped <br>'s.
On IE 7.0 pressing Enter causes the browser to insert <p> tags and pressing Shift-Enter causes the browser to insert <br> tags.
However, despite the implementation differences, it seems to work as expected on other browsers.
(Reporter)

Comment 1

10 years ago
Created attachment 317163 [details]
Page that reproduces document corruption issue when pressing Enter

Comment 2

10 years ago
Confirmed using an up-to-date Mac trunk build.  Nice testcase.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: testcase
OS: Windows Vista → All
Hardware: PC → All

Updated

10 years ago
Assignee: nobody → peterv

Comment 3

10 years ago
confirmed this with 0424 windows nightly build in windows xp
(Assignee)

Updated

10 years ago
Status: NEW → ASSIGNED
Priority: -- → P2
Target Milestone: --- → mozilla1.9
Version: unspecified → Trunk
(Assignee)

Comment 5

10 years ago
Created attachment 318413 [details] [diff] [review]
v1

Now with mochitest.

CollapseAdjacentTextNodes should only collapse adjacent text nodes. GetPriorHTMLSibling finds the previous sibling that is editable, skipping siblings that are not editable, so the node that it returns can be a non-adjacent sibling. We should just use GetPreviousSibling instead.
Attachment #317751 - Attachment is obsolete: true
Attachment #318413 - Flags: superreview?(jst)
Attachment #318413 - Flags: review?(jst)

Updated

10 years ago
Attachment #318413 - Flags: superreview?(jst)
Attachment #318413 - Flags: superreview+
Attachment #318413 - Flags: review?(jst)
Attachment #318413 - Flags: review+
(Assignee)

Comment 6

10 years ago
Comment on attachment 318413 [details] [diff] [review]
v1

Low-risk fix for an annoying contenteditable bug. Has patch.
Attachment #318413 - Flags: approval1.9?
(Assignee)

Comment 7

10 years ago
Comment on attachment 318413 [details] [diff] [review]
v1

I meant has testcase :-/.
Comment on attachment 318413 [details] [diff] [review]
v1

a1.9+=damons
Attachment #318413 - Flags: approval1.9? → approval1.9+
(Assignee)

Updated

10 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 10 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.