{"action":"opened","issue":{"url":"https://api.github.com/repos/infamous/infamous/issues/40","repository_url":"https://api.github.com/repos/infamous/infamous","labels_url":"https://api.github.com/repos/infamous/infamous/issues/40/labels{/name}","comments_url":"https://api.github.com/repos/infamous/infamous/issues/40/comments","events_url":"https://api.github.com/repos/infamous/infamous/issues/40/events","html_url":"https://github.com/infamous/infamous/issues/40","id":162256358,"number":40,"title":"Convert from child-to-parent observation to parent-to-child observation.","user":{"login":"trusktr","id":297678,"avatar_url":"https://avatars.githubusercontent.com/u/297678?v=3","gravatar_id":"","url":"https://api.github.com/users/trusktr","html_url":"https://github.com/trusktr","followers_url":"https://api.github.com/users/trusktr/followers","following_url":"https://api.github.com/users/trusktr/following{/other_user}","gists_url":"https://api.github.com/users/trusktr/gists{/gist_id}","starred_url":"https://api.github.com/users/trusktr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trusktr/subscriptions","organizations_url":"https://api.github.com/users/trusktr/orgs","repos_url":"https://api.github.com/users/trusktr/repos","events_url":"https://api.github.com/users/trusktr/events{/privacy}","received_events_url":"https://api.github.com/users/trusktr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-06-25T01:27:22Z","updated_at":"2016-06-25T01:27:22Z","closed_at":null,"body":"This will solve the problem of being able to detect when a `<motor-node>` element is improperly slotted/distributed into a ShadowDOM tree.\r\n\r\nCurrently, when a `<motor-node>` element is attached into the DOM, it checks to see if it's parent element that it was attached to (\"connected\" to in v1 API terms) is another `<motor-node>` or `<motor-scene>` element. If this is not the case, the child `<motor-node>` element throws an error.\r\n\r\nHowever, this check is not possible when the `<motor-node>` element has been distributed into a ShadowDOM tree because from the perspective of the distributed `<motor-node>` element, it's parent is the parent it was attached to outside of the ShadowDOM tree, and it can not get a reference to it's containing `<content>` element (or `<slot>` element in v1 API), and therefore it cannot check that the parent of the `<content>` or `<slot>` element is another `<motor-node>` or `<motor-scene>` element.\r\n\r\nTo fix the problem we will have parent `<motor-node>` elements make the observation of their children instead of child `<motor-node>` elements looking at their parents. Parent `<motor-node>` elements that are inside of a ShadowDOM tree will have access to their `<content>` or `<slot>` element, and will be able to observe what gets distributed into there, and so the parent can throw the error based on the children it observes instead of the child throwing the error based on the parent it observes.\r\n\r\nWe also need to double check that our behind-the-scenes virtual scene graph is connected based on parent-to-child observation as well, so this way the API will be easier to understand if the flow of observation is the same direction in the virtual scene graph as well as the DOM.\r\n\r\ncc @dmarcos, this will apply to a-frame elements too if they are to be ShadowDOM-compatible. I'm not sure if this is the case already (as far as parent-to-child observation). I know that a-frame isn't considering ShadowDOM yet, so HTML developers will run into this problem with A-Frame at some point when/if they decide to try using A-Frame in ShadowDOM trees."}}
{"actor":{"display_login":"trusktr"}}