@whitesev/domutils 2.0.4 → 2.0.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/dist/index.amd.js +18 -28
- package/dist/index.amd.js.map +1 -1
- package/dist/index.amd.min.js +1 -1
- package/dist/index.amd.min.js.map +1 -1
- package/dist/index.cjs.js +18 -28
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.esm.js +18 -28
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.iife.js +18 -28
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.iife.min.js.map +1 -1
- package/dist/index.system.js +18 -28
- package/dist/index.system.js.map +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/dist/index.umd.js +18 -28
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/types/src/OriginPrototype.d.ts +1 -0
- package/package.json +5 -5
- package/src/ElementEvent.ts +16 -31
- package/src/OriginPrototype.ts +1 -0
package/src/ElementEvent.ts
CHANGED
|
@@ -173,22 +173,12 @@ class ElementEvent extends ElementAnimate {
|
|
|
173
173
|
if (typeof args[startIndex + 2] === "boolean") {
|
|
174
174
|
option.passive = args[startIndex + 2];
|
|
175
175
|
}
|
|
176
|
-
} else if (
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
"isComposedPath" in currentParam ||
|
|
183
|
-
"overrideTarget" in currentParam ||
|
|
184
|
-
"isPreventEvent" in currentParam)
|
|
185
|
-
) {
|
|
186
|
-
option.capture = currentParam.capture;
|
|
187
|
-
option.once = currentParam.once;
|
|
188
|
-
option.passive = currentParam.passive;
|
|
189
|
-
option.isComposedPath = currentParam.isComposedPath;
|
|
190
|
-
option.overrideTarget = currentParam.overrideTarget;
|
|
191
|
-
option.isPreventEvent = currentParam.isPreventEvent;
|
|
176
|
+
} else if (currentParam && typeof currentParam === "object") {
|
|
177
|
+
for (const key in option) {
|
|
178
|
+
if (Reflect.has(currentParam, key)) {
|
|
179
|
+
Reflect.set(option, key, currentParam[key as keyof typeof currentParam]);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
192
182
|
}
|
|
193
183
|
return option;
|
|
194
184
|
};
|
|
@@ -308,16 +298,16 @@ class ElementEvent extends ElementAnimate {
|
|
|
308
298
|
// 这里尝试使用defineProperty修改event的target值
|
|
309
299
|
try {
|
|
310
300
|
const originTarget = event.target;
|
|
311
|
-
OriginPrototype.Object.
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
301
|
+
OriginPrototype.Object.defineProperties(event, {
|
|
302
|
+
target: {
|
|
303
|
+
get() {
|
|
304
|
+
return $target;
|
|
305
|
+
},
|
|
315
306
|
},
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
return originTarget;
|
|
307
|
+
originTarget: {
|
|
308
|
+
get() {
|
|
309
|
+
return originTarget;
|
|
310
|
+
},
|
|
321
311
|
},
|
|
322
312
|
});
|
|
323
313
|
// oxlint-disable-next-line no-empty
|
|
@@ -521,12 +511,7 @@ class ElementEvent extends ElementAnimate {
|
|
|
521
511
|
const currentParam: boolean | DOMUtilsEventListenerOption = args1[startIndex];
|
|
522
512
|
if (typeof currentParam === "boolean") {
|
|
523
513
|
option.capture = currentParam;
|
|
524
|
-
} else if (
|
|
525
|
-
currentParam &&
|
|
526
|
-
typeof currentParam === "object" &&
|
|
527
|
-
currentParam != null &&
|
|
528
|
-
"capture" in currentParam
|
|
529
|
-
) {
|
|
514
|
+
} else if (currentParam && typeof currentParam === "object" && "capture" in currentParam) {
|
|
530
515
|
option.capture = currentParam.capture;
|
|
531
516
|
}
|
|
532
517
|
return option;
|