nativesortable icon indicating copy to clipboard operation
nativesortable copied to clipboard

use native classList functionality

Open james2doyle opened this issue 10 years ago • 5 comments

I noticed that there are some helper functions for manipulating classes.

I was wondering why, since classList is actually better supported than drag. Although, it looks like IE <= 9 doesn't support classList, but I am not sure how well they support drag either. As far as reasons why, it would probably be better performance and smaller code base to just use classList, on the downside, it would mean supporting IE > 9 only.

james2doyle avatar Dec 16 '14 15:12 james2doyle

IIRC, drag and drop has been supported since at least IE 5.5. But I haven't checked this library against older versions of IE in a while. It would be worth checking in <=8 to see if we are working right now It'd be a shame to break it if it was already working in these releases, but if it's already broken we could probably move on and use the newer stuff.

I don't think performance is a real consideration given how infrequently the class names are modified. If things are working in old IE. Although we could always modify the addClassName/hasClassName/removeClassName function to use the classList API if available.

bgrins avatar Dec 16 '14 17:12 bgrins

I just checked it in IE 8 and IE 9.

IE 8 says it has no addEventListener which is the attachEvent problem, and IE 9 wasn't working either, except when dragging an a tag (which is apparently a known issue), but it was also throwing an error on this line.

james2doyle avatar Dec 16 '14 17:12 james2doyle

IE 8 says it has no addEventListener which is the attachEvent problem

Oh right, addEventListener. I'd say we can go ahead and switch to classList in that case.

bgrins avatar Dec 16 '14 18:12 bgrins

IE 9 wasn't working either, except when dragging an a tag (which is apparently a known issue), but it was also throwing an error on this line.

What if we try/catch that line(s)? Will it work in IE9 in that case?

bgrins avatar Dec 16 '14 18:12 bgrins

It's possible. It seems like there might be more things than just the one line though.

james2doyle avatar Dec 16 '14 18:12 james2doyle