webp-animation.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /*!
  2. {
  3. "name": "Webp Animation",
  4. "async": true,
  5. "property": "webpanimation",
  6. "aliases": ["webp-animation"],
  7. "tags": ["image"],
  8. "authors": ["Krister Kari", "Rich Bradshaw", "Ryan Seddon", "Paul Irish"],
  9. "notes": [{
  10. "name": "WebP Info",
  11. "href": "https://developers.google.com/speed/webp/"
  12. },{
  13. "name": "Chromium blog - Chrome 32 Beta: Animated WebP images and faster Chrome for Android touch input",
  14. "href": "https://blog.chromium.org/2013/11/chrome-32-beta-animated-webp-images-and.html"
  15. }]
  16. }
  17. !*/
  18. /* DOC
  19. Tests for animated webp support.
  20. */
  21. define(['Modernizr', 'addTest'], function(Modernizr, addTest) {
  22. Modernizr.addAsyncTest(function() {
  23. var image = new Image();
  24. image.onerror = function() {
  25. addTest('webpanimation', false, {aliases: ['webp-animation']});
  26. };
  27. image.onload = function() {
  28. addTest('webpanimation', image.width === 1, {aliases: ['webp-animation']});
  29. };
  30. image.src = 'data:image/webp;base64,UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA';
  31. });
  32. });