Event: thuộc tính cancelBubble
Deprecated: 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.
Note: This feature is available in Web Workers.
Thuộc tính cancelBubble của giao diện Event đã không còn được dùng nữa. Hãy dùng Event.stopPropagation() thay thế.
Việc đặt giá trị của nó thành true trước khi trả về từ một trình xử lý sự kiện sẽ ngăn sự kiện lan truyền. Trong các triển khai về sau, việc đặt giá trị này thành false không làm gì cả.
Xem Tương thích trình duyệt để biết chi tiết.
Giá trị
Một giá trị boolean. Giá trị true có nghĩa là sự kiện không được phép lan truyền xa hơn.
Ví dụ
elem.onclick = (event) => {
// Làm vài việc thú vị ở đây
event.cancelBubble = true;
};
Thông số kỹ thuật
| Specification |
|---|
| DOM> # dom-event-cancelbubble> |