Skip to content

Commit

Permalink
Merge pull request #1155 from kristerkari/master
Browse files Browse the repository at this point in the history
Added a test for animated WebP images
  • Loading branch information
patrickkettner committed Dec 11, 2013
2 parents a229f38 + 7b025da commit 06089bc
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
37 changes: 37 additions & 0 deletions feature-detects/img/webp-animation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*!
{
"name": "Webp Animation",
"async": true,
"property": "webpanimation",
"aliases": ["webp-animation"],
"tags": ["image"],
"authors": ["Krister Kari", "Rich Bradshaw", "Ryan Seddon", "Paul Irish"],
"notes": [{
"name": "WebP Info",
"href": "http://code.google.com/speed/webp/"
},{
"name": "Chormium blog - Chrome 32 Beta: Animated WebP images and faster Chrome for Android touch input",
"href": "http://blog.chromium.org/2013/11/chrome-32-beta-animated-webp-images-and.html"
}]
}
!*/
/* DOC
Tests for animated webp support.
*/
define(['Modernizr', 'addTest'], function( Modernizr, addTest ) {
Modernizr.addAsyncTest(function(){
var image = new Image();

image.onerror = function() {
addTest('webpanimation', false, { aliases: ['webp-animation'] });
};

image.onload = function() {
addTest('webpanimation', image.width == 1, { aliases: ['webp-animation'] });
};

image.src = 'data:image/webp;base64,UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA';
});
});
1 change: 1 addition & 0 deletions lib/config-all.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
"test/img/srcset",
"test/img/webp-lossless",
"test/img/webp-alpha",
"test/img/webp-animation",
"test/img/webp",
"test/indexedDB",
"test/input",
Expand Down

0 comments on commit 06089bc

Please sign in to comment.