{"action":"created","issue":{"url":"https://api.github.com/repos/whatwg/dom/issues/237","repository_url":"https://api.github.com/repos/whatwg/dom","labels_url":"https://api.github.com/repos/whatwg/dom/issues/237/labels{/name}","comments_url":"https://api.github.com/repos/whatwg/dom/issues/237/comments","events_url":"https://api.github.com/repos/whatwg/dom/issues/237/events","html_url":"https://github.com/whatwg/dom/issues/237","id":150138241,"number":237,"title":"Figure out how listeners should fire AT_TARGET when doing retargeting","user":{"login":"smaug----","id":9219935,"avatar_url":"https://avatars.githubusercontent.com/u/9219935?v=3","gravatar_id":"","url":"https://api.github.com/users/smaug----","html_url":"https://github.com/smaug----","followers_url":"https://api.github.com/users/smaug----/followers","following_url":"https://api.github.com/users/smaug----/following{/other_user}","gists_url":"https://api.github.com/users/smaug----/gists{/gist_id}","starred_url":"https://api.github.com/users/smaug----/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smaug----/subscriptions","organizations_url":"https://api.github.com/users/smaug----/orgs","repos_url":"https://api.github.com/users/smaug----/repos","events_url":"https://api.github.com/users/smaug----/events{/privacy}","received_events_url":"https://api.github.com/users/smaug----/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-04-21T17:20:36Z","updated_at":"2016-04-21T17:28:37Z","closed_at":null,"body":"There are few different options when listeners on non-deep target could fire.\r\n\r\n(1) Gecko has traditionally fired listeners this way for XBL and such:\r\ncapturing listeners, capturing listener on non-deep-target, capturing listeners in shadow content capturing and bubble listeners on shadow-target, bubble listeners in shadow content, bubble listeners on non-deep-target, bubble listener \r\nThat does differentiate capturing and bubble listeners at target phase when the .currentTarget there is a shadow host. But it keeps the algorithms rather easily understandable. There just is internal phase for the event and listeners are called based on that.\r\nFWIW, Gecko uses this also for input elements and such where the implementation of the element is effectively a native shadow DOM thingie  (native anonymous content in Gecko terms)\r\n\r\n(2) Other option is to call both capturing and bubble listeners during capture phase before entering shadow content. That gives non-shadow listeners priority over the listeners in shadow DOM.\r\n\r\n(3) Same as (2) but call the listeners at target during bubble phase, when the listeners in shadow DOM has been called already.\r\n\r\nI don't like (2).\r\n(1) gives kind of best of both setups (2) and (3) depending on whether light DOM uses capturing or bubble listeners, but it makes the existence of shadow dom sort of visible, since the listeners at target aren't called in the order they were registered, but in the order they were registered for capture or non-capture phase. \r\nI think I could live with (3) too."},"comment":{"url":"https://api.github.com/repos/whatwg/dom/issues/comments/213027898","html_url":"https://github.com/whatwg/dom/issues/237#issuecomment-213027898","issue_url":"https://api.github.com/repos/whatwg/dom/issues/237","id":213027898,"user":{"login":"annevk","id":1544111,"avatar_url":"https://avatars.githubusercontent.com/u/1544111?v=3","gravatar_id":"","url":"https://api.github.com/users/annevk","html_url":"https://github.com/annevk","followers_url":"https://api.github.com/users/annevk/followers","following_url":"https://api.github.com/users/annevk/following{/other_user}","gists_url":"https://api.github.com/users/annevk/gists{/gist_id}","starred_url":"https://api.github.com/users/annevk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/annevk/subscriptions","organizations_url":"https://api.github.com/users/annevk/orgs","repos_url":"https://api.github.com/users/annevk/repos","events_url":"https://api.github.com/users/annevk/events{/privacy}","received_events_url":"https://api.github.com/users/annevk/received_events","type":"User","site_admin":false},"created_at":"2016-04-21T17:28:37Z","updated_at":"2016-04-21T17:28:37Z","body":"It would also be weird to end up in a situation where user agent shadow trees do this differently from content shadow trees I think."}}