dragster icon indicating copy to clipboard operation
dragster copied to clipboard

Not working with ie 11

Open claudiorivetti opened this issue 11 years ago • 7 comments

line 264: e.dataTransfer.setData('text/plain', '')

gives an error.

claudiorivetti avatar Jan 08 '14 11:01 claudiorivetti

Thanks for letting me know :) from a quick look it might be fixed by changing text/plain to text http://msdn.microsoft.com/en-us/library/ie/ms536744(v=vs.85).aspx

I'll have a look tomorrow when I have a Windows VM handy.

bensmithett avatar Jan 08 '14 11:01 bensmithett

That is a problem in your demo page, however dragster.js is not working in IE because of the luck of: CustomEvent

would it be possible to replace CustomEvent with:

var evt = document.createEvent("CustomEvent"); evt.initCustomEvent('dragster:leave', true, true, { 'cmd': "blerg!" });

as suggested here: http://stackoverflow.com/questions/19345392/why-arent-my-parameters-getting-passed-through-to-a-dispatched-event/19345563#19345563

claudiorivetti avatar Jan 08 '14 17:01 claudiorivetti

Any updates on this issue

KrisTemmerman avatar May 13 '15 13:05 KrisTemmerman

Sorry everyone, I haven't looked at this repo for ages. #9 fixes this apparently - I don't have IE available for the next few days, can anyone confirm @christophermina's rewrite fixes this issue for you?

bensmithett avatar May 16 '15 02:05 bensmithett

I can confirm the pull request is working! I tried within Windows 10 with Internet Explorer 9, 10, 11 and Edge. Looks fine even in IE9!

MickL avatar Jun 07 '16 17:06 MickL

Interestingly, added CSS-classes don't change the DOM in IE and Edge while "dragster:enter" event. Even jQuery $('#object').css('display', 'block'); doesn't change anything.

Also interestingly the new styles are getting visible on next change, for example if you have :hover styles but i was not able to trigger rerendering while drag.

To reproduce:

  1. Try changing some DOM while "dragster:enter", e.g. adding a class
  2. Drag something in
  3. The classes are added, but the DOM doesn't change visibly

Now if the targeted DOM-element has some :hover CSS-style and you didn't remove the added class on dragster:leave you can hover the element. NOW the styles are shown.

MickL avatar Jun 07 '16 18:06 MickL

I found a solution for this css-rerendering bug on IE. Im using jQuery, but this may work also for plain JavaScript. My code looks like this:

 dropzone.addEventListener("dragster:enter", function(e) {
                $index.addClass("dragEnter");
                $index.hide().show(0); // IE-fix
}

 dropzone.addEventListener("dragster:leave", function(e) {
                $index.removeClass("dragEnter");
                $index.hide().show(0); // IE-fix
}

MickL avatar Jun 08 '16 15:06 MickL