Files
DefinitelyTyped/modernizr/modernizr-tests.ts
2013-11-01 15:37:25 +00:00

55 lines
1.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/// <reference path="modernizr.d.ts" />
declare var $: any;
window.alert = function(thing?: string) {
$('#content').append('<div>' + thing + '</div>');
}
$(function () {
var audio = new Audio();
audio.src = Modernizr.audio.ogg ? 'background.ogg' :
Modernizr.audio.mp3 ? 'background.mp3' :
'background.m4a';
if (Modernizr.webgl) {
// loadAllWebGLScripts();
} else {
var msg = 'With a different browser youll get to see the WebGL experience here: get.webgl.org.';
document.getElementById('#notice').innerHTML = msg;
}
Modernizr.prefixed('boxSizing');
Modernizr.prefixed('requestAnimationFrame', window);
var ms = Modernizr.prefixed("matchesSelector", HTMLElement.prototype, document.body);
Modernizr.prefixed('requestAnimationFrame', window, false);
Modernizr.mq('only all and (max-width: 400px)');
Modernizr.mq('(min-width: 0px)');
Modernizr.mq('only screen and (max-width: 768px)');
Modernizr.addTest('track', () => {
var video = document.createElement('video');
// return typeof video.addTextTrack === 'function'
});
Modernizr.testStyles('#modernizr { width: 9px; color: papayawhip; }', (elem, rule) => {
Modernizr.addTest('width', elem.offsetWidth == 9);
});
Modernizr.testStyles('#modernizr { width: 9px; color: papayawhip; }', (elem, rule) => {
Modernizr.addTest('width', elem.offsetWidth == 9);
}, 2, ["video", "image"]);
Modernizr.testProp('pointerEvents');
Modernizr.testAllProps('boxSizing');
var elem;
Modernizr.hasEvent('gesturestart', elem);
if (!Modernizr.autofocus) {
$("[autofocus]").focus();
}
});