diff --git a/event-algo.bs b/event-algo.bs
index 4e24dcd..3f22980 100644
--- a/event-algo.bs
+++ b/event-algo.bs
@@ -876,7 +876,7 @@ Issue: TODO
1. If suppress key input events flag is set, then
1. Exit (since the keydown was canceled)
- Issue: Handle historical keypress event here
+ Issue: Handle historical keypress event here. Return if cancelled.
1. Let |inputType| = null
1. Let |data| = null
@@ -888,6 +888,9 @@ Issue: TODO
1. If |key| is "Delete", then |inputType| = "deleteContentForward"
1. Otherwise,
1. |inputType| = "insertText"
+
+ Issue: |inputType| should be "insertParagraph" or "insertLineBreak" when pressing Enter.
+
1. |data| = |key|
1. If |inputType| is not null, then
@@ -896,12 +899,25 @@ Issue: TODO
Can be enabled by changing the "dom.input_events.beforeinput_enabled" pref in "about:config"
1. Let |result| = fire an InputEvent with "beforeinput", |inputType| and |data|
- 1. If |result| is true
+ 1. If |result| is false, then return.
+ 1. Let |textInputData| be |data|.
+ 1. Let |shouldFireTextInput| to true.
+ 1. If |inputType| is either "insertParagraph" or "insertLineBreak", then:
+ 1. Set |textInputData| to "\n".
+ 1. If |target| is an {{HTMLInputElement}}, then set |shouldFireTextInput| to false.
+ 1. If |inputType| is not one of "insertText", "insertParagraph" or "insertLineBreak", then set |shouldFireTextInput| to false.
+ 1. If |shouldFireTextInput| is true, then:
+
+ 1. Set |result| = fire a TextEvent with "textInput", and |textInputData|
+
+ Note: The "textInput" event is obsolete.
+
+ 1. If |result| is false, then return.
- Note: Perform DOM update here. Insert key into |target| element
+ Note: Perform DOM update here. Insert key into |target| element
- Note: Compat:
- For insertFromPaste, Chrome has data = null, Firefox has data = same as beforeinput.
+ Note: Compat:
+ For insertFromPaste, Chrome has data = null, Firefox has data = same as beforeinput.
1. Fire an InputEvent with "input", |inputType| and |data|
@@ -935,6 +951,100 @@ Issue: TODO
+
+
+ See IDL definition in UI Events. The
+ If this's dispatch flag is set, then return.
+
+ Initialize a UIEvent with this, |type| and |eventTarget|
+
+ Set this.{{bubbles}} = |bubbles|
+
+ Set this.{{cancelable}} = |cancelable|
+
+ Set this.{{view}} = |view|
+
+ The bubbles/cancelable/view should be parameters to "Initialize a UIEvent" instead of being set twice.
+
+ Set this.{{TextEvent/data}} = |data|
+Text Event
+
+Note: {{TextEvent}} is obsolete.
+
+TextEvent Interface
+
+data
attribute must return the value it was initialized to.
+
+initTextEvent(type, bubbles, cancelable, view, data)
+method steps are:
+
+
+
+initialize a TextEvent
+
+ : Input
+ :: |e|, the {{Event}} to initialize
+ :: |eventType|, a DOMString containing the event type
+ :: |eventTarget|, the {{EventTarget}} of the event
+
+ : Output
+ :: None
+
+ 1. Initialize a UIEvent with |e|, |eventType| and |eventTarget|
+
+ 1. Initialize the following public attributes
+
+ 1. Set event.data = ""
+
+create a TextEvent
+
+ : Input
+ :: |eventType|, a DOMString containing the event type
+ :: |eventTarget|, the {{EventTarget}} of the event
+
+ : Output
+ :: None
+
+ 1. Let |e| = the result of
+ creating a new event using {{TextEvent}}
+ 1. Initialize a TextEvent with |e|, |eventType| and |eventTarget|
+
+ 1. Return |e|
+
+fire a TextEvent
+
+ : Input
+ :: |eventType|, a DOMString containing the event type
+ :: |data|, a DOMString containing event data, or null
+
+ : Output
+ :: None
+
+ 1. Let target =
+ currently focused area of a top-level browsing context
+ 1. Let |event| = result of create a TextEvent with |eventType|, |target|
+ 1. If |data| is null, set |data| to the empty string.
+ 1. Set |event|.{{TextEvent/data}} = |data|
+ 1. Return the result of dispatch |event| at |target|
+
+
To the extent possible under law, the editors have waived all copyright
and related or neighboring rights to this work.
-In addition, as of 19 October 2021,
+In addition, as of 8 February 2024,
the editors have made this specification available under the Open Web Foundation Agreement Version 1.0,
which is available at http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0.
Parts of this work may be from another specification document. If so, those parts are instead covered by the license of that specification document.
This document attempts to describe, in an algorithmic manner, how UIEvents - - should be handled by User Agents. Because this functionality has been shipping - in UAs for many years, the primary goal is to document the existing behaviors - and identify areas where implementations disagree. The intent is to fold this - information into the main UIEvents spec (and other specs) once there is - consensus that this process described here is adequate.
+should be handled by User Agents. Because this functionality has been shipping +in UAs for many years, the primary goal is to document the existing behaviors +and identify areas where implementations disagree. The intent is to fold this +information into the main UIEvents spec (and other specs) once there is +consensus that this process described here is adequate.