Skip to content

Commit

Permalink
[css-scroll-snap-2] Add snap event handler attributes for Document an…
Browse files Browse the repository at this point in the history
…d Element (#10215)

* [css-scroll-snap-2] Add snap event handler attributes for Document and Element

This adds the onsnapchanged and onsnapchanging attributes to the
css-scroll-snap-2 specification for elements and Document objects.

Heavily influenced by css-animations extensions to
GlobalInterfaceHandlers[1].

[1] https://drafts.csswg.org/css-animations/#interface-globaleventhandlers

* [css-scroll-snap-2] Add snap event handler attributes

Move to appendix; point to html spec.

* [css-scroll-snap-2] Add snap event handler attributes

Clarify that event handlers are additional attributes.
  • Loading branch information
DavMila committed May 14, 2024
1 parent 28a6821 commit f59dc15
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions css-scroll-snap-2/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,8 @@ SnapEvent interface
</dl>

A {{SnapEvent}} should not bubble and should not be cancellable.


<!--
██ ███████ ██ ██ ██████ ██ ██ ███ ██ ██ ████████ ██████
██ ██ ██ ███ ██ ██ ██ ██ ██ ██ ██ ███ ██ ██ ██ ██ ██
Expand Down Expand Up @@ -601,3 +603,46 @@ Physical Longhands for 'scroll-start-target' {#scroll-start-target-longhands-phy
</pre>

...

Appendix B: Event Handlers {#event-handlers}
============================================================

ISSUE: This section should be moved to the HTML event handler
<a href="https://html.spec.whatwg.org/#event-handlers-on-elements,-document-objects,-and-window-objects">specification</a>.

Event handlers on elements, Document objects and Window objects {#event-handlers-on-elements-document-and-window-objects}
------------------------------------------------------------------------------------------------------

The following are additional <a>event handlers</a> (and their corresponding <a>event handler event types</a>)
that must be supported by all <a>HTML elements</a> as both <a>event handler content attributes</a>
and <a>event handler IDL attributes</a>; and that must be supported by all {{Window}} objects and {{Document}} objects, as
<a>event handler IDL attributes</a>:

<table class="data" dfn-type=attribute dfn-for="Document,Element,Window">
<tr>
<th><a>Event handler</a></th>
<th><a>Event handler event type</a></th>
<tr>
<td><dfn>onsnapchanged</dfn></td>
<td>{{snapchanged}}</td>
<tr>
<td><dfn>onsnapchanging</dfn></td>
<td>{{snapchanging}}</td>
</table>


Extensions to the <code>GlobalEventHandlers</code> Interface Mixin {#interface-globaleventhandlers}
--------------------------------------------------------------------------------------------------------

This specification extends the {{GlobalEventHandlers}} interface mixin from
HTML to add <a>event handler IDL attributes</a> for {{SnapEvents}} as defined
in [[#event-handlers-on-elements-document-and-window-objects]].

<h4 id="interface-globaleventhandlers-idl">IDL Definition</h4>

<pre class="idl">
partial interface mixin GlobalEventHandlers {
attribute EventHandler onsnapchanged;
attribute EventHandler onsnapchanging;
};
</pre>

0 comments on commit f59dc15

Please sign in to comment.