{"action":"created","issue":{"url":"https://api.github.com/repos/google/incremental-dom/issues/303","repository_url":"https://api.github.com/repos/google/incremental-dom","labels_url":"https://api.github.com/repos/google/incremental-dom/issues/303/labels{/name}","comments_url":"https://api.github.com/repos/google/incremental-dom/issues/303/comments","events_url":"https://api.github.com/repos/google/incremental-dom/issues/303/events","html_url":"https://github.com/google/incremental-dom/issues/303","id":190793192,"number":303,"title":"Check if child is still inside parent before calling removeChild","user":{"login":"mairatma","id":5216049,"avatar_url":"https://avatars.githubusercontent.com/u/5216049?v=3","gravatar_id":"","url":"https://api.github.com/users/mairatma","html_url":"https://github.com/mairatma","followers_url":"https://api.github.com/users/mairatma/followers","following_url":"https://api.github.com/users/mairatma/following{/other_user}","gists_url":"https://api.github.com/users/mairatma/gists{/gist_id}","starred_url":"https://api.github.com/users/mairatma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mairatma/subscriptions","organizations_url":"https://api.github.com/users/mairatma/orgs","repos_url":"https://api.github.com/users/mairatma/repos","events_url":"https://api.github.com/users/mairatma/events{/privacy}","received_events_url":"https://api.github.com/users/mairatma/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-21T18:03:54Z","updated_at":"2016-11-21T18:39:51Z","closed_at":null,"body":"Right now the `removeChild` function is called from different places, receiving a child and the parent node to remove it from. It's possible that the child is not inside the given parent though, which causes an error to be thrown by the browser: `DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node`.\r\n\r\nOne case where this may happen is if during a patch the parent stored his child in its key map, but the child was later removed by the developer without using incremental dom. They key map is not so reliable to guarantee that elements stored there are still inside the parent when used, and so it can throw this error when `removeChild` is called [here](https://github.com/google/incremental-dom/blob/master/src/core.js#L224). \r\n\r\nA simple check inside `removeChild` could prevent all cases like this, so I think it should be worth adding it. I'll send a pull request for this, so you can use it in case you agree to do the change :)"},"comment":{"url":"https://api.github.com/repos/google/incremental-dom/issues/comments/262027662","html_url":"https://github.com/google/incremental-dom/issues/303#issuecomment-262027662","issue_url":"https://api.github.com/repos/google/incremental-dom/issues/303","id":262027662,"user":{"login":"sparhami","id":1410321,"avatar_url":"https://avatars.githubusercontent.com/u/1410321?v=3","gravatar_id":"","url":"https://api.github.com/users/sparhami","html_url":"https://github.com/sparhami","followers_url":"https://api.github.com/users/sparhami/followers","following_url":"https://api.github.com/users/sparhami/following{/other_user}","gists_url":"https://api.github.com/users/sparhami/gists{/gist_id}","starred_url":"https://api.github.com/users/sparhami/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sparhami/subscriptions","organizations_url":"https://api.github.com/users/sparhami/orgs","repos_url":"https://api.github.com/users/sparhami/repos","events_url":"https://api.github.com/users/sparhami/events{/privacy}","received_events_url":"https://api.github.com/users/sparhami/received_events","type":"User","site_admin":false},"created_at":"2016-11-21T18:39:51Z","updated_at":"2016-11-21T18:39:51Z","body":"Seems a bit asymmetric, you would be able remove a keyed node outside of Incremental DOM, but not be able to add one.\r\n\r\nI think the change should be fine though. We do allow non-keyed nodes to be remove outside of Incremental DOM."}}
{"actor":{"display_login":"sparhami"}}