Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding feature detects from modernizr-plugins repo

  • Loading branch information...
commit 4c5eddba791536166c49649dbb8f56a766123262 1 parent 1991630
@addyosmani addyosmani authored
View
16 feature-detects/apng.js
@@ -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==";
+ }
+});
View
4 feature-detects/audiodataApi.js
@@ -0,0 +1,4 @@
+// Mozilla Audio Data API
+// https://wiki.mozilla.org/Audio_Data_API
+// by Addy Osmani
+Modernizr.addTest('audioDataApi', !!(window.Audio));
View
4 feature-detects/classlist.js
@@ -0,0 +1,4 @@
+// classList
+// https://developer.mozilla.org/en/DOM/element.classList
+// By Addy Osmani
+Modernizr.addTest('classList', !!('classList' in document.createElement('a')));
View
4 feature-detects/contextmenu.js
@@ -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/
+
View
4 feature-detects/dataViewApi.js
@@ -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));
View
4 feature-detects/eventsource.js
@@ -0,0 +1,4 @@
+// EventSource
+// http://dev.w3.org/html5/eventsource/
+// By Addy Osmani
+Modernizr.addTest('eventSource', !!('EventSource' in window));
View
6 feature-detects/gamepad.js
@@ -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));
View
4 feature-detects/getUserMedia.js
@@ -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));
View
4 feature-detects/microdata.js
@@ -0,0 +1,4 @@
+// Microdata support
+// http://www.w3.org/TR/html5/microdata.html
+// By Addy Osmani
+Modernizr.addTest('microdata', !!(document['getItems']));
View
3  feature-detects/progress.js
@@ -0,0 +1,3 @@
+// HTML5 <progress> tag
+// By Addy Osmani
+Modernizr.addTest('progress', !!('position' in document.createElement('progress')));
View
4 feature-detects/trackApi.js
@@ -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'));
View
4 feature-detects/webaudioApi.js
@@ -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));
Please sign in to comment.
Something went wrong with that request. Please try again.