Open Bug 557412 Opened 11 years ago Updated 11 years ago

formatblock in contenteditable div with one line inserts blockquote outside div


(Core :: DOM: Editor, defect)

Windows 7
Not set





(Reporter: ahurle, Unassigned)


(Keywords: testcase)


(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv: 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: 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:
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.
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: 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.