{"action":"created","issue":{"url":"https://api.github.com/repos/Polymer/polymer/issues/2335","labels_url":"https://api.github.com/repos/Polymer/polymer/issues/2335/labels{/name}","comments_url":"https://api.github.com/repos/Polymer/polymer/issues/2335/comments","events_url":"https://api.github.com/repos/Polymer/polymer/issues/2335/events","html_url":"https://github.com/Polymer/polymer/issues/2335","id":102370829,"number":2335,"title":"Contents of vanilla <template> disappears inside dom-bind","user":{"login":"gaurav21r","id":1716462,"avatar_url":"https://avatars.githubusercontent.com/u/1716462?v=3","gravatar_id":"","url":"https://api.github.com/users/gaurav21r","html_url":"https://github.com/gaurav21r","followers_url":"https://api.github.com/users/gaurav21r/followers","following_url":"https://api.github.com/users/gaurav21r/following{/other_user}","gists_url":"https://api.github.com/users/gaurav21r/gists{/gist_id}","starred_url":"https://api.github.com/users/gaurav21r/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaurav21r/subscriptions","organizations_url":"https://api.github.com/users/gaurav21r/orgs","repos_url":"https://api.github.com/users/gaurav21r/repos","events_url":"https://api.github.com/users/gaurav21r/events{/privacy}","received_events_url":"https://api.github.com/users/gaurav21r/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Polymer/polymer/labels/p1","name":"p1","color":"eb6420"}],"state":"closed","locked":false,"assignee":{"login":"kevinpschaaf","id":1354932,"avatar_url":"https://avatars.githubusercontent.com/u/1354932?v=3","gravatar_id":"","url":"https://api.github.com/users/kevinpschaaf","html_url":"https://github.com/kevinpschaaf","followers_url":"https://api.github.com/users/kevinpschaaf/followers","following_url":"https://api.github.com/users/kevinpschaaf/following{/other_user}","gists_url":"https://api.github.com/users/kevinpschaaf/gists{/gist_id}","starred_url":"https://api.github.com/users/kevinpschaaf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevinpschaaf/subscriptions","organizations_url":"https://api.github.com/users/kevinpschaaf/orgs","repos_url":"https://api.github.com/users/kevinpschaaf/repos","events_url":"https://api.github.com/users/kevinpschaaf/events{/privacy}","received_events_url":"https://api.github.com/users/kevinpschaaf/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2015-08-21T12:38:27Z","updated_at":"2015-08-27T17:27:20Z","closed_at":"2015-08-27T17:27:20Z","body":"Greetings from [Super Elements!!!](https://github.com/rcorp/superelements)\r\n\r\nWe use HTML5s `<template>` for some cool stuff inside our custom element. When we use our element inside a `<template is=\"dom-bind\">` Polymer seems to remove our `<template>`'s contents!\r\n\r\nSo\r\n```html\r\n<template is=\"dom-bind\">\r\n  <template id=\"my-template>\r\n     Whatever!\r\n </template>\r\n</template>\r\n```\r\n\r\nIsn't the same as\r\n```html\r\n<template is=\"dom-bind\">\r\n</template>\r\n<template id=\"my-template>\r\n   Whatever!\r\n</template>\r\n\r\n```\r\nThe bug can be better illustrated here:\r\nhttp://plnkr.co/edit/A7GsB6kdZBZb4b2gMss4?p=preview\r\n\r\nAccording to me a good architecture is for `dom-bind` should be that it **modifies only `is=\"dom-repeat\"` `is=\"dom-if\"`and `is=\"dom-bind\"`** and **leave the vanilla HTML5 `<template>` alone!**\r\n\r\nI hope you consider this a bug!!!"},"comment":{"url":"https://api.github.com/repos/Polymer/polymer/issues/comments/135500097","html_url":"https://github.com/Polymer/polymer/issues/2335#issuecomment-135500097","issue_url":"https://api.github.com/repos/Polymer/polymer/issues/2335","id":135500097,"user":{"login":"kevinpschaaf","id":1354932,"avatar_url":"https://avatars.githubusercontent.com/u/1354932?v=3","gravatar_id":"","url":"https://api.github.com/users/kevinpschaaf","html_url":"https://github.com/kevinpschaaf","followers_url":"https://api.github.com/users/kevinpschaaf/followers","following_url":"https://api.github.com/users/kevinpschaaf/following{/other_user}","gists_url":"https://api.github.com/users/kevinpschaaf/gists{/gist_id}","starred_url":"https://api.github.com/users/kevinpschaaf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevinpschaaf/subscriptions","organizations_url":"https://api.github.com/users/kevinpschaaf/orgs","repos_url":"https://api.github.com/users/kevinpschaaf/repos","events_url":"https://api.github.com/users/kevinpschaaf/events{/privacy}","received_events_url":"https://api.github.com/users/kevinpschaaf/received_events","type":"User","site_admin":false},"created_at":"2015-08-27T17:27:20Z","updated_at":"2015-08-27T17:27:20Z","body":"`p1` means priority 1, we use labels `p0` - `p3` to denote relative priority (0 highest).\r\n\r\nWe do this processing (cache the template's content and hand it back as `_content` as part of the outer template extension's createdCallback) for a couple reasons:\r\n\r\n1. Better performance: `template.content.cloneNode(true)` runs faster when it does not have to recursively clone nested template content fragments\r\n2. It avoids two critical browser bugs:\r\n   * On Chrome, calling `template.content.cloneNode(true)` results in custom elements in any nested templates to be incorrectly upgraded (they should remain inert: https://code.google.com/p/chromium/issues/detail?id=430578, fixed in Chrome relatively recently)\r\n   * On Safari, calling `template.content.cloneNode(true)` results in empty nested template content fragments (https://bugs.webkit.org/show_bug.cgi?id=137619, we confirmed that it is fixed in WebKit nightly, but it's not yet in a stable version of Safari yet)\r\n\r\nHowever, we have a bailout option: If you place `preserve-content` on any nested templates, they should be left pristine (and subject to the browser bugs in 2 above).  This is the recommended solution, since we don't intend to remove the `_content` treatment in the short term for the reasons above."}}