modernizr
Version:
Modernizr is a JavaScript library that detects HTML5 and CSS3 features in the user’s browser.
28 lines (27 loc) • 801 B
JavaScript
/*!
{
"name": "Inline SVG",
"property": "inlinesvg",
"caniuse": "svg-html5",
"tags": ["svg"],
"notes": [{
"name": "Test page",
"href": "https://paulirish.com/demo/inline-svg"
}, {
"name": "Test page and results",
"href": "https://codepen.io/eltonmesquita/full/GgXbvo/"
}],
"polyfills": ["inline-svg-polyfill"],
"knownBugs": ["False negative on some Chromia browsers."]
}
!*/
/* DOC
Detects support for inline SVG in HTML (not within XHTML).
*/
define(['Modernizr', 'createElement'], function(Modernizr, createElement) {
Modernizr.addTest('inlinesvg', function() {
var div = createElement('div');
div.innerHTML = '<svg/>';
return (typeof SVGRect != 'undefined' && div.firstChild && div.firstChild.namespaceURI) == 'http://www.w3.org/2000/svg';
});
});