@whitesev/domutils 1.5.2 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -296,18 +296,20 @@ var DOMUtils = (function () {
296
296
  let eventTarget = listenerOption.isComposedPath
297
297
  ? event.composedPath()[0]
298
298
  : event.target;
299
- let totalParent = DOMUtilsCommonUtils.isWin(elementItem)
299
+ let totalParent = DOMUtilsCommonUtils.isWin(elementItem) ||
300
+ // @ts-ignore
301
+ elementItem === DOMUtilsContext.windowApi.document
300
302
  ? DOMUtilsContext.windowApi.document.documentElement
301
303
  : elementItem;
302
304
  let findValue = selectorList.find((selectorItem) => {
303
305
  // 判断目标元素是否匹配选择器
304
- if (eventTarget.matches(selectorItem)) {
306
+ if (eventTarget?.matches(selectorItem)) {
305
307
  /* 当前目标可以被selector所匹配到 */
306
308
  return true;
307
309
  }
308
310
  /* 在上层与主元素之间寻找可以被selector所匹配到的 */
309
- let $closestMatches = eventTarget.closest(selectorItem);
310
- if ($closestMatches && totalParent.contains($closestMatches)) {
311
+ let $closestMatches = eventTarget?.closest(selectorItem);
312
+ if ($closestMatches && totalParent?.contains($closestMatches)) {
311
313
  eventTarget = $closestMatches;
312
314
  return true;
313
315
  }
@@ -1061,7 +1063,7 @@ var DOMUtils = (function () {
1061
1063
  super(option);
1062
1064
  }
1063
1065
  /** 版本号 */
1064
- version = "2025.4.8";
1066
+ version = "2025.4.23";
1065
1067
  attr(element, attrName, attrValue) {
1066
1068
  let DOMUtilsContext = this;
1067
1069
  if (typeof element === "string") {