@whitesev/domutils 1.4.4 → 1.4.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whitesev/domutils",
3
- "version": "1.4.4",
3
+ "version": "1.4.5",
4
4
  "description": "使用js重新对jQuery的部分函数进行了仿写",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
package/src/DOMUtils.ts CHANGED
@@ -20,7 +20,7 @@ class DOMUtils extends DOMUtilsEvent {
20
20
  super(option);
21
21
  }
22
22
  /** 版本号 */
23
- version = "2024.12.3";
23
+ version = "2024.12.4";
24
24
  /**
25
25
  * 获取元素的属性值
26
26
  * @param element 目标元素
@@ -276,11 +276,14 @@ export class DOMUtilsEvent {
276
276
  ) as HTMLElement | null;
277
277
  if ($closestMatches && totalParent.contains($closestMatches)) {
278
278
  /* event的target值不能直接修改 */
279
- OriginPrototype.Object.defineProperty(event, "target", {
280
- get() {
281
- return $closestMatches;
282
- },
283
- });
279
+ // 这里尝试使用defineProperty修改eventtarget
280
+ try {
281
+ OriginPrototype.Object.defineProperty(event, "target", {
282
+ get() {
283
+ return $closestMatches;
284
+ },
285
+ });
286
+ } catch (error) {}
284
287
  listenerCallBack.call($closestMatches, event as any);
285
288
  checkOptionOnceToRemoveEventListener();
286
289
  break;