- From: Lonnie Best <notifications@github.com>
- Date: Mon, 10 Dec 2018 15:08:31 -0800
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 10 December 2018 23:08:53 UTC
The fastest way to access an element is by direct object reference. What's the 2nd fastest way? A [Map object](https://stackoverflow.com/questions/34328136/) maybe? This got me thinking. What if you had a really huge template. Could performance be gained on first render if the "comments" knew how to replace themselves without having to walk the DOM to extract comment nodes? So, instead of replacing expressions with comments, why not replace them with something smart enough to know how to manage itself: a custom-element: ``` export class PartResolver extends HTMLElement { constructor() { super(); this.replaceWith(Template.Map.get(this.textContent)); } } customElements.define('part-resolver', PartResolver); ``` This is probably a silly idea, but here's a [proof of concept](http://www.lonniebest.com/Commentless/). -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/w3c/webcomponents/issues/777#issuecomment-446009167
Received on Monday, 10 December 2018 23:08:53 UTC