@@ -30,11 +30,6 @@ spec:url; type:dfn;
30
30
spec:html; type:dfn;
31
31
text:task queues
32
32
for:/; text:event loop
33
- spec:html; type:idl; text:MessageEvent
34
- spec:html; type:event; for:WebSocket;
35
- text:message
36
- text:error
37
- spec:encoding-1; type:dfn; for:/; text:encoding
38
33
spec:url; type:dfn;
39
34
text:origin
40
35
for:/; text:url
@@ -343,7 +338,7 @@ It can have the following values:
343
338
fails, it triggers the [=fail the WebSocket connection=] algorithm, which
344
339
then invokes the [=close the WebSocket connection=] algorithm, which then
345
340
establishes that [=the WebSocket connection is closed=] , which fires the
346
- {{close!!event }} event <a href="#closeWebSocket">as described below</a> .
341
+ {{WebSocket/ close}} event <a href="#closeWebSocket">as described below</a> .
347
342
</div>
348
343
349
344
<hr>
@@ -375,15 +370,15 @@ string. After [=the WebSocket connection is established=], its value might chang
375
370
:: Do nothing.
376
371
377
372
<p class="note"> The connection is already closing or is already closed. If it has not already, a
378
- {{close!!event }} event will eventually fire <a href="#closeWebSocket">as described below</a> .
373
+ {{WebSocket/ close}} event will eventually fire <a href="#closeWebSocket">as described below</a> .
379
374
380
375
: If the WebSocket connection is not yet [=established=] [[!WSP]]
381
376
:: [=Fail the WebSocket connection=] and set [=this=] 's [=WebSocket/ready state=] to
382
377
{{WebSocket/CLOSING}} (2). [[!WSP]]
383
378
384
379
<p class="note"> The [=fail the WebSocket connection=] algorithm invokes the [=close the
385
380
WebSocket connection=] algorithm, which then establishes that [=the WebSocket connection is
386
- closed=] , which fires the {{close!!event }} event <a href="#closeWebSocket">as described
381
+ closed=] , which fires the {{WebSocket/ close}} event <a href="#closeWebSocket">as described
387
382
below</a> .
388
383
389
384
: If the WebSocket closing handshake has not yet been <a lt="the WebSocket closing handshake is
@@ -405,15 +400,15 @@ string. After [=the WebSocket connection is established=], its value might chang
405
400
406
401
<p class="note"> The [=start the WebSocket closing handshake=] algorithm eventually invokes the
407
402
[=close the WebSocket connection=] algorithm, which then establishes that [=the WebSocket
408
- connection is closed=] , which fires the {{close!!event }} event <a href="#closeWebSocket">as
403
+ connection is closed=] , which fires the {{WebSocket/ close}} event <a href="#closeWebSocket">as
409
404
described below</a> .
410
405
411
406
: Otherwise
412
407
:: Set [=this=] 's [=WebSocket/ready state=] to {{WebSocket/CLOSING}} (2).
413
408
414
409
<p class="note"> [=The WebSocket closing handshake is started=] , and will eventually invoke the
415
410
[=close the WebSocket connection=] algorithm, which will establish that [=the WebSocket
416
- connection is closed=] , and thus the {{close!!event }} event will fire, <a
411
+ connection is closed=] , and thus the {{WebSocket/ close}} event will fire, <a
417
412
href="#closeWebSocket"> as described below</a> .
418
413
</dl>
419
414
</div>
@@ -540,10 +535,10 @@ that must be supported, as [=event handler IDL attributes=], by all objects impl
540
535
<thead>
541
536
<tr><th> [=Event handler=] <th> [=Event handler event type=]
542
537
<tbody>
543
- <tr><td> <dfn attribute for=WebSocket>onopen</dfn> <td> {{open!!event }}
544
- <tr><td> <dfn attribute for=WebSocket>onmessage</dfn> <td> {{message!!event }}
545
- <tr><td> <dfn attribute for=WebSocket>onerror</dfn> <td> {{error!!event }}
546
- <tr><td> <dfn attribute for=WebSocket>onclose</dfn> <td> {{close!!event }}
538
+ <tr><td> <dfn attribute for=WebSocket>onopen</dfn> <td> {{WebSocket/ open}}
539
+ <tr><td> <dfn attribute for=WebSocket>onmessage</dfn> <td> {{WebSocket/ message}}
540
+ <tr><td> <dfn attribute for=WebSocket>onerror</dfn> <td> {{WebSocket/ error}}
541
+ <tr><td> <dfn attribute for=WebSocket>onclose</dfn> <td> {{WebSocket/ close}}
547
542
</table>
548
543
549
544
@@ -559,11 +554,12 @@ steps:
559
554
use=] , if it is not the null value. [[!WSP]]
560
555
1. Change the {{WebSocket/protocol}} attribute's value to the [=subprotocol in
561
556
use=] , if it is not the null value. [[!WSP]]
562
- 1. [=Fire an event=] named {{open!! event}} at the {{WebSocket}} object.
557
+ 1. [=Fire an event=] named <dfn event for="WebSocket">open</dfn> at the {{WebSocket}} object.
563
558
564
559
<p class="note"> Since the algorithm above is <a lt="queue a task">queued as a task</a> , there is no
565
560
race condition between <a lt="the WebSocket connection is established">the WebSocket connection
566
- being established</a> and the script setting up an event listener for the {{open!!event}} event.
561
+ being established</a> and the script setting up an event listener for the {{WebSocket/open}}
562
+ event.
567
563
568
564
</div>
569
565
@@ -592,8 +588,8 @@ When [=a WebSocket message has been received=] with type |type| and data |data|,
592
588
whose contents are |data|
593
589
</dl>
594
590
595
- 1. [=Fire an event=] named {{message!! event}} at the {{WebSocket}} object, using {{MessageEvent}} ,
596
- with the {{MessageEvent/origin}} attribute initialized to the <a lt="URL
591
+ 1. [=Fire an event=] named <dfn event for="WebSocket">message</dfn> at the {{WebSocket}} object,
592
+ using {{MessageEvent}} , with the {{MessageEvent/origin}} attribute initialized to the <a lt="URL
597
593
serializer">serialization</a> of the {{WebSocket}} object's [=url=] 's [=origin=] , and the
598
594
{{MessageEvent/data}} attribute initialized to |dataForEvent|.
599
595
@@ -609,8 +605,8 @@ this [=task=] so as to avoid stalling the main thread while it created the {{Arr
609
605
610
606
<div class="example" id="message-example">
611
607
612
- Here is an example of how to define a handler for the {{message!!event}}
613
- event in the case of text frames:
608
+ Here is an example of how to define a handler for the {{WebSocket/ message}} event in the case of
609
+ text frames:
614
610
615
611
<xmp highlight="js">
616
612
mysocket.onmessage = function (event) {
@@ -642,12 +638,14 @@ this task runs.) [[!WSP]]
642
638
1. Change the [=WebSocket/ready state=] to {{WebSocket/CLOSED}} (3).
643
639
1. If the user agent was required to [=fail the WebSocket connection=] , or if <a lt="the
644
640
WebSocket connection is closed">the WebSocket connection was closed</a> after being <dfn>flagged
645
- as full</dfn> , [=fire an event=] named {{error!!event}} at the {{WebSocket}} object. [[!WSP]]
646
- 1. [=Fire an event=] named {{close!!event}} at the {{WebSocket}} object, using {{CloseEvent}} , with
647
- the {{CloseEvent/wasClean}} attribute initialized to true if the connection closed [=cleanly=]
648
- and false otherwise, the {{CloseEvent/code}} attribute initialized to [=the WebSocket connection
649
- close code=] , and the {{CloseEvent/reason}} attribute initialized to the result of applying
650
- [=UTF-8 decode without BOM=] to [=the WebSocket connection close reason=] . [[!WSP]]
641
+ as full</dfn> , [=fire an event=] named <dfn event for="WebSocket">error</dfn> at the
642
+ {{WebSocket}} object. [[!WSP]]
643
+ 1. [=Fire an event=] named <dfn event for="WebSocket">close</dfn> at the {{WebSocket}} object,
644
+ using {{CloseEvent}} , with the {{CloseEvent/wasClean}} attribute initialized to true if the
645
+ connection closed [=cleanly=] and false otherwise, the {{CloseEvent/code}} attribute initialized
646
+ to [=the WebSocket connection close code=] , and the {{CloseEvent/reason}} attribute initialized
647
+ to the result of applying [=UTF-8 decode without BOM=] to [=the WebSocket connection close
648
+ reason=] . [[!WSP]]
651
649
</div>
652
650
653
651
<div class="warning">
@@ -703,7 +701,7 @@ https://www.w3.org/Bugs/Public/show_bug.cgi?id=17264 -->
703
701
704
702
# The {{CloseEvent}} interface # {#the-closeevent-interface}
705
703
706
- {{WebSocket}} objects use the {{CloseEvent}} interface for their {{close!!event }} events:
704
+ {{WebSocket}} objects use the {{CloseEvent}} interface for their {{WebSocket/ close}} events:
707
705
708
706
<xmp class="idl">
709
707
[Exposed=(Window,Worker)]
@@ -748,17 +746,17 @@ to. It represents the WebSocket connection close reason provided by the server.
748
746
749
747
A {{WebSocket}} object whose [=WebSocket/ready state=] was set to {{WebSocket/CONNECTING}} (0) as
750
748
of the last time the [=event loop=] reached <a for="event loop">step 1</a> must not be garbage
751
- collected if there are any event listeners registered for {{open!!event }} events,
752
- {{message!!event }} events, {{error!!event }} events, or {{close!!event }} events.
749
+ collected if there are any event listeners registered for {{WebSocket/ open}} events,
750
+ {{WebSocket/ message}} events, {{WebSocket/ error}} events, or {{WebSocket/ close}} events.
753
751
754
752
A {{WebSocket}} object whose [=WebSocket/ready state=] was set to {{WebSocket/OPEN}} (1) as of the
755
753
last time the [=event loop=] reached <a for="event loop">step 1</a> must not be garbage collected
756
- if there are any event listeners registered for {{message!!event }} events, {{error!!event }} , or
757
- {{ close!!event }} events.
754
+ if there are any event listeners registered for {{WebSocket/ message}} events, {{WebSocket/ error}} ,
755
+ or {{WebSocket/ close}} events.
758
756
759
757
A {{WebSocket}} object whose [=WebSocket/ready state=] was set to {{WebSocket/CLOSING}} (2) as of
760
758
the last time the [=event loop=] reached <a for="event loop">step 1</a> must not be garbage
761
- collected if there are any event listeners registered for {{error!!event }} or {{close!!event }}
759
+ collected if there are any event listeners registered for {{WebSocket/ error}} or {{WebSocket/ close}}
762
760
events.
763
761
764
762
A {{WebSocket}} object with <a lt="the WebSocket connection is established">an established
0 commit comments