Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / JavaScript

Event.bubbles — event bubbling

Event.bubbles is a read-only Boolean property indicating whether an event can bubble from its target to its ancestors. A value of false does not disable capturing or handling at the target itself.

Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support

Syntax

event.bubbles
new Event(type, { bubbles: true })

Event.bubbles returns the Boolean value established when an event is initialized. In new Event(type, options), the bubbles option defaults to false; setting { bubbles: true } enables bubbling.

Bubbling proceeds from the target toward its ancestors. false does not prevent the capturing phase or listener invocation at the target. The example demonstrates both configurations on a detached DOM tree.

bubbles does not report whether propagation actually reached an ancestor: stopPropagation() can stop it without changing this property. cancelable concerns cancellation through preventDefault(), while composed concerns crossing Shadow DOM boundaries; these are separate settings.

This API belongs to the DOM standard, not ECMAScript itself. The example requires a browser DOM; Node 24 being present in a repository does not establish support for this environment or browser APIs.

Examples

{
  const parent = document.createElement('div');
  const child = document.createElement('div');
  parent.appendChild(child);
  const log = [];

  parent.addEventListener('demo', (event) => {
    log.push(`capture: ${event.bubbles}`);
  }, { capture: true });
  child.addEventListener('demo', (event) => {
    log.push(`target: ${event.bubbles}`);
  });
  parent.addEventListener('demo', (event) => {
    log.push(`bubble: ${event.bubbles}`);
  });

  child.dispatchEvent(new Event('demo'));
  child.dispatchEvent(new Event('demo', { bubbles: true }));
  console.log(log.join('\n'));
}

Result

capture: false
target: false
capture: true
target: true
bubble: true

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources