first commit

This commit is contained in:
armansansd
2023-07-12 16:31:19 +01:00
commit 3424b1927b
23306 changed files with 2217776 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
/*!
{
"name": "a[download] Attribute",
"property": "adownload",
"caniuse": "download",
"tags": ["media", "attribute"],
"builderAliases": ["a_download"],
"notes": [{
"name": "WHATWG Spec",
"href": "https://developers.whatwg.org/links.html#downloading-resources"
}]
}
!*/
/* DOC
When used on an `<a>`, this attribute signifies that the resource it points to should be downloaded by the browser rather than navigating to it.
*/
define(['Modernizr', 'createElement'], function(Modernizr, createElement) {
Modernizr.addTest('adownload', !window.externalHost && 'download' in createElement('a'));
});
+16
View File
@@ -0,0 +1,16 @@
/*!
{
"name": "Ambient Light Events",
"property": "ambientlight",
"notes": [{
"name": "W3C Spec",
"href": "https://www.w3.org/TR/ambient-light/"
}]
}
!*/
/* DOC
Detects support for the API that provides information about the ambient light levels, as detected by the device's light detector, in terms of lux units.
*/
define(['Modernizr', 'hasEvent'], function(Modernizr, hasEvent) {
Modernizr.addTest('ambientlight', hasEvent('devicelight', window));
});
+21
View File
@@ -0,0 +1,21 @@
/*!
{
"name": "Application Cache",
"property": "applicationcache",
"caniuse": "offline-apps",
"tags": ["storage", "offline"],
"notes": [{
"name": "MDN Docs",
"href": "https://developer.mozilla.org/en/docs/HTML/Using_the_application_cache"
}],
"polyfills": ["html5gears"]
}
!*/
/* DOC
Detects support for the Application Cache, for storing data to enable web-based applications run offline.
The API has been [heavily criticized](https://alistapart.com/article/application-cache-is-a-douchebag) and discussions are underway to address this.
*/
define(['Modernizr'], function(Modernizr) {
Modernizr.addTest('applicationcache', 'applicationCache' in window);
});
+49
View File
@@ -0,0 +1,49 @@
/*!
{
"name": "HTML5 Audio Element",
"property": "audio",
"tags": ["html5", "audio", "media"]
}
!*/
/* DOC
Detects the audio element
*/
define(['Modernizr', 'createElement'], function(Modernizr, createElement) {
// This tests evaluates support of the audio element, as well as
// testing what types of content it supports.
//
// We're using the Boolean constructor here, so that we can extend the value
// e.g. Modernizr.audio // true
// Modernizr.audio.ogg // 'probably'
//
// Codec values from : github.com/NielsLeenheer/html5test/blob/9106a8/index.html#L845
// thx to NielsLeenheer and zcorpan
// Note: in some older browsers, "no" was a return value instead of empty string.
// It was live in FF3.5.0 and 3.5.1, but fixed in 3.5.2
// It was also live in Safari 4.0.0 - 4.0.4, but fixed in 4.0.5
Modernizr.addTest('audio', function() {
var elem = createElement('audio');
var bool = false;
try {
bool = !!elem.canPlayType;
if (bool) {
bool = new Boolean(bool);
bool.ogg = elem.canPlayType('audio/ogg; codecs="vorbis"') .replace(/^no$/, '');
bool.mp3 = elem.canPlayType('audio/mpeg; codecs="mp3"') .replace(/^no$/, '');
bool.opus = elem.canPlayType('audio/ogg; codecs="opus"') ||
elem.canPlayType('audio/webm; codecs="opus"') .replace(/^no$/, '');
// Mimetypes accepted:
// developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements
// bit.ly/iphoneoscodecs
bool.wav = elem.canPlayType('audio/wav; codecs="1"') .replace(/^no$/, '');
bool.m4a = (elem.canPlayType('audio/x-m4a;') ||
elem.canPlayType('audio/aac;')) .replace(/^no$/, '');
}
} catch (e) {}
return bool;
});
});
+83
View File
@@ -0,0 +1,83 @@
/*!
{
"name": "Audio Autoplay",
"property": "audioautoplay",
"authors": ["Jordy van Dortmont"],
"tags": ["audio"],
"async": true
}
!*/
/* DOC
Checks for support of the autoplay attribute of the audio element.
*/
define(['Modernizr', 'addTest', 'docElement', 'createElement', 'test/audio'], function(Modernizr, addTest, docElement, createElement) {
Modernizr.addAsyncTest(function() {
var timeout;
var waitTime = 200;
var retries = 5;
var currentTry = 0;
var elem = createElement('audio');
var elemStyle = elem.style;
function testAutoplay(arg) {
currentTry++;
clearTimeout(timeout);
var result = arg && arg.type === 'playing' || elem.currentTime !== 0;
if (!result && currentTry < retries) {
// Detection can be flaky if the browser is slow, so lets retry in a little bit
timeout = setTimeout(testAutoplay, waitTime);
return;
}
elem.removeEventListener('playing', testAutoplay, false);
addTest('audioautoplay', result);
// Cleanup, but don't assume elem is still in the page -
// an extension may already have removed it.
if (elem.parentNode) {
elem.parentNode.removeChild(elem);
}
}
// Skip the test if audio itself, or the autoplay element on it isn't supported
if (!Modernizr.audio || !('autoplay' in elem)) {
addTest('audioautoplay', false);
return;
}
elemStyle.position = 'absolute';
elemStyle.height = 0;
elemStyle.width = 0;
try {
if (Modernizr.audio.mp3) {
elem.src = 'data:audio/mpeg;base64,/+MYxAAAAANIAUAAAASEEB/jwOFM/0MM/90b/+RhST//w4NFwOjf///PZu////9lns5GFDv//l9GlUIEEIAAAgIg8Ir/JGq3/+MYxDsLIj5QMYcoAP0dv9HIjUcH//yYSg+CIbkGP//8w0bLVjUP///3Z0x5QCAv/yLjwtGKTEFNRTMuOTeqqqqqqqqqqqqq/+MYxEkNmdJkUYc4AKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq';
}
else if (Modernizr.audio.wav) {
elem.src = 'data:audio/wav;base64,UklGRjQAAABXQVZFZm10IBAAAAABAAEAEAAAABAAAAABAAgAZGF0YRAAAAB/f39/f39/f39/f39/f39/';
}
else {
addTest('audioautoplay', false);
return;
}
}
catch (e) {
addTest('audioautoplay', false);
return;
}
elem.setAttribute('autoplay', '');
elemStyle.cssText = 'display:none';
docElement.appendChild(elem);
// Wait for the next tick to add the listener, otherwise the element may
// not have time to play in high load situations (e.g. the test suite)
setTimeout(function() {
elem.addEventListener('playing', testAutoplay, false);
timeout = setTimeout(testAutoplay, waitTime);
}, 0);
});
});
+13
View File
@@ -0,0 +1,13 @@
/*!
{
"name": "Audio Loop Attribute",
"property": "audioloop",
"tags": ["audio", "media"]
}
!*/
/* DOC
Detects if an audio element can automatically restart, once it has finished
*/
define(['Modernizr', 'createElement'], function(Modernizr, createElement) {
Modernizr.addTest('audioloop', 'loop' in createElement('audio'));
});
File diff suppressed because one or more lines are too long
+29
View File
@@ -0,0 +1,29 @@
/*!
{
"name": "Web Audio API",
"property": "webaudio",
"caniuse": "audio-api",
"polyfills": ["xaudiojs", "dynamicaudiojs", "audiolibjs"],
"tags": ["audio", "media"],
"builderAliases": ["audio_webaudio_api"],
"authors": ["Addy Osmani"],
"notes": [{
"name": "W3C Spec",
"href": "https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html"
}]
}
!*/
/* DOC
Detects the older non standard webaudio API, (as opposed to the standards based AudioContext API)
*/
define(['Modernizr'], function(Modernizr) {
Modernizr.addTest('webaudio', function() {
var prefixed = 'webkitAudioContext' in window;
var unprefixed = 'AudioContext' in window;
if (Modernizr._config.usePrefixes) {
return prefixed || unprefixed;
}
return unprefixed;
});
});
+20
View File
@@ -0,0 +1,20 @@
/*!
{
"name": "Battery API",
"property": "batteryapi",
"aliases": ["battery-api"],
"builderAliases": ["battery_api"],
"tags": ["device", "media"],
"authors": ["Paul Sayre", "Alex Bradley (@abrad1212)"],
"notes": [{
"name": "MDN Docs",
"href": "https://developer.mozilla.org/en/DOM/window.navigator.mozBattery"
}]
}
!*/
/* DOC
Detect support for the Battery API, for accessing information about the system's battery charge level.
*/
define(['Modernizr', 'prefixed'], function(Modernizr, prefixed) {
Modernizr.addTest('batteryapi', !!prefixed('battery', navigator) || !!prefixed('getBattery', navigator), {aliases: ['battery-api']});
});
+23
View File
@@ -0,0 +1,23 @@
/*!
{
"name": "Low Battery Level",
"property": "lowbattery",
"tags": ["hardware", "mobile"],
"builderAliases": ["battery_level"],
"authors": ["Paul Sayre"],
"notes": [{
"name": "MDN Docs",
"href": "https://developer.mozilla.org/en-US/docs/Web/API/Navigator/battery"
}]
}
!*/
/* DOC
Enable a developer to remove CPU intensive CSS/JS when battery is low
*/
define(['Modernizr', 'prefixed'], function(Modernizr, prefixed) {
Modernizr.addTest('lowbattery', function() {
var minLevel = 0.20;
var battery = prefixed('battery', navigator);
return !!(battery && !battery.charging && battery.level <= minLevel);
});
});
+28
View File
@@ -0,0 +1,28 @@
/*!
{
"name": "Blob constructor",
"property": "blobconstructor",
"aliases": ["blob-constructor"],
"builderAliases": ["blob_constructor"],
"caniuse": "blobbuilder",
"notes": [{
"name": "W3C Spec",
"href": "https://w3c.github.io/FileAPI/#constructorBlob"
}],
"polyfills": ["blobjs"]
}
!*/
/* DOC
Detects support for the Blob constructor, for creating file-like objects of immutable, raw data.
*/
define(['Modernizr'], function(Modernizr) {
Modernizr.addTest('blobconstructor', function() {
try {
return !!new Blob();
} catch (e) {
return false;
}
}, {
aliases: ['blob-constructor']
});
});
+21
View File
@@ -0,0 +1,21 @@
/*!
{
"name": "Canvas",
"property": "canvas",
"caniuse": "canvas",
"tags": ["canvas", "graphics"],
"polyfills": ["flashcanvas", "excanvas", "slcanvas", "fxcanvas"]
}
!*/
/* DOC
Detects support for the `<canvas>` element for 2D drawing.
*/
define(['Modernizr', 'createElement'], function(Modernizr, createElement) {
// On the S60 and BB Storm, getContext exists, but always returns undefined
// so we actually have to call getContext() to verify
// github.com/Modernizr/Modernizr/issues/issue/97/
Modernizr.addTest('canvas', function() {
var elem = createElement('canvas');
return !!(elem.getContext && elem.getContext('2d'));
});
});
+32
View File
@@ -0,0 +1,32 @@
/*!
{
"name": "canvas blending support",
"property": "canvasblending",
"caniuse": "canvas-blending",
"tags": ["canvas"],
"notes": [{
"name": "W3C Spec",
"href": "https://drafts.fxtf.org/compositing-1/"
},{
"name": "Article",
"href": "https://web.archive.org/web/20171003232921/http://blogs.adobe.com/webplatform/2013/01/28/blending-features-in-canvas/"
}]
}
!*/
/* DOC
Detects if Photoshop style blending modes are available in canvas.
*/
define(['Modernizr', 'createElement', 'test/canvas'], function(Modernizr, createElement) {
Modernizr.addTest('canvasblending', function() {
if (Modernizr.canvas === false) {
return false;
}
var ctx = createElement('canvas').getContext('2d');
// firefox 3 throws an error when setting an invalid `globalCompositeOperation`
try {
ctx.globalCompositeOperation = 'screen';
} catch (e) {}
return ctx.globalCompositeOperation === 'screen';
});
});
+34
View File
@@ -0,0 +1,34 @@
/*!
{
"name": "canvas.toDataURL type support",
"property": ["todataurljpeg", "todataurlpng", "todataurlwebp"],
"tags": ["canvas"],
"builderAliases": ["canvas_todataurl_type"],
"notes": [{
"name": "MDN Docs",
"href": "https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement.toDataURL"
}]
}
!*/
define(['Modernizr', 'createElement', 'test/canvas'], function(Modernizr, createElement) {
var canvas = createElement('canvas');
Modernizr.addTest('todataurljpeg', function() {
return !!Modernizr.canvas && canvas.toDataURL('image/jpeg').indexOf('data:image/jpeg') === 0;
});
Modernizr.addTest('todataurlpng', function() {
return !!Modernizr.canvas && canvas.toDataURL('image/png').indexOf('data:image/png') === 0;
});
Modernizr.addTest('todataurlwebp', function() {
var supports = false;
// firefox 3 throws an error when you use an "invalid" toDataUrl
try {
supports = !!Modernizr.canvas && canvas.toDataURL('image/webp').indexOf('data:image/webp') === 0;
} catch (e) {}
return supports;
});
});
+28
View File
@@ -0,0 +1,28 @@
/*!
{
"name": "canvas winding support",
"property": "canvaswinding",
"tags": ["canvas"],
"notes": [{
"name": "Article",
"href": "https://web.archive.org/web/20170825024655/http://blogs.adobe.com/webplatform/2013/01/30/winding-rules-in-canvas/"
}]
}
!*/
/* DOC
Determines if winding rules, which controls if a path can go clockwise or counterclockwise
*/
define(['Modernizr', 'createElement', 'test/canvas'], function(Modernizr, createElement) {
Modernizr.addTest('canvaswinding', function() {
if (Modernizr.canvas === false) {
return false;
}
var ctx = createElement('canvas').getContext('2d');
ctx.rect(0, 0, 10, 10);
ctx.rect(2, 2, 6, 6);
return ctx.isPointInPath(5, 5, 'evenodd') === false;
});
});
+20
View File
@@ -0,0 +1,20 @@
/*!
{
"name": "Canvas text",
"property": "canvastext",
"caniuse": "canvas-text",
"tags": ["canvas", "graphics"],
"polyfills": ["canvastext"]
}
!*/
/* DOC
Detects support for the text APIs for `<canvas>` elements.
*/
define(['Modernizr', 'createElement', 'test/canvas'], function(Modernizr, createElement) {
Modernizr.addTest('canvastext', function() {
if (Modernizr.canvas === false) {
return false;
}
return typeof createElement('canvas').getContext('2d').fillText === 'function';
});
});
+30
View File
@@ -0,0 +1,30 @@
/*!
{
"name": "Content Editable",
"property": "contenteditable",
"caniuse": "contenteditable",
"notes": [{
"name": "WHATWG Spec",
"href": "https://html.spec.whatwg.org/multipage/interaction.html#contenteditable"
}]
}
!*/
/* DOC
Detects support for the `contenteditable` attribute of elements, allowing their DOM text contents to be edited directly by the user.
*/
define(['Modernizr', 'createElement', 'docElement'], function(Modernizr, createElement, docElement) {
Modernizr.addTest('contenteditable', function() {
// early bail out
if (!('contentEditable' in docElement)) {
return;
}
// some mobile browsers (android < 3.0, iOS < 5) claim to support
// contentEditable, but but don't really. This test checks to see
// confirms whether or not it actually supports it.
var div = createElement('div');
div.contentEditable = true;
return div.contentEditable === 'true';
});
});
+24
View File
@@ -0,0 +1,24 @@
/*!
{
"name": "Context menus",
"property": "contextmenu",
"caniuse": "menu",
"notes": [{
"name": "W3C Spec",
"href": "https://www.w3.org/TR/html5/interactive-elements.html#context-menus"
},{
"name": "thewebrocks.com Demo",
"href": "http://thewebrocks.com/demos/context-menu/"
}],
"polyfills": ["jquery-contextmenu"]
}
!*/
/* DOC
Detects support for custom context menus.
*/
define(['Modernizr', 'docElement'], function(Modernizr, docElement) {
Modernizr.addTest(
'contextmenu',
('contextMenu' in docElement && 'HTMLMenuItemElement' in window)
);
});
+37
View File
@@ -0,0 +1,37 @@
/*!
{
"name": "Cookies",
"property": "cookies",
"tags": ["storage"],
"authors": ["tauren"]
}
!*/
/* DOC
Detects whether cookie support is enabled.
*/
define(['Modernizr'], function(Modernizr) {
// https://github.com/Modernizr/Modernizr/issues/191
Modernizr.addTest('cookies', function() {
// navigator.cookieEnabled cannot detect custom or nuanced cookie blocking
// configurations. For example, when blocking cookies via the Advanced
// Privacy Settings in IE9, it always returns true. And there have been
// issues in the past with site-specific exceptions.
// Don't rely on it.
// try..catch because some in situations `document.cookie` is exposed but throws a
// SecurityError if you try to access it; e.g. documents created from data URIs
// or in sandboxed iframes (depending on flags/context)
try {
// Create cookie
document.cookie = 'cookietest=1';
var ret = document.cookie.indexOf('cookietest=') !== -1;
// Delete cookie
document.cookie = 'cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT';
return ret;
}
catch (e) {
return false;
}
});
});
+19
View File
@@ -0,0 +1,19 @@
/*!
{
"name": "Cross-Origin Resource Sharing",
"property": "cors",
"caniuse": "cors",
"authors": ["Theodoor van Donge"],
"notes": [{
"name": "MDN Docs",
"href": "https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS"
}],
"polyfills": ["pmxdr", "ppx", "flxhr"]
}
!*/
/* DOC
Detects support for Cross-Origin Resource Sharing: method of performing XMLHttpRequests across domains.
*/
define(['Modernizr'], function(Modernizr) {
Modernizr.addTest('cors', 'XMLHttpRequest' in window && 'withCredentials' in new XMLHttpRequest());
});
+21
View File
@@ -0,0 +1,21 @@
/*!
{
"name": "Web Cryptography",
"property": "cryptography",
"caniuse": "cryptography",
"tags": ["crypto"],
"authors": ["roblarsen"],
"notes": [{
"name": "W3C Editor's Draft Spec",
"href": "https://www.w3.org/TR/WebCryptoAPI/"
}],
"polyfills": ["polycrypt"]
}
!*/
/* DOC
Detects support for the cryptographic functionality available under window.crypto.subtle
*/
define(['Modernizr', 'prefixed'], function(Modernizr, prefixed) {
var crypto = prefixed('crypto', window);
Modernizr.addTest('crypto', !!prefixed('subtle', crypto));
});
+33
View File
@@ -0,0 +1,33 @@
/*!
{
"name": "getRandomValues",
"property": "getrandomvalues",
"caniuse": "getrandomvalues",
"tags": ["crypto"],
"authors": ["komachi"],
"notes": [{
"name": "W3C Editor’s Draft Spec",
"href": "https://w3c.github.io/webcrypto/#Crypto-interface-methods"
}],
"polyfills": ["polycrypt"]
}
!*/
/* DOC
Detects support for the window.crypto.getRandomValues method for generating cryptographically secure random numbers
*/
define(['Modernizr', 'prefixed', 'is'], function(Modernizr, prefixed, is) {
// In Safari <=5.0 `window.crypto` exists (for some reason) but is `undefined`, so we have to check
// it’s truthy before checking for existence of `getRandomValues`
var crypto = prefixed('crypto', window);
var supportsGetRandomValues;
// Safari 6.0 supports crypto.getRandomValues, but does not return the array,
// which is required by the spec, so we need to actually check.
if (crypto && 'getRandomValues' in crypto && 'Uint32Array' in window) {
var array = new Uint32Array(10);
var values = crypto.getRandomValues(array);
supportsGetRandomValues = values && is(values[0], 'number');
}
Modernizr.addTest('getrandomvalues', !!supportsGetRandomValues);
});
+17
View File
@@ -0,0 +1,17 @@
/*!
{
"name": "cssall",
"property": "cssall",
"notes": [{
"name": "Spec",
"href": "https://drafts.csswg.org/css-cascade/#all-shorthand"
}]
}
!*/
/* DOC
Detects support for the `all` css property, which is a shorthand to reset all css properties (except direction and unicode-bidi) to their original value
*/
define(['Modernizr', 'docElement'], function(Modernizr, docElement) {
Modernizr.addTest('cssall', 'all' in docElement.style);
});
+20
View File
@@ -0,0 +1,20 @@
/*!
{
"name": "CSS Animations",
"property": "cssanimations",
"caniuse": "css-animation",
"polyfills": ["transformie", "csssandpaper"],
"tags": ["css"],
"warnings": ["Android < 4 will pass this test, but can only animate a single property at a time"],
"notes": [{
"name": "Article: 'Dispelling the Android CSS animation myths'",
"href": "https://web.archive.org/web/20180602074607/https://daneden.me/2011/12/14/putting-up-with-androids-bullshit/"
}]
}
!*/
/* DOC
Detects whether or not elements can be animated using CSS
*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('cssanimations', testAllProps('animationName', 'a', true));
});
+23
View File
@@ -0,0 +1,23 @@
/*!
{
"name": "Appearance",
"property": "appearance",
"caniuse": "css-appearance",
"tags": ["css"],
"notes": [{
"name": "MDN Docs",
"href": "https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-appearance"
},{
"name": "CSS-Tricks CSS Almanac: appearance",
"href": "https://css-tricks.com/almanac/properties/a/appearance/"
}]
}
!*/
/* DOC
Detects support for the `appearance` css property, which is used to make an
element inherit the style of a standard user interface element. It can also be
used to remove the default styles of an element, such as input and buttons.
*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('appearance', testAllProps('appearance'));
});
+22
View File
@@ -0,0 +1,22 @@
/*!
{
"name": "Backdrop Filter",
"property": "backdropfilter",
"authors": ["Brian Seward"],
"tags": ["css"],
"caniuse": "css-backdrop-filter",
"notes": [{
"name": "W3C Editor’s Draft Spec",
"href": "https://drafts.fxtf.org/filters-2/#BackdropFilterProperty"
},{
"name": "WebKit Blog introduction + Demo",
"href": "https://www.webkit.org/blog/3632/introducing-backdrop-filters/"
}]
}
!*/
/* DOC
Detects support for CSS Backdrop Filters, allowing for background blur effects like those introduced in iOS 7. Support for this was added to iOS Safari/WebKit in iOS 9.
*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('backdropfilter', testAllProps('backdropFilter'));
});
+21
View File
@@ -0,0 +1,21 @@
/*!
{
"name": "CSS Background Blend Mode",
"property": "backgroundblendmode",
"caniuse": "css-backgroundblendmode",
"tags": ["css"],
"notes": [{
"name": "CSS Blend Modes could be the next big thing in Web Design",
"href": "https://medium.com/@bennettfeely/css-blend-modes-could-be-the-next-big-thing-in-web-design-6b51bf53743a"
},{
"name": "Demo",
"href": "https://bennettfeely.com/gradients/"
}]
}
!*/
/* DOC
Detects the ability for the browser to composite backgrounds using blending modes similar to ones found in Photoshop or Illustrator.
*/
define(['Modernizr', 'prefixed'], function(Modernizr, prefixed) {
Modernizr.addTest('backgroundblendmode', prefixed('backgroundBlendMode', 'text'));
});
+27
View File
@@ -0,0 +1,27 @@
/*!
{
"name": "CSS Background Clip Text",
"property": "backgroundcliptext",
"authors": ["ausi"],
"tags": ["css"],
"notes": [{
"name": "CSS Tricks Article",
"href": "https://css-tricks.com/image-under-text/"
},{
"name": "MDN Docs",
"href": "https://developer.mozilla.org/en-US/docs/Web/CSS/background-clip"
},{
"name": "Related Github Issue",
"href": "https://github.com/Modernizr/Modernizr/issues/199"
}]
}
!*/
/* DOC
Detects the ability to control specifies whether or not an element's background
extends beyond its border in CSS
*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('backgroundcliptext', function() {
return testAllProps('backgroundClip', 'text');
});
});
@@ -0,0 +1,33 @@
/*!
{
"name": "Background Position Shorthand",
"property": "bgpositionshorthand",
"tags": ["css"],
"builderAliases": ["css_backgroundposition_shorthand"],
"notes": [{
"name": "MDN Docs",
"href": "https://developer.mozilla.org/en/CSS/background-position"
}, {
"name": "W3C Spec",
"href": "https://www.w3.org/TR/css3-background/#background-position"
}, {
"name": "Demo",
"href": "https://jsfiddle.net/Blink/bBXvt/"
}]
}
!*/
/* DOC
Detects if you can use the shorthand method to define multiple parts of an
element's background-position simultaneously.
eg `background-position: right 10px bottom 10px`
*/
define(['Modernizr', 'createElement'], function(Modernizr, createElement) {
Modernizr.addTest('bgpositionshorthand', function() {
var elem = createElement('a');
var eStyle = elem.style;
var val = 'right 10px bottom 10px';
eStyle.cssText = 'background-position: ' + val + ';';
return (eStyle.backgroundPosition === val);
});
});
+24
View File
@@ -0,0 +1,24 @@
/*!
{
"name": "Background Position XY",
"property": "bgpositionxy",
"tags": ["css"],
"builderAliases": ["css_backgroundposition_xy"],
"authors": ["Allan Lei", "Brandom Aaron"],
"notes": [{
"name": "Demo",
"href": "https://jsfiddle.net/allanlei/R8AYS/"
}, {
"name": "Adapted From",
"href": "https://github.com/brandonaaron/jquery-cssHooks/blob/master/bgpos.js"
}]
}
!*/
/* DOC
Detects the ability to control an element's background position using css
*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('bgpositionxy', function() {
return testAllProps('backgroundPositionX', '3px', true) && testAllProps('backgroundPositionY', '5px', true);
});
});
+27
View File
@@ -0,0 +1,27 @@
/*!
{
"name": "Background Repeat",
"property": ["bgrepeatspace", "bgrepeatround"],
"tags": ["css"],
"builderAliases": ["css_backgroundrepeat"],
"authors": ["Ryan Seddon"],
"notes": [{
"name": "MDN Docs",
"href": "https://developer.mozilla.org/en-US/docs/Web/CSS/background-repeat"
}, {
"name": "Test Page",
"href": "https://jsbin.com/uzesun/"
}, {
"name": "Demo",
"href": "https://jsfiddle.net/ryanseddon/yMLTQ/6/"
}]
}
!*/
/* DOC
Detects the ability to use round and space as properties for background-repeat
*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
// Must value-test these
Modernizr.addTest('bgrepeatround', testAllProps('backgroundRepeat', 'round'));
Modernizr.addTest('bgrepeatspace', testAllProps('backgroundRepeat', 'space'));
});
+15
View File
@@ -0,0 +1,15 @@
/*!
{
"name": "Background Size",
"property": "backgroundsize",
"tags": ["css"],
"knownBugs": ["This will false positive in Opera Mini - https://github.com/Modernizr/Modernizr/issues/396"],
"notes": [{
"name": "Related Issue",
"href": "https://github.com/Modernizr/Modernizr/issues/396"
}]
}
!*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('backgroundsize', testAllProps('backgroundSize', '100%', true));
});
+16
View File
@@ -0,0 +1,16 @@
/*!
{
"name": "Background Size Cover",
"property": "bgsizecover",
"tags": ["css"],
"builderAliases": ["css_backgroundsizecover"],
"notes": [{
"name": "MDN Docs",
"href": "https://developer.mozilla.org/en/CSS/background-size"
}]
}
!*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
// Must test value, as this specifically tests the `cover` value
Modernizr.addTest('bgsizecover', testAllProps('backgroundSize', 'cover'));
});
+13
View File
@@ -0,0 +1,13 @@
/*!
{
"name": "Border Image",
"property": "borderimage",
"caniuse": "border-image",
"polyfills": ["css3pie"],
"knownBugs": ["Android < 2.0 is true, but has a broken implementation"],
"tags": ["css"]
}
!*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('borderimage', testAllProps('borderImage', 'url() 1', true));
});
+16
View File
@@ -0,0 +1,16 @@
/*!
{
"name": "Border Radius",
"property": "borderradius",
"caniuse": "border-radius",
"polyfills": ["css3pie"],
"tags": ["css"],
"notes": [{
"name": "Comprehensive Compat Chart",
"href": "https://muddledramblings.com/table-of-css3-border-radius-compliance"
}]
}
!*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('borderradius', testAllProps('borderRadius', '0px', true));
});
+21
View File
@@ -0,0 +1,21 @@
/*!
{
"name": "Box Decoration Break",
"property": "boxdecorationbreak",
"caniuse": "css-boxdecorationbreak",
"tags": ["css"],
"notes": [{
"name": "MDN Docs",
"href": "https://developer.mozilla.org/en-US/docs/Web/CSS/box-decoration-break"
}, {
"name": "Demo",
"href": "https://jsbin.com/xojoro/edit?css,output"
}]
}
!*/
/* DOC
Specifies how an element's fragments should be rendered when broken across multiple lines, columns, or pages.
*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('boxdecorationbreak', testAllProps('boxDecorationBreak', 'slice'));
});
+15
View File
@@ -0,0 +1,15 @@
/*!
{
"name": "Box Shadow",
"property": "boxshadow",
"caniuse": "css-boxshadow",
"tags": ["css"],
"knownBugs": [
"WebOS false positives on this test.",
"The Kindle Silk browser false positives"
]
}
!*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('boxshadow', testAllProps('boxShadow', '1px 1px', true));
});
+20
View File
@@ -0,0 +1,20 @@
/*!
{
"name": "Box Sizing",
"property": "boxsizing",
"caniuse": "css3-boxsizing",
"polyfills": ["borderboxmodel", "boxsizingpolyfill", "borderbox"],
"tags": ["css"],
"builderAliases": ["css_boxsizing"],
"notes": [{
"name": "MDN Docs",
"href": "https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing"
},{
"name": "Related Github Issue",
"href": "https://github.com/Modernizr/Modernizr/issues/248"
}]
}
!*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('boxsizing', testAllProps('boxSizing', 'border-box', true) && (document.documentMode === undefined || document.documentMode > 7));
});
+30
View File
@@ -0,0 +1,30 @@
/*!
{
"name": "CSS Calc",
"property": "csscalc",
"caniuse": "calc",
"tags": ["css"],
"builderAliases": ["css_calc"],
"authors": ["@calvein"]
}
!*/
/* DOC
Method of allowing calculated values for length units. For example:
```css
//lem {
width: calc(100% - 3em);
}
```
*/
define(['Modernizr', 'createElement', 'prefixes'], function(Modernizr, createElement, prefixes) {
Modernizr.addTest('csscalc', function() {
var prop = 'width:';
var value = 'calc(10px);';
var el = createElement('a');
el.style.cssText = prop + prefixes.join(value + prop);
return !!el.style.length;
});
});
+23
View File
@@ -0,0 +1,23 @@
/*!
{
"name": "CSS :checked pseudo-selector",
"caniuse": "css-sel3",
"property": "checked",
"tags": ["css"],
"notes": [{
"name": "Related Github Issue",
"href": "https://github.com/Modernizr/Modernizr/pull/879"
}]
}
!*/
define(['Modernizr', 'createElement', 'testStyles'], function(Modernizr, createElement, testStyles) {
Modernizr.addTest('checked', function() {
return testStyles('#modernizr {position:absolute} #modernizr input {margin-left:10px} #modernizr :checked {margin-left:20px;display:block}', function(elem) {
var cb = createElement('input');
cb.setAttribute('type', 'checkbox');
cb.setAttribute('checked', 'checked');
elem.appendChild(cb);
return cb.offsetLeft === 20;
});
});
});
+25
View File
@@ -0,0 +1,25 @@
/*!
{
"name": "CSS Font ch Units",
"authors": ["Ron Waldon (@jokeyrhyme)"],
"property": "csschunit",
"tags": ["css"],
"notes": [{
"name": "W3C Spec",
"href": "https://www.w3.org/TR/css3-values/#font-relative-lengths"
}]
}
!*/
define(['Modernizr', 'modElem'], function(Modernizr, modElem) {
Modernizr.addTest('csschunit', function() {
var elemStyle = modElem.elem.style;
var supports;
try {
elemStyle.fontSize = '3ch';
supports = elemStyle.fontSize.indexOf('ch') !== -1;
} catch (e) {
supports = false;
}
return supports;
});
});
+42
View File
@@ -0,0 +1,42 @@
/*!
{
"name": "CSS Columns",
"property": "csscolumns",
"caniuse": "multicolumn",
"polyfills": ["css3multicolumnjs"],
"tags": ["css"]
}
!*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
(function() {
Modernizr.addTest('csscolumns', function() {
var bool = false;
var test = testAllProps('columnCount');
try {
bool = !!test;
if (bool) {
bool = new Boolean(bool);
}
} catch (e) {}
return bool;
});
var props = ['Width', 'Span', 'Fill', 'Gap', 'Rule', 'RuleColor', 'RuleStyle', 'RuleWidth', 'BreakBefore', 'BreakAfter', 'BreakInside'];
var name, test;
for (var i = 0; i < props.length; i++) {
name = props[i].toLowerCase();
test = testAllProps('column' + props[i]);
// break-before, break-after & break-inside are not "column"-prefixed in spec
if (name === 'breakbefore' || name === 'breakafter' || name === 'breakinside') {
test = test || testAllProps(props[i]);
}
Modernizr.addTest('csscolumns.' + name, test);
}
})();
});
+20
View File
@@ -0,0 +1,20 @@
/*!
{
"name": "CSS Grid (old & new)",
"property": ["cssgrid", "cssgridlegacy"],
"authors": ["Faruk Ates"],
"tags": ["css"],
"notes": [{
"name": "The new, standardized CSS Grid",
"href": "https://www.w3.org/TR/css3-grid-layout/"
}, {
"name": "The _old_ CSS Grid (legacy)",
"href": "https://www.w3.org/TR/2011/WD-css3-grid-layout-20110407/"
}]
}
!*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
// `grid-columns` is only in the old syntax, `grid-column` exists in both and so `grid-template-rows` is used for the new syntax.
Modernizr.addTest('cssgridlegacy', testAllProps('grid-columns', '10px', true));
Modernizr.addTest('cssgrid', testAllProps('grid-template-rows', 'none', true));
});
+21
View File
@@ -0,0 +1,21 @@
/*!
{
"name": "CSS Cubic Bezier Range",
"property": "cubicbezierrange",
"tags": ["css"],
"builderAliases": ["css_cubicbezierrange"],
"authors": ["@calvein"],
"warnings": ["cubic-bezier values can't be > 1 for Webkit until [bug #45761](https://bugs.webkit.org/show_bug.cgi?id=45761) is fixed"],
"notes": [{
"name": "Comprehensive Compat Chart",
"href": "https://muddledramblings.com/table-of-css3-border-radius-compliance/"
}]
}
!*/
define(['Modernizr', 'createElement', 'prefixes'], function(Modernizr, createElement, prefixes) {
Modernizr.addTest('cubicbezierrange', function() {
var el = createElement('a');
el.style.cssText = prefixes.join('transition-timing-function:cubic-bezier(1,0,0,1.1); ');
return !!el.style.length;
});
});
+20
View File
@@ -0,0 +1,20 @@
/*!
{
"name": "CSS Custom Properties",
"property": "customproperties",
"caniuse": "css-variables",
"tags": ["css"],
"builderAliases": ["css_customproperties"],
"notes": [{
"name": "MDN Docs",
"href": "https://developer.mozilla.org/en-US/docs/Web/CSS/--*"
},{
"name": "W3C Spec",
"href": "https://drafts.csswg.org/css-variables/"
}]
}
!*/
define(['Modernizr'], function(Modernizr) {
var supportsFn = (window.CSS && window.CSS.supports.bind(window.CSS)) || (window.supportsCSS);
Modernizr.addTest('customproperties', !!supportsFn && (supportsFn('--f:0') || supportsFn('--f', 0)));
});
+20
View File
@@ -0,0 +1,20 @@
/*!
{
"name": "CSS Display run-in",
"property": "display-runin",
"authors": ["alanhogan"],
"tags": ["css"],
"builderAliases": ["css_displayrunin"],
"notes": [{
"name": "CSS Tricks Article",
"href": "https://web.archive.org/web/20111204150927/http://css-tricks.com:80/596-run-in/"
},{
"name": "Related Github Issue",
"href": "https://github.com/Modernizr/Modernizr/issues/198"
}]
}
!*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('displayrunin', testAllProps('display', 'run-in'),
{aliases: ['display-runin']});
});
+27
View File
@@ -0,0 +1,27 @@
/*!
{
"name": "CSS Display table",
"property": "displaytable",
"caniuse": "css-table",
"authors": ["scottjehl"],
"tags": ["css"],
"builderAliases": ["css_displaytable"],
"notes": [{
"name": "Detects for all additional table display values",
"href": "https://pastebin.com/Gk9PeVaQ"
}]
}
!*/
/* DOC
`display: table` and `table-cell` test. (both are tested under one name `table-cell` )
*/
define(['Modernizr', 'testStyles'], function(Modernizr, testStyles) {
// If a document is in rtl mode this test will fail so we force ltr mode on the injected
// element https://github.com/Modernizr/Modernizr/issues/716
testStyles('#modernizr{display: table; direction: ltr}#modernizr div{display: table-cell; padding: 10px}', function(elem) {
var ret;
var child = elem.childNodes;
ret = child[0].offsetLeft < child[1].offsetLeft;
Modernizr.addTest('displaytable', ret, {aliases: ['display-table']});
}, 2);
});
+12
View File
@@ -0,0 +1,12 @@
/*!
{
"name": "CSS text-overflow ellipsis",
"property": "ellipsis",
"caniuse": "text-overflow",
"polyfills": ["text-overflow"],
"tags": ["css"]
}
!*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('ellipsis', testAllProps('textOverflow', 'ellipsis'));
});
+15
View File
@@ -0,0 +1,15 @@
/*!
{
"name": "CSS.escape()",
"property": "cssescape",
"polyfills": ["css-escape"],
"tags": ["css", "cssom"]
}
!*/
/* DOC
Tests for `CSS.escape()` support.
*/
define(['Modernizr'], function(Modernizr) {
var CSS = window.CSS;
Modernizr.addTest('cssescape', CSS ? typeof CSS.escape === 'function' : false);
});
+25
View File
@@ -0,0 +1,25 @@
/*!
{
"name": "CSS Font ex Units",
"authors": ["Ron Waldon (@jokeyrhyme)"],
"property": "cssexunit",
"tags": ["css"],
"notes": [{
"name": "W3C Spec",
"href": "https://www.w3.org/TR/css3-values/#font-relative-lengths"
}]
}
!*/
define(['Modernizr', 'modElem'], function(Modernizr, modElem) {
Modernizr.addTest('cssexunit', function() {
var elemStyle = modElem.elem.style;
var supports;
try {
elemStyle.fontSize = '3ex';
supports = elemStyle.fontSize.indexOf('ex') !== -1;
} catch (e) {
supports = false;
}
return supports;
});
});
+28
View File
@@ -0,0 +1,28 @@
/*!
{
"name": "CSS Filters",
"property": "cssfilters",
"caniuse": "css-filters",
"polyfills": ["polyfilter"],
"tags": ["css"],
"builderAliases": ["css_filters"],
"notes": [{
"name": "MDN Docs",
"href": "https://developer.mozilla.org/en-US/docs/Web/CSS/filter"
}]
}
!*/
define(['Modernizr', 'createElement', 'prefixes', 'testAllProps', 'test/css/supports'], function(Modernizr, createElement, prefixes, testAllProps) {
Modernizr.addTest('cssfilters', function() {
if (Modernizr.supports) {
return testAllProps('filter', 'blur(2px)');
} else {
var el = createElement('a');
el.style.cssText = prefixes.join('filter:blur(2px); ');
// https://github.com/Modernizr/Modernizr/issues/615
// documentMode is needed for false positives in oldIE, please see issue above
return !!el.style.length && ((document.documentMode === undefined || document.documentMode > 9));
}
});
});
+21
View File
@@ -0,0 +1,21 @@
/*!
{
"name": "Flexbox",
"property": "flexbox",
"caniuse": "flexbox",
"tags": ["css"],
"notes": [{
"name": "The _new_ flexbox",
"href": "https://www.w3.org/TR/css-flexbox-1/"
}],
"warnings": [
"A `true` result for this detect does not imply that the `flex-wrap` property is supported; see the `flexwrap` detect."
]
}
!*/
/* DOC
Detects support for the Flexible Box Layout model, a.k.a. Flexbox, which allows easy manipulation of layout order and sizing within a container.
*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('flexbox', testAllProps('flexBasis', '1px', true));
});
+15
View File
@@ -0,0 +1,15 @@
/*!
{
"name": "Flexbox (legacy)",
"property": "flexboxlegacy",
"tags": ["css"],
"polyfills": ["flexie"],
"notes": [{
"name": "The _old_ flexbox",
"href": "https://www.w3.org/TR/2009/WD-css3-flexbox-20090723/"
}]
}
!*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('flexboxlegacy', testAllProps('boxDirection', 'reverse', true));
});
+16
View File
@@ -0,0 +1,16 @@
/*!
{
"name": "Flexbox (tweener)",
"property": "flexboxtweener",
"tags": ["css"],
"polyfills": ["flexie"],
"notes": [{
"name": "The _inbetween_ flexbox",
"href": "https://www.w3.org/TR/2011/WD-css3-flexbox-20111129/"
}],
"warnings": ["This represents an old syntax, not the latest standard syntax."]
}
!*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('flexboxtweener', testAllProps('flexAlign', 'end', true));
});
+31
View File
@@ -0,0 +1,31 @@
/*!
{
"name": "Flex Line Wrapping",
"property": "flexwrap",
"tags": ["css", "flexbox"],
"notes": [{
"name": "W3C Spec",
"href": "https://www.w3.org/TR/css-flexbox-1/"
}],
"warnings": [
"Does not imply a modern implementation – see documentation."
]
}
!*/
/* DOC
Detects support for the `flex-wrap` CSS property, part of Flexbox, which isn’t present in all Flexbox implementations (notably Firefox).
This featured in both the 'tweener' syntax (implemented by IE10) and the 'modern' syntax (implemented by others). This detect will return `true` for either of these implementations, as long as the `flex-wrap` property is supported. So to ensure the modern syntax is supported, use together with `Modernizr.flexbox`:
```javascript
if (Modernizr.flexbox && Modernizr.flexwrap) {
// Modern Flexbox with `flex-wrap` supported
}
else {
// Either old Flexbox syntax, or `flex-wrap` not supported
}
```
*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('flexwrap', testAllProps('flexWrap', 'wrap', true));
});
+18
View File
@@ -0,0 +1,18 @@
/*!
{
"name": "CSS :focus-within pseudo-selector",
"caniuse": "css-focus-visible",
"property": "focuswithin",
"tags": ["css"]
}
!*/
define(['Modernizr'], function(Modernizr) {
Modernizr.addTest('focuswithin', function() {
try {
document.querySelector(':focus-within');
} catch (error) {
return false;
}
return true;
});
});
+21
View File
@@ -0,0 +1,21 @@
/*!
{
"name": "Font Display",
"property": "fontdisplay",
"authors": ["Patrick Kettner"],
"caniuse": "css-font-rendering-controls",
"notes": [{
"name": "W3C Spec",
"href": "https://drafts.csswg.org/css-fonts-4/#font-display-desc"
},{
"name": "`font-display` for the masses",
"href": "https://css-tricks.com/font-display-masses/"
}]
}
!*/
/* DOC
Detects support for the `font-display` descriptor, which defines how font files are loaded and displayed by the browser.
*/
define(['Modernizr'], function(Modernizr, testProp) {
Modernizr.addTest('fontDisplay', testProp('font-display'));
});
+47
View File
@@ -0,0 +1,47 @@
/*!
{
"name": "@font-face",
"property": "fontface",
"authors": ["Diego Perini", "Mat Marquis"],
"tags": ["css"],
"knownBugs": [
"False Positive: WebOS https://github.com/Modernizr/Modernizr/issues/342",
"False Positive: WP7 https://github.com/Modernizr/Modernizr/issues/538"
],
"notes": [{
"name": "@font-face detection routine by Diego Perini",
"href": "http://javascript.nwbox.com/CSSSupport/"
},{
"name": "Filament Group @font-face compatibility research",
"href": "https://docs.google.com/presentation/d/1n4NyG4uPRjAA8zn_pSQ_Ket0RhcWC6QlZ6LMjKeECo0/edit#slide=id.p"
},{
"name": "Filament Grunticon/@font-face device testing results",
"href": "https://docs.google.com/spreadsheet/ccc?key=0Ag5_yGvxpINRdHFYeUJPNnZMWUZKR2ItMEpRTXZPdUE#gid=0"
},{
"name": "CSS fonts on Android",
"href": "https://stackoverflow.com/questions/3200069/css-fonts-on-android"
},{
"name": "@font-face and Android",
"href": "http://archivist.incutio.com/viewlist/css-discuss/115960"
}]
}
!*/
define(['Modernizr', 'testStyles'], function(Modernizr, testStyles) {
var blacklist = (function() {
var ua = navigator.userAgent;
var webos = ua.match(/w(eb)?osbrowser/gi);
var wppre8 = ua.match(/windows phone/gi) && ua.match(/iemobile\/([0-9])+/gi) && parseFloat(RegExp.$1) >= 9;
return webos || wppre8;
}());
if (blacklist) {
Modernizr.addTest('fontface', false);
} else {
testStyles('@font-face {font-family:"font";src:url("https://")}', function(node, rule) {
var style = document.getElementById('smodernizr');
var sheet = style.sheet || style.styleSheet;
var cssText = sheet ? (sheet.cssRules && sheet.cssRules[0] ? sheet.cssRules[0].cssText : sheet.cssText || '') : '';
var bool = /src/i.test(cssText) && cssText.indexOf(rule.split(' ')[0]) === 0;
Modernizr.addTest('fontface', bool);
});
}
});
+24
View File
@@ -0,0 +1,24 @@
/*!
{
"name": "CSS Generated Content",
"property": "generatedcontent",
"tags": ["css"],
"warnings": ["Android won't return correct height for anything below 7px #738"],
"notes": [{
"name": "W3C Spec",
"href": "https://www.w3.org/TR/css3-selectors/#gen-content"
},{
"name": "MDN Docs on :before",
"href": "https://developer.mozilla.org/en-US/docs/Web/CSS/::before"
},{
"name": "MDN Docs on :after",
"href": "https://developer.mozilla.org/en-US/docs/Web/CSS/::after"
}]
}
!*/
define(['Modernizr', 'testStyles'], function(Modernizr, testStyles) {
testStyles('#modernizr{font:0/0 a}#modernizr:after{content:":)";visibility:hidden;font:7px/1 a}', function(node) {
// See bug report on why this value is 6 crbug.com/608142
Modernizr.addTest('generatedcontent', node.offsetHeight >= 6);
});
});
+46
View File
@@ -0,0 +1,46 @@
/*!
{
"name": "CSS Gradients",
"caniuse": "css-gradients",
"property": "cssgradients",
"tags": ["css"],
"knownBugs": ["False-positives on webOS (https://github.com/Modernizr/Modernizr/issues/202)"],
"notes": [{
"name": "Webkit Gradient Syntax",
"href": "https://webkit.org/blog/175/introducing-css-gradients/"
},{
"name": "Linear Gradient Syntax",
"href": "https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient"
},{
"name": "W3C Spec",
"href": "https://drafts.csswg.org/css-images-3/#gradients"
}]
}
!*/
define(['Modernizr', 'prefixes', 'createElement'], function(Modernizr, prefixes, createElement) {
Modernizr.addTest('cssgradients', function() {
var str1 = 'background-image:';
var str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));';
var css = '';
var angle;
for (var i = 0, len = prefixes.length - 1; i < len; i++) {
angle = (i === 0 ? 'to ' : '');
css += str1 + prefixes[i] + 'linear-gradient(' + angle + 'left top, #9f9, white);';
}
if (Modernizr._config.usePrefixes) {
// legacy webkit syntax (FIXME: remove when syntax not in use anymore)
css += str1 + '-webkit-' + str2;
}
var elem = createElement('a');
var style = elem.style;
style.cssText = css;
// IE6 returns undefined so cast to string
return ('' + style.backgroundImage).indexOf('gradient') > -1;
});
});
+24
View File
@@ -0,0 +1,24 @@
/*! {
"name": "CSS Hairline",
"property": "hairline",
"tags": ["css"],
"authors": ["strarsis"],
"notes": [{
"name": "Blog post about CSS retina hairlines",
"href": "http://dieulot.net/css-retina-hairline"
},{
"name": "Derived from",
"href": "https://gist.github.com/dieulot/520a49463f6058fbc8d1"
}]
}
!*/
/* DOC
Detects support for hidpi/retina hairlines, which are CSS borders with less than 1px in width, for being physically 1px on hidpi screens.
*/
define(['Modernizr', 'testStyles'], function(Modernizr, testStyles) {
Modernizr.addTest('hairline', function() {
return testStyles('#modernizr {border:.5px solid transparent}', function(elem) {
return elem.offsetHeight === 1;
});
});
});
+15
View File
@@ -0,0 +1,15 @@
/*!
{
"name": "CSS HSLA Colors",
"caniuse": "css3-colors",
"property": "hsla",
"tags": ["css"]
}
!*/
define(['Modernizr', 'createElement', 'contains'], function(Modernizr, createElement, contains) {
Modernizr.addTest('hsla', function() {
var style = createElement('a').style;
style.cssText = 'background-color:hsla(120,40%,100%,.5)';
return contains(style.backgroundColor, 'rgba') || contains(style.backgroundColor, 'hsla');
});
});
+224
View File
@@ -0,0 +1,224 @@
/*!
{
"name": "CSS Hyphens",
"caniuse": "css-hyphens",
"property": ["csshyphens", "softhyphens", "softhyphensfind"],
"tags": ["css"],
"builderAliases": ["css_hyphens"],
"async": true,
"authors": ["David Newton"],
"warnings": [
"These tests currently require document.body to be present",
"If loading Hyphenator.js via yepnope, be cautious of issue 158: https://github.com/mnater/hyphenator/issues/158",
"This is very large – only include it if you absolutely need it"
],
"notes": [{
"name": "The Current State of Hyphenation on the Web.",
"href": "https://davidnewton.ca/the-current-state-of-hyphenation-on-the-web"
},{
"name": "Hyphenation Test Page",
"href": "https://web.archive.org/web/20150319125549/http://davidnewton.ca/demos/hyphenation/test.html"
},{
"name": "Hyphenation is Language Specific",
"href": "https://code.google.com/p/hyphenator/source/diff?spec=svn975&r=975&format=side&path=/trunk/Hyphenator.js#sc_svn975_313"
},{
"name": "Related Modernizr Issue",
"href": "https://github.com/Modernizr/Modernizr/issues/312"
}]
}
!*/
define(['Modernizr', 'prefixes', 'createElement', 'testAllProps', 'addTest'], function(Modernizr, prefixes, createElement, testAllProps, addTest) {
Modernizr.addAsyncTest(function() {
var waitTime = 300;
setTimeout(runHyphenTest, waitTime);
// Wait 1000ms so we can hope for document.body
function runHyphenTest() {
if (!document.body && !document.getElementsByTagName('body')[0]) {
setTimeout(runHyphenTest, waitTime);
return;
}
// functional test of adding hyphens:auto
function test_hyphens_css() {
try {
/* create a div container and a span within that
* these have to be appended to document.body, otherwise some browsers can give false negative */
var div = createElement('div');
var span = createElement('span');
var divStyle = div.style;
var spanHeight = 0;
var spanWidth = 0;
var result = false;
var firstChild = document.body.firstElementChild || document.body.firstChild;
/* Hyphenation is only applied when language is explicitly set and when respective dictionary
* is available. See https://developer.mozilla.org/en-US/docs/Web/CSS/hyphens for details. */
div.lang = 'en';
div.appendChild(span);
span.innerHTML = 'Bacon ipsum dolor sit amet jerky velit in culpa hamburger et. Laborum dolor proident, enim dolore duis commodo et strip steak. Salami anim et, veniam consectetur dolore qui tenderloin jowl velit sirloin. Et ad culpa, fatback cillum jowl ball tip ham hock nulla short ribs pariatur aute. Pig pancetta ham bresaola, ut boudin nostrud commodo flank esse cow tongue culpa. Pork belly bresaola enim pig, ea consectetur nisi. Fugiat officia turkey, ea cow jowl pariatur ullamco proident do laborum velit sausage. Magna biltong sint tri-tip commodo sed bacon, esse proident aliquip. Ullamco ham sint fugiat, velit in enim sed mollit nulla cow ut adipisicing nostrud consectetur. Proident dolore beef ribs, laborum nostrud meatball ea laboris rump cupidatat labore culpa. Shankle minim beef, velit sint cupidatat fugiat tenderloin pig et ball tip. Ut cow fatback salami, bacon ball tip et in shank strip steak bresaola. In ut pork belly sed mollit tri-tip magna culpa veniam, short ribs qui in andouille ham consequat. Dolore bacon t-bone, velit short ribs enim strip steak nulla. Voluptate labore ut, biltong swine irure jerky. Cupidatat excepteur aliquip salami dolore. Ball tip strip steak in pork dolor. Ad in esse biltong. Dolore tenderloin exercitation ad pork loin t-bone, dolore in chicken ball tip qui pig. Ut culpa tongue, sint ribeye dolore ex shank voluptate hamburger. Jowl et tempor, boudin pork chop labore ham hock drumstick consectetur tri-tip elit swine meatball chicken ground round. Proident shankle mollit dolore. Shoulder ut duis t-bone quis reprehenderit. Meatloaf dolore minim strip steak, laboris ea aute bacon beef ribs elit shank in veniam drumstick qui. Ex laboris meatball cow tongue pork belly. Ea ball tip reprehenderit pig, sed fatback boudin dolore flank aliquip laboris eu quis. Beef ribs duis beef, cow corned beef adipisicing commodo nisi deserunt exercitation. Cillum dolor t-bone spare ribs, ham hock est sirloin. Brisket irure meatloaf in, boudin pork belly sirloin ball tip. Sirloin sint irure nisi nostrud aliqua. Nostrud nulla aute, enim officia culpa ham hock. Aliqua reprehenderit dolore sunt nostrud sausage, ea boudin pork loin ut t-bone ham tempor. Tri-tip et pancetta drumstick laborum. Ham hock magna do nostrud in proident. Ex ground round fatback, venison non ribeye in.';
document.body.insertBefore(div, firstChild);
/* get size of unhyphenated text */
divStyle.cssText = 'position:absolute;top:0;left:0;width:5em;text-align:justify;text-justify:newspaper;';
spanHeight = span.offsetHeight;
spanWidth = span.offsetWidth;
/* compare size with hyphenated text */
divStyle.cssText = 'position:absolute;top:0;left:0;width:5em;text-align:justify;text-justify:newspaper;' +
prefixes.join('hyphens:auto; ');
/* results */
result = (span.offsetHeight !== spanHeight || span.offsetWidth !== spanWidth);
/* cleanup */
document.body.removeChild(div);
div.removeChild(span);
return result;
} catch (e) {
return false;
}
}
// for the softhyphens test
function test_hyphens(delimiter, testWidth) {
try {
/* create a div container and a span within that
* these have to be appended to document.body, otherwise some browsers can give false negative */
var div = createElement('div');
var span = createElement('span');
var divStyle = div.style;
var spanSize = 0;
var result = false;
var result1 = false;
var result2 = false;
var firstChild = document.body.firstElementChild || document.body.firstChild;
divStyle.cssText = 'position:absolute;top:0;left:0;overflow:visible;width:1.25em;';
div.appendChild(span);
document.body.insertBefore(div, firstChild);
/* get height of unwrapped text */
span.innerHTML = 'mm';
spanSize = span.offsetHeight;
/* compare height w/ delimiter, to see if it wraps to new line */
span.innerHTML = 'm' + delimiter + 'm';
result1 = (span.offsetHeight > spanSize);
/* if we're testing the width too (i.e. for soft-hyphen, not zws),
* this is because tested Blackberry devices will wrap the text but not display the hyphen */
if (testWidth) {
/* get width of wrapped, non-hyphenated text */
span.innerHTML = 'm<br />m';
spanSize = span.offsetWidth;
/* compare width w/ wrapped w/ delimiter to see if hyphen is present */
span.innerHTML = 'm' + delimiter + 'm';
result2 = (span.offsetWidth > spanSize);
} else {
result2 = true;
}
/* results and cleanup */
if (result1 === true && result2 === true) { result = true; }
document.body.removeChild(div);
div.removeChild(span);
return result;
} catch (e) {
return false;
}
}
// testing if in-browser Find functionality will work on hyphenated text
function test_hyphens_find(delimiter) {
try {
/* create a dummy input for resetting selection location, and a div container
* these have to be appended to document.body, otherwise some browsers can give false negative
* div container gets the doubled testword, separated by the delimiter
* Note: giving a width to div gives false positive in iOS Safari */
var dummy = createElement('input');
var div = createElement('div');
var testword = 'lebowski';
var result = false;
var textrange;
var firstChild = document.body.firstElementChild || document.body.firstChild;
div.innerHTML = testword + delimiter + testword;
document.body.insertBefore(div, firstChild);
document.body.insertBefore(dummy, div);
/* reset the selection to the dummy input element, i.e. BEFORE the div container
* stackoverflow.com/questions/499126/jquery-set-cursor-position-in-text-area */
if (dummy.setSelectionRange) {
dummy.focus();
dummy.setSelectionRange(0, 0);
} else if (dummy.createTextRange) {
textrange = dummy.createTextRange();
textrange.collapse(true);
textrange.moveEnd('character', 0);
textrange.moveStart('character', 0);
textrange.select();
}
/* try to find the doubled testword, without the delimiter */
try {
if (window.find) {
result = window.find(testword + testword);
} else {
textrange = window.self.document.body.createTextRange();
result = textrange.findText(testword + testword);
}
} catch (e) {
result = false;
}
document.body.removeChild(div);
document.body.removeChild(dummy);
return result;
} catch (e) {
return false;
}
}
addTest('csshyphens', function() {
if (!testAllProps('hyphens', 'auto', true)) {
return false;
}
/* Chrome lies about its hyphens support so we need a more robust test
crbug.com/107111
*/
try {
return test_hyphens_css();
} catch (e) {
return false;
}
});
addTest('softhyphens', function() {
try {
// use numeric entity instead of &shy; in case it's XHTML
return test_hyphens('&#173;', true) && test_hyphens('&#8203;', false);
} catch (e) {
return false;
}
});
addTest('softhyphensfind', function() {
try {
return test_hyphens_find('&#173;') && test_hyphens_find('&#8203;');
} catch (e) {
return false;
}
});
}
});
});
+23
View File
@@ -0,0 +1,23 @@
/*!
{
"name": "CSS :invalid pseudo-class",
"property": "cssinvalid",
"notes": [{
"name": "MDN Docs",
"href": "https://developer.mozilla.org/en-US/docs/Web/CSS/:invalid"
}]
}
!*/
/* DOC
Detects support for the ':invalid' CSS pseudo-class.
*/
define(['Modernizr', 'testStyles', 'createElement'], function(Modernizr, testStyles, createElement) {
Modernizr.addTest('cssinvalid', function() {
return testStyles('#modernizr input{height:0;border:0;padding:0;margin:0;width:10px} #modernizr input:invalid{width:50px}', function(elem) {
var input = createElement('input');
input.required = true;
elem.appendChild(input);
return input.clientWidth > 10;
});
});
});
+18
View File
@@ -0,0 +1,18 @@
/*!
{
"name": "CSS :last-child pseudo-selector",
"caniuse": "css-sel3",
"property": "lastchild",
"tags": ["css"],
"builderAliases": ["css_lastchild"],
"notes": [{
"name": "Related Github Issue",
"href": "https://github.com/Modernizr/Modernizr/pull/304"
}]
}
!*/
define(['Modernizr', 'testStyles'], function(Modernizr, testStyles) {
testStyles('#modernizr div {width:100px} #modernizr :last-child{width:200px;display:block}', function(elem) {
Modernizr.addTest('lastchild', elem.lastChild.offsetWidth > elem.firstChild.offsetWidth);
}, 2);
});
+25
View File
@@ -0,0 +1,25 @@
/*!
{
"name": "CSS Mask",
"caniuse": "css-masks",
"property": "cssmask",
"tags": ["css"],
"builderAliases": ["css_mask"],
"notes": [{
"name": "Webkit blog on CSS Masks",
"href": "https://webkit.org/blog/181/css-masks/"
},{
"name": "Safari Docs",
"href": "https://developer.apple.com/library/archive/documentation/InternetWeb/Conceptual/SafariVisualEffectsProgGuide/Masks/Masks.html"
},{
"name": "CSS SVG mask",
"href": "https://developer.mozilla.org/en-US/docs/Web/CSS/mask"
},{
"name": "Combine with clippaths for awesomeness",
"href": "https://web.archive.org/web/20150508193041/http://generic.cx:80/for/webkit/test.html"
}]
}
!*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('cssmask', testAllProps('maskRepeat', 'repeat-x', true));
});
+12
View File
@@ -0,0 +1,12 @@
/*!
{
"name": "CSS Media Queries",
"caniuse": "css-mediaqueries",
"property": "mediaqueries",
"tags": ["css"],
"builderAliases": ["css_mediaqueries"]
}
!*/
define(['Modernizr', 'mq'], function(Modernizr, mq) {
Modernizr.addTest('mediaqueries', mq('only all'));
});
+22
View File
@@ -0,0 +1,22 @@
/*!
{
"name": "CSS Multiple Backgrounds",
"caniuse": "multibackgrounds",
"property": "multiplebgs",
"tags": ["css"]
}
!*/
define(['Modernizr', 'createElement'], function(Modernizr, createElement) {
// Setting multiple images AND a color on the background shorthand property
// and then querying the style.background property value for the number of
// occurrences of "url(" is a reliable method for detecting ACTUAL support for this!
Modernizr.addTest('multiplebgs', function() {
var style = createElement('a').style;
style.cssText = 'background:url(https://),url(https://),red url(https://)';
// If the UA supports multiple backgrounds, there should be three occurrences
// of the string "url(" in the return value for elemStyle.background
return (/(url\s*\(.*?){3}/).test(style.background);
});
});
+35
View File
@@ -0,0 +1,35 @@
/*!
{
"name": "CSS :nth-child pseudo-selector",
"caniuse": "css-sel3",
"property": "nthchild",
"tags": ["css"],
"notes": [{
"name": "Related Github Issue",
"href": "https://github.com/Modernizr/Modernizr/pull/685"
},{
"name": "Sitepoint :nth-child documentation",
"href": "https://www.sitepoint.com/atoz-css-screencast-nth-child/"
}],
"authors": ["@emilchristensen"],
"warnings": ["Known false negative in Safari 3.1 and Safari 3.2.2"]
}
!*/
/* DOC
Detects support for the ':nth-child()' CSS pseudo-selector.
*/
define(['Modernizr', 'testStyles'], function(Modernizr, testStyles) {
// 5 `<div>` elements with `1px` width are created.
// Then every other element has its `width` set to `2px`.
// A JavaScript loop then tests if the `<div>`s have the expected width
// using the modulus operator.
testStyles('#modernizr div {width:1px} #modernizr div:nth-child(2n) {width:2px;}', function(elem) {
var elems = elem.getElementsByTagName('div');
var correctWidths = true;
for (var i = 0; i < 5; i++) {
correctWidths = correctWidths && elems[i].offsetWidth === i % 2 + 1;
}
Modernizr.addTest('nthchild', correctWidths);
}, 5);
});
+16
View File
@@ -0,0 +1,16 @@
/*!
{
"name": "CSS Object Fit",
"caniuse": "object-fit",
"property": "objectfit",
"tags": ["css"],
"builderAliases": ["css_objectfit"],
"notes": [{
"name": "Opera Article on Object Fit",
"href": "https://dev.opera.com/articles/css3-object-fit-object-position/"
}]
}
!*/
define(['Modernizr', 'prefixed'], function(Modernizr, prefixed) {
Modernizr.addTest('objectfit', !!prefixed('objectFit'), {aliases: ['object-fit']});
});
+23
View File
@@ -0,0 +1,23 @@
/*!
{
"name": "CSS Opacity",
"caniuse": "css-opacity",
"property": "opacity",
"tags": ["css"]
}
!*/
define(['Modernizr', 'createElement', 'prefixes'], function(Modernizr, createElement, prefixes) {
// Browsers that actually have CSS Opacity implemented have done so
// according to spec, which means their return values are within the
// range of [0.0,1.0] - including the leading zero.
Modernizr.addTest('opacity', function() {
var style = createElement('a').style;
style.cssText = prefixes.join('opacity:.55;');
// The non-literal . in this regex is intentional:
// German Chrome returns this value as 0,55
// github.com/Modernizr/Modernizr/issues/#issue/59/comment/516632
return (/^0.55$/).test(style.opacity);
});
});
+16
View File
@@ -0,0 +1,16 @@
/*!
{
"name": "CSS Overflow Scrolling",
"property": "overflowscrolling",
"tags": ["css"],
"builderAliases": ["css_overflow_scrolling"],
"warnings": ["Introduced in iOS5b2. API is subject to change."],
"notes": [{
"name": "Article on iOS overflow scrolling",
"href": "https://css-tricks.com/snippets/css/momentum-scrolling-on-ios-overflow-elements/"
}]
}
!*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('overflowscrolling', testAllProps('overflowScrolling', 'touch', true));
});
+30
View File
@@ -0,0 +1,30 @@
/*!
{
"name": "CSS Pointer Events",
"caniuse": "pointer-events",
"property": "csspointerevents",
"authors": ["ausi"],
"tags": ["css"],
"builderAliases": ["css_pointerevents"],
"notes": [{
"name": "MDN Docs",
"href": "https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events"
},{
"name": "Test Project Page",
"href": "https://ausi.github.com/Feature-detection-technique-for-pointer-events/"
},{
"name": "Test Project Wiki",
"href": "https://github.com/ausi/Feature-detection-technique-for-pointer-events/wiki"
},{
"name": "Related Github Issue",
"href": "https://github.com/Modernizr/Modernizr/issues/80"
}]
}
!*/
define(['Modernizr', 'createElement'], function(Modernizr, createElement) {
Modernizr.addTest('csspointerevents', function() {
var style = createElement('a').style;
style.cssText = 'pointer-events:auto';
return style.pointerEvents === 'auto';
});
});
+27
View File
@@ -0,0 +1,27 @@
/*!
{
"name": "CSS position: sticky",
"property": "csspositionsticky",
"tags": ["css"],
"builderAliases": ["css_positionsticky"],
"notes": [{
"name": "Chrome bug report",
"href":"https://bugs.chromium.org/p/chromium/issues/detail?id=322972"
}],
"warnings": ["using position:sticky on anything but top aligned elements is buggy in Chrome < 37 and iOS <=7+"]
}
!*/
define(['Modernizr', 'createElement', 'prefixes'], function(Modernizr, createElement, prefixes) {
// Sticky positioning - constrains an element to be positioned inside the
// intersection of its container box, and the viewport.
Modernizr.addTest('csspositionsticky', function() {
var prop = 'position:';
var value = 'sticky';
var el = createElement('a');
var mStyle = el.style;
mStyle.cssText = prop + prefixes.join(value + ';' + prop).slice(0, -prop.length);
return mStyle.position.indexOf(value) !== -1;
});
});
+29
View File
@@ -0,0 +1,29 @@
/*!
{
"name": "CSS Generated Content Animations",
"property": "csspseudoanimations",
"tags": ["css"]
}
!*/
define(['Modernizr', 'testStyles', 'prefixes', 'test/css/animations'], function(Modernizr, testStyles, prefixes) {
Modernizr.addTest('csspseudoanimations', function() {
var result = false;
if (!Modernizr.cssanimations || !window.getComputedStyle) {
return result;
}
var styles = [
'@', prefixes.join('keyframes csspseudoanimations { from { font-size: 10px; } }@').replace(/\@$/, ''),
'#modernizr:before { content:" "; font-size:5px;',
prefixes.join('animation:csspseudoanimations 1ms infinite;'),
'}'
].join('');
testStyles(styles, function(elem) {
result = window.getComputedStyle(elem, ':before').getPropertyValue('font-size') === '10px';
});
return result;
});
});
+29
View File
@@ -0,0 +1,29 @@
/*!
{
"name": "CSS Generated Content Transitions",
"property": "csspseudotransitions",
"tags": ["css"]
}
!*/
define(['Modernizr', 'testStyles', 'prefixes', 'test/css/transitions'], function(Modernizr, testStyles, prefixes) {
Modernizr.addTest('csspseudotransitions', function() {
var result = false;
if (!Modernizr.csstransitions || !window.getComputedStyle) {
return result;
}
var styles =
'#modernizr:before { content:" "; font-size:5px;' + prefixes.join('transition:0s 100s;') + '}' +
'#modernizr.trigger:before { font-size:10px; }';
testStyles(styles, function(elem) {
// Force rendering of the element's styles so that the transition will trigger
window.getComputedStyle(elem, ':before').getPropertyValue('font-size');
elem.className += 'trigger';
result = window.getComputedStyle(elem, ':before').getPropertyValue('font-size') === '5px';
});
return result;
});
});
+11
View File
@@ -0,0 +1,11 @@
/*!
{
"name": "CSS Reflections",
"caniuse": "css-reflections",
"property": "cssreflections",
"tags": ["css"]
}
!*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('cssreflections', testAllProps('boxReflect', 'above', true));
});
+93
View File
@@ -0,0 +1,93 @@
/*!
{
"name": "CSS Regions",
"caniuse": "css-regions",
"authors": ["Mihai Balan"],
"property": "regions",
"tags": ["css"],
"builderAliases": ["css_regions"],
"notes": [{
"name": "W3C Spec",
"href": "https://www.w3.org/TR/css3-regions/"
}]
}
!*/
define(['Modernizr', 'createElement', 'docElement', 'isSVG', 'prefixed'], function(Modernizr, createElement, docElement, isSVG, prefixed) {
// We start with a CSS parser test then we check page geometry to see if it's affected by regions
// Later we might be able to retire the second part, as WebKit builds with the false positives die out
Modernizr.addTest('regions', function() {
if (isSVG) {
// css regions don't work inside of SVG elements. Rather than update the
// below test to work in an SVG context, just exit early to save bytes
return false;
}
/* Get the 'flowFrom' property name available in the browser. Either default or vendor prefixed.
If the property name can't be found we'll get Boolean 'false' and fail quickly */
var flowFromProperty = prefixed('flowFrom');
var flowIntoProperty = prefixed('flowInto');
var result = false;
if (!flowFromProperty || !flowIntoProperty) {
return result;
}
/* If CSS parsing is there, try to determine if regions actually work. */
var iframeContainer = createElement('iframe');
var container = createElement('div');
var content = createElement('div');
var region = createElement('div');
/* we create a random, unlikely to be generated flow number to make sure we don't
clash with anything more vanilla, like 'flow', or 'article', or 'f1' */
var flowName = 'modernizr_flow_for_regions_check';
/* First create a div with two adjacent divs inside it. The first will be the
content, the second will be the region. To be able to distinguish between the two,
we'll give the region a particular padding */
content.innerText = 'M';
container.style.cssText = 'top: 150px; left: 150px; padding: 0px;';
region.style.cssText = 'width: 50px; height: 50px; padding: 42px;';
region.style[flowFromProperty] = flowName;
container.appendChild(content);
container.appendChild(region);
docElement.appendChild(container);
/* Now compute the bounding client rect, before and after attempting to flow the
content div in the region div. If regions are enabled, the after bounding rect
should reflect the padding of the region div.*/
var flowedRect, delta;
var plainRect = content.getBoundingClientRect();
content.style[flowIntoProperty] = flowName;
flowedRect = content.getBoundingClientRect();
delta = parseInt(flowedRect.left - plainRect.left, 10);
docElement.removeChild(container);
if (delta === 42) {
result = true;
} else {
/* IE only allows for the content to come from iframes. This has the
* side effect of automatic collapsing of iframes once they get the flow-into
* property set. checking for a change on the height allows us to detect this
* in a sync way, without having to wait for a frame to load */
docElement.appendChild(iframeContainer);
plainRect = iframeContainer.getBoundingClientRect();
iframeContainer.style[flowIntoProperty] = flowName;
flowedRect = iframeContainer.getBoundingClientRect();
if (plainRect.height > 0 && plainRect.height !== flowedRect.height && flowedRect.height === 0) {
result = true;
}
}
content = region = container = iframeContainer = undefined;
return result;
});
});
+31
View File
@@ -0,0 +1,31 @@
/*!
{
"name": "CSS Font rem Units",
"caniuse": "rem",
"authors": ["nsfmc"],
"property": "cssremunit",
"tags": ["css"],
"builderAliases": ["css_remunit"],
"notes": [{
"name": "W3C Spec",
"href": "https://www.w3.org/TR/css3-values/#relative0"
},{
"name": "Font Size with rem by Jonathan Snook",
"href": "https://snook.ca/archives/html_and_css/font-size-with-rem"
}]
}
!*/
define(['Modernizr', 'createElement'], function(Modernizr, createElement) {
// "The 'rem' unit ('root em') is relative to the computed
// value of the 'font-size' value of the root element."
// you can test by checking if the prop was ditched
Modernizr.addTest('cssremunit', function() {
var style = createElement('a').style;
try {
style.fontSize = '3rem';
}
catch (e) {}
return (/rem/).test(style.fontSize);
});
});
+22
View File
@@ -0,0 +1,22 @@
/*!
{
"name": "CSS UI Resize",
"property": "cssresize",
"caniuse": "css-resize",
"tags": ["css"],
"builderAliases": ["css_resize"],
"notes": [{
"name": "W3C Spec",
"href": "https://www.w3.org/TR/css3-ui/#resize"
},{
"name": "MDN Docs",
"href": "https://developer.mozilla.org/en/CSS/resize"
}]
}
!*/
/* DOC
Test for CSS 3 UI "resize" property
*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('cssresize', testAllProps('resize', 'both', true));
});
+20
View File
@@ -0,0 +1,20 @@
/*!
{
"name": "CSS rgba",
"caniuse": "css3-colors",
"property": "rgba",
"tags": ["css"],
"notes": [{
"name": "CSSTricks Tutorial",
"href": "https://css-tricks.com/rgba-browser-support/"
}]
}
!*/
define(['Modernizr', 'createElement'], function(Modernizr, createElement) {
Modernizr.addTest('rgba', function() {
var style = createElement('a').style;
style.cssText = 'background-color:rgba(150,255,150,.5)';
return ('' + style.backgroundColor).indexOf('rgba') > -1;
});
});
+18
View File
@@ -0,0 +1,18 @@
/*!
{
"name": "CSS Stylable Scrollbars",
"property": "cssscrollbar",
"tags": ["css"],
"builderAliases": ["css_scrollbars"]
}
!*/
define(['Modernizr', 'testStyles', 'prefixes'], function(Modernizr, testStyles, prefixes) {
testStyles('#modernizr{overflow: scroll; width: 40px; height: 40px; }#' + prefixes
.join('scrollbar{width:10px}' + ' #modernizr::')
.split('#')
.slice(1)
.join('#') + 'scrollbar{width:10px}',
function(node) {
Modernizr.addTest('cssscrollbar', 'scrollWidth' in node && node.scrollWidth === 30);
});
});
+20
View File
@@ -0,0 +1,20 @@
/*!
{
"name": "Scroll Snap Points",
"property": "scrollsnappoints",
"notes": [{
"name": "Setting native-like scrolling offsets in CSS with Scrolling Snap Points",
"href": "http://generatedcontent.org/post/66817675443/setting-native-like-scrolling-offsets-in-css-with"
},{
"name": "MDN Docs",
"href": "https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Scroll_Snap_Points"
}],
"polyfills": ["scrollsnap"]
}
!*/
/* DOC
Detects support for CSS Snap Points
*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('scrollsnappoints', testAllProps('scrollSnapType'));
});
+20
View File
@@ -0,0 +1,20 @@
/*!
{
"name": "CSS Shapes",
"property": "shapes",
"tags": ["css"],
"notes": [{
"name": "W3C Spec",
"href": "https://www.w3.org/TR/css-shapes"
},{
"name": "Examples from Adobe",
"href": "https://web.archive.org/web/20171230010236/http://webplatform.adobe.com:80/shapes"
}, {
"name": "Examples from CSS-Tricks",
"href": "https://css-tricks.com/examples/ShapesOfCSS/"
}]
}
!*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('shapes', testAllProps('shapeOutside', 'content-box', true));
});
+19
View File
@@ -0,0 +1,19 @@
/*!
{
"name": "CSS general sibling selector",
"caniuse": "css-sel3",
"property": "siblinggeneral",
"tags": ["css"],
"notes": [{
"name": "Related Github Issue",
"href": "https://github.com/Modernizr/Modernizr/pull/889"
}]
}
!*/
define(['Modernizr', 'createElement', 'testStyles'], function(Modernizr, createElement, testStyles) {
Modernizr.addTest('siblinggeneral', function() {
return testStyles('#modernizr div {width:100px} #modernizr div ~ div {width:200px;display:block}', function(elem) {
return elem.lastChild.offsetWidth === 200;
}, 2);
});
});
+27
View File
@@ -0,0 +1,27 @@
/*!
{
"name": "CSS Subpixel Fonts",
"property": "subpixelfont",
"tags": ["css"],
"builderAliases": ["css_subpixelfont"],
"authors": ["@derSchepp", "@gerritvanaaken", "@rodneyrehm", "@yatil", "@ryanseddon"],
"notes": [{
"name": "Origin Test",
"href": "https://github.com/gerritvanaaken/subpixeldetect"
}]
}
!*/
define(['Modernizr', 'testStyles'], function(Modernizr, testStyles) {
/*
* (to infer if GDI or DirectWrite is used on Windows)
*/
testStyles(
'#modernizr{position: absolute; top: -10em; visibility:hidden; font: normal 10px arial;}#subpixel{float: left; font-size: 33.3333%;}',
function(elem) {
var subpixel = elem.firstChild;
subpixel.innerHTML = 'This is a text written in Arial';
Modernizr.addTest('subpixelfont', window.getComputedStyle ?
window.getComputedStyle(subpixel, null).getPropertyValue('width') !== '44px'
: false);
}, 1, ['subpixel']);
});
+24
View File
@@ -0,0 +1,24 @@
/*!
{
"name": "CSS Supports",
"property": "supports",
"caniuse": "css-featurequeries",
"tags": ["css"],
"builderAliases": ["css_supports"],
"notes": [{
"name": "W3C Spec",
"href": "https://dev.w3.org/csswg/css3-conditional/#at-supports"
},{
"name": "Related Github Issue",
"href": "https://github.com/Modernizr/Modernizr/issues/648"
},{
"name": "W3C Spec",
"href": "https://dev.w3.org/csswg/css3-conditional/#the-csssupportsrule-interface"
}]
}
!*/
define(['Modernizr'], function(Modernizr) {
var newSyntax = 'CSS' in window && 'supports' in window.CSS;
var oldSyntax = 'supportsCSS' in window;
Modernizr.addTest('supports', newSyntax || oldSyntax);
});
+33
View File
@@ -0,0 +1,33 @@
/*!
{
"name": "CSS :target pseudo-class",
"caniuse": "css-sel3",
"property": "target",
"tags": ["css"],
"notes": [{
"name": "MDN Docs",
"href": "https://developer.mozilla.org/en-US/docs/Web/CSS/:target"
}],
"authors": ["@zachleat"],
"warnings": ["Opera Mini supports :target but doesn't update the hash for anchor links."]
}
!*/
/* DOC
Detects support for the ':target' CSS pseudo-class.
*/
define(['Modernizr'], function(Modernizr) {
// querySelector
Modernizr.addTest('target', function() {
var doc = window.document;
if (!('querySelectorAll' in doc)) {
return false;
}
try {
doc.querySelectorAll(':target');
return true;
} catch (e) {
return false;
}
});
});
+18
View File
@@ -0,0 +1,18 @@
/*!
{
"name": "CSS text-align-last",
"property": "textalignlast",
"tags": ["css"],
"knownBugs": ["IE does not support the 'start' or 'end' values."],
"notes": [{
"name": "Quirksmode",
"href": "https://www.quirksmode.org/css/text/textalignlast.html"
},{
"name": "MDN Docs",
"href": "https://developer.mozilla.org/en-US/docs/Web/CSS/text-align-last"
}]
}
!*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('textalignlast', testAllProps('textAlignLast'));
});
+41
View File
@@ -0,0 +1,41 @@
/*!
{
"name": "CSS textDecoration",
"property": "textdecoration",
"caniuse": "text-decoration",
"tags": ["css"],
"notes": [{
"name": "W3C Spec",
"href": "https://www.w3.org/TR/css-text-decor-3/#line-decoration"
}]
}
!*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
(function() {
Modernizr.addTest('textdecoration', function() {
var bool = false;
var test = testAllProps('textDecoration');
try {
bool = !!test;
if (bool) {
bool = new Boolean(bool);
}
} catch (e) {}
return bool;
});
var props = ['Line', 'Style', 'Color', 'Skip', 'SkipInk'];
var name, test;
for (var i = 0; i < props.length; i++) {
name = props[i].toLowerCase();
test = testAllProps('textDecoration' + props[i]);
Modernizr.addTest('textdecoration.' + name, test);
}
})();
});
+12
View File
@@ -0,0 +1,12 @@
/*!
{
"name": "CSS textshadow",
"property": "textshadow",
"caniuse": "css-textshadow",
"tags": ["css"],
"knownBugs": ["FF3.0 will false positive on this test"]
}
!*/
define(['Modernizr', 'testProp'], function(Modernizr, testProp) {
Modernizr.addTest('textshadow', testProp('textShadow', '1px 1px'));
});
+16
View File
@@ -0,0 +1,16 @@
/*!
{
"name": "CSS Transforms",
"property": "csstransforms",
"caniuse": "transforms2d",
"tags": ["css"]
}
!*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('csstransforms', function() {
// Android < 3.0 is buggy, so we sniff and blacklist
// https://github.com/Modernizr/Modernizr/issues/903
return navigator.userAgent.indexOf('Android 2.') === -1 &&
testAllProps('transform', 'scale(1)', true);
});
});
+16
View File
@@ -0,0 +1,16 @@
/*!
{
"name": "CSS Transforms 3D",
"property": "csstransforms3d",
"caniuse": "transforms3d",
"tags": ["css"],
"warnings": [
"Chrome may occasionally fail this test on some systems; more info: https://bugs.chromium.org/p/chromium/issues/detail?id=129004"
]
}
!*/
define(['Modernizr', 'testAllProps', 'test/css/supports'], function(Modernizr, testAllProps) {
Modernizr.addTest('csstransforms3d', function() {
return !!testAllProps('perspective', '1px', true);
});
});
+17
View File
@@ -0,0 +1,17 @@
/*!
{
"name": "CSS Transforms Level 2",
"property": "csstransformslevel2",
"authors": ["rupl"],
"tags": ["css"],
"notes": [{
"name": "CSSWG Draft Spec",
"href": "https://drafts.csswg.org/css-transforms-2/"
}]
}
!*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('csstransformslevel2', function() {
return testAllProps('translate', '45px', true);
});
});
+44
View File
@@ -0,0 +1,44 @@
/*!
{
"name": "CSS Transform Style preserve-3d",
"property": "preserve3d",
"authors": ["denyskoch", "aFarkas"],
"tags": ["css"],
"notes": [{
"name": "MDN Docs",
"href": "https://developer.mozilla.org/en-US/docs/Web/CSS/transform-style"
},{
"name": "Related Github Issue",
"href": "https://github.com/Modernizr/Modernizr/issues/1748"
}]
}
!*/
/* DOC
Detects support for `transform-style: preserve-3d`, for getting a proper 3D perspective on elements.
*/
define(['Modernizr', 'createElement', 'docElement'], function(Modernizr, createElement, docElement) {
Modernizr.addTest('preserve3d', function() {
var outerAnchor, innerAnchor;
var CSS = window.CSS;
var result = false;
if (CSS && CSS.supports && CSS.supports('(transform-style: preserve-3d)')) {
return true;
}
outerAnchor = createElement('a');
innerAnchor = createElement('a');
outerAnchor.style.cssText = 'display: block; transform-style: preserve-3d; transform-origin: right; transform: rotateY(40deg);';
innerAnchor.style.cssText = 'display: block; width: 9px; height: 1px; background: #000; transform-origin: right; transform: rotateY(40deg);';
outerAnchor.appendChild(innerAnchor);
docElement.appendChild(outerAnchor);
result = innerAnchor.getBoundingClientRect();
docElement.removeChild(outerAnchor);
result = result.width && result.width < 4;
return result;
});
});
+11
View File
@@ -0,0 +1,11 @@
/*!
{
"name": "CSS Transitions",
"property": "csstransitions",
"caniuse": "css-transitions",
"tags": ["css"]
}
!*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('csstransitions', testAllProps('transition', 'all', true));
});
+18
View File
@@ -0,0 +1,18 @@
/*!
{
"name": "CSS user-select",
"property": "userselect",
"caniuse": "user-select-none",
"authors": ["ryan seddon"],
"tags": ["css"],
"builderAliases": ["css_userselect"],
"notes": [{
"name": "Related Modernizr Issue",
"href": "https://github.com/Modernizr/Modernizr/issues/250"
}]
}
!*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
//https://github.com/Modernizr/Modernizr/issues/250
Modernizr.addTest('userselect', testAllProps('userSelect', 'none', true));
});
+22
View File
@@ -0,0 +1,22 @@
/*!
{
"name": "CSS :valid pseudo-class",
"property": "cssvalid",
"notes": [{
"name": "MDN Docs",
"href": "https://developer.mozilla.org/en-US/docs/Web/CSS/:valid"
}]
}
!*/
/* DOC
Detects support for the ':valid' CSS pseudo-class.
*/
define(['Modernizr', 'testStyles', 'createElement'], function(Modernizr, testStyles, createElement) {
Modernizr.addTest('cssvalid', function() {
return testStyles('#modernizr input{height:0;border:0;padding:0;margin:0;width:10px} #modernizr input:valid{width:50px}', function(elem) {
var input = createElement('input');
elem.appendChild(input);
return input.clientWidth > 10;
});
});
});
+18
View File
@@ -0,0 +1,18 @@
/*!
{
"name": "Variable Open Type Fonts",
"property": "variablefonts",
"authors": ["Patrick Kettner"],
"tags": ["css"],
"notes": [{
"name": "Variable fonts on the web",
"href": "https://webkit.org/blog/7051/variable-fonts-on-the-web/"
}, {
"name": "Variable fonts for responsive design",
"href": "https://alistapart.com/blog/post/variable-fonts-for-responsive-design"
}]
}
!*/
define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {
Modernizr.addTest('variablefonts', testAllProps('fontVariationSettings'));
});
+24
View File
@@ -0,0 +1,24 @@
/*!
{
"name": "CSS vh unit",
"property": "cssvhunit",
"caniuse": "viewport-units",
"tags": ["css"],
"builderAliases": ["css_vhunit"],
"notes": [{
"name": "Related Modernizr Issue",
"href": "https://github.com/Modernizr/Modernizr/issues/572"
},{
"name": "Similar JSFiddle",
"href": "https://jsfiddle.net/FWeinb/etnYC/"
}]
}
!*/
define(['Modernizr', 'testStyles', 'computedStyle', 'roundedEquals'], function(Modernizr, testStyles, computedStyle, roundedEquals) {
testStyles('#modernizr { height: 50vh; }', function(elem) {
var height = parseInt(window.innerHeight / 2, 10);
var compStyle = parseInt(computedStyle(elem, null, 'height'), 10);
Modernizr.addTest('cssvhunit', roundedEquals(compStyle, height));
});
});

Some files were not shown because too many files have changed in this diff Show More