g214/static/bower_components/modernizr/feature-detects/img-webp.js

20 lines
473 B
JavaScript

// code.google.com/speed/webp/
// by rich bradshaw, ryan seddon, and paul irish
// This test is asynchronous. Watch out.
(function(){
var image = new Image();
image.onerror = function() {
Modernizr.addTest('webp', false);
};
image.onload = function() {
Modernizr.addTest('webp', function() { return image.width == 1; });
};
image.src = 'data:image/webp;base64,UklGRiwAAABXRUJQVlA4ICAAAAAUAgCdASoBAAEAL/3+/3+CAB/AAAFzrNsAAP5QAAAAAA==';
}());