-
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.
Merge pull request #419 from addyosmani/master
Pulling in feature-detection tests from modernizr-plugins
- Loading branch information
Showing
15 changed files
with
80 additions
and
1 deletion.
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,24 @@ | ||
// Animated PNG | ||
// http://en.wikipedia.org/wiki/APNG | ||
// By Addy Osmani | ||
(function () { | ||
|
||
var image = new Image(), | ||
canvas = document.createElement('canvas'), | ||
ctx = canvas.getContext('2d'); | ||
|
||
|
||
image.onload = function () { | ||
Modernizr.addTest('apng', function () { | ||
if (typeof canvas.getContext == 'undefined') { | ||
return false; | ||
} else { | ||
ctx.drawImage(image, 0, 0); | ||
return ctx.getImageData(0, 0, 1, 1).data[3] === 0; | ||
} | ||
}); | ||
}; | ||
|
||
image.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACGFjVEwAAAABAAAAAcMq2TYAAAANSURBVAiZY2BgYPgPAAEEAQB9ssjfAAAAGmZjVEwAAAAAAAAAAQAAAAEAAAAAAAAAAAD6A+gBAbNU+2sAAAARZmRBVAAAAAEImWNgYGBgAAAABQAB6MzFdgAAAABJRU5ErkJggg=="; | ||
|
||
}()); |
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,4 @@ | ||
// Mozilla Audio Data API | ||
// https://wiki.mozilla.org/Audio_Data_API | ||
// by Addy Osmani | ||
Modernizr.addTest('audiodata', !!(window.Audio)); |
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,4 @@ | ||
// classList | ||
// https://developer.mozilla.org/en/DOM/element.classList | ||
// By Addy Osmani | ||
Modernizr.addTest('classlist', !!('classList' in document.createElement('a'))); |
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,4 @@ | ||
// contentEditable | ||
// http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#contenteditable | ||
// by Addy Osmani | ||
Modernizr.addTest('contenteditable', !!('isContentEditable' in document.createElement('span'))); |
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 |
---|---|---|
@@ -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/ | ||
|
||
|
||
|
||
|
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,4 @@ | ||
// DataView | ||
// https://developer.mozilla.org/en/JavaScript_typed_arrays/DataView | ||
// By Addy Osmani | ||
Modernizr.addTest('dataview', (typeof DataView !== 'undefined' && 'getFloat64' in DataView.prototype)); |
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,4 @@ | ||
// EventSource | ||
// http://dev.w3.org/html5/eventsource/ | ||
// By Addy Osmani | ||
Modernizr.addTest('eventsource', !!('EventSource' in window)); |
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,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('gamepad', !!('gamepads' in navigator)); |
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,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)); |
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,4 @@ | ||
// Microdata support | ||
// http://www.w3.org/TR/html5/microdata.html | ||
// By Addy Osmani | ||
Modernizr.addTest('microdata', !!(document['getItems'])); |
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,4 @@ | ||
// <output> | ||
// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#the-output-element | ||
// by Addy Osmani | ||
Modernizr.addTest('output', !!('value' in document.createElement('output'))); |
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,3 @@ | ||
// HTML5 <progress> tag | ||
// By Addy Osmani | ||
Modernizr.addTest('progress', !!('position' in document.createElement('progress'))); |
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,4 @@ | ||
// <time> element | ||
// http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html#the-time-element-0 | ||
// by Addy Osmani | ||
Modernizr.addTest('time', !!('valueAsDate' in document.createElement('time'))); |
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,4 @@ | ||
// Track element | ||
// http://www.w3.org/TR/html5/video.html#the-track-element | ||
// By Addy Osmani | ||
Modernizr.addTest('track', (typeof (document.createElement('video').addTextTrack) === 'function')); |
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,4 @@ | ||
// Web Audio API | ||
// https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html | ||
// By Addy Osmani | ||
Modernizr.addTest('webaudio', !!(window.webkitAudioContext || window.AudioContext)); |