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

Issue 590912 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug



Sign in to add a comment

Attributes on drag&drop are lost

Reported by sombra2e...@gmail.com, Feb 29 2016

Issue description

Chrome Version       : 47.0.2526.73 (Build para desarrolladores) Ubuntu 15.04 (64 bits)
URLs (if applicable) : https://jsfiddle.net/sombra2eternity/2bLcs91y/2/
Other browsers tested:
have tested this issue:
    Firefox: OK

What steps will reproduce the problem?
1. Drop the image, you will get "test"
2. Drop the anchor, you should get "test"
3. It should work with any other attributes like data-*

What is the expected result?
The attributes are preserved in both cases

What happens instead?
The attributes are lost in anchor case but ok on image case

A javascript workaround:
ondragstart="event.dataTransfer.setData('text/html',this.outerHTML);"


 
Cc: rnimmagadda@chromium.org
Labels: Needs-Feedback
@sombra2eternity: Could you please have a look at the attached video and let us know if this is the correct procedure to repro this issue.

Else, provide us the screen-recording for better understanding.

Thank you.
590912.mov
3.5 MB Download
The attached video shows the correct procedure :-)

The second alert should be 'test' too. The problem here is that chrome/chromium strips the attributes when dropping an anchor text and recovering through 'text/html'. They are still available when an image is dropped instead an anchor.

In this case I tried to read the "class" attribute, but you could try with "id" or any "data-*", they are stripped too.

If the element is
"<a class="test" id="foo" data-foo="lalala" href="http://google.es">drop this link</a>"
then it comes as
"<a href="http://google.es">drop this link</a>"
only "href" is preserved.

Firefox preserve all attributes in both cases.
Components: Blink>DataTransfer
Project Member

Comment 4 by sheriffbot@chromium.org, Mar 25 2016

Labels: -Needs-Feedback Needs-Review
Owner: rnimmagadda@chromium.org
Thank you for providing more feedback. Adding requester "rnimmagadda@chromium.org" for another review and adding "Needs-Review" label for tracking.

For more details visit https://sites.google.com/a/chromium.org/dev/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: -Needs-Review M-50 OS-Linux OS-Mac OS-Windows Pri-2 Type-Bug
Owner: ----
Status: Untriaged (was: Unconfirmed)
Able to repro this issue on Windows 7, MAC (10.11.3) & Ubuntu Trusty (14.04) for Google Chrome Stable Version - 49.0.2623.110

This is a Non-Regression issue existing from M30 - # 30.0.1549.0
Owner: dcheng@chromium.org
Status: Started (was: Untriaged)
Firefox does this so we should match them. Edge doesn't appear to have enough DnD support for the test case to work.
Project Member

Comment 7 by bugdroid1@chromium.org, Apr 6 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/3accf1e624bb65f3c4b594e646b54b28dab05c21

commit 3accf1e624bb65f3c4b594e646b54b28dab05c21
Author: dcheng <dcheng@chromium.org>
Date: Wed Apr 06 03:25:55 2016

Serialize original node when dragging a link instead of synthesizing HTML.

This preserves the original attributes, like what already happens for
image and selection drags today.

BUG= 590912 

Review URL: https://codereview.chromium.org/1860293003

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

[modify] https://crrev.com/3accf1e624bb65f3c4b594e646b54b28dab05c21/third_party/WebKit/LayoutTests/editing/pasteboard/dragstart-contains-default-content-expected.txt
[modify] https://crrev.com/3accf1e624bb65f3c4b594e646b54b28dab05c21/third_party/WebKit/LayoutTests/editing/pasteboard/drop-link.html
[modify] https://crrev.com/3accf1e624bb65f3c4b594e646b54b28dab05c21/third_party/WebKit/Source/core/clipboard/DataTransfer.cpp
[modify] https://crrev.com/3accf1e624bb65f3c4b594e646b54b28dab05c21/third_party/WebKit/Source/core/clipboard/DataTransfer.h
[modify] https://crrev.com/3accf1e624bb65f3c4b594e646b54b28dab05c21/third_party/WebKit/Source/core/editing/serializers/Serialization.cpp
[modify] https://crrev.com/3accf1e624bb65f3c4b594e646b54b28dab05c21/third_party/WebKit/Source/core/editing/serializers/Serialization.h
[modify] https://crrev.com/3accf1e624bb65f3c4b594e646b54b28dab05c21/third_party/WebKit/Source/core/page/DragController.cpp

Status: Fixed (was: Started)

Sign in to add a comment