DOM

DOM

Source
  1. Let composedPath be an empty list.

  2. Let path be this’s path.

  3. If path is empty, then return composedPath.

  4. Let currentTarget be this’s currentTarget attribute value.

  5. Append currentTarget to composedPath.

  6. Let currentTargetIndex be 0.

  7. Let currentTargetHiddenSubtreeLevel be 0.

  8. Let index be path’s size − 1.

  9. While index is greater than or equal to 0:

    1. If path[index]'s root-of-closed-tree is true, then increase currentTargetHiddenSubtreeLevel by 1.

    2. If path[index]'s invocation target is currentTarget, then set currentTargetIndex to index and break.

    3. If path[index]'s slot-in-closed-tree is true, then decrease currentTargetHiddenSubtreeLevel by 1.

    4. Decrease index by 1.

  10. Let currentHiddenLevel and maxHiddenLevel be currentTargetHiddenSubtreeLevel.

  11. Set index to currentTargetIndex − 1.

  12. While index is greater than or equal to 0:

    1. If path[index]'s root-of-closed-tree is true, then increase currentHiddenLevel by 1.

    2. If currentHiddenLevel is less than or equal to maxHiddenLevel, then prepend path[index]'s invocation target to composedPath.

    3. If path[index]'s slot-in-closed-tree is true, then:

      1. Decrease currentHiddenLevel by 1.

      2. If currentHiddenLevel is less than maxHiddenLevel, then set maxHiddenLevel to currentHiddenLevel.

    4. Decrease index by 1.

  13. Set currentHiddenLevel and maxHiddenLevel to currentTargetHiddenSubtreeLevel.

  14. Set index to currentTargetIndex + 1.

  15. While index is less than path’s size:

    1. If path[index]'s slot-in-closed-tree is true, then increase currentHiddenLevel by 1.

    2. If currentHiddenLevel is less than or equal to maxHiddenLevel, then append path[index]'s invocation target to composedPath.

    3. If path[index]'s root-of-closed-tree is true, then:

      1. Decrease currentHiddenLevel by 1.

      2. If currentHiddenLevel is less than maxHiddenLevel, then set maxHiddenLevel to currentHiddenLevel.

    4. Increase index by 1.

  16. Return composedPath.

Event/eventPhase

In all current engines.

FirefoxYesSafariYesChrome45+ Opera32+Edge79+ Edge (Legacy)12+IE9+ Firefox for AndroidYesiOS SafariYesChrome for Android45+Android WebView45+Samsung Internet5.0+Opera Mobile32+ Node.js14.5.0+

The eventPhase attribute must return the value it was
initialized to, which must be one of the following:

NONE (numeric value 0) Events not currently dispatched are in this phase. CAPTURING_PHASE (numeric value 1) When an event is dispatched to an object that participates in a tree it will be in this phase before it reaches its target. AT_TARGET (numeric value 2) When an event is dispatched it will be in this phase on its target. BUBBLING_PHASE (numeric value 3) When an event is dispatched to an object that participates in a tree it will be in this phase after it reaches its target.

Initially the attribute must be initialized to NONE.

Each event has the following associated flags that are all initially unset:

  • stop propagation flag
  • stop immediate propagation flag
  • canceled flag
  • in passive listener flag
  • composed flag
  • initialized flag
  • dispatch flag

Event/stopPropagation

In all current engines.

Firefox1+Safari1+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ Node.js14.5.0+

The stopPropagation() method steps are to set this’s stop propagation flag.



Read Next page

Report Page