Rara sends a note out of the kartu-produk component: set your CustomEvent’s bubbles and composed, see how far it gets out of the shadow root, and every…
Pub/sub for free from the DOM: components talk without importing each other. The basis of Web Components and many vanilla libraries. Get one option wrong (bubbles, composed, cancelable, detail) and the event seems sent, but nobody hears it, or the data is gone.
Emit without knowing who listens, and it all runs inside dispatchEvent
bubbles: true, a listener on a parent gets nothing A CustomEvent does not bubble by default. Set bubbles: true when the listener is on a parent or on document (delegation).detail The constructor only reads detail, bubbles, cancelable and composed; any other key is dropped silently. Any payload goes in { detail: … } and is read as e.detail.preventDefault() in a listener but dispatchEvent is still true The event has to be made with cancelable: true. Without it preventDefault() is ignored and e.defaultPrevented stays false..app, then C on document (phase 3). The line after dispatchEvent comes last: synchronous."bubbles": true line, send again Only A hears it: the event ends at .card."composed": true (keep bubbles), send again The note is held at the shadow root: D, B and C hear nothing."cancelable": true D calls preventDefault(), B steps aside because of e.defaultPrevented, and dispatchEvent returns false.