- // Browsers with outdated or limited JavaScript engines get the no-JS experience
- return !(
- // Internet Explorer < 9
- ( ua.indexOf( 'MSIE' ) !== -1 && parseFloat( ua.split( 'MSIE' )[ 1 ] ) < 9 ) ||
- // Firefox < 3
- ( ua.indexOf( 'Firefox/' ) !== -1 && parseFloat( ua.split( 'Firefox/' )[ 1 ] ) < 3 ) ||
- // Opera < 12
- ( ua.indexOf( 'Opera/' ) !== -1 && ( ua.indexOf( 'Version/' ) === -1 ?
- // "Opera/x.y"
- parseFloat( ua.split( 'Opera/' )[ 1 ] ) < 10 :
- // "Opera/9.80 ... Version/x.y"
- parseFloat( ua.split( 'Version/' )[ 1 ] ) < 12
- ) ) ||
- // "Mozilla/0.0 ... Opera x.y"
- ( ua.indexOf( 'Opera ' ) !== -1 && parseFloat( ua.split( ' Opera ' )[ 1 ] ) < 10 ) ||
- // BlackBerry < 6
- ua.match( /BlackBerry[^\/]*\/[1-5]\./ ) ||
- // Open WebOS < 1.5
- ua.match( /webOS\/1\.[0-4]/ ) ||
- // Anything PlayStation based.
- ua.match( /PlayStation/i ) ||
- // Any Symbian based browsers
- ua.match( /SymbianOS|Series60/ ) ||
- // Any NetFront based browser
- ua.match( /NetFront/ ) ||
- // Opera Mini, all versions
- ua.match( /Opera Mini/ ) ||
- // Nokia's Ovi Browser
- ua.match( /S40OviBrowser/ ) ||
- // MeeGo's browser
- ua.match( /MeeGo/ ) ||
- // Google Glass browser groks JS but UI is too limited
- ( ua.match( /Glass/ ) && ua.match( /Android/ ) )
+ // http://caniuse.com/#feat=addeventlistener
+ && 'addEventListener' in window
+
+ // Hardcoded exceptions for browsers that pass the requirement but we don't want to
+ // support in the modern run-time.
+ && !(
+ ua.match( /webOS\/1\.[0-4]/ ) ||
+ ua.match( /PlayStation/i ) ||
+ ua.match( /SymbianOS|Series60|NetFront|Opera Mini|S40OviBrowser|MeeGo/ ) ||
+ ( ua.match( /Glass/ ) && ua.match( /Android/ ) )
+ )