@whitesev/domutils 1.4.4 → 1.4.6
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.amd.js +12 -8
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +12 -8
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +12 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +12 -8
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +12 -8
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +12 -8
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/DOMUtilsEvent.d.ts +6 -6
- package/package.json +1 -1
- package/src/DOMUtils.ts +1 -1
- package/src/DOMUtilsEvent.ts +53 -19
package/dist/index.cjs.js
CHANGED
|
@@ -276,7 +276,7 @@ class DOMUtilsEvent {
|
|
|
276
276
|
const selectorItem = selectorList[index];
|
|
277
277
|
if (eventTarget.matches(selectorItem)) {
|
|
278
278
|
/* 当前目标可以被selector所匹配到 */
|
|
279
|
-
listenerCallBack.call(eventTarget, event);
|
|
279
|
+
listenerCallBack.call(eventTarget, event, eventTarget);
|
|
280
280
|
checkOptionOnceToRemoveEventListener();
|
|
281
281
|
break;
|
|
282
282
|
}
|
|
@@ -285,12 +285,16 @@ class DOMUtilsEvent {
|
|
|
285
285
|
let $closestMatches = eventTarget.closest(selectorItem);
|
|
286
286
|
if ($closestMatches && totalParent.contains($closestMatches)) {
|
|
287
287
|
/* event的target值不能直接修改 */
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
288
|
+
// 这里尝试使用defineProperty修改event的target值
|
|
289
|
+
try {
|
|
290
|
+
OriginPrototype.Object.defineProperty(event, "target", {
|
|
291
|
+
get() {
|
|
292
|
+
return $closestMatches;
|
|
293
|
+
},
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
catch (error) { }
|
|
297
|
+
listenerCallBack.call($closestMatches, event, $closestMatches);
|
|
294
298
|
checkOptionOnceToRemoveEventListener();
|
|
295
299
|
break;
|
|
296
300
|
}
|
|
@@ -1030,7 +1034,7 @@ class DOMUtils extends DOMUtilsEvent {
|
|
|
1030
1034
|
super(option);
|
|
1031
1035
|
}
|
|
1032
1036
|
/** 版本号 */
|
|
1033
|
-
version = "2024.12.
|
|
1037
|
+
version = "2024.12.4";
|
|
1034
1038
|
attr(element, attrName, attrValue) {
|
|
1035
1039
|
let DOMUtilsContext = this;
|
|
1036
1040
|
if (typeof element === "string") {
|