@@ -33,7 +33,6 @@ export class DOMRect extends DOMRectReadOnly {
33
33
}
34
34
}
35
35
36
-
37
36
export class Element extends Node {
38
37
private _classList = new Set ( ) ;
39
38
_nativeElement : ViewBase ;
@@ -43,7 +42,6 @@ export class Element extends Node {
43
42
private _attributeOriginalValue : Map < string , unknown > = new Map ( ) ;
44
43
private _jsBuffer : Float32Array ;
45
44
46
-
47
45
set nativeElement ( value ) {
48
46
this . _nativeElement = value ;
49
47
if ( value ) {
@@ -76,6 +74,61 @@ export class Element extends Node {
76
74
return this . nodeName ;
77
75
}
78
76
77
+ get children ( ) {
78
+ const element = ( < any > this ) . _xmlDom ?. documentElement ?? ( < any > this ) . _xmlDom ;
79
+ if ( element ) {
80
+ const ret = [ ] ;
81
+ const length = element ?. childNodes ?. length ?? 0 ;
82
+
83
+ for ( let i = 0 ; i < length ; i ++ ) {
84
+ const node = element . childNodes . item ( i ) ;
85
+ if ( node ) {
86
+ switch ( node . nodeName ) {
87
+ case 'line' :
88
+ {
89
+ const line = new SVGLineElement ( ) as any ;
90
+ line . __instance = node ;
91
+ ret . push ( line ) ;
92
+ }
93
+ break ;
94
+ case 'polyline' :
95
+ {
96
+ const polyline = new SVGPolylineElement ( ) as any ;
97
+ polyline . __instance = node ;
98
+ ret . push ( polyline ) ;
99
+ }
100
+ break ;
101
+ case 'g' :
102
+ {
103
+ const g = new SVGGElement ( ) as any ;
104
+ g . __instance = node ;
105
+ ret . push ( g ) ;
106
+ }
107
+ break ;
108
+ case 'path' :
109
+ {
110
+ const path = new SVGPathElement ( ) as any ;
111
+ path . __instance = node ;
112
+ ret . push ( path ) ;
113
+ }
114
+ break ;
115
+ case 'rect' :
116
+ {
117
+ const rect = new SVGRectElement ( ) as any ;
118
+ rect . __instance = node ;
119
+ ret . push ( rect ) ;
120
+ }
121
+ break ;
122
+ }
123
+ }
124
+ }
125
+
126
+ return ret ;
127
+ }
128
+
129
+ return [ ] ;
130
+ }
131
+
79
132
getAttribute ( key : string ) : unknown {
80
133
if ( this . nativeElement ) {
81
134
return this . nativeElement [ key ] ;
@@ -108,11 +161,9 @@ export class Element extends Node {
108
161
}
109
162
}
110
163
111
- setAttributeNS ( ) {
112
- }
164
+ setAttributeNS ( ) { }
113
165
114
- removeAttributeNS ( ) {
115
- }
166
+ removeAttributeNS ( ) { }
116
167
117
168
querySelector ( selector : string ) {
118
169
const selection = querySelector ( selector , this ) ;
@@ -126,7 +177,6 @@ export class Element extends Node {
126
177
return querySelector ( selector , this ) ;
127
178
}
128
179
129
-
130
180
getBoundingClientRect ( ) {
131
181
const nativeElement = this [ 'nativeElement' ] ;
132
182
if ( this . nodeName === 'CANVAS' ) {
@@ -152,7 +202,7 @@ export class Element extends Node {
152
202
x : 0 ,
153
203
y : 0 ,
154
204
width : this . innerWidth ,
155
- height : this . innerHeight
205
+ height : this . innerHeight ,
156
206
} ;
157
207
}
158
208
@@ -216,9 +266,7 @@ export class Element extends Node {
216
266
return { } ;
217
267
}
218
268
219
- setPointerCapture ( id : string ) {
220
- }
269
+ setPointerCapture ( id : string ) { }
221
270
222
- releasePointerCapture ( id : string ) {
223
- }
271
+ releasePointerCapture ( id : string ) { }
224
272
}
0 commit comments