kornelski / slip

Slip.js — UI library for manipulating lists via swipe and drag gestures
BSD 2-Clause "Simplified" License
2.44k stars 213 forks source link

Slip doesn't work in IE9 #36

Open aarfing opened 9 years ago

aarfing commented 9 years ago

Hey pornel,

Just did a drag and drop test in IE9 and it doesn't work.

You're not able to drag an item - and it shows no erros in the console. I think it either should work in IE9 or it should be feature-detectable, so a proper fallback can be used.

Also -ms-user-select: none; should be added to your demo for improved IE support :)

kornelski commented 9 years ago

Thanks for checking it. Could you investigate what is failing? Does it fire mouse events?

aarfing commented 9 years ago

Ok, so I did some investigating and made it work. The problem is that while IE9 understands 'transform' as a CSS property, in JavaScript it needs the 'ms'-prefix like so: 'msTransform', so a simple test for that makes it work.

aarfing commented 9 years ago

Actually IE9 needs a prefix on the CSS property as well, so a simple verbose proof of concept would be:

var transformPrefix = "webkitTransform" in testElement.style ? "webkitTransform" : "transform"; if(transformPrefix === "transform"){ transformPrefix = "msTransform" in testElement.style ? "msTransform" : "transform"; } var transformProperty = transformPrefix === "webkitTransform" ? "-webkit-transform" : "transform"; if(transformProperty === "transform"){ transformProperty = transformPrefix === "msTransform" ? "-ms-transform" : "transform"; }