cferdinandi / kraken

A lightweight, mobile-first boilerplate for front-end web developers.
http://cferdinandi.github.io/kraken
MIT License
806 stars 81 forks source link

Improve SVG detection #206

Closed cferdinandi closed 9 years ago

cferdinandi commented 9 years ago
;(function (window, document, undefined) {

    'use strict';

    // SVG feature detection
    var supports = !!document.createElementNS && !!document.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGRect;

    // Check against Opera Mini (throws a false positive)
    var whitelist = navigator.userAgent.indexOf('Opera Mini') === -1;

    // If SVG is supported, add `.svg` class to <html> element
    if ( supports && whitelist ) {
        document.documentElement.className += (document.documentElement.className ? ' ' : '') + 'svg';
    }

})(window, document);
cferdinandi commented 9 years ago

v5.6.1