Select all + Copy in a contenteditable div selects the div element itself

UNCONFIRMED
Unassigned

Status

()

Core
Editor
UNCONFIRMED
8 years ago
4 years ago

People

(Reporter: Constantine Tsaregradsky, Unassigned, NeedInfo)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

8 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; uk; rv:1.9.2.8) Gecko/20100722 AskTbFXTV5/3.8.0.12304 Firefox/3.6.8
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.1; uk; rv:1.9.2.8) Gecko/20100722 AskTbFXTV5/3.8.0.12304 Firefox/3.6.8

When a div has the contenteditable attribute set to true, and the user selects all contents (cmd + a, mouse selection, execCommand or range.selectAllChildren(DOMNode) ) and copies the contents,the <div> element itself is copied to the clipboard. 
In https://bugzilla.mozilla.org/show_bug.cgi?id=436703 a case was fixed when a user pastes the copied contents into that contenteditable div, but the problem seems much deeper. 
Normally you can't see how html is stored in a clipboard (only with special clipboard viewers), but if you paste the copied contents in any of the Rich Text Editors like CKEditor, FCKEditor, tinyMCE, you'll see an additional <div contenteditable="true"> element.

Reproducible: Always

Steps to Reproduce:
1. Download any Rich Text Editor (like CKeditor, tinyMCE etc.) or clipboard viewers (like Inside Clipboard). Create an html-page with such contents:
<html>
<head>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>  
</head>
<body>
	<div contenteditable="true" style="width: 300px; height: 200px; border: 1px solid black;"></div>
	<textarea cols="80" id="editor1" name="editor1" rows="10"></textarea>
	<script type="text/javascript">
		CKEDITOR.replace( 'editor1' );
	</script>
</body>
</html>
2. Type any text in the conteneditable div, e.g. "This is an example."
3. Then press ctrl+a and ctrl+c.
4. Then paste with ctrl+v into the ckeditor (or look into the clipboard viewer).
Actual Results:  
Contents wrapped in an external <div contenteditable="true"> like:
<div contenteditable="true" style="width: 300px; height: 200px; border: 1px solid black;">This is an example.</div>

Expected Results:  
Only contents with no external <div contenteditable="true"> like:
This is an example.

In Opera, IE, Chrome the sample works correctly.
(Reporter)

Updated

8 years ago
See Also: → bug 436703

Updated

6 years ago
Duplicate of this bug: 788978

Updated

6 years ago
OS: Windows 7 → All

Updated

4 years ago
See Also: → bug 1072600

Comment 2

4 years ago
I think it's fixed by bug 858918 in Nightly (FF36).
Constantine, could you download Nightly and confirm on your side, please?
https://nightly.mozilla.org/
Flags: needinfo?(tsaregradsky)
You need to log in before you can comment on or make changes to this bug.