-
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.
Added tests for transparent Webp images
Related issue #1023
- Loading branch information
Krister Kari
committed
Dec 10, 2013
1 parent
26f64a2
commit f39fcbf
Showing
2 changed files
with
41 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,40 @@ | ||
/*! | ||
{ | ||
"name": "Webp Alpha", | ||
"async": true, | ||
"property": "webpalpha", | ||
"aliases": ["webp-alpha"], | ||
"tags": ["image"], | ||
"authors": ["Krister Kari", "Rich Bradshaw", "Ryan Seddon", "Paul Irish"], | ||
"notes": [{ | ||
"name": "WebP Info", | ||
"href": "http://code.google.com/speed/webp/" | ||
},{ | ||
"name": "Article about WebP support on Android browsers", | ||
"href": "http://www.wope-framework.com/en/2013/06/24/webp-support-on-android-browsers/" | ||
},{ | ||
"name": "Chormium WebP announcement", | ||
"href": "http://blog.chromium.org/2011/11/lossless-and-transparency-encoding-in.html?m=1" | ||
}] | ||
} | ||
!*/ | ||
/* DOC | ||
Tests for transparent webp support. | ||
*/ | ||
define(['Modernizr', 'addTest'], function( Modernizr, addTest ) { | ||
Modernizr.addAsyncTest(function(){ | ||
var image = new Image(); | ||
|
||
image.onerror = function() { | ||
addTest('webpalpha', false, { aliases: ['webp-alpha'] }); | ||
}; | ||
|
||
image.onload = function() { | ||
addTest('webpalpha', image.width == 1, { aliases: ['webp-alpha'] }); | ||
}; | ||
|
||
image.src = 'data:image/webp;base64,UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAABBxAR/Q9ERP8DAABWUDggGAAAADABAJ0BKgEAAQADADQlpAADcAD++/1QAA=='; | ||
}); | ||
}); |
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