@@ -510,6 +510,7 @@ string.
510
510
<p> The <dfn attribute for=Event><code>currentTarget</code></dfn> attribute must return the value it
511
511
was initialized to. When an <a>event</a> is created the attribute must be initialized to null.
512
512
513
+ <div algorithm>
513
514
<p> The <dfn method for=Event><code>composedPath()</code></dfn> method steps are:
514
515
515
516
<ol>
@@ -608,6 +609,7 @@ was initialized to. When an <a>event</a> is created the attribute must be initia
608
609
609
610
<li><p> Return <var> composedPath</var> .
610
611
</ol>
612
+ </div>
611
613
612
614
<p> The <dfn attribute for=Event><code>eventPhase</code></dfn> attribute must return the value it was
613
615
initialized to, which must be one of the following:
@@ -703,6 +705,7 @@ initialized to.
703
705
704
706
<hr>
705
707
708
+ <div algorithm>
706
709
<p> To <dfn export for=Event id=concept-event-initialize>initialize</dfn> an <var> event</var> , with
707
710
<var> type</var> , <var> bubbles</var> , and <var> cancelable</var> , run these steps:
708
711
@@ -722,7 +725,9 @@ initialized to.
722
725
723
726
<li><p> Set <var> event</var> 's {{Event/cancelable}} attribute to <var> cancelable</var> .
724
727
</ol>
728
+ </div>
725
729
730
+ <div algorithm>
726
731
<p> The
727
732
<dfn method for=Event><code>initEvent(<var>type</var>, <var>bubbles</var>, <var>cancelable</var>)</code></dfn>
728
733
method steps are:
@@ -733,6 +738,7 @@ method steps are:
733
738
<li><p> <a>Initialize</a> <a>this</a> with <var> type</var> , <var> bubbles</var> , and
734
739
<var> cancelable</var> .
735
740
</ol>
741
+ </div>
736
742
737
743
<p class=note> {{Event/initEvent()}} is redundant with <a>event</a> constructors and
738
744
incapable of setting {{Event/composed}} . It has to be supported for legacy content.
@@ -792,6 +798,7 @@ dictionary CustomEventInit : EventInit {
792
798
<p> The <dfn attribute for=CustomEvent><code>detail</code></dfn> attribute must return the value it
793
799
was initialized to.
794
800
801
+ <div algorithm>
795
802
<p> The
796
803
<dfn method for=CustomEvent><code>initCustomEvent(<var>type</var>, <var>bubbles</var>, <var>cancelable</var>, <var>detail</var>)</code></dfn>
797
804
method steps are:
@@ -804,6 +811,7 @@ method steps are:
804
811
805
812
<li><p> Set <a>this</a> 's {{CustomEvent/detail}} attribute to <var> detail</var> .
806
813
</ol>
814
+ </div>
807
815
808
816
809
817
<h3 id=constructing-events>Constructing events</h3>
@@ -816,6 +824,7 @@ method steps are:
816
824
<p class=note> This construct can be used by {{Event}} subclasses that have a more complex structure
817
825
than a simple 1:1 mapping between their initializing dictionary members and IDL attributes.
818
826
827
+ <div algorithm>
819
828
<p> When a <dfn export for=Event id=concept-event-constructor>constructor</dfn> of the {{Event}}
820
829
interface, or of an interface that inherits from the {{Event}} interface, is invoked, these steps
821
830
must be run, given the arguments <var> type</var> and <var> eventInitDict</var> :
@@ -828,7 +837,9 @@ must be run, given the arguments <var>type</var> and <var>eventInitDict</var>:
828
837
829
838
<li><p> Return <var> event</var> .
830
839
</ol>
840
+ </div>
831
841
842
+ <div algorithm>
832
843
<p> To
833
844
<dfn export id=concept-event-create lt="creating an event|create an event">create an event</dfn>
834
845
using <var> eventInterface</var> , which must be either {{Event}} or an interface that inherits from
@@ -858,13 +869,15 @@ it, and optionally given a <a>realm</a> <var>realm</var>, run these steps:</p>
858
869
859
870
<li><p> Return <var> event</var> .
860
871
</ol>
872
+ </div>
861
873
862
874
<p class=note> <a>Create an event</a> is meant to be used by other specifications which need to
863
875
separately <a lt="create an event">create</a> and <a>dispatch</a> events, instead of simply
864
876
<a lt="fire an event">firing</a> them. It ensures the event's attributes are initialized to the
865
877
correct defaults.</p>
866
878
867
- <p> The <dfn noexport>inner event creation steps</dfn> , given an <var> interface</var> ,
879
+ <div algorithm>
880
+ <p> The <dfn noexport>inner event creation steps</dfn> , given an <var> eventInterface</var> ,
868
881
<var> realm</var> , <var> time</var> , and <var> dictionary</var> , are as follows:</p>
869
882
870
883
<ol>
@@ -890,6 +903,7 @@ correct defaults.</p>
890
903
891
904
<li><p> Return <var> event</var> .
892
905
</ol>
906
+ </div>
893
907
894
908
895
909
<h3 id=defining-event-interfaces>Defining event interfaces</h3>
@@ -1246,6 +1260,7 @@ property of the event being dispatched.
1246
1260
<p> Ideally, any new event APIs are defined such that they do not need this property. (Use
1247
1261
<a href="https://github.com/whatwg/dom/issues">whatwg/dom</a> for discussion.)
1248
1262
1263
+ <div algorithm>
1249
1264
<p> To <dfn export>legacy-obtain service worker fetch event listener callbacks</dfn> given a
1250
1265
{{ServiceWorkerGlobalScope}} <var> global</var> , run these steps. They return a <a for=/>list</a> of
1251
1266
{{EventListener}} objects.
@@ -1265,10 +1280,12 @@ property of the event being dispatched.
1265
1280
1266
1281
<li><p> Return <var> callbacks</var> .
1267
1282
</ol>
1283
+ </div>
1268
1284
1269
1285
1270
1286
<h3 id=dispatching-events>Dispatching events</h3>
1271
1287
1288
+ <div algorithm>
1272
1289
<p> To <dfn export id=concept-event-dispatch>dispatch</dfn> an <var> event</var> to a
1273
1290
<var> target</var> , with an optional <var> legacy target override flag</var> and an optional
1274
1291
<var> legacyOutputDidListenersThrowFlag</var> , run these steps:
@@ -1468,7 +1485,9 @@ property of the event being dispatched.
1468
1485
1469
1486
<li><p> Return false if <var> event</var> 's <a>canceled flag</a> is set; otherwise true.
1470
1487
</ol>
1488
+ </div>
1471
1489
1490
+ <div algorithm>
1472
1491
<p> To <dfn noexport id=concept-event-path-append>append to an event path</dfn> , given an
1473
1492
<var> event</var> , <var> invocationTarget</var> , <var> shadowAdjustedTarget</var> ,
1474
1493
<var> relatedTarget</var> , <var> touchTargets</var> , and a <var> slot-in-closed-tree</var> , run these
@@ -1494,7 +1513,9 @@ steps:</p>
1494
1513
<a for=Event/path>root-of-closed-tree</a> is <var> root-of-closed-tree</var> , and
1495
1514
<a for=Event/path>slot-in-closed-tree</a> is <var> slot-in-closed-tree</var> .
1496
1515
</ol>
1516
+ </div>
1497
1517
1518
+ <div algorithm>
1498
1519
<p> To <dfn noexport id=concept-event-listener-invoke>invoke</dfn> , given a <var> struct</var> ,
1499
1520
<var> event</var> , <var> phase</var> , and an optional <var> legacyOutputDidListenersThrowFlag</var> ,
1500
1521
run these steps:
@@ -1559,7 +1580,9 @@ run these steps:
1559
1580
<li><p> Set <var> event</var> 's {{Event/type}} attribute value to <var> originalEventType</var> .
1560
1581
</ol>
1561
1582
</ol>
1583
+ </div>
1562
1584
1585
+ <div algorithm>
1563
1586
<p> To <dfn noexport id=concept-event-listener-inner-invoke>inner invoke</dfn> , given an
1564
1587
<var> event</var> , <var> listeners</var> , <var> phase</var> , <var> invocationTargetInShadowTree</var> ,
1565
1588
and an optional <var> legacyOutputDidListenersThrowFlag</var> , run these steps:
@@ -1633,10 +1656,12 @@ and an optional <var>legacyOutputDidListenersThrowFlag</var>, run these steps:
1633
1656
1634
1657
<li><p> Return <var> found</var> .
1635
1658
</ol>
1659
+ </div>
1636
1660
1637
1661
1638
1662
<h3 id=firing-events>Firing events</h3>
1639
1663
1664
+ <div algorithm>
1640
1665
<p> To <dfn export id=concept-event-fire>fire an event</dfn> named <var> e</var> at <var> target</var> ,
1641
1666
optionally using an <var> eventConstructor</var> , with a description of how IDL attributes are to be
1642
1667
initialized, and a <var> legacy target override flag</var> , run these steps:
@@ -1659,6 +1684,7 @@ initialized, and a <var>legacy target override flag</var>, run these steps:
1659
1684
<li><p> Return the result of <a>dispatching</a> <var> event</var> at <var> target</var> , with
1660
1685
<var> legacy target override flag</var> set if set.
1661
1686
</ol>
1687
+ </div>
1662
1688
1663
1689
<p class=note> Fire in the context of DOM is short for
1664
1690
<a lt="create an event">creating</a> , initializing, and <a>dispatching</a> an <a>event</a> .
0 commit comments