LitElement sets template reference to null if the reference is mutated?

Viewed 58

This stackblitz mutates this.iframe:

  @query("#iframe")
  iframe: any;

  firstUpdated() {
    console.log("THE IFRAME IS: ", this.iframe);
    this.iframe.id = "";
    console.log("THE IFRAME IS: ", this.iframe);
  }

After the this.iframe.id statement executes this.iframe is null.

Any ideas why that's happening?

1 Answers

It's my own bad. I'm querying the template by id and then changing the id to something else, which then repeats the query and sets the iframe to null since it cannot be found.

Related