@whitesev/domutils 1.4.0 → 1.4.2
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 -6
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +12 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +12 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +12 -6
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +12 -6
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +12 -6
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/DOMUtilsEvent.d.ts +3 -0
- package/package.json +1 -1
- package/src/DOMUtilsEvent.ts +15 -6
package/dist/index.iife.js
CHANGED
|
@@ -936,8 +936,8 @@ var DOMUtils = (function () {
|
|
|
936
936
|
return $ele?.innerHTML?.trim() === "";
|
|
937
937
|
});
|
|
938
938
|
}
|
|
939
|
-
else if (selector.match(/[^\s]{1}:contains\("(.*)"\)$/
|
|
940
|
-
selector.match(/[^\s]{1}:contains\('(.*)'\)$/
|
|
939
|
+
else if (selector.match(/[^\s]{1}:contains\("(.*)"\)$/i) ||
|
|
940
|
+
selector.match(/[^\s]{1}:contains\('(.*)'\)$/i)) {
|
|
941
941
|
// contains 语法
|
|
942
942
|
let textMatch = selector.match(/:contains\(("|')(.*)("|')\)$/i);
|
|
943
943
|
let text = textMatch[2];
|
|
@@ -947,12 +947,18 @@ var DOMUtils = (function () {
|
|
|
947
947
|
return ($ele?.textContent || $ele?.innerText)?.includes(text);
|
|
948
948
|
});
|
|
949
949
|
}
|
|
950
|
-
else if (selector.match(/[^\s]{1}:regexp\("(.*)"\)$/
|
|
951
|
-
selector.match(/[^\s]{1}:regexp\('(.*)'\)$/
|
|
950
|
+
else if (selector.match(/[^\s]{1}:regexp\("(.*)"\)$/i) ||
|
|
951
|
+
selector.match(/[^\s]{1}:regexp\('(.*)'\)$/i)) {
|
|
952
952
|
// regexp 语法
|
|
953
953
|
let textMatch = selector.match(/:regexp\(("|')(.*)("|')\)$/i);
|
|
954
|
-
let
|
|
955
|
-
let
|
|
954
|
+
let pattern = textMatch[2];
|
|
955
|
+
let flagMatch = pattern.match(/("|'),[\s]*("|')([igm]{0,3})$/i);
|
|
956
|
+
let flags = "";
|
|
957
|
+
if (flagMatch) {
|
|
958
|
+
pattern = pattern.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi, "");
|
|
959
|
+
flags = flagMatch[3];
|
|
960
|
+
}
|
|
961
|
+
let regexp = new RegExp(pattern, flags);
|
|
956
962
|
selector = selector.replace(/:regexp\(("|')(.*)("|')\)$/gi, "");
|
|
957
963
|
return Array.from(context.windowApi.document.querySelectorAll(selector)).filter(($ele) => {
|
|
958
964
|
// @ts-ignore
|