asimg.js 883 B

123456789101112131415161718192021222324252627
  1. /*!
  2. {
  3. "name": "SVG as an <img> tag source",
  4. "property": "svgasimg",
  5. "caniuse": "svg-img",
  6. "tags": ["svg"],
  7. "aliases": ["svgincss"],
  8. "authors": ["Chris Coyier"],
  9. "notes": [{
  10. "name": "HTML5 Spec",
  11. "href": "https://www.w3.org/TR/html5/embedded-content-0.html#the-img-element"
  12. }]
  13. }
  14. !*/
  15. define(['Modernizr', 'addTest'], function(Modernizr) {
  16. // Original Async test by Stu Cox
  17. // https://gist.github.com/chriscoyier/8774501
  18. // Now a Sync test based on good results here
  19. // https://codepen.io/chriscoyier/pen/bADFx
  20. // Note http://www.w3.org/TR/SVG11/feature#Image is *supposed* to represent
  21. // support for the `<image>` tag in SVG, not an SVG file linked from an `<img>`
  22. // tag in HTML – but it’s a heuristic which works
  23. Modernizr.addTest('svgasimg', document.implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#Image', '1.1'));
  24. });