File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed
Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -178,9 +178,10 @@ export class DebugElement extends DebugNode {
178178 /**
179179 * A map of attribute names to attribute values for an element.
180180 */
181+ // TODO: replace null by undefined in the return type
181182 get attributes ( ) : { [ key : string ] : string | null } {
182183 const attributes : { [ key : string ] : string | null } = { } ;
183- const element = this . nativeElement ;
184+ const element = this . nativeElement as Element | undefined ;
184185
185186 if ( ! element ) {
186187 return attributes ;
@@ -233,16 +234,11 @@ export class DebugElement extends DebugNode {
233234
234235 /**
235236 * The inline styles of the DOM element.
236- *
237- * Will be `null` if there is no `style` property on the underlying DOM element.
238- *
239- * @see [ElementCSSInlineStyle](https://developer.mozilla.org/en-US/docs/Web/API/ElementCSSInlineStyle/style)
240237 */
238+ // TODO: replace null by undefined in the return type
241239 get styles ( ) : { [ key : string ] : string | null } {
242- if ( this . nativeElement && ( this . nativeElement as HTMLElement ) . style ) {
243- return ( this . nativeElement as HTMLElement ) . style as { [ key : string ] : any } ;
244- }
245- return { } ;
240+ const element = this . nativeElement as HTMLElement | null ;
241+ return ( element ?. style ?? { } ) as { [ key : string ] : string | null } ;
246242 }
247243
248244 /**
You can’t perform that action at this time.
0 commit comments