Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

renaming files to match filenaming pattern requested, updating apng test

  • Loading branch information...
commit 969f4ea1fe8a6dbc272b5db5a8aec03b27d0f4f4 1 parent fa5d138
@addyosmani addyosmani authored
View
30 feature-detects/apng.js
@@ -2,15 +2,25 @@
// http://en.wikipedia.org/wiki/APNG
// By Addy Osmani
-Modernizr.addTest('apng', function () {
- var canvas = document.createElement('canvas');
- if !! (typeof canvas.getContext == 'undefined') {
- var apngTest = new Image(),
- ctx = document.createElement('canvas').getContext('2d');
- apngTest.onload = function () {
- ctx.drawImage(apngTest, 0, 0);
- return ctx.getImageData(0, 0, 1, 1).data[3] === 0;
+(function () {
+
+ var image = new Image(),
+ canvas = document.createElement('canvas'),
+ ctx = canvas.getContext('2d');
+
+ if (!(typeof canvas.getContext == 'undefined')) {
+
+ image.onerror = function () {
+ Modernizr.addTest('apng', false);
};
- apngTest.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACGFjVEwAAAABAAAAAcMq2TYAAAANSURBVAiZY2BgYPgPAAEEAQB9ssjfAAAAGmZjVEwAAAAAAAAAAQAAAAEAAAAAAAAAAAD6A+gBAbNU+2sAAAARZmRBVAAAAAEImWNgYGBgAAAABQAB6MzFdgAAAABJRU5ErkJggg==";
+ image.onload = function () {
+ Modernizr.addTest('apng', function () {
+ ctx.drawImage(image, 0, 0);
+ return ctx.getImageData(0, 0, 1, 1).data[3] === 0;
+ });
+ };
+
+ image.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACGFjVEwAAAABAAAAAcMq2TYAAAANSURBVAiZY2BgYPgPAAEEAQB9ssjfAAAAGmZjVEwAAAAAAAAAAQAAAAEAAAAAAAAAAAD6A+gBAbNU+2sAAAARZmRBVAAAAAEImWNgYGBgAAAABQAB6MzFdgAAAABJRU5ErkJggg==";
}
-});
+
+}());
View
0  feature-detects/audioDataApi.js → feature-detects/audiodata-api.js
File renamed without changes
View
0  feature-detects/dataViewApi.js → feature-detects/dataview-api.js
File renamed without changes
View
0  feature-detects/trackApi.js → feature-detects/track.js
File renamed without changes
View
0  feature-detects/webAudioApi.js → feature-detects/webaudio-api.js
File renamed without changes
Please sign in to comment.
Something went wrong with that request. Please try again.