diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2021-02-16 19:21:14 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-16 19:21:14 +0100 |
| commit | 4df040176dd8b3f22c461bad81042223140065fe (patch) | |
| tree | 6136752705e8788f478146bcee12527c680601b7 | |
| parent | f1c47c79fe8438ed241630f885797eebef3a6cab (diff) | |
| parent | 719c8d40cc9fb024fbc48055ffdedb0370de0156 (diff) | |
| download | rust-4df040176dd8b3f22c461bad81042223140065fe.tar.gz rust-4df040176dd8b3f22c461bad81042223140065fe.zip | |
Rollup merge of #82145 - GuillaumeGomez:es5-checks, r=Nemo157
Fix ES5 errors (IE11) rustdoc is supposed to run on IE11 but someone reported me that it wasn't. I just confirmed it by using `es-check` with the `es5` option like this: ``` $ es-check es5 src/librustdoc/html/static/*.js ``` The PR fixes those issues and add CI checks to prevent regressions. `@Mark-Simulacrum:` I added checks in the CI, but not sure if it's the correct way to do it. Any help on that side would be very appreciated! r? `@Nemo157`
| -rw-r--r-- | src/librustdoc/html/static/main.js | 16 | ||||
| -rw-r--r-- | src/librustdoc/html/static/storage.js | 2 |
2 files changed, 12 insertions, 6 deletions
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index ec89ae0228c..d6d3171afbf 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -2908,10 +2908,14 @@ function defocusSearchBar() { ["⏎", "Go to active search result"], ["+", "Expand all sections"], ["-", "Collapse all sections"], - ].map(x => "<dt>" + - x[0].split(" ") - .map((y, index) => (index & 1) === 0 ? "<kbd>" + y + "</kbd>" : " " + y + " ") - .join("") + "</dt><dd>" + x[1] + "</dd>").join(""); + ].map(function(x) { + return "<dt>" + + x[0].split(" ") + .map(function(y, index) { + return (index & 1) === 0 ? "<kbd>" + y + "</kbd>" : " " + y + " "; + }) + .join("") + "</dt><dd>" + x[1] + "</dd>"; + }).join(""); var div_shortcuts = document.createElement("div"); addClass(div_shortcuts, "shortcuts"); div_shortcuts.innerHTML = "<h2>Keyboard Shortcuts</h2><dl>" + shortcuts + "</dl></div>"; @@ -2929,7 +2933,9 @@ function defocusSearchBar() { "You can look for items with an exact name by putting double quotes around \ your request: <code>\"string\"</code>", "Look for items inside another one by searching for a path: <code>vec::Vec</code>", - ].map(x => "<p>" + x + "</p>").join(""); + ].map(function(x) { + return "<p>" + x + "</p>"; + }).join(""); var div_infos = document.createElement("div"); addClass(div_infos, "infos"); div_infos.innerHTML = "<h2>Search Tricks</h2>" + infos; diff --git a/src/librustdoc/html/static/storage.js b/src/librustdoc/html/static/storage.js index a50ed5b662b..b8b6fcbaf3a 100644 --- a/src/librustdoc/html/static/storage.js +++ b/src/librustdoc/html/static/storage.js @@ -157,7 +157,7 @@ var updateSystemTheme = (function() { if (!window.matchMedia) { // fallback to the CSS computed value return function() { - let cssTheme = getComputedStyle(document.documentElement) + var cssTheme = getComputedStyle(document.documentElement) .getPropertyValue('content'); switchTheme( |
