zurb / twentytwenty

jQuery Plugin to Compare Images
ISC License
1.27k stars 295 forks source link

safari (7 and 8) support #79

Open nosilver4u opened 7 years ago

nosilver4u commented 7 years ago

It would be nice for the readme to specify that only Safari 9+ is supported. From what I can see, 7 and 8 both lack support for "Symbol", which causes a fatal error.

screenshot from 2017-07-05 11-51-49

Now I'm off to go find a way to unbreak my site for folks using old versions of Mac OS X

nosilver4u commented 7 years ago

I should also mention that somehow this error never triggers when the script is unminified. I'm using Autoptimize in WordPress, and only when it's been merged and minified does the error occur. Fix was pretty simple, just wrapped the problematic line in an if,else similar to what core jQuery does:

if ( typeof Symbol === "function" ) { var eventsSymbol = Symbol('events'); } else { var eventsSymbol = {}; }

JamieBradders commented 7 years ago

@nosilver4u - This COULD be related to this issue https://github.com/zurb/twentytwenty/issues/78 - Symbol is an ES6 method which has only recently been supported natively in modern browsers. If you take a look at this issue I've linked, a few of us have found suitable polyfills that can be used to resolve this issue. The error itself seems to come from the jquery.event.move dependency. I would suggest giving this a go and seeing how you get on! I've made a suggestion to get this documented in the linked issue but so far no response from the folks at Zurb.