--- title: compositionupdate slug: Web/API/Element/compositionupdate_event translation_of: Web/API/Element/compositionupdate_event original_slug: Web/Events/compositionupdate ---

compositionupdate 事件触发于字符被输入到一段文字的时候(这些可见字符的输入可能需要一连串的键盘操作、语音识别或者点击输入法的备选词)

Bubbles Yes
Cancelable No
Target objects {{domxref("Element")}}
Interface {{domxref("TouchEvent")}}

属性

Property Type Description
target {{ReadOnlyInline}} {{domxref("EventTarget")}} 焦点所在的,处理文字输入的元素。
type {{ReadOnlyInline}} {{domxref("DOMString")}} The type of event.
bubbles {{ReadOnlyInline}} boolean Does the event normally bubble?
cancelable {{ReadOnlyInline}} boolean Is it possible to cancel the event?
view {{ReadOnlyInline}} {{domxref("WindowProxy")}} {{domxref("Document.defaultView")}} (the window of the document).
detail {{ReadOnlyInline}} long (float) 0.
data {{ReadOnlyInline}} {{domxref("DOMString")}} (string) 要被替换掉的字符串,如果输入时没有字符串被选,则为空字符串。只读。
locale {{ReadOnlyInline}} {{domxref("DOMString")}} (string) 输入事件的语言代号,或者空字符串。只读。

浏览器兼容性

{{Compat("api.Element.compositionupdate_event")}}

参阅