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
+30
View File
@@ -0,0 +1,30 @@
/*!
{
"name": "bdi Element",
"property": "bdi",
"notes": [{
"name": "MDN Docs",
"href": "https://developer.mozilla.org/en-US/docs/Web/HTML/Element/bdi"
}]
}
!*/
/* DOC
Detect support for the bdi element, a way to have text that is isolated from its possibly bidirectional surroundings
*/
define(['Modernizr', 'createElement', 'docElement', 'computedStyle'], function(Modernizr, createElement, docElement, computedStyle) {
Modernizr.addTest('bdi', function() {
var div = createElement('div');
var bdi = createElement('bdi');
bdi.innerHTML = 'إ';
div.appendChild(bdi);
docElement.appendChild(div);
var supports = computedStyle(bdi, null, 'direction') === 'rtl';
docElement.removeChild(div);
return supports;
});
});
+23
View File
@@ -0,0 +1,23 @@
/*!
{
"name": "datalist Element",
"caniuse": "datalist",
"property": "datalistelem",
"tags": ["elem"],
"builderAliases": ["elem_datalist"],
"warnings": ["This test is a dupe of Modernizr.input.list. Only around for legacy reasons."],
"notes": [{
"name": "CSS Tricks Article",
"href": "https://css-tricks.com/relevant-dropdowns-polyfill-for-datalist/"
},{
"name": "Mike Taylor Code",
"href": "https://miketaylr.com/code/datalist.html"
}]
}
!*/
define(['Modernizr', 'test/input'], function(Modernizr) {
// lol. we already have a test for datalist built in! silly you.
// Leaving it around in case anyone's using it
Modernizr.addTest('datalistelem', Modernizr.input.list);
});
+35
View File
@@ -0,0 +1,35 @@
/*!
{
"name": "details Element",
"caniuse": "details",
"property": "details",
"tags": ["elem"],
"builderAliases": ["elem_details"],
"authors": ["@mathias"],
"notes": [{
"name": "Mathias' Original",
"href": "https://mathiasbynens.be/notes/html5-details-jquery#comment-35"
}]
}
!*/
define(['Modernizr', 'createElement', 'docElement', 'testStyles'], function(Modernizr, createElement, docElement, testStyles) {
Modernizr.addTest('details', function() {
var el = createElement('details');
var diff;
// return early if possible; thanks @aFarkas!
if (!('open' in el)) {
return false;
}
testStyles('#modernizr details{display:block}', function(node) {
node.appendChild(el);
el.innerHTML = '<summary>a</summary>b';
diff = el.offsetHeight;
el.open = true;
diff = diff !== el.offsetHeight;
});
return diff;
});
});
+15
View File
@@ -0,0 +1,15 @@
/*!
{
"name": "output Element",
"property": "outputelem",
"tags": ["elem"],
"builderAliases": ["elem_output"],
"notes": [{
"name": "WhatWG Spec",
"href": "https://html.spec.whatwg.org/multipage/form-elements.html#the-output-element"
}]
}
!*/
define(['Modernizr', 'createElement'], function(Modernizr, createElement) {
Modernizr.addTest('outputelem', 'value' in createElement('output'));
});
+18
View File
@@ -0,0 +1,18 @@
/*!
{
"name": "picture Element",
"property": "picture",
"tags": ["elem"],
"authors": ["Scott Jehl", "Mat Marquis"],
"notes": [{
"name": "WHATWG Spec",
"href": "https://html.spec.whatwg.org/multipage/embedded-content.html#embedded-content"
},{
"name": "Relevant spec issue",
"href": "https://github.com/ResponsiveImagesCG/picture-element/issues/87"
}]
}
!*/
define(['Modernizr'], function(Modernizr) {
Modernizr.addTest('picture', 'HTMLPictureElement' in window);
});
+17
View File
@@ -0,0 +1,17 @@
/*!
{
"name": "progress Element",
"caniuse": "progress",
"property": ["progressbar", "meter"],
"tags": ["elem"],
"builderAliases": ["elem_progress_meter"],
"authors": ["Stefan Wallin"]
}
!*/
define(['Modernizr', 'createElement'], function(Modernizr, createElement) {
// Tests for progressbar-support. All browsers that don't support progressbar returns undefined =)
Modernizr.addTest('progressbar', createElement('progress').max !== undefined);
// Tests for meter-support. All browsers that don't support meters returns undefined =)
Modernizr.addTest('meter', createElement('meter').max !== undefined);
});
+65
View File
@@ -0,0 +1,65 @@
/*!
{
"name": "ruby, rp, rt Elements",
"caniuse": "ruby",
"property": "ruby",
"tags": ["elem"],
"builderAliases": ["elem_ruby"],
"authors": ["Cătălin Mariș"],
"notes": [{
"name": "WHATWG Spec",
"href": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-ruby-element"
}]
}
!*/
define(['Modernizr', 'createElement', 'docElement'], function(Modernizr, createElement, docElement) {
Modernizr.addTest('ruby', function() {
var ruby = createElement('ruby');
var rt = createElement('rt');
var rp = createElement('rp');
var displayStyleProperty = 'display';
// 'fontSize' - because it`s only used for IE6 and IE7
var fontSizeStyleProperty = 'fontSize';
ruby.appendChild(rp);
ruby.appendChild(rt);
docElement.appendChild(ruby);
// browsers that support <ruby> hide the <rp> via "display:none"
if (getStyle(rp, displayStyleProperty) === 'none' || // for non-IE browsers
// but in IE browsers <rp> has "display:inline" so, the test needs other conditions:
getStyle(ruby, displayStyleProperty) === 'ruby' && getStyle(rt, displayStyleProperty) === 'ruby-text' || // for IE8+
getStyle(rp, fontSizeStyleProperty) === '6pt' && getStyle(rt, fontSizeStyleProperty) === '6pt') { // for IE6 & IE7
cleanUp();
return true;
} else {
cleanUp();
return false;
}
function getStyle(element, styleProperty) {
var result;
if (window.getComputedStyle) { // for non-IE browsers
result = document.defaultView.getComputedStyle(element, null).getPropertyValue(styleProperty);
} else if (element.currentStyle) { // for IE
result = element.currentStyle[styleProperty];
}
return result;
}
function cleanUp() {
docElement.removeChild(ruby);
// the removed child node still exists in memory, so ...
ruby = null;
rt = null;
rp = null;
}
});
});
+17
View File
@@ -0,0 +1,17 @@
/*!
{
"name": "Template Tag",
"property": "template",
"tags": ["elem"],
"notes": [{
"name": "HTML5Rocks Article",
"href": "https://www.html5rocks.com/en/tutorials/webcomponents/template/"
},{
"name": "W3C Spec",
"href": "https://web.archive.org/web/20171130222649/http://www.w3.org/TR/html5/scripting-1.html"
}]
}
!*/
define(['Modernizr', 'createElement'], function(Modernizr, createElement) {
Modernizr.addTest('template', 'content' in createElement('template'));
});
+15
View File
@@ -0,0 +1,15 @@
/*!
{
"name": "time Element",
"property": "time",
"tags": ["elem"],
"builderAliases": ["elem_time"],
"notes": [{
"name": "WHATWG Spec",
"href": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-time-element"
}]
}
!*/
define(['Modernizr', 'createElement'], function(Modernizr, createElement) {
Modernizr.addTest('time', 'valueAsDate' in createElement('time'));
});
+23
View File
@@ -0,0 +1,23 @@
/*!
{
"name": "Track element and Timed Text Track",
"property": ["texttrackapi", "track"],
"tags": ["elem"],
"builderAliases": ["elem_track"],
"authors": ["Addy Osmani"],
"notes": [{
"name": "W3C Spec (Track Element)",
"href": "https://web.archive.org/web/20121119095019/http://www.w3.org/TR/html5/the-track-element.html#the-track-element"
},{
"name": "W3C Spec (Track API)",
"href": "https://web.archive.org/web/20121119094620/http://www.w3.org/TR/html5/media-elements.html#text-track-api"
}],
"warnings": ["While IE10 has implemented the track element, IE10 does not expose the underlying APIs to create timed text tracks by JS (really sad)"]
}
!*/
define(['Modernizr', 'createElement'], function(Modernizr, createElement) {
Modernizr.addTest('texttrackapi', typeof (createElement('video').addTextTrack) === 'function');
// a more strict test for track including UI support: document.createElement('track').kind === 'subtitles'
Modernizr.addTest('track', 'kind' in createElement('track'));
});
+26
View File
@@ -0,0 +1,26 @@
/*!
{
"name": "Unknown Elements",
"property": "unknownelements",
"tags": ["elem"],
"notes": [{
"name": "The Story of the HTML5 Shiv",
"href": "https://www.paulirish.com/2011/the-history-of-the-html5-shiv/"
}, {
"name": "original implementation of detect code",
"href": "https://github.com/aFarkas/html5shiv/blob/bf4fcc4/src/html5shiv.js#L36"
}],
"polyfills": ["html5shiv"],
"authors": ["Ron Waldon (@jokeyrhyme)"]
}
!*/
/* DOC
Does the browser support HTML with non-standard / new elements?
*/
define(['Modernizr', 'createElement'], function(Modernizr, createElement) {
Modernizr.addTest('unknownelements', function() {
var a = createElement('a');
a.innerHTML = '<xyz></xyz>';
return a.childNodes.length === 1;
});
});