Skip to content

Commit

Permalink
Split event types source file by event type
Browse files Browse the repository at this point in the history
This splits the event-types.txt file into smaller files (by event type) so that they are easier to manage.

This should help reduce conflicts while converting the event types to an algorithmic description.

The generated spec should be identical after this cl.
  • Loading branch information
garykac committed Jun 7, 2024
1 parent 579c178 commit 09a2031
Show file tree
Hide file tree
Showing 10 changed files with 3,444 additions and 3,416 deletions.
7 changes: 7 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,13 @@ def process_main_spec():
'architecture',
'event-interfaces',
'event-types',
'event-types-uievent',
'event-types-focusevent',
'event-types-mouseevent',
'event-types-wheelevent',
'event-types-inputevent',
'event-types-keyboardevent',
'event-types-compositionevent',
'keyboard',
'legacy-event-initializers',
'legacy-key-attributes',
Expand Down
23 changes: 23 additions & 0 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,32 @@ path: sections/event-interfaces.include
</pre>

<!-- Section 5: The Events ================================================= -->
<section>
<pre class="include">
path: sections/event-types.include
</pre>
<pre class="include">
path: sections/event-types-uievent.include
</pre>
<pre class="include">
path: sections/event-types-focusevent.include
</pre>
<pre class="include">
path: sections/event-types-mouseevent.include
</pre>
<pre class="include">
path: sections/event-types-wheelevent.include
</pre>
<pre class="include">
path: sections/event-types-inputevent.include
</pre>
<pre class="include">
path: sections/event-types-keyboardevent.include
</pre>
<pre class="include">
path: sections/event-types-compositionevent.include
</pre>
</section>

<!-- Section 6: Keyboard and key values ==================================== -->
<pre class="include">
Expand Down
345 changes: 345 additions & 0 deletions sections/event-types-compositionevent.txt

Large diffs are not rendered by default.

253 changes: 253 additions & 0 deletions sections/event-types-focusevent.txt

Large diffs are not rendered by default.

168 changes: 168 additions & 0 deletions sections/event-types-inputevent.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
<h3 id="events-inputevents">Input Events</h3>

Input events are sent as notifications whenever the DOM is being updated (or about
to be updated) as a direct result of a user action (e.g., keyboard input in an editable
region, deleting or formatting text, ...).

<h4 id="interface-inputevent">Interface InputEvent</h4>

<h5 id="idl-inputevent">InputEvent</h5>

<p class="intro-dom">Introduced in DOM Level 3</p>

<pre class="idl">
[Exposed=Window]
interface InputEvent : UIEvent {
constructor(DOMString type, optional InputEventInit eventInitDict = {});
readonly attribute USVString? data;
readonly attribute boolean isComposing;
readonly attribute DOMString inputType;
};
</pre>

<dl dfn-for="InputEvent">
<dt><dfn attribute>data</dfn></dt>
<dd>
<code>data</code> holds the value of the characters generated by
an input method. This MAY be a single Unicode character or a
non-empty sequence of Unicode characters [[Unicode]]. Characters
SHOULD be normalized as defined by the Unicode normalization
form <em>NFC</em>, defined in [[UAX15]].
This attribute MAY contain the <a>empty string</a>.

The <a>un-initialized value</a> of this attribute MUST be
<code>null</code>.
</dd>

<dt><dfn attribute>isComposing</dfn></dt>
<dd>
<code>true</code> if the input event occurs as part of a
composition session, i.e., after a EVENT{compositionstart} event
and before the corresponding EVENT{compositionend} event.

The <a>un-initialized value</a> of this attribute MUST be
<code>false</code>.
</dd>

<dt><dfn attribute>inputType</dfn></dt>
<dd>
<code>inputType</code> contains a string that identifies the type
of input associated with the event.

For a list of valid values for this attribute, refer to the
[[Input-Events]] specification.

The <a>un-initialized value</a> of this attribute MUST be
the empty string <code>""</code>.
</dd>
</dl>

<h5 id="idl-inputeventinit">InputEventInit</h5>

<pre class="idl">
dictionary InputEventInit : UIEventInit {
DOMString? data = null;
boolean isComposing = false;
DOMString inputType = "";
};
</pre>

<dl dfn-for="InputEventInit">
<dt><dfn dict-member>data</dfn></dt>
<dd>
Initializes the <code>data</code> attribute of the InputEvent object.
</dd>

<dt><dfn dict-member>isComposing</dfn></dt>
<dd>
Initializes the <code>isComposing</code> attribute of the InputEvent object.
</dd>

<dt><dfn dict-member>inputType</dfn></dt>
<dd>
Initializes the <code>inputType</code> attribute of the InputEvent object.
</dd>
</dl>

<h4 id="events-inputevent-event-order">Input Event Order</h4>

The input events defined in this specification MUST occur in a set order
relative to one another.

++---+-------------+---------------------------------------------------+
=| # | Event Type | Notes |
+---+-------------+---------------------------------------------------+
+| 1 | beforeinput | |
+| | | <em>DOM element is updated</em> |
+| 2 | input | |
++---+-------------+---------------------------------------------------+

<h4 id="events-input-types">Input Event Types</h4>

<h5 id="event-type-beforeinput"><dfn>beforeinput</dfn></h5>

++------------------+--------------------------------------------------------------------------------------+ event-definition
=| % | |
+------------------+--------------------------------------------------------------------------------------+
+| Type | <strong><code>beforeinput</code></strong> |
+| Interface | {{InputEvent}} |
+| Sync / Async | Sync |
+| Bubbles | Yes |
+| Trusted Targets | <code>Element</code> (specifically: control types such as |
| | <code>HTMLInputElement</code>, etc.) or any <code>Element</code> with |
| | <code>contenteditable</code> attribute enabled |
+| Cancelable | Yes |
+| Composed | Yes |
+| Default action | Update the DOM element |
+| Context<br> | <ul> |
| (trusted events) | <li>{{Event}}.{{Event/target}} : <a>event target</a> that is about to be updated</li>|
| | <li>{{UIEvent}}.{{UIEvent/view}} : <a><code>Window</code></a></li> |
| | <li>{{UIEvent}}.{{UIEvent/detail}} : <code>0</code></li> |
| | <li>{{InputEvent}}.{{InputEvent/data}} : the string containing the data that will |
| | be added to the element, which MAY be <code>null</code> if the content will |
| | be deleted</li> |
| | <li>{{InputEvent}}.{{InputEvent/isComposing}} : <code>true</code> if this event is |
| | dispatched during a <a href="#keys-dead">dead key</a> sequence or while an |
| | <a>input method editor</a> is active (such that |
| | <a href="#events-compositionevents">composition events</a> are being dispatched);|
| | <code>false</code> otherwise.</li> |
| | </ul> |
++------------------+--------------------------------------------------------------------------------------+

A <a>user agent</a> MUST dispatch this event when the DOM is about
to be updated.

<h5 id="event-type-input"><dfn>input</dfn></h5>

++------------------+--------------------------------------------------------------------------------------+ event-definition
=| % | |
+------------------+--------------------------------------------------------------------------------------+
+| Type | <strong><code>input</code></strong> |
+| Interface | {{InputEvent}} |
+| Sync / Async | Sync |
+| Bubbles | Yes |
+| Trusted Targets | <code>Element</code> (specifically: control types such as |
| | <code>HTMLInputElement</code>, etc.) or any <code>Element</code> with |
| | <code>contenteditable</code> attribute enabled |
+| Cancelable | No |
+| Composed | Yes |
+| Default action | None |
+| Context<br> | <ul> |
| (trusted events) | <li>{{Event}}.{{Event/target}} : <a>event target</a> that was just updated</li> |
| | <li>{{UIEvent}}.{{UIEvent/view}} : <a><code>Window</code></a></li> |
| | <li>{{UIEvent}}.{{UIEvent/detail}} : <code>0</code></li> |
| | <li>{{InputEvent}}.{{InputEvent/data}} : the string containing the data that has |
| | been added to the element, which MAY be the <a>empty string</a> if the content |
| | has been deleted</li> |
| | <li>{{InputEvent}}.{{InputEvent/isComposing}} : <code>true</code> if this event is |
| | dispatched during a <a href="#keys-dead">dead key</a> sequence or while an |
| | <a>input method editor</a> is active (such that |
| | <a href="#events-compositionevents">composition events</a> are being dispatched);|
| | <code>false</code> otherwise.</li> |
| | </ul> |
++------------------+--------------------------------------------------------------------------------------+

A <a>user agent</a> MUST dispatch this event immediately after the
DOM has been updated.


Loading

0 comments on commit 09a2031

Please sign in to comment.