{"action":"created","issue":{"url":"https://api.github.com/repos/marionettejs/backbone.marionette/issues/3172","repository_url":"https://api.github.com/repos/marionettejs/backbone.marionette","labels_url":"https://api.github.com/repos/marionettejs/backbone.marionette/issues/3172/labels{/name}","comments_url":"https://api.github.com/repos/marionettejs/backbone.marionette/issues/3172/comments","events_url":"https://api.github.com/repos/marionettejs/backbone.marionette/issues/3172/events","html_url":"https://github.com/marionettejs/backbone.marionette/issues/3172","id":176225499,"number":3172,"title":"Document View element removal","user":{"login":"scott-w","id":1969937,"avatar_url":"https://avatars.githubusercontent.com/u/1969937?v=3","gravatar_id":"","url":"https://api.github.com/users/scott-w","html_url":"https://github.com/scott-w","followers_url":"https://api.github.com/users/scott-w/followers","following_url":"https://api.github.com/users/scott-w/following{/other_user}","gists_url":"https://api.github.com/users/scott-w/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-w/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-w/subscriptions","organizations_url":"https://api.github.com/users/scott-w/orgs","repos_url":"https://api.github.com/users/scott-w/repos","events_url":"https://api.github.com/users/scott-w/events{/privacy}","received_events_url":"https://api.github.com/users/scott-w/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/marionettejs/backbone.marionette/labels/docs","name":"docs","color":"207de5"}],"state":"open","locked":false,"assignee":{"login":"paulfalgout","id":2028470,"avatar_url":"https://avatars.githubusercontent.com/u/2028470?v=3","gravatar_id":"","url":"https://api.github.com/users/paulfalgout","html_url":"https://github.com/paulfalgout","followers_url":"https://api.github.com/users/paulfalgout/followers","following_url":"https://api.github.com/users/paulfalgout/following{/other_user}","gists_url":"https://api.github.com/users/paulfalgout/gists{/gist_id}","starred_url":"https://api.github.com/users/paulfalgout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulfalgout/subscriptions","organizations_url":"https://api.github.com/users/paulfalgout/orgs","repos_url":"https://api.github.com/users/paulfalgout/repos","events_url":"https://api.github.com/users/paulfalgout/events{/privacy}","received_events_url":"https://api.github.com/users/paulfalgout/received_events","type":"User","site_admin":false},"assignees":[{"login":"paulfalgout","id":2028470,"avatar_url":"https://avatars.githubusercontent.com/u/2028470?v=3","gravatar_id":"","url":"https://api.github.com/users/paulfalgout","html_url":"https://github.com/paulfalgout","followers_url":"https://api.github.com/users/paulfalgout/followers","following_url":"https://api.github.com/users/paulfalgout/following{/other_user}","gists_url":"https://api.github.com/users/paulfalgout/gists{/gist_id}","starred_url":"https://api.github.com/users/paulfalgout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulfalgout/subscriptions","organizations_url":"https://api.github.com/users/paulfalgout/orgs","repos_url":"https://api.github.com/users/paulfalgout/repos","events_url":"https://api.github.com/users/paulfalgout/events{/privacy}","received_events_url":"https://api.github.com/users/paulfalgout/received_events","type":"User","site_admin":false}],"milestone":null,"comments":13,"created_at":"2016-09-11T06:49:51Z","updated_at":"2016-10-23T19:09:20Z","closed_at":null,"body":"Reported by @bazineta\r\n\r\n~~In Mn 3, a DOM element is removed from the DOM tree before any events fire on its children. For example:~~\r\n\r\n```javascript\r\nimport {View} from 'backbone.marionette';\r\n\r\nconst SecondChild = View.extend({\r\n  onBeforeDestroy() {\r\n    console.log('This is already out the DOM');\r\n  }\r\n});\r\n\r\nconst FirstChild = View.extend({\r\n  regions: {\r\n    child: '.child-hook'\r\n  },\r\n\r\n  onRender() {\r\n    this.showChildView('child', new SecondChild());\r\n  }\r\n});\r\n\r\nconst Root = View.extend({\r\n  regions: {\r\n    child: '.child-hook'\r\n  },\r\n\r\n  onRender() {\r\n    this.showChildView('child', new FirstChild());\r\n  }\r\n});\r\n\r\napp.getRegion().show(new Root()); // Renders everything\r\n\r\napp.getRegion().empty();\r\n```\r\n\r\nIn this example, by the time, the log hits, `SecondChild` is no longer visible in the DOM tree."},"comment":{"url":"https://api.github.com/repos/marionettejs/backbone.marionette/issues/comments/255607624","html_url":"https://github.com/marionettejs/backbone.marionette/issues/3172#issuecomment-255607624","issue_url":"https://api.github.com/repos/marionettejs/backbone.marionette/issues/3172","id":255607624,"user":{"login":"paulfalgout","id":2028470,"avatar_url":"https://avatars.githubusercontent.com/u/2028470?v=3","gravatar_id":"","url":"https://api.github.com/users/paulfalgout","html_url":"https://github.com/paulfalgout","followers_url":"https://api.github.com/users/paulfalgout/followers","following_url":"https://api.github.com/users/paulfalgout/following{/other_user}","gists_url":"https://api.github.com/users/paulfalgout/gists{/gist_id}","starred_url":"https://api.github.com/users/paulfalgout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulfalgout/subscriptions","organizations_url":"https://api.github.com/users/paulfalgout/orgs","repos_url":"https://api.github.com/users/paulfalgout/repos","events_url":"https://api.github.com/users/paulfalgout/events{/privacy}","received_events_url":"https://api.github.com/users/paulfalgout/received_events","type":"User","site_admin":false},"created_at":"2016-10-23T19:09:20Z","updated_at":"2016-10-23T19:09:20Z","body":"> Extend from View.\r\n> Implement _getImmediateChildren\r\n> Implement _removeChildren\r\n> When adding a view to the container view, call Marionette.monitorViewEvents(view).\r\n\r\nSo with this.. 3 thoughts..\r\n\r\n1. We could make public `_getImmediateChildren` and `_removeChildren` for this purpose.\r\n2. We could make a Marionette.Babysitter library that is simple Backbone.Babysitter but with the private stuff implemented.\r\n3. No change.  Implement babysitter at your own risk.\r\n\r\n#2 is a tiny bit harder and means more maintenance, but less things get publicized... seems like it wouldn't be hard to maintain.. but I dunno.\r\n"}}
{"actor":{"display_login":"paulfalgout"}}