Event.cancelBubble

지원이 중단되었습니다: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

Event.cancelBubble 속성은 Event.stopPropagation()의 별칭입니다. 이벤트 핸들러에서 반환되기 전에 값을 true로 설정하면 이벤트가 전파되지 않습니다.

예제

js
elem.onclick = function (event) {
  // Do cool things here
  event.cancelBubble = true;
};

명세

Specification
DOM Standard
# ref-for-dom-event-cancelbubble①

브라우저 호환성

BCD tables only load in the browser