{"action":"created","comment":{"url":"https://api.github.com/repos/Polymer/lit-html/pulls/comments/193536528","pull_request_review_id":126527562,"id":193536528,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5MzUzNjUyOA==","diff_hunk":"@@ -23,40 +26,57 @@ export function removeNodesFromTemplate(template: Template, nodesToRemove: Set<N\n   const {element: {content}, parts} = template;\n   const walker = document.createTreeWalker(\n     content,\n-    NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT |\n-        NodeFilter.SHOW_TEXT,\n+    walkerNodeFilter,\n     null as any,\n     false);\n   let partIndex = 0;\n   let part = parts[0];\n   let nodeIndex = -1;\n   let removeCount = 0;\n   const nodesToRemoveInTemplate = [];\n-  // TODO(sorvell): fix type\n-  const removalStack: any[] = [];\n+  let currentRemovingNode: Node|null = null;\n   while (walker.nextNode()) {\n     nodeIndex++;\n     const node = walker.currentNode as Element;\n-    // maybe pop the stack\n-    if (walker.previousSibling === removalStack[removalStack.length - 1]) {\n-      removalStack.pop();\n+    // end removal if stepped past the removing node\n+    if (node.previousSibling === currentRemovingNode) {\n+      currentRemovingNode = null;","path":"src/lib/modify-template.ts","position":null,"original_position":37,"commit_id":"51268afe8b764ca1f2539418bb4cae62bc1b111b","original_commit_id":"51268afe8b764ca1f2539418bb4cae62bc1b111b","user":{"login":"justinfagnani","id":522948,"node_id":"MDQ6VXNlcjUyMjk0OA==","avatar_url":"https://avatars0.githubusercontent.com/u/522948?v=4","gravatar_id":"","url":"https://api.github.com/users/justinfagnani","html_url":"https://github.com/justinfagnani","followers_url":"https://api.github.com/users/justinfagnani/followers","following_url":"https://api.github.com/users/justinfagnani/following{/other_user}","gists_url":"https://api.github.com/users/justinfagnani/gists{/gist_id}","starred_url":"https://api.github.com/users/justinfagnani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinfagnani/subscriptions","organizations_url":"https://api.github.com/users/justinfagnani/orgs","repos_url":"https://api.github.com/users/justinfagnani/repos","events_url":"https://api.github.com/users/justinfagnani/events{/privacy}","received_events_url":"https://api.github.com/users/justinfagnani/received_events","type":"User","site_admin":false},"body":"I think this needs to be the next node in the stack, in the case of nested removal.","created_at":"2018-06-06T19:47:51Z","updated_at":"2018-06-06T19:48:47Z","html_url":"https://github.com/Polymer/lit-html/pull/337#discussion_r193536528","pull_request_url":"https://api.github.com/repos/Polymer/lit-html/pulls/337","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/Polymer/lit-html/pulls/comments/193536528"},"html":{"href":"https://github.com/Polymer/lit-html/pull/337#discussion_r193536528"},"pull_request":{"href":"https://api.github.com/repos/Polymer/lit-html/pulls/337"}}},"pull_request":{"url":"https://api.github.com/repos/Polymer/lit-html/pulls/337","id":189821800,"node_id":"MDExOlB1bGxSZXF1ZXN0MTg5ODIxODAw","html_url":"https://github.com/Polymer/lit-html/pull/337","diff_url":"https://github.com/Polymer/lit-html/pull/337.diff","patch_url":"https://github.com/Polymer/lit-html/pull/337.patch","issue_url":"https://api.github.com/repos/Polymer/lit-html/issues/337","number":337,"state":"open","locked":false,"title":"Shady render fix","user":{"login":"sorvell","id":78891,"node_id":"MDQ6VXNlcjc4ODkx","avatar_url":"https://avatars1.githubusercontent.com/u/78891?v=4","gravatar_id":"","url":"https://api.github.com/users/sorvell","html_url":"https://github.com/sorvell","followers_url":"https://api.github.com/users/sorvell/followers","following_url":"https://api.github.com/users/sorvell/following{/other_user}","gists_url":"https://api.github.com/users/sorvell/gists{/gist_id}","starred_url":"https://api.github.com/users/sorvell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sorvell/subscriptions","organizations_url":"https://api.github.com/users/sorvell/orgs","repos_url":"https://api.github.com/users/sorvell/repos","events_url":"https://api.github.com/users/sorvell/events{/privacy}","received_events_url":"https://api.github.com/users/sorvell/received_events","type":"User","site_admin":false},"body":"Fixes #326 by imposing a limitation that styles for a scope name can only be supplied in the initial render of that shadowRoot. This is required because `ShadyCSS` can only prepare styles for a scope once to properly track styles in that scope and process custom properties when polyfilled and @apply.\r\n\r\nStyles are processed based on initial scope rendering, but templated DOM within a scope will always be correctly given a scoping class. \r\n\r\nNote that styles in the first render of a scope can contain lit parts. This is useful for one-time bindings.\r\n\r\n**Warning:** merge only after [this ShadyCSS PR](https://github.com/webcomponents/shadycss/pull/183) is merged and released.","created_at":"2018-05-22T23:46:42Z","updated_at":"2018-06-06T19:48:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a99515841b63d98d3f5f3dd31bf1eba94f091278","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Polymer/lit-html/pulls/337/commits","review_comments_url":"https://api.github.com/repos/Polymer/lit-html/pulls/337/comments","review_comment_url":"https://api.github.com/repos/Polymer/lit-html/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Polymer/lit-html/issues/337/comments","statuses_url":"https://api.github.com/repos/Polymer/lit-html/statuses/51268afe8b764ca1f2539418bb4cae62bc1b111b","head":{"label":"Polymer:shady-render-fix","ref":"shady-render-fix","sha":"51268afe8b764ca1f2539418bb4cae62bc1b111b","user":{"login":"Polymer","id":2159051,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxNTkwNTE=","avatar_url":"https://avatars3.githubusercontent.com/u/2159051?v=4","gravatar_id":"","url":"https://api.github.com/users/Polymer","html_url":"https://github.com/Polymer","followers_url":"https://api.github.com/users/Polymer/followers","following_url":"https://api.github.com/users/Polymer/following{/other_user}","gists_url":"https://api.github.com/users/Polymer/gists{/gist_id}","starred_url":"https://api.github.com/users/Polymer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Polymer/subscriptions","organizations_url":"https://api.github.com/users/Polymer/orgs","repos_url":"https://api.github.com/users/Polymer/repos","events_url":"https://api.github.com/users/Polymer/events{/privacy}","received_events_url":"https://api.github.com/users/Polymer/received_events","type":"Organization","site_admin":false},"repo":{"id":95797174,"node_id":"MDEwOlJlcG9zaXRvcnk5NTc5NzE3NA==","name":"lit-html","full_name":"Polymer/lit-html","owner":{"login":"Polymer","id":2159051,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxNTkwNTE=","avatar_url":"https://avatars3.githubusercontent.com/u/2159051?v=4","gravatar_id":"","url":"https://api.github.com/users/Polymer","html_url":"https://github.com/Polymer","followers_url":"https://api.github.com/users/Polymer/followers","following_url":"https://api.github.com/users/Polymer/following{/other_user}","gists_url":"https://api.github.com/users/Polymer/gists{/gist_id}","starred_url":"https://api.github.com/users/Polymer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Polymer/subscriptions","organizations_url":"https://api.github.com/users/Polymer/orgs","repos_url":"https://api.github.com/users/Polymer/repos","events_url":"https://api.github.com/users/Polymer/events{/privacy}","received_events_url":"https://api.github.com/users/Polymer/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Polymer/lit-html","description":"HTML template literals in JavaScript","fork":false,"url":"https://api.github.com/repos/Polymer/lit-html","forks_url":"https://api.github.com/repos/Polymer/lit-html/forks","keys_url":"https://api.github.com/repos/Polymer/lit-html/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Polymer/lit-html/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Polymer/lit-html/teams","hooks_url":"https://api.github.com/repos/Polymer/lit-html/hooks","issue_events_url":"https://api.github.com/repos/Polymer/lit-html/issues/events{/number}","events_url":"https://api.github.com/repos/Polymer/lit-html/events","assignees_url":"https://api.github.com/repos/Polymer/lit-html/assignees{/user}","branches_url":"https://api.github.com/repos/Polymer/lit-html/branches{/branch}","tags_url":"https://api.github.com/repos/Polymer/lit-html/tags","blobs_url":"https://api.github.com/repos/Polymer/lit-html/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Polymer/lit-html/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Polymer/lit-html/git/refs{/sha}","trees_url":"https://api.github.com/repos/Polymer/lit-html/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Polymer/lit-html/statuses/{sha}","languages_url":"https://api.github.com/repos/Polymer/lit-html/languages","stargazers_url":"https://api.github.com/repos/Polymer/lit-html/stargazers","contributors_url":"https://api.github.com/repos/Polymer/lit-html/contributors","subscribers_url":"https://api.github.com/repos/Polymer/lit-html/subscribers","subscription_url":"https://api.github.com/repos/Polymer/lit-html/subscription","commits_url":"https://api.github.com/repos/Polymer/lit-html/commits{/sha}","git_commits_url":"https://api.github.com/repos/Polymer/lit-html/git/commits{/sha}","comments_url":"https://api.github.com/repos/Polymer/lit-html/comments{/number}","issue_comment_url":"https://api.github.com/repos/Polymer/lit-html/issues/comments{/number}","contents_url":"https://api.github.com/repos/Polymer/lit-html/contents/{+path}","compare_url":"https://api.github.com/repos/Polymer/lit-html/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Polymer/lit-html/merges","archive_url":"https://api.github.com/repos/Polymer/lit-html/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Polymer/lit-html/downloads","issues_url":"https://api.github.com/repos/Polymer/lit-html/issues{/number}","pulls_url":"https://api.github.com/repos/Polymer/lit-html/pulls{/number}","milestones_url":"https://api.github.com/repos/Polymer/lit-html/milestones{/number}","notifications_url":"https://api.github.com/repos/Polymer/lit-html/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Polymer/lit-html/labels{/name}","releases_url":"https://api.github.com/repos/Polymer/lit-html/releases{/id}","deployments_url":"https://api.github.com/repos/Polymer/lit-html/deployments","created_at":"2017-06-29T16:27:16Z","updated_at":"2018-06-06T16:03:23Z","pushed_at":"2018-06-06T19:19:58Z","git_url":"git://github.com/Polymer/lit-html.git","ssh_url":"git@github.com:Polymer/lit-html.git","clone_url":"https://github.com/Polymer/lit-html.git","svn_url":"https://github.com/Polymer/lit-html","homepage":"https://polymer.github.io/lit-html/","size":795,"stargazers_count":2503,"watchers_count":2503,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":130,"mirror_url":null,"archived":false,"open_issues_count":52,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":130,"open_issues":52,"watchers":2503,"default_branch":"master"}},"base":{"label":"Polymer:master","ref":"master","sha":"8936682e95f35dab5d80a6f76fa81b8995421c92","user":{"login":"Polymer","id":2159051,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxNTkwNTE=","avatar_url":"https://avatars3.githubusercontent.com/u/2159051?v=4","gravatar_id":"","url":"https://api.github.com/users/Polymer","html_url":"https://github.com/Polymer","followers_url":"https://api.github.com/users/Polymer/followers","following_url":"https://api.github.com/users/Polymer/following{/other_user}","gists_url":"https://api.github.com/users/Polymer/gists{/gist_id}","starred_url":"https://api.github.com/users/Polymer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Polymer/subscriptions","organizations_url":"https://api.github.com/users/Polymer/orgs","repos_url":"https://api.github.com/users/Polymer/repos","events_url":"https://api.github.com/users/Polymer/events{/privacy}","received_events_url":"https://api.github.com/users/Polymer/received_events","type":"Organization","site_admin":false},"repo":{"id":95797174,"node_id":"MDEwOlJlcG9zaXRvcnk5NTc5NzE3NA==","name":"lit-html","full_name":"Polymer/lit-html","owner":{"login":"Polymer","id":2159051,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxNTkwNTE=","avatar_url":"https://avatars3.githubusercontent.com/u/2159051?v=4","gravatar_id":"","url":"https://api.github.com/users/Polymer","html_url":"https://github.com/Polymer","followers_url":"https://api.github.com/users/Polymer/followers","following_url":"https://api.github.com/users/Polymer/following{/other_user}","gists_url":"https://api.github.com/users/Polymer/gists{/gist_id}","starred_url":"https://api.github.com/users/Polymer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Polymer/subscriptions","organizations_url":"https://api.github.com/users/Polymer/orgs","repos_url":"https://api.github.com/users/Polymer/repos","events_url":"https://api.github.com/users/Polymer/events{/privacy}","received_events_url":"https://api.github.com/users/Polymer/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Polymer/lit-html","description":"HTML template literals in JavaScript","fork":false,"url":"https://api.github.com/repos/Polymer/lit-html","forks_url":"https://api.github.com/repos/Polymer/lit-html/forks","keys_url":"https://api.github.com/repos/Polymer/lit-html/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Polymer/lit-html/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Polymer/lit-html/teams","hooks_url":"https://api.github.com/repos/Polymer/lit-html/hooks","issue_events_url":"https://api.github.com/repos/Polymer/lit-html/issues/events{/number}","events_url":"https://api.github.com/repos/Polymer/lit-html/events","assignees_url":"https://api.github.com/repos/Polymer/lit-html/assignees{/user}","branches_url":"https://api.github.com/repos/Polymer/lit-html/branches{/branch}","tags_url":"https://api.github.com/repos/Polymer/lit-html/tags","blobs_url":"https://api.github.com/repos/Polymer/lit-html/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Polymer/lit-html/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Polymer/lit-html/git/refs{/sha}","trees_url":"https://api.github.com/repos/Polymer/lit-html/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Polymer/lit-html/statuses/{sha}","languages_url":"https://api.github.com/repos/Polymer/lit-html/languages","stargazers_url":"https://api.github.com/repos/Polymer/lit-html/stargazers","contributors_url":"https://api.github.com/repos/Polymer/lit-html/contributors","subscribers_url":"https://api.github.com/repos/Polymer/lit-html/subscribers","subscription_url":"https://api.github.com/repos/Polymer/lit-html/subscription","commits_url":"https://api.github.com/repos/Polymer/lit-html/commits{/sha}","git_commits_url":"https://api.github.com/repos/Polymer/lit-html/git/commits{/sha}","comments_url":"https://api.github.com/repos/Polymer/lit-html/comments{/number}","issue_comment_url":"https://api.github.com/repos/Polymer/lit-html/issues/comments{/number}","contents_url":"https://api.github.com/repos/Polymer/lit-html/contents/{+path}","compare_url":"https://api.github.com/repos/Polymer/lit-html/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Polymer/lit-html/merges","archive_url":"https://api.github.com/repos/Polymer/lit-html/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Polymer/lit-html/downloads","issues_url":"https://api.github.com/repos/Polymer/lit-html/issues{/number}","pulls_url":"https://api.github.com/repos/Polymer/lit-html/pulls{/number}","milestones_url":"https://api.github.com/repos/Polymer/lit-html/milestones{/number}","notifications_url":"https://api.github.com/repos/Polymer/lit-html/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Polymer/lit-html/labels{/name}","releases_url":"https://api.github.com/repos/Polymer/lit-html/releases{/id}","deployments_url":"https://api.github.com/repos/Polymer/lit-html/deployments","created_at":"2017-06-29T16:27:16Z","updated_at":"2018-06-06T16:03:23Z","pushed_at":"2018-06-06T19:19:58Z","git_url":"git://github.com/Polymer/lit-html.git","ssh_url":"git@github.com:Polymer/lit-html.git","clone_url":"https://github.com/Polymer/lit-html.git","svn_url":"https://github.com/Polymer/lit-html","homepage":"https://polymer.github.io/lit-html/","size":795,"stargazers_count":2503,"watchers_count":2503,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":130,"mirror_url":null,"archived":false,"open_issues_count":52,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":130,"open_issues":52,"watchers":2503,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Polymer/lit-html/pulls/337"},"html":{"href":"https://github.com/Polymer/lit-html/pull/337"},"issue":{"href":"https://api.github.com/repos/Polymer/lit-html/issues/337"},"comments":{"href":"https://api.github.com/repos/Polymer/lit-html/issues/337/comments"},"review_comments":{"href":"https://api.github.com/repos/Polymer/lit-html/pulls/337/comments"},"review_comment":{"href":"https://api.github.com/repos/Polymer/lit-html/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Polymer/lit-html/pulls/337/commits"},"statuses":{"href":"https://api.github.com/repos/Polymer/lit-html/statuses/51268afe8b764ca1f2539418bb4cae62bc1b111b"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"justinfagnani"}}