-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1155 from kristerkari/master
Added a test for animated WebP images
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters