fix(common/js/event-safety): 修复dataset访问可能的空指针问题

使用可选链操作符避免target为null/undefined时访问dataset报错
This commit is contained in:
2026-07-18 11:58:09 +08:00
parent 74e53a9ca6
commit 018616dd0e

View File

@@ -44,7 +44,7 @@ export class EventSafety {
// 安全的方法
matches: (selector) => EventSafety.safeMatches(target, selector),
// 数据集
dataset: target.dataset || {}
dataset: target?.dataset || {}
}
return safeTarget