Restore click handler logging + use logInfo for errors (SES-safe)

SES lockdown may suppress console.error. Use logInfo for error
reporting since we know it works ([sx-ref] prefix visible).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 21:57:44 +00:00
parent 3d191099e0
commit d1a47e1e52
3 changed files with 6 additions and 4 deletions

View File

@@ -14,7 +14,7 @@
// =========================================================================
var NIL = Object.freeze({ _nil: true, toString: function() { return "nil"; } });
var SX_VERSION = "2026-03-06T21:53:47Z";
var SX_VERSION = "2026-03-06T21:57:37Z";
function isNil(x) { return x === NIL || x === null || x === undefined; }
function isSxTruthy(x) { return x !== false && !isNil(x); }
@@ -1842,7 +1842,8 @@ return postSwap(target); });
var timer = NIL;
var lastVal = NIL;
var listenTarget = (isSxTruthy(get(mods, "from")) ? domQuery(get(mods, "from")) : el);
return (isSxTruthy(listenTarget) ? domAddListener(listenTarget, eventName, function(e) { return (function() {
return (isSxTruthy(listenTarget) ? domAddListener(listenTarget, eventName, function(e) { logInfo((String("sx:click ") + String(eventName) + String(" ") + String(domTagName(el)) + String(" href=") + String(domGetAttr(el, "href"))));
return (function() {
var shouldFire = true;
if (isSxTruthy(get(mods, "changed"))) {
(function() {
@@ -2994,7 +2995,7 @@ callExpr.push(dictGet(kwargs, k)); } }
if (opts.once || opts["once"]) o.once = true;
}
el.addEventListener(event, function(e) {
try { fn(e); } catch (err) { console.error("[sx-ref] event handler error:", event, err); }
try { fn(e); } catch (err) { logInfo("EVENT ERROR: " + event + " " + (err && err.message ? err.message : err)); console.error("[sx-ref] event handler error:", event, err); }
}, o);
}