增加dialog支持判断
This commit is contained in:
parent
79f93ff04d
commit
2896892856
|
@ -1,16 +1,17 @@
|
|||
const unsupportFeatures = (()=>{
|
||||
const features = [
|
||||
{name: "Optional chaining (?.) / 可选链操作符(?.)", version:{firefox:74,chrome:80,safari:13.4}, url: "https://caniuse.com/mdn-javascript_operators_optional_chaining", test: ()=>!Boolean(eval("undefined?.undefined || true"))},
|
||||
{name: "Nullish coalescing operator (??) / 空值合并操作符(??)", version:{firefox:72,chrome:80,safari:13.4}, url: "https://caniuse.com/mdn-javascript_operators_nullish_coalescing", test: ()=>!Boolean(eval("undefined ?? true"))},
|
||||
{name: "BigInt value (1n) / BigInt 数据类型(1n)", version:{firefox:79,chrome:67,safari:14}, url: "https://caniuse.com/bigint", test: ()=>!Boolean(eval("1n"))},
|
||||
{name: "CSS selector: :is() / CSS选择器: :is()", version:{firefox:78,chrome:88,safari:14}, url: "https://caniuse.com/css-matches-pseudo", test: ()=>!Boolean(eval("document.querySelector(':is()') || true"))},
|
||||
{name: "CSS selector: :where() / CSS选择器: :where()", version:{firefox:78,chrome:88,safari:14}, url: "https://caniuse.com/mdn-css_selectors_where", test: ()=>!Boolean(eval("document.querySelector(':where()') || true"))},
|
||||
{name: "CSS selector: :not() / CSS选择器: :not()", version:{firefox:84,chrome:88,safari:9}, url: "https://caniuse.com/css-not-sel-list", test: ()=>!Boolean(eval("document.querySelector(':not(html)') || true"))},
|
||||
//{name: "Private class fields (#name) / 类私有域(#name)", version:{firefox:90,chrome:74,safari:14.5}, url: "https://caniuse.com/mdn-javascript_classes_private_class_fields", test: ()=>!Boolean(eval("class test {#v = 0;}; true;"))},
|
||||
{name: "Optional chaining (?.) / 可选链操作符(?.)", version:{firefox:74,chrome:80,safari:13.4}, url: "https://caniuse.com/mdn-javascript_operators_optional_chaining", test: ()=>Boolean(eval("undefined?.undefined || true"))},
|
||||
{name: "Nullish coalescing operator (??) / 空值合并操作符(??)", version:{firefox:72,chrome:80,safari:13.4}, url: "https://caniuse.com/mdn-javascript_operators_nullish_coalescing", test: ()=>Boolean(eval("undefined ?? true"))},
|
||||
{name: "BigInt value (1n) / BigInt 数据类型(1n)", version:{firefox:79,chrome:67,safari:14}, url: "https://caniuse.com/bigint", test: ()=>Boolean(eval("1n"))},
|
||||
{name: "CSS selector: :is() / CSS选择器: :is()", version:{firefox:78,chrome:88,safari:14}, url: "https://caniuse.com/css-matches-pseudo", test: ()=>Boolean(eval("document.querySelector(':is()') || true"))},
|
||||
{name: "CSS selector: :where() / CSS选择器: :where()", version:{firefox:78,chrome:88,safari:14}, url: "https://caniuse.com/mdn-css_selectors_where", test: ()=>Boolean(eval("document.querySelector(':where()') || true"))},
|
||||
{name: "CSS selector: :not() / CSS选择器: :not()", version:{firefox:84,chrome:88,safari:9}, url: "https://caniuse.com/css-not-sel-list", test: ()=>Boolean(eval("document.querySelector(':not(html)') || true"))},
|
||||
//{name: "Private class fields (#name) / 类私有域(#name)", version:{firefox:90,chrome:74,safari:14.5}, url: "https://caniuse.com/mdn-javascript_classes_private_class_fields", test: ()=>Boolean(eval("class test {#v = 0;}; true;"))},
|
||||
//{name: "Dialog element / Dialog 元素", version:{firefox:98,chrome:37,safari:15.4}, url: "https://caniuse.com/dialog", test: ()=>Boolean(eval("HTMLDialogElement"))},
|
||||
]
|
||||
return features.filter(feature=>{
|
||||
try {
|
||||
return feature.test();
|
||||
return !feature.test();
|
||||
} catch (e) {
|
||||
if (e.name !== 'SyntaxError') throw e // Throw the error if it is not a SyntaxError
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue