- From: <bugzilla@jessica.w3.org>
- Date: Wed, 24 Sep 2014 16:23:18 +0000
- To: public-webapps-bugzilla@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=26892 --- Comment #2 from Dimitri Glazkov <dglazkov@chromium.org> --- (In reply to Olli Pettay from comment #1) > No, events don't appear as bubbling in the scope of the host. What happens > under the host doesn't matter. If a "cancel" is dispatched there, then > it is supposed to look like its target is actually the host. > > Capturing event listeners should fire during capture phase, and > phase should be at_target is currentTarget == target. > bubbling event listeners would then fire during bubble phase, and > phase would be at_target when currentTarget == target. Yes, this is all good. I was there, remember? :) > > I don't quite see what bubbling actually have to do with your example. > What if web page uses capturing listeners? You'd have the same issue even > if bubbling would stop earlier. Take your browser eng hat off for a minute and put your average webdev hat on. As an average web dev, you only have a vague idea what the hell capturing listener is. You mostly do element.addEventListener(name, handler). So you have this app structure (idealized/simplified): grocery-app.html: ... <edit-grocery-item-dialog> #shadow-root ... <confirm-delete-dialog> #shadow-root ... ... <script> ... var editGroceryItem = document.querySelector('edit-grocery-item-dialog'); editGroceryItem.addEventListener('cancel', function() { console.log('CANCEL: closing edit grocery item!'); ... }); ... var confirmDelete = editGroceryItem.shadowRoot.querySelector('confirm-delete-dialog'); confirmDelete.addEventListener('cancel', function() { console.log('CANCEL: closing confirm!'); }); ... // when CANCEL button in the confirm delete dialog is clicked... buttonInsideConfirmDeleteDialog.dispatchEvent(new CustomEvent('cancel')); </script> Now, as a webdev, you'll be surprised (and probably frustrated) to find out that you ALWAYS get both event handlers invoked when you click on the cancel delete button. You'll be like "whaaa? I just wanted to close the confirm delete dialog. You stupid SOB, why are also closing my edit item dialog?" The web developer's expectation that the event doesn't bubble, and that whole AT_TARGET mumbo jumbo that you and I are painfully aware of is but a faint nagging feeling that something's gone terribly wrong. > > What we may need is some way to say that events x,y,z shouldn't propagate > out from the shadow dom, either in capture or bubble phase. Yes! That's what I said in the first comment! :) -- You are receiving this mail because: You are the QA Contact for the bug.
Received on Wednesday, 24 September 2014 16:23:20 UTC