{"action":"created","issue":{"url":"https://api.github.com/repos/whatwg/dom/issues/447","repository_url":"https://api.github.com/repos/whatwg/dom","labels_url":"https://api.github.com/repos/whatwg/dom/issues/447/labels{/name}","comments_url":"https://api.github.com/repos/whatwg/dom/issues/447/comments","events_url":"https://api.github.com/repos/whatwg/dom/issues/447/events","html_url":"https://github.com/whatwg/dom/issues/447","id":224427134,"number":447,"title":"Shadow: Specify when `slotchange` fires","user":{"login":"surma","id":234957,"avatar_url":"https://avatars2.githubusercontent.com/u/234957?v=3","gravatar_id":"","url":"https://api.github.com/users/surma","html_url":"https://github.com/surma","followers_url":"https://api.github.com/users/surma/followers","following_url":"https://api.github.com/users/surma/following{/other_user}","gists_url":"https://api.github.com/users/surma/gists{/gist_id}","starred_url":"https://api.github.com/users/surma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/surma/subscriptions","organizations_url":"https://api.github.com/users/surma/orgs","repos_url":"https://api.github.com/users/surma/repos","events_url":"https://api.github.com/users/surma/events{/privacy}","received_events_url":"https://api.github.com/users/surma/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2017-04-26T10:56:59Z","updated_at":"2017-05-10T06:07:19Z","closed_at":null,"body":"Safari, Chrome and ShadyDOM currently exhibit different behavior when `slotchange` does and does not fire. As far as I understand the spec, it is not precisely spec’d, meaning all these current behaviors are technically spec compliant, but can be very frustrating for developers.\r\n\r\n[Demo 1](https://jsbin.com/nomupo/3/edit?html,console,output): The parser creates a CustomElement that  uses ShadowDOM with slots\r\n[Demo 2](https://jsbin.com/sizehoz/6/edit?html,console,output): The same element in an upgraded\r\n\r\n**Which browser fires `slotchange`?**\r\n\r\n| | Parser Create demo | Upgrade demo |\r\n|-|----|---|\r\n|Chrome| Fire | No fire |\r\n|Safari| No fire | No fire |\r\n|ShadyDOM| Fire | Fire |\r\n\r\n(ShadyDOM was tested using Firefox).\r\n\r\nWhile **my main concern is consistency across browsers**, I like ShadyDOM’s behavior best in terms of DX as it is consistent with how `attributeChangeCallback` in that it fires upon initialization. This would allow developers to have their update logic in the `slotchange` handler and they wouldn’t need to manually detect silently slotted elements in `connectedCallback()`.\r\n\r\n/cc @hayatoito"},"comment":{"url":"https://api.github.com/repos/whatwg/dom/issues/comments/300383890","html_url":"https://github.com/whatwg/dom/issues/447#issuecomment-300383890","issue_url":"https://api.github.com/repos/whatwg/dom/issues/447","id":300383890,"user":{"login":"rniwa","id":285965,"avatar_url":"https://avatars3.githubusercontent.com/u/285965?v=3","gravatar_id":"","url":"https://api.github.com/users/rniwa","html_url":"https://github.com/rniwa","followers_url":"https://api.github.com/users/rniwa/followers","following_url":"https://api.github.com/users/rniwa/following{/other_user}","gists_url":"https://api.github.com/users/rniwa/gists{/gist_id}","starred_url":"https://api.github.com/users/rniwa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rniwa/subscriptions","organizations_url":"https://api.github.com/users/rniwa/orgs","repos_url":"https://api.github.com/users/rniwa/repos","events_url":"https://api.github.com/users/rniwa/events{/privacy}","received_events_url":"https://api.github.com/users/rniwa/received_events","type":"User","site_admin":false},"created_at":"2017-05-10T06:07:19Z","updated_at":"2017-05-10T06:07:19Z","body":"WebKit's behavior is not to fire `slotchange` on a newly created slot when the slot got assigned of nodes as it got inserted into the tree as I mentioned in https://github.com/w3c/webcomponents/issues/288#issuecomment-206791125. I don't know Chrome fires only in demo1 but not in demo2.\r\n\r\nHere's my thought.\r\n\r\n 1. Other DOM events such as `change` don't fire when the initial value is set.\r\n 2. A well written component probably have an efficient code path for when it's constructing shadow tree instead of relying on `slotchange` event\r\n\r\nFiring `slotchange` event when `slot` is inserted would make (2) harder because now we have to remember to ignore the very first `slotchange` being fired. So I'm still slightly inclined towards not firing for the initial insertion."}}
{"actor":{"display_login":"rniwa"}}