@whitesev/domutils 1.5.2 → 1.5.4

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.
package/dist/index.umd.js CHANGED
@@ -299,18 +299,20 @@
299
299
  let eventTarget = listenerOption.isComposedPath
300
300
  ? event.composedPath()[0]
301
301
  : event.target;
302
- let totalParent = DOMUtilsCommonUtils.isWin(elementItem)
302
+ let totalParent = DOMUtilsCommonUtils.isWin(elementItem) ||
303
+ // @ts-ignore
304
+ elementItem === DOMUtilsContext.windowApi.document
303
305
  ? DOMUtilsContext.windowApi.document.documentElement
304
306
  : elementItem;
305
307
  let findValue = selectorList.find((selectorItem) => {
306
308
  // 判断目标元素是否匹配选择器
307
- if (eventTarget.matches(selectorItem)) {
309
+ if (eventTarget?.matches(selectorItem)) {
308
310
  /* 当前目标可以被selector所匹配到 */
309
311
  return true;
310
312
  }
311
313
  /* 在上层与主元素之间寻找可以被selector所匹配到的 */
312
- let $closestMatches = eventTarget.closest(selectorItem);
313
- if ($closestMatches && totalParent.contains($closestMatches)) {
314
+ let $closestMatches = eventTarget?.closest(selectorItem);
315
+ if ($closestMatches && totalParent?.contains($closestMatches)) {
314
316
  eventTarget = $closestMatches;
315
317
  return true;
316
318
  }
@@ -1064,7 +1066,7 @@
1064
1066
  super(option);
1065
1067
  }
1066
1068
  /** 版本号 */
1067
- version = "2025.4.8";
1069
+ version = "2025.5.12";
1068
1070
  attr(element, attrName, attrValue) {
1069
1071
  let DOMUtilsContext = this;
1070
1072
  if (typeof element === "string") {
@@ -1208,7 +1210,8 @@
1208
1210
  return;
1209
1211
  }
1210
1212
  let setStyleProperty = (propertyName, propertyValue) => {
1211
- if (propertyValue === "string" && propertyValue.includes("!important")) {
1213
+ if (typeof propertyValue === "string" &&
1214
+ propertyValue.trim().endsWith("!important")) {
1212
1215
  propertyValue = propertyValue
1213
1216
  .trim()
1214
1217
  .replace(/!important$/gi, "")