New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 5 users

Issue metadata

Status: Fixed
Closed: Oct 2016
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug

Sign in to add a comment

Formatting tags converted to spans with styles on cut/paste

Reported by, Aug 4 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36

Steps to reproduce the problem:
1. Open the attached pasteTransform.html in Chrome. 
2. Look at the source of the document. Notice that the formatting has B elements. 
3. Select all the text in the contenteditable and cut it using Ctrl/Meta+A, Ctrl/Meta+X
4. Paste it back into the contenteditable using Ctrl/Meta+V
5. Look at the HTML now. Notice the B elements have been replaced with SPAN elements with styles.

What is the expected behavior?
The pasted HTML should be the same as the cut HTML.

What went wrong?
All formatting tags (B, I, U) are converted to SPAN elements with style attributes. The HTML should not be transformed in this manner.

Did this work before? N/A 

Chrome version: 52.0.2743.82  Channel: stable
OS Version: OS X 10.11.5
Flash Version: Shockwave Flash 22.0 r0

The HTML in my example file is what I get from using standard execCommand statements and typing. No special code was used to modify what Chrome created. 

Before I cut the HTML the contenteditable contains:


After the cut/paste operation this is the result:

Mac: <br class="Apple-interchange-newline"><span style="font-weight: bold">aaaa</span>
Windows:  <div><br></div><div><span style="font-weight: bold;">aaaa</span><br></div>

The formatting tags shouldn't be transformed in this manner by a simple cut/paste operation.
277 bytes View Download
Components: Blink>HTML
Labels: M-54 OS-Linux OS-Windows
Status: Untriaged (was: Unconfirmed)
Able to reproduce the issue on Chrome Stable# 52.0.2743.116 on Windows, Mac and Linux.
This is a Non-Regression Issue existing from M30 Builds# 30.0.1599.101 (Official Build 227552) m.
Changing the status to Untriaged so that the issue would get addressed.
Thank You.
Components: Blink>Editing>Paste
Components: -Blink>HTML -Blink>Editing>Paste Blink>Editing
Status: Available (was: Untriaged)
Yes, this is a bit surprising. From memory this is actually caused when the content is *cut*, not when it is pasted.
Project Member

Comment 4 by, Aug 13 2016

The following revision refers to this bug:

commit f77d0eaedb2787483c147b973bcf7e7de82bf0f3
Author: joone.hur <>
Date: Sat Aug 13 06:47:05 2016

Keep formatting tags included when it is cut or copied.

When we copy/cut a formatting tag without the highest node.
the formatting tag's text can be wrapped by <span> tag
instead of the formatting tag. This CL allows to keep
formatting tags included when it is cut or copied.

BUG= 634482 

Cr-Commit-Position: refs/heads/master@{#411883}


Comment 5 by, Oct 17 2016

Status: Started (was: Available)

Comment 6 by, Oct 18 2016

Status: Fixed (was: Started)

Sign in to add a comment