Permalink
Browse files

Adding feature detects from modernizr-plugins repo

  • Loading branch information...
1 parent 1991630 commit 4c5eddba791536166c49649dbb8f56a766123262 @addyosmani addyosmani committed Nov 29, 2011
View
@@ -0,0 +1,16 @@
+// Animated PNG
+// 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;
+ };
+ apngTest.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACGFjVEwAAAABAAAAAcMq2TYAAAANSURBVAiZY2BgYPgPAAEEAQB9ssjfAAAAGmZjVEwAAAAAAAAAAQAAAAEAAAAAAAAAAAD6A+gBAbNU+2sAAAARZmRBVAAAAAEImWNgYGBgAAAABQAB6MzFdgAAAABJRU5ErkJggg==";
+ }
+});
@@ -0,0 +1,4 @@
+// Mozilla Audio Data API
+// https://wiki.mozilla.org/Audio_Data_API
+// by Addy Osmani
+Modernizr.addTest('audioDataApi', !!(window.Audio));
@@ -0,0 +1,4 @@
+// classList
+// https://developer.mozilla.org/en/DOM/element.classList
+// By Addy Osmani
+Modernizr.addTest('classList', !!('classList' in document.createElement('a')));
@@ -1,9 +1,11 @@
+// http://www.w3.org/TR/html5/interactive-elements.html#context-menus
+// Demo at http://thewebrocks.com/demos/context-menu/
Modernizr.addTest(
'contextmenu',
('contextMenu' in document.body && 'HTMLMenuItemElement' in window)
);
-// Demo at http://thewebrocks.com/demos/context-menu/
+
@@ -0,0 +1,4 @@
+// DataView
+// https://developer.mozilla.org/en/JavaScript_typed_arrays/DataView
+// By Addy Osmani
+Modernizr.addTest('dataView', (typeof DataView !== 'undefined' && 'getFloat64' in DataView.prototype));
@@ -0,0 +1,4 @@
+// EventSource
+// http://dev.w3.org/html5/eventsource/
+// By Addy Osmani
+Modernizr.addTest('eventSource', !!('EventSource' in window));
@@ -0,0 +1,6 @@
+// GamePad API
+// https://wiki.mozilla.org/GamepadAPI
+// Note: this feature detection test has been confirmed with the developers
+// of the GamePad API implementation in FF
+// By Addy Osmani
+Modernizr.addTest('classList', !!('gamepads' in navigator));
@@ -0,0 +1,4 @@
+// getUserMedia
+// http://www.whatwg.org/specs/web-apps/current-work/multipage/video-conferencing-and-peer-to-peer-communication.html
+// By Addy Osmani
+Modernizr.addTest('getUserMedia', !!('getUserMedia' in navigator));
@@ -0,0 +1,4 @@
+// Microdata support
+// http://www.w3.org/TR/html5/microdata.html
+// By Addy Osmani
+Modernizr.addTest('microdata', !!(document['getItems']));
@@ -0,0 +1,3 @@
+// HTML5 <progress> tag
+// By Addy Osmani
+Modernizr.addTest('progress', !!('position' in document.createElement('progress')));
@@ -0,0 +1,4 @@
+// Track element
+// http://www.w3.org/TR/html5/video.html#the-track-element
+// By Addy Osmani
+Modernizr.addTest('trackElement', (typeof (document.createElement('video').addTextTrack) === 'function'));
@@ -0,0 +1,4 @@
+// Web Audio API
+// https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html
+// By Addy Osmani
+Modernizr.addTest('webAudioApi', !!(window.webkitAudioContext || window.AudioContext));

0 comments on commit 4c5eddb

Please sign in to comment.