forked from rahatool/runtime-system
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweb-browser-features-checklist.html
60 lines (54 loc) · 1.98 KB
/
web-browser-features-checklist.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<script type="text/javascript">
function unsupported(name, asserted = false) {
if (!asserted) {
document.write(`${name} is not supported.<br />`);
}
}
function tryFunction(name, value) {
try {
Function(value);
// document.write("+");
} catch (why) {
// document.write("-");
unsupported(name);
}
// document.write(name + "<br />");
}
tryFunction('GeneratorFunction', 'function* g(){}');
tryFunction('AsyncFunction', 'async function f(){}');
tryFunction('AsyncGeneratorFunction', 'async function* fg(){}');
tryFunction('EventTarget.constructor', 'new EventTarget');
tryFunction('BigInt', '1n');
tryFunction('for await', 'async function f(){for await (let item of []) {}}');
tryFunction('Static class fields', 'class C {static name = "value"}');
tryFunction('Dynamic class fields', 'class C {name = "value"}');
tryFunction('Generator arrow functions', 'let g = () =>* {}');
class bound {
}
tryFunction('Decorators', `class C {
@bound render() {
}
}`);
function tryReference(name) {
// document.write((window[name] ? '+' : '-') + name + "<br />");
unsupported(name, window[name]);
}
tryReference('DataTransferItem');
tryReference('DataTransferItemList');
tryReference('BroadcastChannel');
tryReference('VisualViewport');
tryReference('FontFace');
tryReference('customElements');
tryReference('IntersectionObserver');
tryReference('ResizeObserver');
function tryFeature(name, value) {
// document.write((value ? '+' : '-') + name + "<br />");
unsupported(name, value);
}
let dummyElement = document.createElement('div');
tryFeature('HTMLElement.prototype.animate', dummyElement.animate);
tryFeature('HTMLElement.prototype.attributeStyleMap', dummyElement.attributeStyleMap);
tryFeature('HTMLElement.prototype.computedStyleMap', dummyElement.computedStyleMap);
tryFeature('Set.prototype.difference(iterable)', (new Set).difference);
tryFeature('HTMLScriptElement.prototype.noModule', document.createElement('script').noModule == false);
</script>