Some checks are pending
CI / build-check-test (push) Waiting to run
- Add diagnostics.html page to test Lit event binding - Add SES protection script in index.html (runs before modules) - Force Vite dep optimization to prevent stale caches - Fixes for users with crypto wallet extensions (MetaMask etc.)
81 lines
No EOL
2.8 KiB
HTML
81 lines
No EOL
2.8 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head><title>JAE Diagnostics</title></head>
|
|
<body style="background:#111;color:#eee;font-family:monospace;padding:20px">
|
|
<h1>JAE Event Binding Diagnostics</h1>
|
|
<div id="results" style="white-space:pre;line-height:1.8"></div>
|
|
|
|
<script type="module">
|
|
import { html, render } from "/node_modules/lit/index.js";
|
|
|
|
const log = (msg, ok) => {
|
|
const el = document.getElementById("results");
|
|
el.innerHTML += `${ok ? "✅" : "❌"} ${msg}
|
|
`;
|
|
};
|
|
|
|
// Test 1: Check SES lockdown
|
|
const sesFrozen = Object.isFrozen(Object.prototype);
|
|
log(`SES Lockdown active: ${sesFrozen}`, !sesFrozen);
|
|
|
|
if (sesFrozen) {
|
|
log("⚠️ A browser extension (crypto wallet) has frozen JS intrinsics!", false);
|
|
log("⚠️ This BREAKS Lit event bindings. Disable crypto wallet extensions.", false);
|
|
}
|
|
|
|
// Test 2: Check EventTarget
|
|
const etFrozen = Object.isFrozen(EventTarget.prototype);
|
|
log(`EventTarget.prototype frozen: ${etFrozen}`, !etFrozen);
|
|
|
|
// Test 3: Basic Lit event binding
|
|
let clickWorked = false;
|
|
const container = document.createElement("div");
|
|
document.body.appendChild(container);
|
|
|
|
render(
|
|
html`<button id="test-btn" @click=${() => { clickWorked = true; }}
|
|
style="padding:10px 20px;background:#6d5acd;color:white;border:none;border-radius:8px;cursor:pointer;font-size:16px;margin-top:20px">
|
|
CLICK ME TO TEST
|
|
</button>`,
|
|
container
|
|
);
|
|
|
|
const btn = document.getElementById("test-btn");
|
|
if (btn) {
|
|
log("Lit rendered button element: yes", true);
|
|
// Try programmatic click
|
|
btn.click();
|
|
setTimeout(() => {
|
|
log(`Lit @click binding works: ${clickWorked}`, clickWorked);
|
|
if (!clickWorked) {
|
|
log("", false);
|
|
log("========================================", false);
|
|
log("DIAGNOSIS: Lit event bindings are BROKEN", false);
|
|
log("CAUSE: Likely SES lockdown from browser extension", false);
|
|
log("FIX: Open in Incognito mode or disable crypto wallet extensions", false);
|
|
log("========================================", false);
|
|
} else {
|
|
log("", true);
|
|
log("========================================", true);
|
|
log("Lit events work! The issue is elsewhere.", true);
|
|
log("========================================", true);
|
|
}
|
|
}, 100);
|
|
} else {
|
|
log("Lit rendered button element: no", false);
|
|
}
|
|
|
|
// Test 4: Plain DOM event
|
|
let plainClickWorked = false;
|
|
const plainBtn = document.createElement("button");
|
|
plainBtn.textContent = "Plain DOM Test";
|
|
plainBtn.style.cssText = "padding:10px 20px;background:#333;color:white;border:1px solid #555;border-radius:8px;cursor:pointer;font-size:14px;margin:10px";
|
|
plainBtn.addEventListener("click", () => { plainClickWorked = true; });
|
|
document.body.appendChild(plainBtn);
|
|
plainBtn.click();
|
|
setTimeout(() => {
|
|
log(`Plain DOM addEventListener works: ${plainClickWorked}`, plainClickWorked);
|
|
}, 50);
|
|
</script>
|
|
</body>
|
|
</html> |