Skip to content

Commit a196433

Browse files
committed
docs: support IE8+ for compat page
1 parent 207c190 commit a196433

File tree

10 files changed

+40
-97
lines changed

10 files changed

+40
-97
lines changed

docs/.vuepress/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default defineUserConfig({
3232
sidebar: sidebarZh,
3333
},
3434
},
35-
copyright: `&copy 2014-${new Date().getFullYear()} zloirock and contributors`,
35+
copyright: `© 2014-${new Date().getFullYear()} zloirock and contributors`,
3636
displayFooter: true,
3737
plugins: {
3838
blog: {

docs/.vuepress/layouts/Compat.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ onMounted(async () => {
9191
<CommonWrapper>
9292
<NormalPage>
9393
<template #contentAfter>
94-
<table class="theme-hope-content compat">
94+
<table class="theme-hope-content compat" id="table">
9595
<tr>
9696
<th>module</th>
9797
<th

docs/.vuepress/public/compat/browsers-runner.js

Lines changed: 0 additions & 88 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
window.onload = function () {
2+
var table = document.getElementById("table");
3+
var tests = window.tests;
4+
5+
for (var i = 1; i < table.childNodes[0].childNodes.length; i++) {
6+
var element = table.childNodes[0].childNodes[i];
7+
if (element.tagName !== "TR") continue;
8+
9+
var moduleName = element.firstChild.firstChild.innerHTML;
10+
var test = tests[moduleName];
11+
var result;
12+
try {
13+
if (typeof test == "function") {
14+
result = !!test();
15+
} else if (t !== undefined) {
16+
for (var t = 0; t < test.length; t++)
17+
result = !!result && !!test[t].call(undefined);
18+
}
19+
} catch (error) {
20+
result = false;
21+
}
22+
23+
element.childNodes[2].innerHTML =
24+
result === undefined
25+
? "no available test"
26+
: result
27+
? "not required"
28+
: "required";
29+
element.childNodes[2].className = result === undefined ? "nodata" : result;
30+
}
31+
};

docs/compat.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ head:
1212
src: /compat/tests.js
1313
- - script
1414
- nomodule: ""
15-
src: /compat/browsers-runner.js
15+
src: /compat/legacy-runner.js
1616
---
1717

1818
## About
1919

20-
`core-js` project provides (as [`core-js-compat`](/packages/core-js-compat) package) all required data about the necessity of `core-js` modules, entry points, and tools for work with it - it's useful for integration with tools like `babel` or `swc`. If you wanna help, you could take a look at the related section of [`CONTRIBUTING.md`](/CONTRIBUTING.md#how-to-update-core-js-compat-data). The visualization of compatibility data and the browser tests runner is available below
20+
`core-js` project provides (as [`core-js-compat`](/packages/core-js-compat) package) all required data about the necessity of `core-js` modules, entry points, and tools for work with it - it's useful for integration with tools like `babel` or `swc`. If you wanna help, you could take a look at the related section of [`CONTRIBUTING.md`](/dev/README.md#how-to-update-core-js-compat-data). The visualization of compatibility data and the browser tests runner is available below
2121

2222
Supported engines:
2323
::: details

docs/features/web-standard/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ APIs that aren't part of ES, but are provided by browsers and available to JS co
66

77
- [`structuredClone`](structured-clone.md)
88
- [Base64 utility methods](base64-utility-methods.md)
9-
- [`setTimeout` and `setInterval`](set-timeout%20and%20set-interval.md)
9+
- [`setTimeout` and `setInterval`](set-timeout-and-set-interval.md)
1010
- [`setImmediate`](set-immediate.md)
1111
- [`queueMicrotask`](queue-microtask.md)
1212
- [`URL` and `URLSearchParams`](url.md)
1313
- [`DOMException`](dom-exception.md)
14-
- [Iterable DOM collections](Iterable%20DOM%20collections.md)
14+
- [Iterable DOM collections](dom-collections.md)
File renamed without changes.

scripts/copy-compat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
await Promise.all(
2-
["browsers-runner.js", "compat-data.js", "tests.js"].map((file) =>
2+
["compat-data.js", "tests.js"].map((file) =>
33
fs.copy(`tests/compat/${file}`, `docs/.vuepress/public/compat/${file}`)
44
)
55
);

tests/compat/browsers-runner.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function createElement(name, props) {
44
return element;
55
}
66

7-
var table = document.getElementsByClassName('table')[0];
7+
var table = document.getElementById('table');
88
var tests = window.tests;
99
var data = window.data;
1010

tests/compat/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
text-align: center;
3333
}
3434
</style>
35-
<table class='table'></table>
35+
<table id='table'></table>
3636
<script src='./compat-data.js'></script>
3737
<script src='./tests.js'></script>
3838
<script src='./browsers-runner.js'></script>

0 commit comments

Comments
 (0)