{"action":"created","issue":{"url":"https://api.github.com/repos/w3c/webcomponents/issues/777","repository_url":"https://api.github.com/repos/w3c/webcomponents","labels_url":"https://api.github.com/repos/w3c/webcomponents/issues/777/labels{/name}","comments_url":"https://api.github.com/repos/w3c/webcomponents/issues/777/comments","events_url":"https://api.github.com/repos/w3c/webcomponents/issues/777/events","html_url":"https://github.com/w3c/webcomponents/issues/777","id":387454971,"node_id":"MDU6SXNzdWUzODc0NTQ5NzE=","number":777,"title":"Discussion: Templates that Don't Destroy Element References","user":{"login":"Lonniebiz","id":151919,"node_id":"MDQ6VXNlcjE1MTkxOQ==","avatar_url":"https://avatars3.githubusercontent.com/u/151919?v=4","gravatar_id":"","url":"https://api.github.com/users/Lonniebiz","html_url":"https://github.com/Lonniebiz","followers_url":"https://api.github.com/users/Lonniebiz/followers","following_url":"https://api.github.com/users/Lonniebiz/following{/other_user}","gists_url":"https://api.github.com/users/Lonniebiz/gists{/gist_id}","starred_url":"https://api.github.com/users/Lonniebiz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lonniebiz/subscriptions","organizations_url":"https://api.github.com/users/Lonniebiz/orgs","repos_url":"https://api.github.com/users/Lonniebiz/repos","events_url":"https://api.github.com/users/Lonniebiz/events{/privacy}","received_events_url":"https://api.github.com/users/Lonniebiz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-04T19:57:30Z","updated_at":"2018-12-06T17:51:51Z","closed_at":null,"author_association":"NONE","body":"In the same manner that tagged template literals allow the embedding of interpolated JavaScript expressions, I think it would be awesome if HTML <template> tags (or some new tag type) allowed ${elementReferenceName} expressions also. Then, instead of cloning a template, you could just instantiate it in the same manner you would an object from a class (without losing your element references), and when you do this the interpolated values could be based on the original context from where the instantiation occurs (or through .bind to specify an alternative context), kind of like arrow function scoping but with bindablity. \r\n\r\nAlso, I think if an interpolation's output is anything other than an element, the template-instantiation should covert that output to a static string that cannot be modified. There's no need to update the template if you can instead update the dynamic elements that were place into it. Cloning <template> destroys your element references. Template instantiation should **keep** those element references! This way, at the custom class level, you'll always be able to modify the vary same elements you created before injecting it into the template.\r\n\r\nI need something like the `<template>` tag that I can stick inside my custom class's constructors, where each time I instantiate it, it will contain the same referenced element I created in that constructor. Cloning is a pain; you clone it and then you have modify it before it goes out so that you can maintain element references. Cloning is fine for some things, but not ideal inside a class constructor.\r\n\r\nIf we had a `<template>` tag like this; it would be all I'd ever need.\r\n"},"comment":{"url":"https://api.github.com/repos/w3c/webcomponents/issues/comments/444965352","html_url":"https://github.com/w3c/webcomponents/issues/777#issuecomment-444965352","issue_url":"https://api.github.com/repos/w3c/webcomponents/issues/777","id":444965352,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NDk2NTM1Mg==","user":{"login":"bahrus","id":1449290,"node_id":"MDQ6VXNlcjE0NDkyOTA=","avatar_url":"https://avatars3.githubusercontent.com/u/1449290?v=4","gravatar_id":"","url":"https://api.github.com/users/bahrus","html_url":"https://github.com/bahrus","followers_url":"https://api.github.com/users/bahrus/followers","following_url":"https://api.github.com/users/bahrus/following{/other_user}","gists_url":"https://api.github.com/users/bahrus/gists{/gist_id}","starred_url":"https://api.github.com/users/bahrus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bahrus/subscriptions","organizations_url":"https://api.github.com/users/bahrus/orgs","repos_url":"https://api.github.com/users/bahrus/repos","events_url":"https://api.github.com/users/bahrus/events{/privacy}","received_events_url":"https://api.github.com/users/bahrus/received_events","type":"User","site_admin":false},"created_at":"2018-12-06T17:51:51Z","updated_at":"2018-12-06T17:51:51Z","author_association":"NONE","body":"There is [a proposal](https://github.com/w3c/webcomponents/blob/gh-pages/proposals/Template-Instantiation.md) along the lines of what you are suggesting, I think."}}
{"actor":{"display_login":"bahrus"}}