Skip to content

Add html to LitElement.prototype#2120

Merged
balloob merged 1 commit intohome-assistant:devfrom
cdce8p:lit-html
Nov 26, 2018
Merged

Add html to LitElement.prototype#2120
balloob merged 1 commit intohome-assistant:devfrom
cdce8p:lit-html

Conversation

@cdce8p
Copy link
Copy Markdown
Member

@cdce8p cdce8p commented Nov 26, 2018

This PR maps the html function form lit-html to LitElement.prototype.html to be accessible within custom_ui components when overriding existing class implementation.

I've added the mapping inside src/layouts/app/home-assistant.js for now, but am happy to move it if there is a better place for it.

Example

const ExistingRow = customElements.get('existing-row');
// 'existing-row' being the name of the customElement

class MyFancyRow extends ExistingRow {
  render() {             // overrides existing render implementation
    return this.html`    // use `this.html`
      ...
    `;
  }
}

Fixes: #2107
CC: @balloob

@zsarnett
Copy link
Copy Markdown
Contributor

@thomasloven

@thomasloven
Copy link
Copy Markdown
Contributor

thomasloven commented Nov 26, 2018

As much as I'd love to pull a fast one and just sneak-merge this, I would like to hear what @balloob has to say, since I know he doesn't really like putting stuff in the global scope.

Also, why only lit-html? Why not LitElement too?

Edit: Wait... this won't put anything in the global scope, will it?

@balloob
Copy link
Copy Markdown
Member

balloob commented Nov 26, 2018

What can go wrong 🙈

@balloob balloob merged commit 1cc6e09 into home-assistant:dev Nov 26, 2018
@ghost ghost removed the in progress label Nov 26, 2018
@cdce8p cdce8p deleted the lit-html branch November 26, 2018 22:28
@cdce8p
Copy link
Copy Markdown
Member Author

cdce8p commented Nov 26, 2018

@balloob Thanks for the help!

@balloob balloob mentioned this pull request Dec 5, 2018
@github-actions github-actions bot locked and limited conversation to collaborators Jul 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom ui lit - Child template inheritance issue

5 participants