Upgrading to LitHtml 2

已查看 0 次
跳至第一个未读帖子

Jack Franklin

未读,
2021年4月30日 04:39:522021/4/30
收件人 devtools-dev
Hi all,

Today I'm going to land a CL (https://crrev.com/c/2859906) that upgrades us to the release candidate of LitHtml v2. If you're interested in the details you can read the Lit upgrade guide, but I wanted to call out two changes in Lit that are worth being aware of:

  • Rather than setting `eventContext: this` to bind all a component's event listeners to the class instance, you now use `host: this`.
  • If you want to render a literal string representation of an element (e.g show the user `Active node: <iframe>`), you used to be able to do: `<${myNodeName}>` but that now doesn't work. You can achieve this by escaping the < and >: `&lt;${myNodeName}&gt;`. I don't expect many people will hit this, but we had one instance in the DevTools codebase so wanted to highlight it.
LitHtml 2 also offers some new features we hope to take advantage of, but so far this upgrade is mechanical. I'll be in touch when we've evaluated and updated our components with the details.

Thanks,

Jack
回复全部
回复作者
转发
0 个新帖子