File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -86,9 +86,12 @@ function _htmlElementAsString(el: unknown, keyAttrs?: string[]): string {
86
86
return '' ;
87
87
}
88
88
89
- // If using the component name annotation plugin, this value may be available on the DOM node
90
- if ( elem instanceof HTMLElement && elem . dataset && elem . dataset [ 'sentryComponent' ] ) {
91
- return elem . dataset [ 'sentryComponent' ] ;
89
+ // @ts -expect-error WINDOW has HTMLElement
90
+ if ( WINDOW . HTMLElement ) {
91
+ // If using the component name annotation plugin, this value may be available on the DOM node
92
+ if ( elem instanceof HTMLElement && elem . dataset && elem . dataset [ 'sentryComponent' ] ) {
93
+ return elem . dataset [ 'sentryComponent' ] ;
94
+ }
92
95
}
93
96
94
97
out . push ( elem . tagName . toLowerCase ( ) ) ;
@@ -171,6 +174,11 @@ export function getDomElement<E = any>(selector: string): E | null {
171
174
* @returns a string representation of the component for the provided DOM element, or `null` if not found
172
175
*/
173
176
export function getComponentName ( elem : unknown ) : string | null {
177
+ // @ts -expect-error WINDOW has HTMLElement
178
+ if ( ! WINDOW . HTMLElement ) {
179
+ return null ;
180
+ }
181
+
174
182
let currentElem = elem as SimpleNode ;
175
183
const MAX_TRAVERSE_HEIGHT = 5 ;
176
184
for ( let i = 0 ; i < MAX_TRAVERSE_HEIGHT ; i ++ ) {
You can’t perform that action at this time.
0 commit comments