{"action":"created","comment":{"url":"https://api.github.com/repos/tildeio/glimmer/pulls/comments/60151035","id":60151035,"diff_hunk":"@@ -127,3 +120,50 @@ export class UpdateTrustingAppendOpcode extends UpdatingContentOpcode {\n     return { guid, type, details };\n   }\n }\n+\n+export class UpdateCautiousAppendOpcode extends UpdatingContentOpcode {\n+  type = 'update-cautious-append';\n+  private cache: ReferenceCache<string>;\n+  private bounds: Fragment;\n+  private textNode: Text;\n+\n+  constructor(cache: ReferenceCache<string>, bounds: Fragment, textNode: Text) {\n+    super();\n+    this.cache = cache;\n+    this.bounds = bounds;\n+    this.textNode = textNode;\n+  }\n+\n+  evaluate(vm: UpdatingVM) {\n+    let value = this.cache.revalidate();\n+\n+    if (isModified(value)) {\n+      let parent = <HTMLElement>this.bounds.parentElement();\n+\n+      if (isSafeString(value)) {\n+        this.textNode = null;\n+        let nextSibling = clear(this.bounds);\n+        this.bounds.update(vm.dom.insertHTMLBefore(parent, nextSibling, value));\n+      } else {\n+        if(this.textNode) {\n+          this.textNode.nodeValue = value;\n+        } else {\n+          let nextSibling = clear(this.bounds);\n+          this.bounds.update(vm.dom.insertTextBefore(parent, nextSibling, value));\n+          this.textNode = this.bounds.firstNode() as Text;","path":"packages/glimmer-runtime/lib/compiled/opcodes/content.ts","position":122,"original_position":122,"commit_id":"377cec4f1993d9c3082b1217b9831783b07061be","original_commit_id":"377cec4f1993d9c3082b1217b9831783b07061be","user":{"login":"zackthehuman","id":203712,"avatar_url":"https://avatars.githubusercontent.com/u/203712?v=3","gravatar_id":"","url":"https://api.github.com/users/zackthehuman","html_url":"https://github.com/zackthehuman","followers_url":"https://api.github.com/users/zackthehuman/followers","following_url":"https://api.github.com/users/zackthehuman/following{/other_user}","gists_url":"https://api.github.com/users/zackthehuman/gists{/gist_id}","starred_url":"https://api.github.com/users/zackthehuman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zackthehuman/subscriptions","organizations_url":"https://api.github.com/users/zackthehuman/orgs","repos_url":"https://api.github.com/users/zackthehuman/repos","events_url":"https://api.github.com/users/zackthehuman/events{/privacy}","received_events_url":"https://api.github.com/users/zackthehuman/received_events","type":"User","site_admin":false},"body":"I avoided doing this because nowhere else are bounds constructed inside of `content.ts` -- they seem to all be constructed at a different layer (inside of the `dom` object). I can move it, it just seemed inconsistent.","created_at":"2016-04-18T23:17:48Z","updated_at":"2016-04-18T23:17:48Z","html_url":"https://github.com/tildeio/glimmer/pull/133#discussion_r60151035","pull_request_url":"https://api.github.com/repos/tildeio/glimmer/pulls/133","_links":{"self":{"href":"https://api.github.com/repos/tildeio/glimmer/pulls/comments/60151035"},"html":{"href":"https://github.com/tildeio/glimmer/pull/133#discussion_r60151035"},"pull_request":{"href":"https://api.github.com/repos/tildeio/glimmer/pulls/133"}}},"pull_request":{"url":"https://api.github.com/repos/tildeio/glimmer/pulls/133","id":66576637,"html_url":"https://github.com/tildeio/glimmer/pull/133","diff_url":"https://github.com/tildeio/glimmer/pull/133.diff","patch_url":"https://github.com/tildeio/glimmer/pull/133.patch","issue_url":"https://api.github.com/repos/tildeio/glimmer/issues/133","number":133,"state":"closed","locked":false,"title":"Implement htmlSafe support","user":{"login":"zackthehuman","id":203712,"avatar_url":"https://avatars.githubusercontent.com/u/203712?v=3","gravatar_id":"","url":"https://api.github.com/users/zackthehuman","html_url":"https://github.com/zackthehuman","followers_url":"https://api.github.com/users/zackthehuman/followers","following_url":"https://api.github.com/users/zackthehuman/following{/other_user}","gists_url":"https://api.github.com/users/zackthehuman/gists{/gist_id}","starred_url":"https://api.github.com/users/zackthehuman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zackthehuman/subscriptions","organizations_url":"https://api.github.com/users/zackthehuman/orgs","repos_url":"https://api.github.com/users/zackthehuman/repos","events_url":"https://api.github.com/users/zackthehuman/events{/privacy}","received_events_url":"https://api.github.com/users/zackthehuman/received_events","type":"User","site_admin":false},"body":"This PR implements support for `htmlSafe` during append. It treats any value that isn't const as *possibly* a SafeString, and then later checks if the value really is one.\r\n\r\nIt's possible that a value that previously was a SafeString is no longer one, and vice-versa. To account for this, it is treated as a range of nodes with a `Bounds`. In the case that it is not a SafeString and currently is text, it simple updates the `nodeValue` -- the same way as `UpdateAppendOpcode` does. Otherwise, it works basically like `UpdateTrustingAppendOpcode`.\r\n\r\nI still need to do some work around detecting SafeString using its symbol. For now I think this is far enough along to get feedback.","created_at":"2016-04-15T00:57:53Z","updated_at":"2016-04-18T23:17:48Z","closed_at":"2016-04-18T16:53:30Z","merged_at":"2016-04-18T16:53:30Z","merge_commit_sha":"b421a520da853cbcd3a0fbc83f7427f84f84e8ac","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tildeio/glimmer/pulls/133/commits","review_comments_url":"https://api.github.com/repos/tildeio/glimmer/pulls/133/comments","review_comment_url":"https://api.github.com/repos/tildeio/glimmer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tildeio/glimmer/issues/133/comments","statuses_url":"https://api.github.com/repos/tildeio/glimmer/statuses/377cec4f1993d9c3082b1217b9831783b07061be","head":{"label":"zackthehuman:htmlSafe-support","ref":"htmlSafe-support","sha":"377cec4f1993d9c3082b1217b9831783b07061be","user":{"login":"zackthehuman","id":203712,"avatar_url":"https://avatars.githubusercontent.com/u/203712?v=3","gravatar_id":"","url":"https://api.github.com/users/zackthehuman","html_url":"https://github.com/zackthehuman","followers_url":"https://api.github.com/users/zackthehuman/followers","following_url":"https://api.github.com/users/zackthehuman/following{/other_user}","gists_url":"https://api.github.com/users/zackthehuman/gists{/gist_id}","starred_url":"https://api.github.com/users/zackthehuman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zackthehuman/subscriptions","organizations_url":"https://api.github.com/users/zackthehuman/orgs","repos_url":"https://api.github.com/users/zackthehuman/repos","events_url":"https://api.github.com/users/zackthehuman/events{/privacy}","received_events_url":"https://api.github.com/users/zackthehuman/received_events","type":"User","site_admin":false},"repo":{"id":56105032,"name":"glimmer","full_name":"zackthehuman/glimmer","owner":{"login":"zackthehuman","id":203712,"avatar_url":"https://avatars.githubusercontent.com/u/203712?v=3","gravatar_id":"","url":"https://api.github.com/users/zackthehuman","html_url":"https://github.com/zackthehuman","followers_url":"https://api.github.com/users/zackthehuman/followers","following_url":"https://api.github.com/users/zackthehuman/following{/other_user}","gists_url":"https://api.github.com/users/zackthehuman/gists{/gist_id}","starred_url":"https://api.github.com/users/zackthehuman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zackthehuman/subscriptions","organizations_url":"https://api.github.com/users/zackthehuman/orgs","repos_url":"https://api.github.com/users/zackthehuman/repos","events_url":"https://api.github.com/users/zackthehuman/events{/privacy}","received_events_url":"https://api.github.com/users/zackthehuman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zackthehuman/glimmer","description":"","fork":true,"url":"https://api.github.com/repos/zackthehuman/glimmer","forks_url":"https://api.github.com/repos/zackthehuman/glimmer/forks","keys_url":"https://api.github.com/repos/zackthehuman/glimmer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zackthehuman/glimmer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zackthehuman/glimmer/teams","hooks_url":"https://api.github.com/repos/zackthehuman/glimmer/hooks","issue_events_url":"https://api.github.com/repos/zackthehuman/glimmer/issues/events{/number}","events_url":"https://api.github.com/repos/zackthehuman/glimmer/events","assignees_url":"https://api.github.com/repos/zackthehuman/glimmer/assignees{/user}","branches_url":"https://api.github.com/repos/zackthehuman/glimmer/branches{/branch}","tags_url":"https://api.github.com/repos/zackthehuman/glimmer/tags","blobs_url":"https://api.github.com/repos/zackthehuman/glimmer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zackthehuman/glimmer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zackthehuman/glimmer/git/refs{/sha}","trees_url":"https://api.github.com/repos/zackthehuman/glimmer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zackthehuman/glimmer/statuses/{sha}","languages_url":"https://api.github.com/repos/zackthehuman/glimmer/languages","stargazers_url":"https://api.github.com/repos/zackthehuman/glimmer/stargazers","contributors_url":"https://api.github.com/repos/zackthehuman/glimmer/contributors","subscribers_url":"https://api.github.com/repos/zackthehuman/glimmer/subscribers","subscription_url":"https://api.github.com/repos/zackthehuman/glimmer/subscription","commits_url":"https://api.github.com/repos/zackthehuman/glimmer/commits{/sha}","git_commits_url":"https://api.github.com/repos/zackthehuman/glimmer/git/commits{/sha}","comments_url":"https://api.github.com/repos/zackthehuman/glimmer/comments{/number}","issue_comment_url":"https://api.github.com/repos/zackthehuman/glimmer/issues/comments{/number}","contents_url":"https://api.github.com/repos/zackthehuman/glimmer/contents/{+path}","compare_url":"https://api.github.com/repos/zackthehuman/glimmer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zackthehuman/glimmer/merges","archive_url":"https://api.github.com/repos/zackthehuman/glimmer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zackthehuman/glimmer/downloads","issues_url":"https://api.github.com/repos/zackthehuman/glimmer/issues{/number}","pulls_url":"https://api.github.com/repos/zackthehuman/glimmer/pulls{/number}","milestones_url":"https://api.github.com/repos/zackthehuman/glimmer/milestones{/number}","notifications_url":"https://api.github.com/repos/zackthehuman/glimmer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zackthehuman/glimmer/labels{/name}","releases_url":"https://api.github.com/repos/zackthehuman/glimmer/releases{/id}","deployments_url":"https://api.github.com/repos/zackthehuman/glimmer/deployments","created_at":"2016-04-12T23:28:51Z","updated_at":"2016-04-12T23:28:52Z","pushed_at":"2016-04-18T21:57:23Z","git_url":"git://github.com/zackthehuman/glimmer.git","ssh_url":"git@github.com:zackthehuman/glimmer.git","clone_url":"https://github.com/zackthehuman/glimmer.git","svn_url":"https://github.com/zackthehuman/glimmer","homepage":null,"size":3069,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"tildeio:master","ref":"master","sha":"8fac0730bbac1141adbada8958224563a031cbe1","user":{"login":"tildeio","id":1355851,"avatar_url":"https://avatars.githubusercontent.com/u/1355851?v=3","gravatar_id":"","url":"https://api.github.com/users/tildeio","html_url":"https://github.com/tildeio","followers_url":"https://api.github.com/users/tildeio/followers","following_url":"https://api.github.com/users/tildeio/following{/other_user}","gists_url":"https://api.github.com/users/tildeio/gists{/gist_id}","starred_url":"https://api.github.com/users/tildeio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tildeio/subscriptions","organizations_url":"https://api.github.com/users/tildeio/orgs","repos_url":"https://api.github.com/users/tildeio/repos","events_url":"https://api.github.com/users/tildeio/events{/privacy}","received_events_url":"https://api.github.com/users/tildeio/received_events","type":"Organization","site_admin":false},"repo":{"id":42467001,"name":"glimmer","full_name":"tildeio/glimmer","owner":{"login":"tildeio","id":1355851,"avatar_url":"https://avatars.githubusercontent.com/u/1355851?v=3","gravatar_id":"","url":"https://api.github.com/users/tildeio","html_url":"https://github.com/tildeio","followers_url":"https://api.github.com/users/tildeio/followers","following_url":"https://api.github.com/users/tildeio/following{/other_user}","gists_url":"https://api.github.com/users/tildeio/gists{/gist_id}","starred_url":"https://api.github.com/users/tildeio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tildeio/subscriptions","organizations_url":"https://api.github.com/users/tildeio/orgs","repos_url":"https://api.github.com/users/tildeio/repos","events_url":"https://api.github.com/users/tildeio/events{/privacy}","received_events_url":"https://api.github.com/users/tildeio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tildeio/glimmer","description":"","fork":false,"url":"https://api.github.com/repos/tildeio/glimmer","forks_url":"https://api.github.com/repos/tildeio/glimmer/forks","keys_url":"https://api.github.com/repos/tildeio/glimmer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tildeio/glimmer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tildeio/glimmer/teams","hooks_url":"https://api.github.com/repos/tildeio/glimmer/hooks","issue_events_url":"https://api.github.com/repos/tildeio/glimmer/issues/events{/number}","events_url":"https://api.github.com/repos/tildeio/glimmer/events","assignees_url":"https://api.github.com/repos/tildeio/glimmer/assignees{/user}","branches_url":"https://api.github.com/repos/tildeio/glimmer/branches{/branch}","tags_url":"https://api.github.com/repos/tildeio/glimmer/tags","blobs_url":"https://api.github.com/repos/tildeio/glimmer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tildeio/glimmer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tildeio/glimmer/git/refs{/sha}","trees_url":"https://api.github.com/repos/tildeio/glimmer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tildeio/glimmer/statuses/{sha}","languages_url":"https://api.github.com/repos/tildeio/glimmer/languages","stargazers_url":"https://api.github.com/repos/tildeio/glimmer/stargazers","contributors_url":"https://api.github.com/repos/tildeio/glimmer/contributors","subscribers_url":"https://api.github.com/repos/tildeio/glimmer/subscribers","subscription_url":"https://api.github.com/repos/tildeio/glimmer/subscription","commits_url":"https://api.github.com/repos/tildeio/glimmer/commits{/sha}","git_commits_url":"https://api.github.com/repos/tildeio/glimmer/git/commits{/sha}","comments_url":"https://api.github.com/repos/tildeio/glimmer/comments{/number}","issue_comment_url":"https://api.github.com/repos/tildeio/glimmer/issues/comments{/number}","contents_url":"https://api.github.com/repos/tildeio/glimmer/contents/{+path}","compare_url":"https://api.github.com/repos/tildeio/glimmer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tildeio/glimmer/merges","archive_url":"https://api.github.com/repos/tildeio/glimmer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tildeio/glimmer/downloads","issues_url":"https://api.github.com/repos/tildeio/glimmer/issues{/number}","pulls_url":"https://api.github.com/repos/tildeio/glimmer/pulls{/number}","milestones_url":"https://api.github.com/repos/tildeio/glimmer/milestones{/number}","notifications_url":"https://api.github.com/repos/tildeio/glimmer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tildeio/glimmer/labels{/name}","releases_url":"https://api.github.com/repos/tildeio/glimmer/releases{/id}","deployments_url":"https://api.github.com/repos/tildeio/glimmer/deployments","created_at":"2015-09-14T17:59:26Z","updated_at":"2016-04-18T17:42:34Z","pushed_at":"2016-04-18T22:58:52Z","git_url":"git://github.com/tildeio/glimmer.git","ssh_url":"git@github.com:tildeio/glimmer.git","clone_url":"https://github.com/tildeio/glimmer.git","svn_url":"https://github.com/tildeio/glimmer","homepage":null,"size":3119,"stargazers_count":180,"watchers_count":180,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":28,"mirror_url":null,"open_issues_count":26,"forks":28,"open_issues":26,"watchers":180,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tildeio/glimmer/pulls/133"},"html":{"href":"https://github.com/tildeio/glimmer/pull/133"},"issue":{"href":"https://api.github.com/repos/tildeio/glimmer/issues/133"},"comments":{"href":"https://api.github.com/repos/tildeio/glimmer/issues/133/comments"},"review_comments":{"href":"https://api.github.com/repos/tildeio/glimmer/pulls/133/comments"},"review_comment":{"href":"https://api.github.com/repos/tildeio/glimmer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tildeio/glimmer/pulls/133/commits"},"statuses":{"href":"https://api.github.com/repos/tildeio/glimmer/statuses/377cec4f1993d9c3082b1217b9831783b07061be"}}}}