FF redirects to null.com while dataTransfer.setData("text", null) dragstart event definition




3 years ago
2 years ago


(Reporter: springer.ronny, Unassigned, NeedInfo)



Firefox Tracking Flags

(Not tracked)


(Whiteboard: btpp-followup-2016-04-21, URL)



3 years ago
:: Developer Documentation Request

      Request Type: New Documentation
     Gecko Version: unspecified
 Technical Contact: rolfedh@gmail.com

:: Details

I found a unwanted behaviour if second parameter is passed as null or undefined while using .setData(format, data) at 'dragstart' event definition - firefox redirects to null.com or undefined.com after 'dragend' event is passed. event.stopPropagation(); inside 'dragend' handler methode does not prevent redirect.

Could someone please update the documentation and mentioned that an empty string is well defined default data string?

code snipped:
dragstart: function (event) {
  if (browser.isFF) {
    event.originalEvent.dataTransfer.setData("text", null);

dragend: function (event) {

This behaviour occurred since FF41 up to FF44.
Ronny, do you know if this behaviour also occurs in other browsers? In other work is this a bug in Firefox (in addition to the docs)
Flags: needinfo?(springer.ronny)

Comment 2

2 years ago
Hi Jean-Yves, 
a customer reported this issue only with FF41. I checked Chrome49, IE11, IEedge and Safari9 which are working well with .setData("text", null). 

This ticket is neither critical not urgent because I follow the specification via empty string at '.setData("text", "")'. This little change works fine with all mentioned browsers.

I figured out that any string will be converted into a redirect url, e.g. '.setData("text", "firefox")' > firefox.com.


Spec > https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/setData
Flags: needinfo?(springer.ronny)
I'm moving this bug to the right (IMHO) component for triaging by the dev teams. I'll keep an eye an it to see if there is a need to update our docs.

Spec entry: https://html.spec.whatwg.org/#the-datatransfer-interface
Our webidl: http://mxr.mozilla.org/mozilla-central/source/dom/webidl/DataTransfer.webidl
Component: General → Untriaged
Keywords: dev-doc-needed
Product: Developer Documentation → Core
Could you please share an opinion on this issue?
Component: Untriaged → DOM
Flags: needinfo?(bugs)

Comment 5

2 years ago
So per HTML and WebIDL specs passing null as the 2nd param here means the value is converted to string "null". Do other browsers not do that? Do they keep the value as null, meaning that getData ends up returning null, and not "null". Or do they convert the value to ""?
Flags: needinfo?(bugs) → needinfo?(springer.ronny)
Whiteboard: btpp-followup-2016-04-21
You need to log in before you can comment on or make changes to this bug.