move ES6 feature detection from home1.css to home1.js

Combine the two inline script blocks into a single try/catch
using new Function() so old browsers fail gracefully.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Mark Eaton
2026-02-07 23:22:21 -05:00
co-authored by Claude Opus 4.6
parent 9b74aa26a8
commit 5a2bc3b4cb
2 changed files with 35 additions and 37 deletions
+35
View File
@@ -1,3 +1,38 @@
// ES6 feature detection
(function () {
window.isES6 = false;
try {
new Function([
"// Arrow functions",
"() => {};",
"",
"// Class support",
"class __ES6FeatureDetectionTest {}",
"",
"// Object initializer property and method shorthands",
"let es6a = true;",
"let es6b = {",
" es6a,",
" es6c() { return true; },",
" es6d: [1, 2, 3],",
"};",
"",
"// Object destructuring",
"let { es6c, es6d } = es6b;",
"",
"// Spread operator",
"let es6e = [...es6d, 4];",
"",
"// Ternary operator",
"let es6f = es6a ? 'ternary' : 'no ternary';",
"",
"// Nullish coalescing",
"es6a ??= 10;",
].join("\n"))();
window.isES6 = true;
} catch (e) {}
})();
const hamburgerComponent = {
template: `<div class="bigger-fancy-text">
<i v-bind:class="item.icon" aria-hidden="true"></i>