@whitesev/domutils 1.6.5 → 1.6.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.cjs.js CHANGED
@@ -325,10 +325,8 @@ const DOMUtilsCommonUtils = {
325
325
  * 获取安全的html
326
326
  */
327
327
  getSafeHTML(text) {
328
- // @ts-ignore
329
- if (globalThis.trustedTypes) {
330
- // @ts-ignore
331
- const policy = globalThis.trustedTypes.createPolicy("safe-innerHTML", {
328
+ if (window.trustedTypes) {
329
+ const policy = window.trustedTypes.createPolicy("safe-innerHTML", {
332
330
  createHTML: (html) => html,
333
331
  });
334
332
  return policy.createHTML(text);
@@ -351,7 +349,7 @@ const DOMUtilsCommonUtils = {
351
349
  * @param element
352
350
  */
353
351
  showElement(element) {
354
- let dupNode = element.cloneNode(true);
352
+ const dupNode = element.cloneNode(true);
355
353
  dupNode.setAttribute("style", "visibility: hidden !important;display:block !important;");
356
354
  this.windowApi.document.documentElement.appendChild(dupNode);
357
355
  return {
@@ -382,7 +380,7 @@ const DOMUtilsCommonUtils = {
382
380
  }
383
381
  styles = view.getComputedStyle(element);
384
382
  }
385
- let value = parseFloat(styles[styleName]);
383
+ const value = parseFloat(styles[styleName]);
386
384
  if (isNaN(value)) {
387
385
  return 0;
388
386
  }
@@ -447,7 +445,7 @@ const DOMUtilsCommonUtils = {
447
445
  try {
448
446
  return setTimeout$1(callback, timeout);
449
447
  }
450
- catch (error) {
448
+ catch {
451
449
  return this.windowApi.setTimeout(callback, timeout);
452
450
  }
453
451
  },
@@ -460,7 +458,8 @@ const DOMUtilsCommonUtils = {
460
458
  clearTimeout$1(timeId);
461
459
  }
462
460
  }
463
- catch (error) {
461
+ catch {
462
+ // TODO
464
463
  }
465
464
  finally {
466
465
  this.windowApi.clearTimeout(timeId);
@@ -473,7 +472,7 @@ const DOMUtilsCommonUtils = {
473
472
  try {
474
473
  return setInterval$1(callback, timeout);
475
474
  }
476
- catch (error) {
475
+ catch {
477
476
  return this.windowApi.setInterval(callback, timeout);
478
477
  }
479
478
  },
@@ -486,7 +485,8 @@ const DOMUtilsCommonUtils = {
486
485
  clearInterval$1(timeId);
487
486
  }
488
487
  }
489
- catch (error) {
488
+ catch {
489
+ // TODO
490
490
  }
491
491
  finally {
492
492
  this.windowApi.clearInterval(timeId);
@@ -534,7 +534,7 @@ class DOMUtilsEvent {
534
534
  * @param option
535
535
  */
536
536
  function getOption(args, startIndex, option) {
537
- let currentParam = args[startIndex];
537
+ const currentParam = args[startIndex];
538
538
  if (typeof currentParam === "boolean") {
539
539
  option.capture = currentParam;
540
540
  if (typeof args[startIndex + 1] === "boolean") {
@@ -556,8 +556,9 @@ class DOMUtilsEvent {
556
556
  }
557
557
  return option;
558
558
  }
559
- let DOMUtilsContext = this;
560
- let args = arguments;
559
+ const DOMUtilsContext = this;
560
+ // eslint-disable-next-line prefer-rest-params
561
+ const args = arguments;
561
562
  if (typeof element === "string") {
562
563
  element = DOMUtilsContext.selectorAll(element);
563
564
  }
@@ -633,14 +634,14 @@ class DOMUtilsEvent {
633
634
  totalParent = DOMUtilsContext.windowApi.document.documentElement;
634
635
  }
635
636
  }
636
- let findValue = selectorList.find((selectorItem) => {
637
+ const findValue = selectorList.find((selectorItem) => {
637
638
  // 判断目标元素是否匹配选择器
638
639
  if (DOMUtilsContext.matches(eventTarget, selectorItem)) {
639
640
  /* 当前目标可以被selector所匹配到 */
640
641
  return true;
641
642
  }
642
643
  /* 在上层与主元素之间寻找可以被selector所匹配到的 */
643
- let $closestMatches = DOMUtilsContext.closest(eventTarget, selectorItem);
644
+ const $closestMatches = DOMUtilsContext.closest(eventTarget, selectorItem);
644
645
  if ($closestMatches && totalParent?.contains($closestMatches)) {
645
646
  eventTarget = $closestMatches;
646
647
  return true;
@@ -656,7 +657,9 @@ class DOMUtilsEvent {
656
657
  },
657
658
  });
658
659
  }
659
- catch (error) { }
660
+ catch {
661
+ // TODO
662
+ }
660
663
  listenerCallBack.call(eventTarget, event, eventTarget);
661
664
  checkOptionOnceToRemoveEventListener();
662
665
  }
@@ -671,7 +674,7 @@ class DOMUtilsEvent {
671
674
  eventTypeList.forEach((eventName) => {
672
675
  elementItem.addEventListener(eventName, domUtilsEventCallBack, listenerOption);
673
676
  /* 获取对象上的事件 */
674
- let elementEvents = Reflect.get(elementItem, DOMUtilsData.SymbolEvents) || {};
677
+ const elementEvents = Reflect.get(elementItem, DOMUtilsData.SymbolEvents) || {};
675
678
  /* 初始化对象上的xx事件 */
676
679
  elementEvents[eventName] = elementEvents[eventName] || [];
677
680
  elementEvents[eventName].push({
@@ -693,7 +696,7 @@ class DOMUtilsEvent {
693
696
  * @param option
694
697
  */
695
698
  function getOption(args1, startIndex, option) {
696
- let currentParam = args1[startIndex];
699
+ const currentParam = args1[startIndex];
697
700
  if (typeof currentParam === "boolean") {
698
701
  option.capture = currentParam;
699
702
  }
@@ -702,8 +705,9 @@ class DOMUtilsEvent {
702
705
  }
703
706
  return option;
704
707
  }
705
- let DOMUtilsContext = this;
706
- let args = arguments;
708
+ const DOMUtilsContext = this;
709
+ // eslint-disable-next-line prefer-rest-params
710
+ const args = arguments;
707
711
  if (typeof element === "string") {
708
712
  element = DOMUtilsContext.selectorAll(element);
709
713
  }
@@ -765,14 +769,14 @@ class DOMUtilsEvent {
765
769
  }
766
770
  elementList.forEach((elementItem) => {
767
771
  /* 获取对象上的事件 */
768
- let elementEvents = Reflect.get(elementItem, DOMUtilsData.SymbolEvents) || {};
772
+ const elementEvents = Reflect.get(elementItem, DOMUtilsData.SymbolEvents) || {};
769
773
  eventTypeList.forEach((eventName) => {
770
774
  let handlers = elementEvents[eventName] || [];
771
775
  if (typeof filter === "function") {
772
776
  handlers = handlers.filter(filter);
773
777
  }
774
778
  for (let index = 0; index < handlers.length; index++) {
775
- let handler = handlers[index];
779
+ const handler = handlers[index];
776
780
  let flag = true;
777
781
  if (flag && listenerCallBack && handler.originCallBack !== listenerCallBack) {
778
782
  // callback不同
@@ -807,7 +811,7 @@ class DOMUtilsEvent {
807
811
  * @param eventType (可选)需要取消监听的事件
808
812
  */
809
813
  offAll(element, eventType) {
810
- let DOMUtilsContext = this;
814
+ const DOMUtilsContext = this;
811
815
  if (typeof element === "string") {
812
816
  element = DOMUtilsContext.selectorAll(element);
813
817
  }
@@ -833,10 +837,10 @@ class DOMUtilsEvent {
833
837
  if (!symbolEvents.toString().startsWith("Symbol(events_")) {
834
838
  return;
835
839
  }
836
- let elementEvents = elementItem[symbolEvents] || {};
837
- let iterEventNameList = eventTypeList.length ? eventTypeList : Object.keys(elementEvents);
840
+ const elementEvents = elementItem[symbolEvents] || {};
841
+ const iterEventNameList = eventTypeList.length ? eventTypeList : Object.keys(elementEvents);
838
842
  iterEventNameList.forEach((eventName) => {
839
- let handlers = elementEvents[eventName];
843
+ const handlers = elementEvents[eventName];
840
844
  if (!handlers) {
841
845
  return;
842
846
  }
@@ -845,7 +849,7 @@ class DOMUtilsEvent {
845
849
  capture: handler["option"]["capture"],
846
850
  });
847
851
  }
848
- let events = Reflect.get(elementItem, symbolEvents);
852
+ const events = Reflect.get(elementItem, symbolEvents);
849
853
  DOMUtilsCommonUtils.delete(events, eventName);
850
854
  });
851
855
  });
@@ -863,7 +867,7 @@ class DOMUtilsEvent {
863
867
  if (typeof callback !== "function") {
864
868
  return;
865
869
  }
866
- let DOMUtilsContext = this;
870
+ const DOMUtilsContext = this;
867
871
  /**
868
872
  * 检测文档是否加载完毕
869
873
  */
@@ -878,7 +882,7 @@ class DOMUtilsEvent {
878
882
  return false;
879
883
  }
880
884
  }
881
- catch (error) {
885
+ catch {
882
886
  return false;
883
887
  }
884
888
  }
@@ -889,7 +893,7 @@ class DOMUtilsEvent {
889
893
  removeDomReadyListener();
890
894
  callback();
891
895
  }
892
- let targetList = [
896
+ const targetList = [
893
897
  {
894
898
  target: DOMUtilsContext.windowApi.document,
895
899
  eventType: "DOMContentLoaded",
@@ -906,7 +910,7 @@ class DOMUtilsEvent {
906
910
  */
907
911
  function addDomReadyListener() {
908
912
  for (let index = 0; index < targetList.length; index++) {
909
- let item = targetList[index];
913
+ const item = targetList[index];
910
914
  item.target.addEventListener(item.eventType, item.callback);
911
915
  }
912
916
  }
@@ -915,7 +919,7 @@ class DOMUtilsEvent {
915
919
  */
916
920
  function removeDomReadyListener() {
917
921
  for (let index = 0; index < targetList.length; index++) {
918
- let item = targetList[index];
922
+ const item = targetList[index];
919
923
  item.target.removeEventListener(item.eventType, item.callback);
920
924
  }
921
925
  }
@@ -943,7 +947,7 @@ class DOMUtilsEvent {
943
947
  * DOMUtils.trigger("a.xx",["click","tap","hover"])
944
948
  */
945
949
  trigger(element, eventType, details, useDispatchToTriggerEvent = true) {
946
- let DOMUtilsContext = this;
950
+ const DOMUtilsContext = this;
947
951
  if (typeof element === "string") {
948
952
  element = DOMUtilsContext.selectorAll(element);
949
953
  }
@@ -967,7 +971,7 @@ class DOMUtilsEvent {
967
971
  }
968
972
  elementList.forEach((elementItem) => {
969
973
  /* 获取对象上的事件 */
970
- let events = elementItem[DOMUtilsData.SymbolEvents] || {};
974
+ const events = elementItem[DOMUtilsData.SymbolEvents] || {};
971
975
  eventTypeList.forEach((_eventType_) => {
972
976
  let event = null;
973
977
  if (details && details instanceof Event) {
@@ -1007,7 +1011,7 @@ class DOMUtilsEvent {
1007
1011
  * })
1008
1012
  * */
1009
1013
  click(element, handler, details, useDispatchToTriggerEvent) {
1010
- let DOMUtilsContext = this;
1014
+ const DOMUtilsContext = this;
1011
1015
  if (typeof element === "string") {
1012
1016
  element = DOMUtilsContext.selectorAll(element);
1013
1017
  }
@@ -1043,7 +1047,7 @@ class DOMUtilsEvent {
1043
1047
  * })
1044
1048
  * */
1045
1049
  blur(element, handler, details, useDispatchToTriggerEvent) {
1046
- let DOMUtilsContext = this;
1050
+ const DOMUtilsContext = this;
1047
1051
  if (typeof element === "string") {
1048
1052
  element = DOMUtilsContext.selectorAll(element);
1049
1053
  }
@@ -1079,7 +1083,7 @@ class DOMUtilsEvent {
1079
1083
  * })
1080
1084
  * */
1081
1085
  focus(element, handler, details, useDispatchToTriggerEvent) {
1082
- let DOMUtilsContext = this;
1086
+ const DOMUtilsContext = this;
1083
1087
  if (typeof element === "string") {
1084
1088
  element = DOMUtilsContext.selectorAll(element);
1085
1089
  }
@@ -1115,7 +1119,7 @@ class DOMUtilsEvent {
1115
1119
  * })
1116
1120
  */
1117
1121
  hover(element, handler, option) {
1118
- let DOMUtilsContext = this;
1122
+ const DOMUtilsContext = this;
1119
1123
  if (typeof element === "string") {
1120
1124
  element = DOMUtilsContext.selectorAll(element);
1121
1125
  }
@@ -1139,7 +1143,7 @@ class DOMUtilsEvent {
1139
1143
  * @param option 配置项,这里默认配置once为true
1140
1144
  */
1141
1145
  animationend(element, handler, option) {
1142
- let DOMUtilsContext = this;
1146
+ const DOMUtilsContext = this;
1143
1147
  if (typeof element === "string") {
1144
1148
  element = DOMUtilsContext.selector(element);
1145
1149
  }
@@ -1174,7 +1178,7 @@ class DOMUtilsEvent {
1174
1178
  * @param option 配置项,这里默认配置once为true
1175
1179
  */
1176
1180
  transitionend(element, handler, option) {
1177
- let DOMUtilsContext = this;
1181
+ const DOMUtilsContext = this;
1178
1182
  if (typeof element === "string") {
1179
1183
  element = DOMUtilsContext.selector(element);
1180
1184
  }
@@ -1218,7 +1222,7 @@ class DOMUtilsEvent {
1218
1222
  * })
1219
1223
  */
1220
1224
  keyup(element, handler, option) {
1221
- let DOMUtilsContext = this;
1225
+ const DOMUtilsContext = this;
1222
1226
  if (element == null) {
1223
1227
  return;
1224
1228
  }
@@ -1250,7 +1254,7 @@ class DOMUtilsEvent {
1250
1254
  * })
1251
1255
  */
1252
1256
  keydown(element, handler, option) {
1253
- let DOMUtilsContext = this;
1257
+ const DOMUtilsContext = this;
1254
1258
  if (element == null) {
1255
1259
  return;
1256
1260
  }
@@ -1282,7 +1286,7 @@ class DOMUtilsEvent {
1282
1286
  * })
1283
1287
  */
1284
1288
  keypress(element, handler, option) {
1285
- let DOMUtilsContext = this;
1289
+ const DOMUtilsContext = this;
1286
1290
  if (element == null) {
1287
1291
  return;
1288
1292
  }
@@ -1299,80 +1303,80 @@ class DOMUtilsEvent {
1299
1303
  DOMUtilsContext.on(element, "keypress", null, handler, option);
1300
1304
  }
1301
1305
  /**
1302
- * 监听某个元素键盘按键事件或window全局按键事件
1303
- * 按下有值的键时触发,按下Ctrl\Alt\Shift\Meta是无值键。按下先触发keydown事件,再触发keypress事件。
1304
- * @param element 需要监听的对象,可以是全局Window或者某个元素
1305
- * @param eventName 事件名,默认keypress
1306
- * @param callback 自己定义的回调事件,参数1为当前的key,参数2为组合按键,数组类型,包含ctrl、shift、alt和meta(win键或mac的cmd键)
1307
- * @param options 监听事件的配置
1308
- * @example
1309
- Utils.listenKeyboard(window,(keyName,keyValue,otherKey,event)=>{
1310
- if(keyName === "Enter"){
1311
- console.log("回车按键的值是:"+keyValue)
1312
- }
1313
- if(otherKey.indexOf("ctrl") && keyName === "Enter" ){
1314
- console.log("Ctrl和回车键");
1315
- }
1316
- })
1317
- * @example
1318
- 字母和数字键的键码值(keyCode)
1319
- 按键 键码 按键 键码 按键 键码 按键 键码
1320
- A 65 J 74 S 83 1 49
1321
- B 66 K 75 T 84 2 50
1322
- C 67 L 76 U 85 3 51
1323
- D 68 M 77 V 86 4 52
1324
- E 69 N 78 W 87 5 53
1325
- F 70 O 79 X 88 6 54
1326
- G 71 P 80 Y 89 7 55
1327
- H 72 Q 81 Z 90 8 56
1328
- I 73 R 82 0 48 9 57
1329
-
1330
- 数字键盘上的键的键码值(keyCode)
1331
- 功能键键码值(keyCode)
1332
- 按键 键码 按键 键码 按键 键码 按键 键码
1333
- 0 96 8 104 F1 112 F7 118
1334
- 1 97 9 105 F2 113 F8 119
1335
- 2 98 * 106 F3 114 F9 120
1336
- 3 99 + 107 F4 115 F10 121
1337
- 4 100 Enter 108 F5 116 F11 122
1338
- 5 101 - 109 F6 117 F12 123
1339
- 6 102 . 110
1340
- 7 103 / 111
1341
-
1342
- 控制键键码值(keyCode)
1343
- 按键 键码 按键 键码 按键 键码 按键 键码
1344
- BackSpace 8 Esc 27 → 39 -_ 189
1345
- Tab 9 Spacebar 32 ↓ 40 .> 190
1346
- Clear 12 Page Up 33 Insert 45 /? 191
1347
- Enter 13 Page Down 34 Delete 46 `~ 192
1348
- Shift 16 End 35 Num Lock 144 [{ 219
1349
- Control 17 Home 36 ;: 186 \| 220
1350
- Alt 18 ← 37 =+ 187 ]} 221
1351
- Cape Lock 20 ↑ 38 ,< 188 '" 222
1352
-
1353
- 多媒体键码值(keyCode)
1354
- 按键 键码
1355
- 音量加 175
1356
- 音量减 174
1357
- 停止 179
1358
- 静音 173
1359
- 浏览器 172
1360
- 邮件 180
1361
- 搜索 170
1362
- 收藏 171
1363
- **/
1306
+ * 监听某个元素键盘按键事件或window全局按键事件
1307
+ * 按下有值的键时触发,按下Ctrl\Alt\Shift\Meta是无值键。按下先触发keydown事件,再触发keypress事件。
1308
+ * @param element 需要监听的对象,可以是全局Window或者某个元素
1309
+ * @param eventName 事件名,默认keypress
1310
+ * @param callback 自己定义的回调事件,参数1为当前的key,参数2为组合按键,数组类型,包含ctrl、shift、alt和meta(win键或mac的cmd键)
1311
+ * @param options 监听事件的配置
1312
+ * @example
1313
+ Utils.listenKeyboard(window,(keyName,keyValue,otherKey,event)=>{
1314
+ if(keyName === "Enter"){
1315
+ console.log("回车按键的值是:"+keyValue)
1316
+ }
1317
+ if(otherKey.indexOf("ctrl") && keyName === "Enter" ){
1318
+ console.log("Ctrl和回车键");
1319
+ }
1320
+ })
1321
+ * @example
1322
+ 字母和数字键的键码值(keyCode)
1323
+ 按键 键码 按键 键码 按键 键码 按键 键码
1324
+ A 65 J 74 S 83 1 49
1325
+ B 66 K 75 T 84 2 50
1326
+ C 67 L 76 U 85 3 51
1327
+ D 68 M 77 V 86 4 52
1328
+ E 69 N 78 W 87 5 53
1329
+ F 70 O 79 X 88 6 54
1330
+ G 71 P 80 Y 89 7 55
1331
+ H 72 Q 81 Z 90 8 56
1332
+ I 73 R 82 0 48 9 57
1333
+
1334
+ 数字键盘上的键的键码值(keyCode)
1335
+ 功能键键码值(keyCode)
1336
+ 按键 键码 按键 键码 按键 键码 按键 键码
1337
+ 0 96 8 104 F1 112 F7 118
1338
+ 1 97 9 105 F2 113 F8 119
1339
+ 2 98 * 106 F3 114 F9 120
1340
+ 3 99 + 107 F4 115 F10 121
1341
+ 4 100 Enter 108 F5 116 F11 122
1342
+ 5 101 - 109 F6 117 F12 123
1343
+ 6 102 . 110
1344
+ 7 103 / 111
1345
+
1346
+ 控制键键码值(keyCode)
1347
+ 按键 键码 按键 键码 按键 键码 按键 键码
1348
+ BackSpace 8 Esc 27 → 39 -_ 189
1349
+ Tab 9 Spacebar 32 ↓ 40 .> 190
1350
+ Clear 12 Page Up 33 Insert 45 /? 191
1351
+ Enter 13 Page Down 34 Delete 46 `~ 192
1352
+ Shift 16 End 35 Num Lock 144 [{ 219
1353
+ Control 17 Home 36 ;: 186 \| 220
1354
+ Alt 18 ← 37 =+ 187 ]} 221
1355
+ Cape Lock 20 ↑ 38 ,< 188 '" 222
1356
+
1357
+ 多媒体键码值(keyCode)
1358
+ 按键 键码
1359
+ 音量加 175
1360
+ 音量减 174
1361
+ 停止 179
1362
+ 静音 173
1363
+ 浏览器 172
1364
+ 邮件 180
1365
+ 搜索 170
1366
+ 收藏 171
1367
+ **/
1364
1368
  listenKeyboard(element, eventName = "keypress", callback, options) {
1365
- let DOMUtilsContext = this;
1369
+ const DOMUtilsContext = this;
1366
1370
  if (typeof element === "string") {
1367
1371
  element = DOMUtilsContext.selectorAll(element);
1368
1372
  }
1369
- let keyboardEventCallBack = function (event) {
1373
+ const keyboardEventCallBack = function (event) {
1370
1374
  /** 键名 */
1371
- let keyName = event.key || event.code;
1375
+ const keyName = event.key || event.code;
1372
1376
  /** 键值 */
1373
- let keyValue = event.charCode || event.keyCode || event.which;
1377
+ const keyValue = event.charCode || event.keyCode || event.which;
1374
1378
  /** 组合键列表 */
1375
- let otherCodeList = [];
1379
+ const otherCodeList = [];
1376
1380
  if (event.ctrlKey) {
1377
1381
  otherCodeList.push("ctrl");
1378
1382
  }
@@ -1410,29 +1414,27 @@ class DOMUtilsEvent {
1410
1414
  return $ele?.innerHTML?.trim() === "";
1411
1415
  });
1412
1416
  }
1413
- else if (selector.match(/[^\s]{1}:contains\("(.*)"\)$/i) ||
1414
- selector.match(/[^\s]{1}:contains\('(.*)'\)$/i)) {
1417
+ else if (selector.match(/[^\s]{1}:contains\("(.*)"\)$/i) || selector.match(/[^\s]{1}:contains\('(.*)'\)$/i)) {
1415
1418
  // contains 语法
1416
- let textMatch = selector.match(/:contains\(("|')(.*)("|')\)$/i);
1417
- let text = textMatch[2];
1419
+ const textMatch = selector.match(/:contains\(("|')(.*)("|')\)$/i);
1420
+ const text = textMatch[2];
1418
1421
  selector = selector.replace(/:contains\(("|')(.*)("|')\)$/gi, "");
1419
1422
  return Array.from(parent.querySelectorAll(selector)).filter(($ele) => {
1420
1423
  // @ts-ignore
1421
1424
  return ($ele?.textContent || $ele?.innerText)?.includes(text);
1422
1425
  });
1423
1426
  }
1424
- else if (selector.match(/[^\s]{1}:regexp\("(.*)"\)$/i) ||
1425
- selector.match(/[^\s]{1}:regexp\('(.*)'\)$/i)) {
1427
+ else if (selector.match(/[^\s]{1}:regexp\("(.*)"\)$/i) || selector.match(/[^\s]{1}:regexp\('(.*)'\)$/i)) {
1426
1428
  // regexp 语法
1427
- let textMatch = selector.match(/:regexp\(("|')(.*)("|')\)$/i);
1429
+ const textMatch = selector.match(/:regexp\(("|')(.*)("|')\)$/i);
1428
1430
  let pattern = textMatch[2];
1429
- let flagMatch = pattern.match(/("|'),[\s]*("|')([igm]{0,3})$/i);
1431
+ const flagMatch = pattern.match(/("|'),[\s]*("|')([igm]{0,3})$/i);
1430
1432
  let flags = "";
1431
1433
  if (flagMatch) {
1432
1434
  pattern = pattern.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi, "");
1433
1435
  flags = flagMatch[3];
1434
1436
  }
1435
- let regexp = new RegExp(pattern, flags);
1437
+ const regexp = new RegExp(pattern, flags);
1436
1438
  selector = selector.replace(/:regexp\(("|')(.*)("|')\)$/gi, "");
1437
1439
  return Array.from(parent.querySelectorAll(selector)).filter(($ele) => {
1438
1440
  // @ts-ignore
@@ -1475,11 +1477,10 @@ class DOMUtilsEvent {
1475
1477
  selector = selector.replace(/:empty$/gi, "");
1476
1478
  return $el.matches(selector) && $el?.innerHTML?.trim() === "";
1477
1479
  }
1478
- else if (selector.match(/[^\s]{1}:contains\("(.*)"\)$/i) ||
1479
- selector.match(/[^\s]{1}:contains\('(.*)'\)$/i)) {
1480
+ else if (selector.match(/[^\s]{1}:contains\("(.*)"\)$/i) || selector.match(/[^\s]{1}:contains\('(.*)'\)$/i)) {
1480
1481
  // contains 语法
1481
- let textMatch = selector.match(/:contains\(("|')(.*)("|')\)$/i);
1482
- let text = textMatch[2];
1482
+ const textMatch = selector.match(/:contains\(("|')(.*)("|')\)$/i);
1483
+ const text = textMatch[2];
1483
1484
  selector = selector.replace(/:contains\(("|')(.*)("|')\)$/gi, "");
1484
1485
  // @ts-ignore
1485
1486
  let content = $el?.textContent || $el?.innerText;
@@ -1488,18 +1489,17 @@ class DOMUtilsEvent {
1488
1489
  }
1489
1490
  return $el.matches(selector) && content?.includes(text);
1490
1491
  }
1491
- else if (selector.match(/[^\s]{1}:regexp\("(.*)"\)$/i) ||
1492
- selector.match(/[^\s]{1}:regexp\('(.*)'\)$/i)) {
1492
+ else if (selector.match(/[^\s]{1}:regexp\("(.*)"\)$/i) || selector.match(/[^\s]{1}:regexp\('(.*)'\)$/i)) {
1493
1493
  // regexp 语法
1494
- let textMatch = selector.match(/:regexp\(("|')(.*)("|')\)$/i);
1494
+ const textMatch = selector.match(/:regexp\(("|')(.*)("|')\)$/i);
1495
1495
  let pattern = textMatch[2];
1496
- let flagMatch = pattern.match(/("|'),[\s]*("|')([igm]{0,3})$/i);
1496
+ const flagMatch = pattern.match(/("|'),[\s]*("|')([igm]{0,3})$/i);
1497
1497
  let flags = "";
1498
1498
  if (flagMatch) {
1499
1499
  pattern = pattern.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi, "");
1500
1500
  flags = flagMatch[3];
1501
1501
  }
1502
- let regexp = new RegExp(pattern, flags);
1502
+ const regexp = new RegExp(pattern, flags);
1503
1503
  selector = selector.replace(/:regexp\(("|')(.*)("|')\)$/gi, "");
1504
1504
  // @ts-ignore
1505
1505
  let content = $el?.textContent || $el?.innerText;
@@ -1518,45 +1518,43 @@ class DOMUtilsEvent {
1518
1518
  if (selector.match(/[^\s]{1}:empty$/gi)) {
1519
1519
  // empty 语法
1520
1520
  selector = selector.replace(/:empty$/gi, "");
1521
- let $closest = $el?.closest(selector);
1521
+ const $closest = $el?.closest(selector);
1522
1522
  if ($closest && $closest?.innerHTML?.trim() === "") {
1523
1523
  return $closest;
1524
1524
  }
1525
1525
  return null;
1526
1526
  }
1527
- else if (selector.match(/[^\s]{1}:contains\("(.*)"\)$/i) ||
1528
- selector.match(/[^\s]{1}:contains\('(.*)'\)$/i)) {
1527
+ else if (selector.match(/[^\s]{1}:contains\("(.*)"\)$/i) || selector.match(/[^\s]{1}:contains\('(.*)'\)$/i)) {
1529
1528
  // contains 语法
1530
- let textMatch = selector.match(/:contains\(("|')(.*)("|')\)$/i);
1531
- let text = textMatch[2];
1529
+ const textMatch = selector.match(/:contains\(("|')(.*)("|')\)$/i);
1530
+ const text = textMatch[2];
1532
1531
  selector = selector.replace(/:contains\(("|')(.*)("|')\)$/gi, "");
1533
- let $closest = $el?.closest(selector);
1532
+ const $closest = $el?.closest(selector);
1534
1533
  if ($closest) {
1535
1534
  // @ts-ignore
1536
- let content = $el?.textContent || $el?.innerText;
1535
+ const content = $el?.textContent || $el?.innerText;
1537
1536
  if (typeof content === "string" && content.includes(text)) {
1538
1537
  return $closest;
1539
1538
  }
1540
1539
  }
1541
1540
  return null;
1542
1541
  }
1543
- else if (selector.match(/[^\s]{1}:regexp\("(.*)"\)$/i) ||
1544
- selector.match(/[^\s]{1}:regexp\('(.*)'\)$/i)) {
1542
+ else if (selector.match(/[^\s]{1}:regexp\("(.*)"\)$/i) || selector.match(/[^\s]{1}:regexp\('(.*)'\)$/i)) {
1545
1543
  // regexp 语法
1546
- let textMatch = selector.match(/:regexp\(("|')(.*)("|')\)$/i);
1544
+ const textMatch = selector.match(/:regexp\(("|')(.*)("|')\)$/i);
1547
1545
  let pattern = textMatch[2];
1548
- let flagMatch = pattern.match(/("|'),[\s]*("|')([igm]{0,3})$/i);
1546
+ const flagMatch = pattern.match(/("|'),[\s]*("|')([igm]{0,3})$/i);
1549
1547
  let flags = "";
1550
1548
  if (flagMatch) {
1551
1549
  pattern = pattern.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi, "");
1552
1550
  flags = flagMatch[3];
1553
1551
  }
1554
- let regexp = new RegExp(pattern, flags);
1552
+ const regexp = new RegExp(pattern, flags);
1555
1553
  selector = selector.replace(/:regexp\(("|')(.*)("|')\)$/gi, "");
1556
- let $closest = $el?.closest(selector);
1554
+ const $closest = $el?.closest(selector);
1557
1555
  if ($closest) {
1558
1556
  // @ts-ignore
1559
- let content = $el?.textContent || $el?.innerText;
1557
+ const content = $el?.textContent || $el?.innerText;
1560
1558
  if (typeof content === "string" && content.match(regexp)) {
1561
1559
  return $closest;
1562
1560
  }
@@ -1565,20 +1563,22 @@ class DOMUtilsEvent {
1565
1563
  }
1566
1564
  else {
1567
1565
  // 普通语法
1568
- let $closest = $el?.closest(selector);
1566
+ const $closest = $el?.closest(selector);
1569
1567
  return $closest;
1570
1568
  }
1571
1569
  }
1572
1570
  }
1573
1571
 
1572
+ const version = "1.6.6";
1573
+
1574
1574
  class DOMUtils extends DOMUtilsEvent {
1575
1575
  constructor(option) {
1576
1576
  super(option);
1577
1577
  }
1578
1578
  /** 版本号 */
1579
- version = "2025.8.11";
1579
+ version = version;
1580
1580
  attr(element, attrName, attrValue) {
1581
- let DOMUtilsContext = this;
1581
+ const DOMUtilsContext = this;
1582
1582
  if (typeof element === "string") {
1583
1583
  element = DOMUtilsContext.selectorAll(element);
1584
1584
  }
@@ -1605,24 +1605,6 @@ class DOMUtils extends DOMUtilsEvent {
1605
1605
  element.setAttribute(attrName, attrValue);
1606
1606
  }
1607
1607
  }
1608
- /**
1609
- * 创建元素
1610
- * @param tagName 标签名
1611
- * @param property 属性
1612
- * @param attributes 元素上的自定义属性
1613
- * @example
1614
- * // 创建一个DIV元素,且属性class为xxx
1615
- * DOMUtils.createElement("div",undefined,{ class:"xxx" });
1616
- * > <div class="xxx"></div>
1617
- * @example
1618
- * // 创建一个DIV元素
1619
- * DOMUtils.createElement("div");
1620
- * > <div></div>
1621
- * @example
1622
- * // 创建一个DIV元素
1623
- * DOMUtils.createElement("div","测试");
1624
- * > <div>测试</div>
1625
- */
1626
1608
  createElement(
1627
1609
  /** 元素名 */
1628
1610
  tagName,
@@ -1630,8 +1612,8 @@ class DOMUtils extends DOMUtilsEvent {
1630
1612
  property,
1631
1613
  /** 自定义属性 */
1632
1614
  attributes) {
1633
- let DOMUtilsContext = this;
1634
- let tempElement = DOMUtilsContext.windowApi.document.createElement(tagName);
1615
+ const DOMUtilsContext = this;
1616
+ const tempElement = DOMUtilsContext.windowApi.document.createElement(tagName);
1635
1617
  if (typeof property === "string") {
1636
1618
  DOMUtilsContext.html(tempElement, property);
1637
1619
  return tempElement;
@@ -1643,7 +1625,7 @@ class DOMUtils extends DOMUtilsEvent {
1643
1625
  attributes = {};
1644
1626
  }
1645
1627
  Object.keys(property).forEach((key) => {
1646
- let value = property[key];
1628
+ const value = property[key];
1647
1629
  if (key === "innerHTML") {
1648
1630
  DOMUtilsContext.html(tempElement, value);
1649
1631
  return;
@@ -1665,18 +1647,16 @@ class DOMUtils extends DOMUtilsEvent {
1665
1647
  return tempElement;
1666
1648
  }
1667
1649
  css(element, property, value) {
1668
- let DOMUtilsContext = this;
1650
+ const DOMUtilsContext = this;
1669
1651
  /**
1670
1652
  * 把纯数字没有px的加上
1671
1653
  */
1672
1654
  function handlePixe(propertyName, propertyValue) {
1673
- let allowAddPixe = ["width", "height", "top", "left", "right", "bottom", "font-size"];
1655
+ const allowAddPixe = ["width", "height", "top", "left", "right", "bottom", "font-size"];
1674
1656
  if (typeof propertyValue === "number") {
1675
1657
  propertyValue = propertyValue.toString();
1676
1658
  }
1677
- if (typeof propertyValue === "string" &&
1678
- allowAddPixe.includes(propertyName) &&
1679
- propertyValue.match(/[0-9]$/gi)) {
1659
+ if (typeof propertyValue === "string" && allowAddPixe.includes(propertyName) && propertyValue.match(/[0-9]$/gi)) {
1680
1660
  propertyValue = propertyValue + "px";
1681
1661
  }
1682
1662
  return propertyValue;
@@ -1708,10 +1688,9 @@ class DOMUtils extends DOMUtilsEvent {
1708
1688
  });
1709
1689
  return;
1710
1690
  }
1711
- else ;
1712
1691
  return;
1713
1692
  }
1714
- let setStyleProperty = (propertyName, propertyValue) => {
1693
+ const setStyleProperty = (propertyName, propertyValue) => {
1715
1694
  if (typeof propertyValue === "string" && propertyValue.trim().endsWith("!important")) {
1716
1695
  propertyValue = propertyValue
1717
1696
  .trim()
@@ -1733,8 +1712,8 @@ class DOMUtils extends DOMUtilsEvent {
1733
1712
  }
1734
1713
  }
1735
1714
  else if (typeof property === "object") {
1736
- for (let prop in property) {
1737
- let value = property[prop];
1715
+ for (const prop in property) {
1716
+ const value = property[prop];
1738
1717
  setStyleProperty(prop, value);
1739
1718
  }
1740
1719
  }
@@ -1744,7 +1723,7 @@ class DOMUtils extends DOMUtilsEvent {
1744
1723
  }
1745
1724
  }
1746
1725
  text(element, text) {
1747
- let DOMUtilsContext = this;
1726
+ const DOMUtilsContext = this;
1748
1727
  if (typeof element === "string") {
1749
1728
  element = DOMUtilsContext.selectorAll(element);
1750
1729
  }
@@ -1780,7 +1759,7 @@ class DOMUtils extends DOMUtilsEvent {
1780
1759
  }
1781
1760
  }
1782
1761
  html(element, html) {
1783
- let DOMUtilsContext = this;
1762
+ const DOMUtilsContext = this;
1784
1763
  if (typeof element === "string") {
1785
1764
  element = DOMUtilsContext.selectorAll(element);
1786
1765
  }
@@ -1818,19 +1797,19 @@ class DOMUtils extends DOMUtilsEvent {
1818
1797
  * 获取移动元素的transform偏移
1819
1798
  */
1820
1799
  getTransform(element, isShow = false) {
1821
- let DOMUtilsContext = this;
1800
+ const DOMUtilsContext = this;
1822
1801
  let transform_left = 0;
1823
1802
  let transform_top = 0;
1824
1803
  if (!(isShow || (!isShow && DOMUtilsCommonUtils.isShow(element)))) {
1825
1804
  /* 未显示 */
1826
- let { recovery } = DOMUtilsCommonUtils.showElement(element);
1827
- let transformInfo = DOMUtilsContext.getTransform(element, true);
1805
+ const { recovery } = DOMUtilsCommonUtils.showElement(element);
1806
+ const transformInfo = DOMUtilsContext.getTransform(element, true);
1828
1807
  recovery();
1829
1808
  return transformInfo;
1830
1809
  }
1831
- let elementTransform = DOMUtilsContext.windowApi.globalThis.getComputedStyle(element).transform;
1810
+ const elementTransform = DOMUtilsContext.windowApi.globalThis.getComputedStyle(element).transform;
1832
1811
  if (elementTransform != null && elementTransform !== "none" && elementTransform !== "") {
1833
- let elementTransformSplit = elementTransform.match(/\((.+)\)/)?.[1].split(",");
1812
+ const elementTransformSplit = elementTransform.match(/\((.+)\)/)?.[1].split(",");
1834
1813
  if (elementTransformSplit) {
1835
1814
  transform_left = Math.abs(parseInt(elementTransformSplit[4]));
1836
1815
  transform_top = Math.abs(parseInt(elementTransformSplit[5]));
@@ -1846,7 +1825,7 @@ class DOMUtils extends DOMUtilsEvent {
1846
1825
  };
1847
1826
  }
1848
1827
  val(element, value) {
1849
- let DOMUtilsContext = this;
1828
+ const DOMUtilsContext = this;
1850
1829
  if (typeof element === "string") {
1851
1830
  element = DOMUtilsContext.selectorAll(element);
1852
1831
  }
@@ -1886,7 +1865,7 @@ class DOMUtils extends DOMUtilsEvent {
1886
1865
  }
1887
1866
  }
1888
1867
  prop(element, propName, propValue) {
1889
- let DOMUtilsContext = this;
1868
+ const DOMUtilsContext = this;
1890
1869
  if (typeof element === "string") {
1891
1870
  element = DOMUtilsContext.selectorAll(element);
1892
1871
  }
@@ -1928,7 +1907,7 @@ class DOMUtils extends DOMUtilsEvent {
1928
1907
  * DOMUtils.removeAttr("a.xx","data-value")
1929
1908
  * */
1930
1909
  removeAttr(element, attrName) {
1931
- let DOMUtilsContext = this;
1910
+ const DOMUtilsContext = this;
1932
1911
  if (typeof element === "string") {
1933
1912
  element = DOMUtilsContext.selectorAll(element);
1934
1913
  }
@@ -1954,7 +1933,7 @@ class DOMUtils extends DOMUtilsEvent {
1954
1933
  * DOMUtils.removeClass("a.xx","xx")
1955
1934
  */
1956
1935
  removeClass(element, className) {
1957
- let DOMUtilsContext = this;
1936
+ const DOMUtilsContext = this;
1958
1937
  if (typeof element === "string") {
1959
1938
  element = DOMUtilsContext.selectorAll(element);
1960
1939
  }
@@ -1974,7 +1953,7 @@ class DOMUtils extends DOMUtilsEvent {
1974
1953
  }
1975
1954
  else {
1976
1955
  if (!Array.isArray(className)) {
1977
- className = className.split(" ");
1956
+ className = className.trim().split(" ");
1978
1957
  }
1979
1958
  className.forEach((itemClassName) => {
1980
1959
  element.classList.remove(itemClassName);
@@ -1991,7 +1970,7 @@ class DOMUtils extends DOMUtilsEvent {
1991
1970
  * DOMUtils.removeProp("a.xx","href")
1992
1971
  * */
1993
1972
  removeProp(element, propName) {
1994
- let DOMUtilsContext = this;
1973
+ const DOMUtilsContext = this;
1995
1974
  if (typeof element === "string") {
1996
1975
  element = DOMUtilsContext.selectorAll(element);
1997
1976
  }
@@ -2017,7 +1996,7 @@ class DOMUtils extends DOMUtilsEvent {
2017
1996
  * DOMUtils.replaceWith("a.xx",'<b class="xx"></b>')
2018
1997
  */
2019
1998
  replaceWith(element, newElement) {
2020
- let DOMUtilsContext = this;
1999
+ const DOMUtilsContext = this;
2021
2000
  if (typeof element === "string") {
2022
2001
  element = DOMUtilsContext.selectorAll(element);
2023
2002
  }
@@ -2034,7 +2013,7 @@ class DOMUtils extends DOMUtilsEvent {
2034
2013
  if (typeof newElement === "string") {
2035
2014
  newElement = DOMUtilsContext.parseHTML(newElement, false, false);
2036
2015
  }
2037
- let $parent = element.parentElement;
2016
+ const $parent = element.parentElement;
2038
2017
  if ($parent) {
2039
2018
  $parent.replaceChild(newElement, element);
2040
2019
  }
@@ -2053,7 +2032,7 @@ class DOMUtils extends DOMUtilsEvent {
2053
2032
  * DOMUtils.addClass("a.xx","_vue_")
2054
2033
  * */
2055
2034
  addClass(element, className) {
2056
- let DOMUtilsContext = this;
2035
+ const DOMUtilsContext = this;
2057
2036
  if (typeof element === "string") {
2058
2037
  element = DOMUtilsContext.selectorAll(element);
2059
2038
  }
@@ -2083,7 +2062,7 @@ class DOMUtils extends DOMUtilsEvent {
2083
2062
  * @param className
2084
2063
  */
2085
2064
  hasClass(element, className) {
2086
- let DOMUtilsContext = this;
2065
+ const DOMUtilsContext = this;
2087
2066
  if (typeof element === "string") {
2088
2067
  element = DOMUtilsContext.selectorAll(element);
2089
2068
  }
@@ -2122,7 +2101,7 @@ class DOMUtils extends DOMUtilsEvent {
2122
2101
  * DOMUtils.append("a.xx","'<b class="xx"></b>")
2123
2102
  * */
2124
2103
  append(element, content) {
2125
- let DOMUtilsContext = this;
2104
+ const DOMUtilsContext = this;
2126
2105
  if (typeof element === "string") {
2127
2106
  element = DOMUtilsContext.selectorAll(element);
2128
2107
  }
@@ -2154,7 +2133,7 @@ class DOMUtils extends DOMUtilsEvent {
2154
2133
  }
2155
2134
  if (Array.isArray(content) || content instanceof NodeList) {
2156
2135
  /* 数组 */
2157
- let fragment = DOMUtilsContext.windowApi.document.createDocumentFragment();
2136
+ const fragment = DOMUtilsContext.windowApi.document.createDocumentFragment();
2158
2137
  content.forEach((ele) => {
2159
2138
  if (typeof ele === "string") {
2160
2139
  // 转为元素
@@ -2178,7 +2157,7 @@ class DOMUtils extends DOMUtilsEvent {
2178
2157
  * DOMUtils.prepend("a.xx","'<b class="xx"></b>")
2179
2158
  * */
2180
2159
  prepend(element, content) {
2181
- let DOMUtilsContext = this;
2160
+ const DOMUtilsContext = this;
2182
2161
  if (typeof element === "string") {
2183
2162
  element = DOMUtilsContext.selectorAll(element);
2184
2163
  }
@@ -2202,7 +2181,7 @@ class DOMUtils extends DOMUtilsEvent {
2202
2181
  }
2203
2182
  }
2204
2183
  else {
2205
- let $firstChild = element.firstChild;
2184
+ const $firstChild = element.firstChild;
2206
2185
  if ($firstChild == null) {
2207
2186
  element.prepend(content);
2208
2187
  }
@@ -2221,7 +2200,7 @@ class DOMUtils extends DOMUtilsEvent {
2221
2200
  * DOMUtils.after("a.xx","'<b class="xx"></b>")
2222
2201
  * */
2223
2202
  after(element, content) {
2224
- let DOMUtilsContext = this;
2203
+ const DOMUtilsContext = this;
2225
2204
  if (typeof element === "string") {
2226
2205
  element = DOMUtilsContext.selectorAll(element);
2227
2206
  }
@@ -2239,8 +2218,8 @@ class DOMUtils extends DOMUtilsEvent {
2239
2218
  element.insertAdjacentHTML("afterend", DOMUtilsCommonUtils.getSafeHTML(content));
2240
2219
  }
2241
2220
  else {
2242
- let $parent = element.parentElement;
2243
- let $nextSlibling = element.nextSibling;
2221
+ const $parent = element.parentElement;
2222
+ const $nextSlibling = element.nextSibling;
2244
2223
  if (!$parent || $nextSlibling) {
2245
2224
  // 任意一个不行
2246
2225
  element.after(content);
@@ -2260,7 +2239,7 @@ class DOMUtils extends DOMUtilsEvent {
2260
2239
  * DOMUtils.before("a.xx","'<b class="xx"></b>")
2261
2240
  * */
2262
2241
  before(element, content) {
2263
- let DOMUtilsContext = this;
2242
+ const DOMUtilsContext = this;
2264
2243
  if (typeof element === "string") {
2265
2244
  element = DOMUtilsContext.selectorAll(element);
2266
2245
  }
@@ -2278,7 +2257,7 @@ class DOMUtils extends DOMUtilsEvent {
2278
2257
  element.insertAdjacentHTML("beforebegin", DOMUtilsCommonUtils.getSafeHTML(content));
2279
2258
  }
2280
2259
  else {
2281
- let $parent = element.parentElement;
2260
+ const $parent = element.parentElement;
2282
2261
  if (!$parent) {
2283
2262
  element.before(content);
2284
2263
  }
@@ -2297,7 +2276,7 @@ class DOMUtils extends DOMUtilsEvent {
2297
2276
  * DOMUtils.remove("a.xx")
2298
2277
  * */
2299
2278
  remove(element) {
2300
- let DOMUtilsContext = this;
2279
+ const DOMUtilsContext = this;
2301
2280
  if (typeof element === "string") {
2302
2281
  element = DOMUtilsContext.selectorAll(element);
2303
2282
  }
@@ -2329,7 +2308,7 @@ class DOMUtils extends DOMUtilsEvent {
2329
2308
  * DOMUtils.empty("a.xx")
2330
2309
  * */
2331
2310
  empty(element) {
2332
- let DOMUtilsContext = this;
2311
+ const DOMUtilsContext = this;
2333
2312
  if (typeof element === "string") {
2334
2313
  element = DOMUtilsContext.selectorAll(element);
2335
2314
  }
@@ -2360,14 +2339,14 @@ class DOMUtils extends DOMUtilsEvent {
2360
2339
  * > 0
2361
2340
  */
2362
2341
  offset(element) {
2363
- let DOMUtilsContext = this;
2342
+ const DOMUtilsContext = this;
2364
2343
  if (typeof element === "string") {
2365
2344
  element = DOMUtilsContext.selector(element);
2366
2345
  }
2367
2346
  if (element == null) {
2368
2347
  return;
2369
2348
  }
2370
- let rect = element.getBoundingClientRect();
2349
+ const rect = element.getBoundingClientRect();
2371
2350
  return {
2372
2351
  /** y轴偏移 */
2373
2352
  top: rect.top + DOMUtilsContext.windowApi.globalThis.scrollY,
@@ -2376,14 +2355,10 @@ class DOMUtils extends DOMUtilsEvent {
2376
2355
  };
2377
2356
  }
2378
2357
  width(element, isShow = false) {
2379
- let DOMUtilsContext = this;
2358
+ const DOMUtilsContext = this;
2380
2359
  if (typeof element === "string") {
2381
2360
  element = DOMUtilsContext.selector(element);
2382
2361
  }
2383
- if (element == null) {
2384
- // @ts-ignore
2385
- return;
2386
- }
2387
2362
  if (DOMUtilsCommonUtils.isWin(element)) {
2388
2363
  return DOMUtilsContext.windowApi.window.document.documentElement.clientWidth;
2389
2364
  }
@@ -2402,11 +2377,11 @@ class DOMUtils extends DOMUtilsEvent {
2402
2377
  }
2403
2378
  /* 如果从css里获取到的值不是大于0 可能是auto 则通过offsetWidth来进行计算 */
2404
2379
  if (element.offsetWidth > 0) {
2405
- let borderLeftWidth = DOMUtilsCommonUtils.getStyleValue(element, "borderLeftWidth");
2406
- let borderRightWidth = DOMUtilsCommonUtils.getStyleValue(element, "borderRightWidth");
2407
- let paddingLeft = DOMUtilsCommonUtils.getStyleValue(element, "paddingLeft");
2408
- let paddingRight = DOMUtilsCommonUtils.getStyleValue(element, "paddingRight");
2409
- let backHeight = parseFloat(element.offsetWidth.toString()) -
2380
+ const borderLeftWidth = DOMUtilsCommonUtils.getStyleValue(element, "borderLeftWidth");
2381
+ const borderRightWidth = DOMUtilsCommonUtils.getStyleValue(element, "borderRightWidth");
2382
+ const paddingLeft = DOMUtilsCommonUtils.getStyleValue(element, "paddingLeft");
2383
+ const paddingRight = DOMUtilsCommonUtils.getStyleValue(element, "paddingRight");
2384
+ const backHeight = parseFloat(element.offsetWidth.toString()) -
2410
2385
  parseFloat(borderLeftWidth.toString()) -
2411
2386
  parseFloat(borderRightWidth.toString()) -
2412
2387
  parseFloat(paddingLeft.toString()) -
@@ -2418,24 +2393,20 @@ class DOMUtils extends DOMUtilsEvent {
2418
2393
  else {
2419
2394
  /* 未显示 */
2420
2395
  element = element;
2421
- let { recovery } = DOMUtilsCommonUtils.showElement(element);
2422
- let width = DOMUtilsContext.width(element, true);
2396
+ const { recovery } = DOMUtilsCommonUtils.showElement(element);
2397
+ const width = DOMUtilsContext.width(element, true);
2423
2398
  recovery();
2424
2399
  return width;
2425
2400
  }
2426
2401
  }
2427
2402
  height(element, isShow = false) {
2428
- let DOMUtilsContext = this;
2403
+ const DOMUtilsContext = this;
2429
2404
  if (DOMUtilsCommonUtils.isWin(element)) {
2430
2405
  return DOMUtilsContext.windowApi.window.document.documentElement.clientHeight;
2431
2406
  }
2432
2407
  if (typeof element === "string") {
2433
2408
  element = DOMUtilsContext.selector(element);
2434
2409
  }
2435
- if (element == null) {
2436
- // @ts-ignore
2437
- return;
2438
- }
2439
2410
  if (element.nodeType === 9) {
2440
2411
  element = element;
2441
2412
  /* Document文档节点 */
@@ -2451,11 +2422,11 @@ class DOMUtils extends DOMUtilsEvent {
2451
2422
  }
2452
2423
  /* 如果从css里获取到的值不是大于0 可能是auto 则通过offsetHeight来进行计算 */
2453
2424
  if (element.offsetHeight > 0) {
2454
- let borderTopWidth = DOMUtilsCommonUtils.getStyleValue(element, "borderTopWidth");
2455
- let borderBottomWidth = DOMUtilsCommonUtils.getStyleValue(element, "borderBottomWidth");
2456
- let paddingTop = DOMUtilsCommonUtils.getStyleValue(element, "paddingTop");
2457
- let paddingBottom = DOMUtilsCommonUtils.getStyleValue(element, "paddingBottom");
2458
- let backHeight = parseFloat(element.offsetHeight.toString()) -
2425
+ const borderTopWidth = DOMUtilsCommonUtils.getStyleValue(element, "borderTopWidth");
2426
+ const borderBottomWidth = DOMUtilsCommonUtils.getStyleValue(element, "borderBottomWidth");
2427
+ const paddingTop = DOMUtilsCommonUtils.getStyleValue(element, "paddingTop");
2428
+ const paddingBottom = DOMUtilsCommonUtils.getStyleValue(element, "paddingBottom");
2429
+ const backHeight = parseFloat(element.offsetHeight.toString()) -
2459
2430
  parseFloat(borderTopWidth.toString()) -
2460
2431
  parseFloat(borderBottomWidth.toString()) -
2461
2432
  parseFloat(paddingTop.toString()) -
@@ -2467,60 +2438,52 @@ class DOMUtils extends DOMUtilsEvent {
2467
2438
  else {
2468
2439
  /* 未显示 */
2469
2440
  element = element;
2470
- let { recovery } = DOMUtilsCommonUtils.showElement(element);
2471
- let height = DOMUtilsContext.height(element, true);
2441
+ const { recovery } = DOMUtilsCommonUtils.showElement(element);
2442
+ const height = DOMUtilsContext.height(element, true);
2472
2443
  recovery();
2473
2444
  return height;
2474
2445
  }
2475
2446
  }
2476
2447
  outerWidth(element, isShow = false) {
2477
- let DOMUtilsContext = this;
2448
+ const DOMUtilsContext = this;
2478
2449
  if (DOMUtilsCommonUtils.isWin(element)) {
2479
2450
  return DOMUtilsContext.windowApi.window.innerWidth;
2480
2451
  }
2481
2452
  if (typeof element === "string") {
2482
2453
  element = DOMUtilsContext.selector(element);
2483
2454
  }
2484
- if (element == null) {
2485
- // @ts-ignore
2486
- return;
2487
- }
2488
2455
  element = element;
2489
2456
  if (isShow || (!isShow && DOMUtilsCommonUtils.isShow(element))) {
2490
- let style = DOMUtilsContext.windowApi.globalThis.getComputedStyle(element, null);
2491
- let marginLeft = DOMUtilsCommonUtils.getStyleValue(style, "marginLeft");
2492
- let marginRight = DOMUtilsCommonUtils.getStyleValue(style, "marginRight");
2457
+ const style = DOMUtilsContext.windowApi.globalThis.getComputedStyle(element, null);
2458
+ const marginLeft = DOMUtilsCommonUtils.getStyleValue(style, "marginLeft");
2459
+ const marginRight = DOMUtilsCommonUtils.getStyleValue(style, "marginRight");
2493
2460
  return element.offsetWidth + marginLeft + marginRight;
2494
2461
  }
2495
2462
  else {
2496
- let { recovery } = DOMUtilsCommonUtils.showElement(element);
2497
- let outerWidth = DOMUtilsContext.outerWidth(element, true);
2463
+ const { recovery } = DOMUtilsCommonUtils.showElement(element);
2464
+ const outerWidth = DOMUtilsContext.outerWidth(element, true);
2498
2465
  recovery();
2499
2466
  return outerWidth;
2500
2467
  }
2501
2468
  }
2502
2469
  outerHeight(element, isShow = false) {
2503
- let DOMUtilsContext = this;
2470
+ const DOMUtilsContext = this;
2504
2471
  if (DOMUtilsCommonUtils.isWin(element)) {
2505
2472
  return DOMUtilsContext.windowApi.window.innerHeight;
2506
2473
  }
2507
2474
  if (typeof element === "string") {
2508
2475
  element = DOMUtilsContext.selector(element);
2509
2476
  }
2510
- if (element == null) {
2511
- // @ts-ignore
2512
- return;
2513
- }
2514
2477
  element = element;
2515
2478
  if (isShow || (!isShow && DOMUtilsCommonUtils.isShow(element))) {
2516
- let style = DOMUtilsContext.windowApi.globalThis.getComputedStyle(element, null);
2517
- let marginTop = DOMUtilsCommonUtils.getStyleValue(style, "marginTop");
2518
- let marginBottom = DOMUtilsCommonUtils.getStyleValue(style, "marginBottom");
2479
+ const style = DOMUtilsContext.windowApi.globalThis.getComputedStyle(element, null);
2480
+ const marginTop = DOMUtilsCommonUtils.getStyleValue(style, "marginTop");
2481
+ const marginBottom = DOMUtilsCommonUtils.getStyleValue(style, "marginBottom");
2519
2482
  return element.offsetHeight + marginTop + marginBottom;
2520
2483
  }
2521
2484
  else {
2522
- let { recovery } = DOMUtilsCommonUtils.showElement(element);
2523
- let outerHeight = DOMUtilsContext.outerHeight(element, true);
2485
+ const { recovery } = DOMUtilsCommonUtils.showElement(element);
2486
+ const outerHeight = DOMUtilsContext.outerHeight(element, true);
2524
2487
  recovery();
2525
2488
  return outerHeight;
2526
2489
  }
@@ -2538,7 +2501,7 @@ class DOMUtils extends DOMUtilsEvent {
2538
2501
  * })
2539
2502
  */
2540
2503
  animate(element, styles, duration = 1000, callback = null) {
2541
- let DOMUtilsContext = this;
2504
+ const DOMUtilsContext = this;
2542
2505
  if (typeof element === "string") {
2543
2506
  element = DOMUtilsContext.selectorAll(element);
2544
2507
  }
@@ -2564,21 +2527,20 @@ class DOMUtils extends DOMUtilsEvent {
2564
2527
  if (Object.keys(styles).length === 0) {
2565
2528
  throw new Error("styles must contain at least one property");
2566
2529
  }
2567
- let start = performance.now();
2568
- let from = {};
2569
- let to = {};
2570
- for (let prop in styles) {
2571
- from[prop] =
2572
- element.style[prop] || DOMUtilsContext.windowApi.globalThis.getComputedStyle(element)[prop];
2530
+ const start = performance.now();
2531
+ const from = {};
2532
+ const to = {};
2533
+ for (const prop in styles) {
2534
+ from[prop] = element.style[prop] || DOMUtilsContext.windowApi.globalThis.getComputedStyle(element)[prop];
2573
2535
  to[prop] = styles[prop];
2574
2536
  }
2575
- let timer = DOMUtilsCommonUtils.setInterval(function () {
2576
- let timePassed = performance.now() - start;
2537
+ const timer = DOMUtilsCommonUtils.setInterval(function () {
2538
+ const timePassed = performance.now() - start;
2577
2539
  let progress = timePassed / duration;
2578
2540
  if (progress > 1) {
2579
2541
  progress = 1;
2580
2542
  }
2581
- for (let prop in styles) {
2543
+ for (const prop in styles) {
2582
2544
  element.style[prop] = from[prop] + (to[prop] - from[prop]) * progress + "px";
2583
2545
  }
2584
2546
  if (progress === 1) {
@@ -2598,7 +2560,7 @@ class DOMUtils extends DOMUtilsEvent {
2598
2560
  * DOMUtils.wrap(document.querySelector("a.xx"),"<div></div>")
2599
2561
  */
2600
2562
  wrap(element, wrapperHTML) {
2601
- let DOMUtilsContext = this;
2563
+ const DOMUtilsContext = this;
2602
2564
  if (typeof element === "string") {
2603
2565
  element = DOMUtilsContext.selectorAll(element);
2604
2566
  }
@@ -2614,17 +2576,17 @@ class DOMUtils extends DOMUtilsEvent {
2614
2576
  }
2615
2577
  element = element;
2616
2578
  // 创建一个新的div元素,并将wrapperHTML作为其innerHTML
2617
- let wrapper = DOMUtilsContext.windowApi.document.createElement("div");
2579
+ const wrapper = DOMUtilsContext.windowApi.document.createElement("div");
2618
2580
  DOMUtilsContext.html(wrapper, wrapperHTML);
2619
- let wrapperFirstChild = wrapper.firstChild;
2581
+ const wrapperFirstChild = wrapper.firstChild;
2620
2582
  // 将要包裹的元素插入目标元素前面
2621
- let parentElement = element.parentElement;
2583
+ const parentElement = element.parentElement;
2622
2584
  parentElement.insertBefore(wrapperFirstChild, element);
2623
2585
  // 将要包裹的元素移动到wrapper中
2624
2586
  wrapperFirstChild.appendChild(element);
2625
2587
  }
2626
2588
  prev(element) {
2627
- let DOMUtilsContext = this;
2589
+ const DOMUtilsContext = this;
2628
2590
  if (typeof element === "string") {
2629
2591
  element = DOMUtilsContext.selector(element);
2630
2592
  }
@@ -2634,7 +2596,7 @@ class DOMUtils extends DOMUtilsEvent {
2634
2596
  return element.previousElementSibling;
2635
2597
  }
2636
2598
  next(element) {
2637
- let DOMUtilsContext = this;
2599
+ const DOMUtilsContext = this;
2638
2600
  if (typeof element === "string") {
2639
2601
  element = DOMUtilsContext.selector(element);
2640
2602
  }
@@ -2649,7 +2611,7 @@ class DOMUtils extends DOMUtilsEvent {
2649
2611
  * let DOMUtils = window.DOMUtils.noConflict()
2650
2612
  */
2651
2613
  noConflict() {
2652
- let DOMUtilsContext = this;
2614
+ const DOMUtilsContext = this;
2653
2615
  if (DOMUtilsContext.windowApi.window.DOMUtils) {
2654
2616
  DOMUtilsCommonUtils.delete(window, "DOMUtils");
2655
2617
  }
@@ -2657,7 +2619,7 @@ class DOMUtils extends DOMUtilsEvent {
2657
2619
  return this;
2658
2620
  }
2659
2621
  siblings(element) {
2660
- let DOMUtilsContext = this;
2622
+ const DOMUtilsContext = this;
2661
2623
  if (typeof element === "string") {
2662
2624
  element = DOMUtilsContext.selector(element);
2663
2625
  }
@@ -2677,7 +2639,7 @@ class DOMUtils extends DOMUtilsEvent {
2677
2639
  * > <div ...>....</div>
2678
2640
  */
2679
2641
  parent(element) {
2680
- let DOMUtilsContext = this;
2642
+ const DOMUtilsContext = this;
2681
2643
  if (typeof element === "string") {
2682
2644
  element = DOMUtilsContext.selector(element);
2683
2645
  }
@@ -2685,7 +2647,7 @@ class DOMUtils extends DOMUtilsEvent {
2685
2647
  return;
2686
2648
  }
2687
2649
  if (DOMUtilsCommonUtils.isNodeList(element)) {
2688
- let resultArray = [];
2650
+ const resultArray = [];
2689
2651
  element.forEach(($ele) => {
2690
2652
  resultArray.push(DOMUtilsContext.parent($ele));
2691
2653
  });
@@ -2696,11 +2658,11 @@ class DOMUtils extends DOMUtilsEvent {
2696
2658
  }
2697
2659
  }
2698
2660
  parseHTML(html, useParser = false, isComplete = false) {
2699
- let DOMUtilsContext = this;
2661
+ const DOMUtilsContext = this;
2700
2662
  // 去除html前后的空格
2701
2663
  html = html.trim();
2702
2664
  function parseHTMLByDOMParser() {
2703
- let parser = new DOMParser();
2665
+ const parser = new DOMParser();
2704
2666
  if (isComplete) {
2705
2667
  return parser.parseFromString(html, "text/html");
2706
2668
  }
@@ -2709,7 +2671,7 @@ class DOMUtils extends DOMUtilsEvent {
2709
2671
  }
2710
2672
  }
2711
2673
  function parseHTMLByCreateDom() {
2712
- let tempDIV = DOMUtilsContext.windowApi.document.createElement("div");
2674
+ const tempDIV = DOMUtilsContext.windowApi.document.createElement("div");
2713
2675
  DOMUtilsContext.html(tempDIV, html);
2714
2676
  if (isComplete) {
2715
2677
  return tempDIV;
@@ -2734,7 +2696,7 @@ class DOMUtils extends DOMUtilsEvent {
2734
2696
  */
2735
2697
  serialize($form) {
2736
2698
  const elements = $form.elements;
2737
- let serializedArray = [];
2699
+ const serializedArray = [];
2738
2700
  for (let i = 0; i < elements.length; i++) {
2739
2701
  const element = elements[i];
2740
2702
  if (element.name &&
@@ -2773,7 +2735,7 @@ class DOMUtils extends DOMUtilsEvent {
2773
2735
  * DOMUtils.show("a.xx")
2774
2736
  */
2775
2737
  show(target, checkVisiblie = true) {
2776
- let DOMUtilsContext = this;
2738
+ const DOMUtilsContext = this;
2777
2739
  if (target == null) {
2778
2740
  return;
2779
2741
  }
@@ -2810,7 +2772,7 @@ class DOMUtils extends DOMUtilsEvent {
2810
2772
  * DOMUtils.hide("a.xx")
2811
2773
  */
2812
2774
  hide(target, checkVisiblie = true) {
2813
- let DOMUtilsContext = this;
2775
+ const DOMUtilsContext = this;
2814
2776
  if (target == null) {
2815
2777
  return;
2816
2778
  }
@@ -2852,7 +2814,7 @@ class DOMUtils extends DOMUtilsEvent {
2852
2814
  if (element == null) {
2853
2815
  return;
2854
2816
  }
2855
- let DOMUtilsContext = this;
2817
+ const DOMUtilsContext = this;
2856
2818
  if (typeof element === "string") {
2857
2819
  element = DOMUtilsContext.selectorAll(element);
2858
2820
  }
@@ -2870,7 +2832,7 @@ class DOMUtils extends DOMUtilsEvent {
2870
2832
  function step(timestamp) {
2871
2833
  if (!start)
2872
2834
  start = timestamp;
2873
- let progress = timestamp - start;
2835
+ const progress = timestamp - start;
2874
2836
  element = element;
2875
2837
  element.style.opacity = Math.min(progress / duration, 1).toString();
2876
2838
  if (progress < duration) {
@@ -2900,7 +2862,7 @@ class DOMUtils extends DOMUtilsEvent {
2900
2862
  * })
2901
2863
  */
2902
2864
  fadeOut(element, duration = 400, callback) {
2903
- let DOMUtilsContext = this;
2865
+ const DOMUtilsContext = this;
2904
2866
  if (element == null) {
2905
2867
  return;
2906
2868
  }
@@ -2920,7 +2882,7 @@ class DOMUtils extends DOMUtilsEvent {
2920
2882
  function step(timestamp) {
2921
2883
  if (!start)
2922
2884
  start = timestamp;
2923
- let progress = timestamp - start;
2885
+ const progress = timestamp - start;
2924
2886
  element = element;
2925
2887
  element.style.opacity = Math.max(1 - progress / duration, 0).toString();
2926
2888
  if (progress < duration) {
@@ -2946,7 +2908,7 @@ class DOMUtils extends DOMUtilsEvent {
2946
2908
  * DOMUtils.toggle("a.xx")
2947
2909
  */
2948
2910
  toggle(element, checkVisiblie) {
2949
- let DOMUtilsContext = this;
2911
+ const DOMUtilsContext = this;
2950
2912
  if (typeof element === "string") {
2951
2913
  element = DOMUtilsContext.selectorAll(element);
2952
2914
  }
@@ -2984,7 +2946,7 @@ class DOMUtils extends DOMUtilsEvent {
2984
2946
  * DOMUtils.getTextBoundingRect(document.querySelector("input"));
2985
2947
  */
2986
2948
  getTextBoundingRect($input, selectionStart, selectionEnd) {
2987
- let DOMUtilsContext = this;
2949
+ const DOMUtilsContext = this;
2988
2950
  // Basic parameter validation
2989
2951
  if (!$input || !("value" in $input))
2990
2952
  return $input;
@@ -3013,18 +2975,20 @@ class DOMUtils extends DOMUtilsEvent {
3013
2975
  else
3014
2976
  selectionEnd = Math.min($input.value.length, selectionEnd);
3015
2977
  // If available (thus IE), use the createTextRange method
3016
- // @ts-ignore
3017
2978
  if (typeof $input.createTextRange == "function") {
3018
- let range = $input.createTextRange();
2979
+ const range = $input.createTextRange();
3019
2980
  range.collapse(true);
3020
2981
  range.moveStart("character", selectionStart);
3021
2982
  range.moveEnd("character", selectionEnd - selectionStart);
3022
2983
  return range.getBoundingClientRect();
3023
2984
  }
3024
2985
  // createTextRange is not supported, create a fake text range
3025
- let offset = getInputOffset(), topPos = offset.top, leftPos = offset.left, width = getInputCSS("width", true), height = getInputCSS("height", true);
2986
+ const offset = getInputOffset(), width = getInputCSS("width", true), height = getInputCSS("height", true);
2987
+ let topPos = offset.top;
2988
+ let leftPos = offset.left;
3026
2989
  // Styles to simulate a node in an input field
3027
- let cssDefaultStyles = "white-space:pre;padding:0;margin:0;", listOfModifiers = [
2990
+ let cssDefaultStyles = "white-space:pre;padding:0;margin:0;";
2991
+ const listOfModifiers = [
3028
2992
  "direction",
3029
2993
  "font-family",
3030
2994
  "font-size",
@@ -3046,16 +3010,15 @@ class DOMUtils extends DOMUtilsEvent {
3046
3010
  leftPos += getInputCSS("border-left-width", true);
3047
3011
  leftPos += 1; //Seems to be necessary
3048
3012
  for (let index = 0; index < listOfModifiers.length; index++) {
3049
- let property = listOfModifiers[index];
3050
- // @ts-ignore
3051
- cssDefaultStyles += property + ":" + getInputCSS(property) + ";";
3013
+ const property = listOfModifiers[index];
3014
+ cssDefaultStyles += property + ":" + getInputCSS(property, false) + ";";
3052
3015
  }
3053
3016
  // End of CSS variable checks
3054
3017
  // 不能为空,不然获取不到高度
3055
- let text = $input.value || "G", textLen = text.length, fakeClone = DOMUtilsContext.windowApi.document.createElement("div");
3018
+ const text = $input.value || "G", textLen = text.length, fakeClone = DOMUtilsContext.windowApi.document.createElement("div");
3056
3019
  if (selectionStart > 0)
3057
3020
  appendPart(0, selectionStart);
3058
- var fakeRange = appendPart(selectionStart, selectionEnd);
3021
+ const fakeRange = appendPart(selectionStart, selectionEnd);
3059
3022
  if (textLen > selectionEnd)
3060
3023
  appendPart(selectionEnd, textLen);
3061
3024
  // Styles to inherit the font styles of the element
@@ -3067,7 +3030,7 @@ class DOMUtils extends DOMUtilsEvent {
3067
3030
  fakeClone.style.width = width + "px";
3068
3031
  fakeClone.style.height = height + "px";
3069
3032
  DOMUtilsContext.windowApi.document.body.appendChild(fakeClone);
3070
- var returnValue = fakeRange.getBoundingClientRect(); //Get rect
3033
+ const returnValue = fakeRange.getBoundingClientRect(); //Get rect
3071
3034
  fakeClone?.parentNode?.removeChild(fakeClone); //Remove temp
3072
3035
  return returnValue;
3073
3036
  // Local functions for readability of the previous code
@@ -3078,7 +3041,7 @@ class DOMUtils extends DOMUtilsEvent {
3078
3041
  * @returns
3079
3042
  */
3080
3043
  function appendPart(start, end) {
3081
- var span = DOMUtilsContext.windowApi.document.createElement("span");
3044
+ const span = DOMUtilsContext.windowApi.document.createElement("span");
3082
3045
  span.style.cssText = cssDefaultStyles; //Force styles to prevent unexpected results
3083
3046
  span.textContent = text.substring(start, end);
3084
3047
  fakeClone.appendChild(span);
@@ -3086,13 +3049,13 @@ class DOMUtils extends DOMUtilsEvent {
3086
3049
  }
3087
3050
  // Computing offset position
3088
3051
  function getInputOffset() {
3089
- let body = DOMUtilsContext.windowApi.document.body, win = DOMUtilsContext.windowApi.document.defaultView, docElem = DOMUtilsContext.windowApi.document.documentElement, $box = DOMUtilsContext.windowApi.document.createElement("div");
3052
+ const body = DOMUtilsContext.windowApi.document.body, win = DOMUtilsContext.windowApi.document.defaultView, docElem = DOMUtilsContext.windowApi.document.documentElement, $box = DOMUtilsContext.windowApi.document.createElement("div");
3090
3053
  $box.style.paddingLeft = $box.style.width = "1px";
3091
3054
  body.appendChild($box);
3092
- var isBoxModel = $box.offsetWidth == 2;
3055
+ const isBoxModel = $box.offsetWidth == 2;
3093
3056
  body.removeChild($box);
3094
- let $boxRect = $input.getBoundingClientRect();
3095
- var clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0, scrollTop = win.pageYOffset || (isBoxModel && docElem.scrollTop) || body.scrollTop, scrollLeft = win.pageXOffset || (isBoxModel && docElem.scrollLeft) || body.scrollLeft;
3057
+ const $boxRect = $input.getBoundingClientRect();
3058
+ const clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0, scrollTop = win.pageYOffset || (isBoxModel && docElem.scrollTop) || body.scrollTop, scrollLeft = win.pageXOffset || (isBoxModel && docElem.scrollLeft) || body.scrollLeft;
3096
3059
  return {
3097
3060
  top: $boxRect.top + scrollTop - clientTop,
3098
3061
  left: $boxRect.left + scrollLeft - clientLeft,
@@ -3105,10 +3068,13 @@ class DOMUtils extends DOMUtilsEvent {
3105
3068
  * @returns
3106
3069
  */
3107
3070
  function getInputCSS(prop, isNumber) {
3108
- var val = DOMUtilsContext.windowApi.document
3109
- .defaultView.getComputedStyle($input, null)
3110
- .getPropertyValue(prop);
3111
- return isNumber ? parseFloat(val) : val;
3071
+ const val = DOMUtilsContext.windowApi.document.defaultView.getComputedStyle($input, null).getPropertyValue(prop);
3072
+ if (isNumber) {
3073
+ return parseFloat(val);
3074
+ }
3075
+ else {
3076
+ return val;
3077
+ }
3112
3078
  }
3113
3079
  }
3114
3080
  /** 获取 animationend 在各个浏览器的兼容名 */
@@ -3120,7 +3086,7 @@ class DOMUtils extends DOMUtilsEvent {
3120
3086
  return DOMUtilsCommonUtils.getTransitionEndNameList();
3121
3087
  }
3122
3088
  }
3123
- let domUtils = new DOMUtils();
3089
+ const domUtils = new DOMUtils();
3124
3090
 
3125
3091
  module.exports = domUtils;
3126
3092
  //# sourceMappingURL=index.cjs.js.map