formatblock in contenteditable div with one line inserts blockquote outside div

UNCONFIRMED
Unassigned

Status

()

UNCONFIRMED
9 years ago
9 years ago

People

(Reporter: ahurle, Unassigned)

Tracking

({testcase})

Trunk
x86
Windows 7
testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

9 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2 (.NET CLR 3.5.30729)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2 (.NET CLR 3.5.30729)

If you use document.execCommand('FormatBlock', false, '<blockquote>') in a contenteditable div that only has one line, a blockquote element will be inserted before the editable div.  Will attach test case.

Reproducible: Always

Steps to Reproduce:
1.  Go to the test case page
2.  Click inside the editor to give it focus
3.  Click the blockquote button
Actual Results:  
A blockquote element is inserted outside of the editor, before it (outlined in red).  There is also an error generated in the error console:

Error: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLDocument.execCommand]
Source file: http://vestitools.pbworks.com/f/formatblocktest.html
Line: 1


Expected Results:  
Inserted a blockquote element inside the rich text editor

If you type anything on the first line and try to insert a blockquote, it will still be inserted before the editor.  It seems like it can only be prevented (in this example) by inserting a line break.  Then, blockquotes will be entered into the editor as expected.
(Reporter)

Comment 1

9 years ago
Created attachment 437193 [details]
Demonstrates the bug with a contenteditable div and button to execute command

Bad blockquotes are outlined in red, good ones in green
confirmed with 
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.3a4pre) Gecko/20100405 Firefox/3.7a4pre ID:20100405051240 and 
Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.19) Gecko/2010031422 Firefox/3.0.19 ID:2010031422

GC 5 dev and Opera 10.5 behave as expected.

unsure if this is already covered by a dependency of Bug 237964.
Keywords: testcase
Version: unspecified → Trunk
You need to log in before you can comment on or make changes to this bug.