@whitesev/utils 1.9.6 → 1.9.7
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 +8 -15
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +8 -15
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +8 -15
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +8 -15
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +8 -15
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +8 -15
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.amd.js
CHANGED
|
@@ -3817,7 +3817,9 @@ define((function () { 'use strict';
|
|
|
3817
3817
|
/* CODE FOR BROWSERS THAT SUPPORT window.find */
|
|
3818
3818
|
let windowFind = UtilsCore.self.find;
|
|
3819
3819
|
strFound = windowFind(str, caseSensitive, true, true, false);
|
|
3820
|
-
if (strFound &&
|
|
3820
|
+
if (strFound &&
|
|
3821
|
+
UtilsCore.self.getSelection &&
|
|
3822
|
+
!UtilsCore.self.getSelection().anchorNode) {
|
|
3821
3823
|
strFound = windowFind(str, caseSensitive, true, true, false);
|
|
3822
3824
|
}
|
|
3823
3825
|
if (!strFound) {
|
|
@@ -4889,7 +4891,8 @@ define((function () { 'use strict';
|
|
|
4889
4891
|
return result;
|
|
4890
4892
|
}
|
|
4891
4893
|
isThemeDark() {
|
|
4892
|
-
return UtilsCore.globalThis.matchMedia("(prefers-color-scheme: dark)")
|
|
4894
|
+
return UtilsCore.globalThis.matchMedia("(prefers-color-scheme: dark)")
|
|
4895
|
+
.matches;
|
|
4893
4896
|
}
|
|
4894
4897
|
isVisible(element, inView = false) {
|
|
4895
4898
|
let needCheckDomList = [];
|
|
@@ -5088,11 +5091,6 @@ define((function () { 'use strict';
|
|
|
5088
5091
|
}
|
|
5089
5092
|
mutationObserver(target, observer_config) {
|
|
5090
5093
|
let UtilsContext = this;
|
|
5091
|
-
if (!(target instanceof Node) &&
|
|
5092
|
-
!(target instanceof NodeList) &&
|
|
5093
|
-
!UtilsContext.isJQuery(target)) {
|
|
5094
|
-
throw new Error("Utils.mutationObserver 参数 target 必须为 Node|NodeList|jQuery类型");
|
|
5095
|
-
}
|
|
5096
5094
|
let default_obverser_config = {
|
|
5097
5095
|
/* 监听到元素有反馈,需执行的函数 */
|
|
5098
5096
|
callback: () => { },
|
|
@@ -5141,12 +5139,8 @@ define((function () { 'use strict';
|
|
|
5141
5139
|
let mutationObserver = new windowMutationObserver(function (mutations, observer) {
|
|
5142
5140
|
observer_config?.callback(mutations, observer);
|
|
5143
5141
|
});
|
|
5144
|
-
if (target instanceof
|
|
5145
|
-
|
|
5146
|
-
mutationObserver.observe(target, observer_config.config);
|
|
5147
|
-
}
|
|
5148
|
-
else if (target instanceof NodeList) {
|
|
5149
|
-
/* 传入的参数是节点元素数组 */
|
|
5142
|
+
if (Array.isArray(target) || target instanceof NodeList) {
|
|
5143
|
+
// 传入的是数组或者元素数组
|
|
5150
5144
|
target.forEach((item) => {
|
|
5151
5145
|
mutationObserver.observe(item, observer_config.config);
|
|
5152
5146
|
});
|
|
@@ -5158,8 +5152,7 @@ define((function () { 'use strict';
|
|
|
5158
5152
|
});
|
|
5159
5153
|
}
|
|
5160
5154
|
else {
|
|
5161
|
-
|
|
5162
|
-
console.error("Utils.mutationObserver 未知参数", arguments);
|
|
5155
|
+
mutationObserver.observe(target, observer_config.config);
|
|
5163
5156
|
}
|
|
5164
5157
|
if (observer_config.immediate) {
|
|
5165
5158
|
/* 主动触发一次 */
|