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