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