MutationEvent: phương thức initMutationEvent()
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.
Non-standard: This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists.
Phương thức initMutationEvent() của giao diện MutationEvent khởi tạo giá trị của một mutation event sau khi nó được tạo (thường sử dụng phương thức Document.createEvent()).
Phương thức này phải được gọi để thiết lập sự kiện trước khi nó được gửi đi, sử dụng EventTarget.dispatchEvent().
Note: Nói chung, bạn sẽ không tự tạo các sự kiện này; chúng được tạo bởi trình duyệt.
Cú pháp
initMutationEvent(type, canBubble, cancelable, relatedNode,
prevValue, newValue, attrName, attrChange)
Tham số
type-
Một chuỗi để đặt
typecủa sự kiện. Các trình duyệt đặt các giá trị sau choMutationEvent:DOMAttrModified,DOMAttributeNameChanged,DOMCharacterDataModified,DOMElementNameChanged,DOMNodeInserted,DOMNodeInsertedIntoDocument,DOMNodeRemoved,DOMNodeRemovedFromDocument,DOMSubtreeModified. canBubble-
Một giá trị boolean cho biết liệu sự kiện có thể nổi bọt hay không. Đặt giá trị của
Event.bubbles. cancelable-
Một giá trị boolean cho biết liệu hành động mặc định của sự kiện có thể bị ngăn chặn hay không. Đặt giá trị của
Event.cancelable. -
Một chuỗi đại diện cho giá trị mới của nút được sửa đổi, nếu có. Đặt giá trị của
MutationEvent.relatedNode. prevValue-
Một chuỗi đại diện cho giá trị trước của nút được sửa đổi, nếu có. Đặt giá trị của
MutationEvent.prevValue. newValue-
Một chuỗi đại diện cho giá trị mới của nút được sửa đổi, nếu có. Đặt giá trị của
MutationEvent.newValue. attrName-
Một chuỗi đại diện cho tên của nút
Attrđã thay đổi, nếu có. Đặt giá trị củaMutationEvent.attrName. attrChange-
Một số nguyên đại diện cho lý do nút thuộc tính thay đổi. Đặt giá trị của
MutationEvent.attrChange.
Giá trị trả về
Không có (undefined).