Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added detection of type worker option and aspect ratio #2702

Merged
merged 7 commits into from
Oct 16, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
added detection of workeroption and aspectratio css property
  • Loading branch information
debadutta98 committed Sep 26, 2022
commit 195f1680b0386f0d1f83e0386217bccb4db45f8b
31 changes: 31 additions & 0 deletions feature-detects/css/aspectratio.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*!
{
"name": "aspectration css property",
debadutta98 marked this conversation as resolved.
Show resolved Hide resolved
"property": "aspectratio",
"tags": ["css aspectration", "aspect-ratio"],
debadutta98 marked this conversation as resolved.
Show resolved Hide resolved
"builderAliases": ["aspectratio"],
"authors": ["Debadutta Panda"],
"notes": [{
"name": "MDN Docs",
"href": "https://developer.mozilla.org/en-US/docs/Web/CSS/aspect-ratio"
}]
}
!*/
/* DOC
Detect working status of all aspectratio css property
*/
/**
debadutta98 marked this conversation as resolved.
Show resolved Hide resolved
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/aspect-ratio
*/
define(['Modernizr'], function (Modernizr) {
Modernizr.addTest("aspectratio", function () {
const element = document.createElement('p');
if ('aspectRatio' in element.style) {
element.remove();
return true;
} else {
element.remove();
return false;
}
});
});
56 changes: 56 additions & 0 deletions feature-detects/workers/workeroptions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*!
{
"name": "Worker options test",
"property": "workeroptions",
"tags": ["web worker", "worker options"],
"builderAliases": ["worker_options"],
"warnings": ["This test may output garbage to console."],
"authors": ["Debadutta Panda"],
"async": true,
"notes": [{
"name": "MDN Docs",
"href": "https://developer.mozilla.org/en-US/docs/Web/API/Worker/Worker"
}]
}
!*/
/* DOC
Detect working status of all Workeroptions
*/
/**
* @see https://developer.mozilla.org/en-US/docs/Web/API/Worker/Worker
*/
define(['Modernizr', 'addTest'], function (Modernizr, addTest) {
Modernizr.addAsyncTest(function (){
const workerOptions={
type:false,
credentials:false,
name:false
}
if ('Worker' in window){
const testOptions = {
get type() {
workerOptions.type = true;
return "module";
},
get credentials() {
workerOptions.credentials = true;
return "same-origin";
},
get name() {
workerOptions.name = true;
return "testworker";
},
};
try {
const worker = new Worker('blob://', testOptions);
worker.terminate();
} catch (err) {
//fallback massage
} finally {
addTest("workeroptions", workerOptions);
}
}else{
addTest("workeroptions", workerOptions);
}
});
})
2 changes: 2 additions & 0 deletions lib/config-all.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"css/all",
"css/animations",
"css/appearance",
"css/aspectratio",
"css/backdropfilter",
"css/backgroundblendmode",
"css/backgroundcliptext",
Expand Down Expand Up @@ -323,6 +324,7 @@
"workers/sharedworkers",
"workers/transferables",
"workers/webworkers",
"workers/workeroptions",
"xdomainrequest"
]
}
Loading