@whitesev/domutils 1.3.8 → 1.4.0

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.
@@ -1,12 +1,56 @@
1
1
  var DOMUtils = (function () {
2
2
  'use strict';
3
3
 
4
+ class WindowApi {
5
+ /** 默认的配置 */
6
+ defaultApi = {
7
+ document: document,
8
+ window: window,
9
+ globalThis: globalThis,
10
+ self: self,
11
+ top: top,
12
+ };
13
+ /** 使用的配置 */
14
+ api;
15
+ constructor(option) {
16
+ if (option) {
17
+ if (option.globalThis == null) {
18
+ option.globalThis = option.window;
19
+ }
20
+ if (option.self == null) {
21
+ option.self = option.window;
22
+ }
23
+ }
24
+ if (!option) {
25
+ option = Object.assign({}, this.defaultApi);
26
+ }
27
+ // @ts-ignore
28
+ this.api = Object.assign({}, option);
29
+ }
30
+ get document() {
31
+ return this.api.document;
32
+ }
33
+ get window() {
34
+ return this.api.window;
35
+ }
36
+ get globalThis() {
37
+ return this.api.globalThis;
38
+ }
39
+ get self() {
40
+ return this.api.self;
41
+ }
42
+ get top() {
43
+ return this.api.top;
44
+ }
45
+ }
46
+
4
47
  /** 通用工具类 */
5
48
  const DOMUtilsCommonUtils = {
6
- windowApi: {
7
- window: window,
49
+ windowApi: new WindowApi({
8
50
  document: document,
9
- },
51
+ window: window,
52
+ top: top,
53
+ }),
10
54
  /**
11
55
  * 判断元素是否已显示或已连接
12
56
  * @param element
@@ -112,7 +156,7 @@ var DOMUtils = (function () {
112
156
 
113
157
  /* 数据 */
114
158
  const DOMUtilsData = {
115
- /** .on绑定的事件 */
159
+ /** .on添加在元素存储的事件 */
116
160
  SymbolEvents: Symbol("events_" + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1)),
117
161
  };
118
162
 
@@ -122,40 +166,6 @@ var DOMUtils = (function () {
122
166
  },
123
167
  };
124
168
 
125
- class WindowApi {
126
- /** 默认的配置 */
127
- defaultApi = {
128
- document: document,
129
- window: window,
130
- globalThis: globalThis,
131
- self: self,
132
- top: top,
133
- };
134
- /** 使用的配置 */
135
- api;
136
- constructor(option) {
137
- if (!option) {
138
- option = Object.assign({}, this.defaultApi);
139
- }
140
- this.api = Object.assign({}, option);
141
- }
142
- get document() {
143
- return this.api.document;
144
- }
145
- get window() {
146
- return this.api.window;
147
- }
148
- get globalThis() {
149
- return this.api.globalThis;
150
- }
151
- get self() {
152
- return this.api.self;
153
- }
154
- get top() {
155
- return this.api.top;
156
- }
157
- }
158
-
159
169
  class DOMUtilsEvent {
160
170
  windowApi;
161
171
  constructor(windowApiOption) {
@@ -968,7 +978,7 @@ var DOMUtils = (function () {
968
978
  super(option);
969
979
  }
970
980
  /** 版本号 */
971
- version = "2024.10.23";
981
+ version = "2024.11.6";
972
982
  attr(element, attrName, attrValue) {
973
983
  let DOMUtilsContext = this;
974
984
  if (typeof element === "string") {