- From: poot <cvsmail@w3.org>
- Date: Thu, 26 Feb 2009 17:37:36 +0900 (JST)
- To: public-html-diffs@w3.org
Drop <eventsource>. Replace the API with an EventSource object. Rename onclosed to onclose on WebSocket. Remove the mostly worthless event definitions. I'll add more useful intro text to replace them later. Defined garbage collection specialness for WebSocket and EventSource. (whatwg r2870) onload http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#handler-onload 3.3.3 Global attributes http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#global-attributes 7.3.4.2.1 Handshake http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#handshake width http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#dom-dim-width remote event task source http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#remote-event-task-source 7.2.5 Interpreting an event stream http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#event-stream-interpretation 7.3.4.2.2 Data framing http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#data-framing 7.3.4.3.2 Handshake details http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#handshake-details send data using the Web Socket http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#send-data-using-the-web-socket onmessage http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#handler-websocket-onmessage 7.3.3 Feedback from the protocol http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#feedback-from-the-protocol 7.2.6 Notes http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#notes A start tag whose tag name is "isindex" http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#isindex 7.2.3 Processing model http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#processing-model-3 7.3.3.1 Garbage collection http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#garbage-collection-1 7.2.7 Garbage collection http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#garbage-collection-0 fail the Web Socket connection http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#fail-the-web-socket-connection readyState http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#dom-eventsource-readystate 4.8.17 Dimension attributes http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#dimension-attributes disconnect() http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#dom-websocket-disconnect disconnect() http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#dom-eventsource-disconnect EventSource(url) http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#dom-eventsource Special http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#special OPEN http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#dom-eventsource-open 7.3 Web sockets http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#network fail the connection http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#fail-the-connection 8.1.2 Elements http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#elements-0 7.3.4.4 Closing the connection http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#closing-the-connection 7.3.4.3 Server-side requirements http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#server-side-requirements CLOSED http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#dom-eventsource-closed Data: Read a byte, let b be that byte. http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#ws-sd-data onopen http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#handler-websocket-onopen A vocabulary and associated APIs for HTML and XHTML http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#a-vocabulary-and-associated-apis-for-html-and-xhtml reconnection time http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#concept-event-stream-reconnection-time 7.2.4 Parsing an event stream http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#parsing-an-event-stream 8.2.5.7 The "in head" insertion mode http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#parsing-main-inhead Scoping http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#scoping last event ID string http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#concept-event-stream-last-event-id Web Socket task source http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#web-socket-task-source messagePort http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#dom-messageevent-messageport 4.3.2 The noscript element http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#the-noscript-element HTMLElement http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#htmlelement 7.3.4.1 Introduction http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#introduction-5 4.4 Sections http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#sections 10.2.2 Display types http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#display-types 8.4 Serializing HTML fragments http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#serializing-html-fragments W3C Working Draft 12 February 2009 http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#w3c-working-draft-12-february-year Void elements http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#void-elements URL http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#dom-eventsource-url onmessage http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#handler-eventsource-onmessage 7.2 Server-sent events http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#server-sent-events When the Web Socket connection is closed, the readyState attribute's value must be changed to CLOSED (2), and the user agent must queue a task to fire a simple event named close at the WebSocket object. http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#closeWebSocket announce the connection http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#announce-the-connection When the user agent is required to dispatch the event, then the user agent must act as follows: http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#dispatchMessage WebSocket http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#websocket 7.3.4.5 Security considerations http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#security-considerations onopen http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#handler-eventsource-onopen 7.3.4.3.3 Data framing http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#ws-sd-framing reset the connection http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#reset-the-connection HTMLBodyElement http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#htmlbodyelement 7.2.2 The EventSource interface http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#the-eventsource-interface onerror http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#handler-eventsource-onerror EventSource http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#eventsource CONNECTING http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#dom-eventsource-connecting Index http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#index 7.3.4 The Web Socket protocol http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#websocket-protocol Web Socket connection is closed http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#web-socket-connection-is-closed 8.2.5.10 The "in body" insertion mode http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#parsing-main-inbody onclose http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#handler-websocket-onclose Status of this document http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#status-of-this-document 4.8.16 SVG http://people.w3.org/mike/diffs/html5/spec/Overview.1.2043.html#svg http://people.w3.org/mike/diffs/html5/spec/Overview.diff.html http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.2042&r2=1.2043&f=h http://html5.org/tools/web-apps-tracker?from=2869&to=2870 =================================================================== RCS file: /sources/public/html5/spec/Overview.html,v retrieving revision 1.2042 retrieving revision 1.2043 diff -u -d -r1.2042 -r1.2043 --- Overview.html 25 Feb 2009 23:37:29 -0000 1.2042 +++ Overview.html 26 Feb 2009 08:33:48 -0000 1.2043 @@ -10,7 +10,7 @@ <p><a href=http://www.w3.org/><img alt=W3C height=48 src=http://www.w3.org/Icons/w3c_home width=72></a></p> <h1>HTML 5</h1> <h2 class="no-num no-toc" id=a-vocabulary-and-associated-apis-for-html-and-xhtml>A vocabulary and associated APIs for HTML and XHTML</h2> - <h2 class="no-num no-toc" id=w3c-working-draft-12-february-year><!--ZZZ:--> W3C Working Draft 12 February 2009<!-- fix date ZZZ --><!-- Editor's Draft 25 February 2009 --><!--:ZZZ--></h2> + <h2 class="no-num no-toc" id=w3c-working-draft-12-february-year><!--ZZZ:--> W3C Working Draft 12 February 2009<!-- fix date ZZZ --><!-- Editor's Draft 26 February 2009 --><!--:ZZZ--></h2> <dl><!-- ZZZ: update the month/day (twice), uncomment out --><dt>This Version:</dt> <dd><a href=http://www.w3.org/TR/2009/WD-html5-20090212/>http://www.w3.org/TR/2009/WD-html5-20090212/</a></dd> <!-- :ZZZ --> @@ -100,7 +100,7 @@ track. <!--ZZZ:--> This specification is the 12 February 2009 Working Draft. - <!-- This specification is the 25 February 2009 Editor's Draft. --> + <!-- This specification is the 26 February 2009 Editor's Draft. --> <!--:ZZZ--> </p><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- relationship to other work (required) --><p>This specification is also being produced by the <a href=http://www.whatwg.org/>WHATWG</a>. The two specifications are identical from the table of contents onwards.</p><!-- UNDER NO CIRCUMSTANCES IS THE FOLLOWING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- context and rationale (required) --><p>This specification is intended to replace (be a new version of) @@ -287,8 +287,7 @@ <ol> <li><a href=#scriptingLanguages><span class=secno>4.3.1.1 </span>Scripting languages</a></li> <li><a href=#inline-documentation-for-external-scripts><span class=secno>4.3.1.2 </span>Inline documentation for external scripts</a></ol></li> - <li><a href=#the-noscript-element><span class=secno>4.3.2 </span>The <code>noscript</code> element</a></li> - <li><a href=#the-eventsource-element><span class=secno>4.3.3 </span>The <code>eventsource</code> element</a></ol></li> + <li><a href=#the-noscript-element><span class=secno>4.3.2 </span>The <code>noscript</code> element</a></ol></li> <li><a href=#sections><span class=secno>4.4 </span>Sections</a> <ol> <li><a href=#the-body-element><span class=secno>4.4.1 </span>The <code>body</code> element</a></li> @@ -789,39 +788,42 @@ <li><a href=#event-definitions><span class=secno>7.1 </span>Event definitions</a></li> <li><a href=#server-sent-events><span class=secno>7.2 </span>Server-sent events</a> <ol> - <li><a href=#the-remoteeventtarget-interface><span class=secno>7.2.1 </span>The <code>RemoteEventTarget</code> interface</a></li> - <li><a href=#connecting-to-an-event-stream><span class=secno>7.2.2 </span>Connecting to an event stream</a></li> - <li><a href=#parsing-an-event-stream><span class=secno>7.2.3 </span>Parsing an event stream</a></li> - <li><a href=#event-stream-interpretation><span class=secno>7.2.4 </span>Interpreting an event stream</a></li> - <li><a href=#notes><span class=secno>7.2.5 </span>Notes</a></ol></li> + <li><a href=#server-sent-events-intro><span class=secno>7.2.1 </span>Introduction</a></li> + <li><a href=#the-eventsource-interface><span class=secno>7.2.2 </span>The <code>EventSource</code> interface</a></li> + <li><a href=#processing-model-3><span class=secno>7.2.3 </span>Processing model</a></li> + <li><a href=#parsing-an-event-stream><span class=secno>7.2.4 </span>Parsing an event stream</a></li> + <li><a href=#event-stream-interpretation><span class=secno>7.2.5 </span>Interpreting an event stream</a></li> + <li><a href=#notes><span class=secno>7.2.6 </span>Notes</a></li> + <li><a href=#garbage-collection-0><span class=secno>7.2.7 </span>Garbage collection</a></ol></li> <li><a href=#network><span class=secno>7.3 </span>Web sockets</a> <ol> <li><a href=#network-intro><span class=secno>7.3.1 </span>Introduction</a></li> <li><a href=#the-websocket-interface><span class=secno>7.3.2 </span>The <code>WebSocket</code> interface</a></li> - <li><a href=#websocket-events><span class=secno>7.3.3 </span>WebSocket Events</a></li> - <li><a href=#feedback-from-the-protocol><span class=secno>7.3.4 </span>Feedback from the protocol</a></li> + <li><a href=#feedback-from-the-protocol><span class=secno>7.3.3 </span>Feedback from the protocol</a> + <ol> + <li><a href=#garbage-collection-1><span class=secno>7.3.3.1 </span>Garbage collection</a></ol></li> <li><a href=#websocket-protocol title="This protocol enables two-way communication between a user agent running untrusted code running in a controlled environment to a remote host that understands the protocol. It is intended to fail to communicate with servers of pre-existing protocols like SMTP or HTTP, while allowing HTTP servers to opt-in to supporting this protocol if desired. It is - designed to be easy to implement on the server side."><span class=secno>7.3.5 </span>The Web Socket + designed to be easy to implement on the server side."><span class=secno>7.3.4 </span>The Web Socket protocol</a> <ol> - <li><a href=#introduction-5><span class=secno>7.3.5.1 </span>Introduction</a></li> - <li><a href=#client-side-requirements><span class=secno>7.3.5.2 </span>Client-side requirements</a> + <li><a href=#introduction-5><span class=secno>7.3.4.1 </span>Introduction</a></li> + <li><a href=#client-side-requirements><span class=secno>7.3.4.2 </span>Client-side requirements</a> <ol> - <li><a href=#handshake><span class=secno>7.3.5.2.1 </span>Handshake</a></li> - <li><a href=#data-framing><span class=secno>7.3.5.2.2 </span>Data framing</a></ol></li> - <li><a href=#server-side-requirements><span class=secno>7.3.5.3 </span>Server-side requirements</a> + <li><a href=#handshake><span class=secno>7.3.4.2.1 </span>Handshake</a></li> + <li><a href=#data-framing><span class=secno>7.3.4.2.2 </span>Data framing</a></ol></li> + <li><a href=#server-side-requirements><span class=secno>7.3.4.3 </span>Server-side requirements</a> <ol> - <li><a href=#minimal-handshake><span class=secno>7.3.5.3.1 </span>Minimal handshake</a></li> - <li><a href=#handshake-details><span class=secno>7.3.5.3.2 </span>Handshake details</a></li> - <li><a href=#ws-sd-framing><span class=secno>7.3.5.3.3 </span>Data framing</a></ol></li> - <li><a href=#closing-the-connection><span class=secno>7.3.5.4 </span>Closing the connection</a></li> - <li><a href=#security-considerations><span class=secno>7.3.5.5 </span>Security considerations</a></li> - <li><a href=#iana-considerations><span class=secno>7.3.5.6 </span>IANA considerations</a></ol></ol></li> + <li><a href=#minimal-handshake><span class=secno>7.3.4.3.1 </span>Minimal handshake</a></li> + <li><a href=#handshake-details><span class=secno>7.3.4.3.2 </span>Handshake details</a></li> + <li><a href=#ws-sd-framing><span class=secno>7.3.4.3.3 </span>Data framing</a></ol></li> + <li><a href=#closing-the-connection><span class=secno>7.3.4.4 </span>Closing the connection</a></li> + <li><a href=#security-considerations><span class=secno>7.3.4.5 </span>Security considerations</a></li> + <li><a href=#iana-considerations><span class=secno>7.3.4.6 </span>IANA considerations</a></ol></ol></li> <li><a href=#crossDocumentMessages><span class=secno>7.4 </span>Cross-document messaging</a> <ol> <li><a href=#introduction-6><span class=secno>7.4.1 </span>Introduction</a></li> @@ -5896,7 +5898,6 @@ attribute <a href=#function>Function</a> <a href=#handler-onkeypress title=handler-onkeypress>onkeypress</a>; attribute <a href=#function>Function</a> <a href=#handler-onkeyup title=handler-onkeyup>onkeyup</a>; attribute <a href=#function>Function</a> <a href=#handler-onload title=handler-onload>onload</a>; - attribute <a href=#function>Function</a> <a href=#handler-onmessage title=handler-onmessage>onmessage</a>; attribute <a href=#function>Function</a> <a href=#handler-onmousedown title=handler-onmousedown>onmousedown</a>; attribute <a href=#function>Function</a> <a href=#handler-onmousemove title=handler-onmousemove>onmousemove</a>; attribute <a href=#function>Function</a> <a href=#handler-onmouseout title=handler-onmouseout>onmouseout</a>; @@ -5944,7 +5945,6 @@ <li><code title=handler-onkeypress><a href=#handler-onkeypress>onkeypress</a></code></li> <li><code title=handler-onkeyup><a href=#handler-onkeyup>onkeyup</a></code></li> <li><code title=handler-onload><a href=#handler-onload>onload</a></code>*</li> - <li><code title=handler-onmessage><a href=#handler-onmessage>onmessage</a></code>*</li> <li><code title=handler-onmousedown><a href=#handler-onmousedown>onmousedown</a></code></li> <li><code title=handler-onmousemove><a href=#handler-onmousemove>onmousemove</a></code></li> <li><code title=handler-onmouseout><a href=#handler-onmouseout>onmouseout</a></code></li> @@ -5954,10 +5954,11 @@ <li><code title=handler-onscroll><a href=#handler-onscroll>onscroll</a></code></li> <li><code title=handler-onselect><a href=#handler-onselect>onselect</a></code></li> <li><code title=handler-onsubmit><a href=#handler-onsubmit>onsubmit</a></code></li> - </ul><p class=note>The attributes marked with an asterisk cannot be - specified on <code><a href=#the-body-element>body</a></code> elements as those elements expose - <a href=#event-handler-attributes-0>event handler attributes</a> of the <code><a href=#window>Window</a></code> - object with the same names.</p><hr><p>Also, <a href=#custom-data-attribute title="custom data attribute">custom data + </ul><p class=note>The attribute<!--s--> marked with an asterisk cannot + be specified on <code><a href=#the-body-element>body</a></code> elements as those elements expose + <!---->an<!----> <a href=#event-handler-attributes-0 title="event handler attributes">event + handler attribute<!--s--></a> of the <code><a href=#window>Window</a></code> object + with the same name<!--s-->.</p><hr><p>Also, <a href=#custom-data-attribute title="custom data attribute">custom data attributes</a> (e.g. <code title="">data-foldername</code> or <code title="">data-msgid</code>) can be specified on any <a href=#html-elements title="HTML elements">HTML element</a>, to store custom data specific to the page.<p>In <a href=#html-documents>HTML documents</a>, elements in the <a href=#html-namespace-0>HTML @@ -8802,77 +8803,7 @@ particular, children of the <code><a href=#the-noscript-element>noscript</a></code> element are not exempt from <a href=#form-submission-0>form submission</a>, scripting, and so forth, even when <a href=#concept-n-script title=concept-n-script>scripting is enabled</a> - for the element.<h4 id=the-eventsource-element><span class=secno>4.3.3 </span>The <dfn><code>eventsource</code></dfn> element</h4><dl class=element><dt>Categories</dt> - <dd><a href=#metadata-content-0>Metadata content</a>.</dd> - <dd><a href=#flow-content-0>Flow content</a>.</dd> - <dd><a href=#phrasing-content-0>Phrasing content</a>.</dd> - <dt>Contexts in which this element may be used:</dt> - <dd>Where <a href=#metadata-content-0>metadata content</a> is expected.</dd> - <dd>Where <a href=#phrasing-content-0>phrasing content</a> is expected.</dd> - <dt>Content model:</dt> - <dd>Empty.</dd> - <dt>Content attributes:</dt> - <dd><a href=#global-attributes>Global attributes</a></dd> - <dd><code title=attr-eventsource-src><a href=#attr-eventsource-src>src</a></code></dd> - <dt>DOM interface:</dt> - <dd> -<pre class=idl>interface <dfn id=htmleventsourceelement>HTMLEventSourceElement</dfn> : <a href=#htmlelement>HTMLElement</a> { - attribute DOMString <a href=#dom-eventsource-src title=dom-eventsource-src>src</a>; -};</pre> - </dd> - </dl><p>The <code><a href=#the-eventsource-element>eventsource</a></code> element <a href=#represents>represents</a> a - target for events generated by a remote server.<p>The <dfn id=attr-eventsource-src title=attr-eventsource-src><code>src</code></dfn> - attribute, if specified, must give a <a href=#valid-url>valid URL</a> - identifying a resource that uses the <code>text/event-stream</code> - format.<p>When an <code><a href=#the-eventsource-element>eventsource</a></code> element with a <code title=attr-eventsource-src><a href=#attr-eventsource-src>src</a></code> attribute specified is <a href=#insert-an-element-into-a-document title="insert an element into a document">inserted into the - document</a>, and when an <code><a href=#the-eventsource-element>eventsource</a></code> element that - is already in the document<!--XXX xref--> has a <code title=attr-eventsource-src><a href=#attr-eventsource-src>src</a></code> attribute added, the user - agent must run the <a href=#add-declared-event-source>add declared event source</a> - algorithm.<p>While an <code><a href=#the-eventsource-element>eventsource</a></code> element is in a document<!-- - XXX xref -->, if its <code title=attr-eventsource-src><a href=#attr-eventsource-src>src</a></code> - attribute is mutated, the user agent must must run the <a href=#remove-declared-event-source>remove - declared event source</a> algorithm followed by the <a href=#add-declared-event-source>add - declared event source</a> algorithm.<p>When an <code><a href=#the-eventsource-element>eventsource</a></code> element with a <code title=attr-eventsource-src><a href=#attr-eventsource-src>src</a></code> attribute specified is - removed from a document<!-- XXX xref -->, and when an - <code><a href=#the-eventsource-element>eventsource</a></code> element that is in a document<!--XXX - xref--> with a <code title=attr-eventsource-src><a href=#attr-eventsource-src>src</a></code> - attribute specified has its <code title=attr-eventsource-src><a href=#attr-eventsource-src>src</a></code> attribute removed, the user - agent must run the <a href=#remove-declared-event-source>remove declared event source</a> - algorithm.</p><!-- changing the base URL doesn't trigger these algorithms --><p>When it is created, an <code><a href=#the-eventsource-element>eventsource</a></code> element must - have its <i>current declared event source</i> set to - "undefined".<p>The <dfn id=add-declared-event-source>add declared event source</dfn> algorithm is as - follows:<ol><li><a href=#resolve-a-url title="resolve a url">Resolve</a> the <a href=#url>URL</a> - specified by the <code><a href=#the-eventsource-element>eventsource</a></code> element's <code title=attr-eventsource-src><a href=#attr-eventsource-src>src</a></code> attribute, relative to the - element.</li> - - <li>If that fails, then set the element's <i>current declared event - source</i> to "undefined" and abort these steps.</li> - - <li>Otherwise, add the resulting <a href=#absolute-url>absolute URL</a> to the - <a href=#concept-eventsource-list title=concept-eventsource-list>list of event sources</a> - for the element.</li> - - <li>Let the element's <i>current declared event source</i> be that - <a href=#absolute-url>absolute URL</a>.</li> - - </ol><p>The <dfn id=remove-declared-event-source>remove declared event source</dfn> algorithm is as - follows:<ol><li>If the element's <i>current declared event source</i> is - "undefined", abort these steps.</li> - - <li>Otherwise, remove the element's <i>current declared event - source</i> from the <a href=#concept-eventsource-list title=concept-eventsource-list>list of - event sources</a> for the element.</li> - - <li>Let the element's <i>current declared event source</i> be - "undefined".</li> - - </ol><p>There can be more than one <code><a href=#the-eventsource-element>eventsource</a></code> element per - document, but authors should take care to avoid opening multiple - connections to the same server as HTTP recommends a limit to the - number of simultaneous connections that a user agent can open per - server.</p><!-- v2: make 'load', 'error', 'abort' events fire on this element --><p>The <dfn id=dom-eventsource-src title=dom-eventsource-src><code>src</code></dfn> DOM - attribute must <a href=#reflect>reflect</a> the content attribute of the - same name.<h3 id=sections><span class=secno>4.4 </span>Sections</h3><p id=applyToSection>Some elements, for example + for the element.<h3 id=sections><span class=secno>4.4 </span>Sections</h3><p id=applyToSection>Some elements, for example <code><a href=#the-address-element>address</a></code> elements, are scoped to their nearest ancestor <a href=#sectioning-content-0>sectioning content</a>. For such elements <var title="">x</var>, the elements that apply to a <a href=#sectioning-content-0>sectioning content</a> element <var title="">e</var> are all the <var title="">x</var> elements whose nearest <a href=#sectioning-content-0>sectioning @@ -8922,20 +8853,20 @@ <code><a href=#the-body-element>body</a></code> element.<p>The <code><a href=#the-body-element>body</a></code> element exposes as <a href=#event-handler-content-attributes>event handler content attributes</a> a number of the <a href=#event-handler-attributes-0>event handler attributes</a> of the <code><a href=#window>Window</a></code> object. It also mirrors - their <a href=#event-handler-dom-attributes>event handler DOM attributes</a>.<p>The <code title=handler-window-onerror><a href=#handler-window-onerror>onerror</a></code> and <code title=handler-window-onmessage><a href=#handler-window-onmessage>onmessage</a></code> <a href=#event-handler-attributes-0>event - handler attributes</a> of the <code><a href=#window>Window</a></code> object, exposed - on the <code><a href=#the-body-element>body</a></code> element, shadow the generic <code title=handler-onerror><a href=#handler-onerror>onerror</a></code> and <code title=handler-onmessage><a href=#handler-onmessage>onmessage</a></code> <a href=#event-handler-attributes-0>event handler - attributes</a> normally supported by <a href=#html-elements>HTML - elements</a>.<p class=example>Thus, for example, a bubbling <code title=event-message><a href=#event-message>message</a></code> event fired on a child of - <a href=#the-body-element-0>the body element</a> of a <code>Document</code> would first - trigger the <code title=handler-onmessage><a href=#handler-onmessage>onmessage</a></code> - <a href=#event-handler-content-attributes>event handler content attributes</a> of that element, then - that of the root <code><a href=#the-html-element>html</a></code> element, and only <em>then</em> - would it trigger the <code title=handler-window-onmessage><a href=#handler-window-onmessage>onmessage</a></code> <a href=#event-handler-content-attributes title="event - handler content attributes">event handler content attribute</a> - on the <code><a href=#the-body-element>body</a></code> element. This is because the event would - bubble from the target, to the <code><a href=#the-body-element>body</a></code>, to the - <code><a href=#the-html-element>html</a></code>, to the <code>Document</code>, to the + their <a href=#event-handler-dom-attributes>event handler DOM attributes</a>.<p>The <code title=handler-window-onerror><a href=#handler-window-onerror>onerror</a></code> <a href=#event-handler-attributes-0 title="event handler attributes">event handler + attribute<!--s--></a> of the <code><a href=#window>Window</a></code> object, exposed + on the <code><a href=#the-body-element>body</a></code> element, shadow<!---->s<!----> the generic + <code title=handler-onerror><a href=#handler-onerror>onerror</a></code> <a href=#event-handler-attributes-0 title="event + handler attributes">event handler attribute<!--s--></a> normally + supported by <a href=#html-elements>HTML elements</a>.<p class=example>Thus, for example, a bubbling <code title=event-error><a href=#event-error>error</a></code> event fired on a child of <a href=#the-body-element-0>the + body element</a> of a <code>Document</code> would first trigger + the <code title=handler-onerror><a href=#handler-onerror>onerror</a></code> <a href=#event-handler-content-attributes>event handler + content attributes</a> of that element, then that of the root + <code><a href=#the-html-element>html</a></code> element, and only <em>then</em> would it trigger + the <code title=handler-window-onerror><a href=#handler-window-onerror>onerror</a></code> <a href=#event-handler-content-attributes title="event handler content attributes">event handler content + attribute</a> on the <code><a href=#the-body-element>body</a></code> element. This is because + the event would bubble from the target, to the <code><a href=#the-body-element>body</a></code>, to + the <code><a href=#the-html-element>html</a></code>, to the <code>Document</code>, to the <code><a href=#window>Window</a></code>, and the event handler attribute on the <code><a href=#the-body-element>body</a></code> is watching the <code><a href=#window>Window</a></code> not the <code><a href=#the-body-element>body</a></code>. A regular event listener attached to the @@ -18535,7 +18466,7 @@ fragment.<p>When the SVG <code>foreignObject</code> element contains elements from the HTML namespace, such elements must all be <a href=#flow-content-0>flow content</a> and must not be interleaved with non-HTML - elements. <a href=#references>[SVG]</a><h4 id=dimension-attributes><span class=secno>4.8.17 </span><dfn>Dimension attributes</dfn></h4><p>The <dfn id=attr-dim-width title=attr-dim-width><code>width</code></dfn> and <dfn id=attr-dim-height title=attr-dim-height><code>height</code></dfn> attributes on + elements. <a href=#references>[SVG]</a><h4 id=dimension-attributes><span class=secno>4.8.17 </span><dfn>Dimension attributes</dfn></h4><p><strong>Author requirements:</strong> The <dfn id=attr-dim-width title=attr-dim-width><code>width</code></dfn> and <dfn id=attr-dim-height title=attr-dim-height><code>height</code></dfn> attributes on <code><a href=#the-img-element>img</a></code>, <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-object-element>object</a></code>, <code><a href=#video>video</a></code>, and, when their <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#image-button-state title=attr-input-type-image>Image Button</a> state, <code><a href=#the-input-element>input</a></code> elements may be specified to give the dimensions @@ -18560,7 +18491,9 @@ intrinsic width to the intrinsic height in the resource. The <var title="">specified width</var> and <var title="">specified height</var> are the values of the <code title=attr-dim-width><a href=#attr-dim-width>width</a></code> and <code title=attr-dim-height><a href=#attr-dim-height>height</a></code> attributes respectively.<p>The two attributes must be omitted if the resource in question does not have both an intrinsic width and an intrinsic height.<p class=note>Basically, the dimension attributes can't be used to - stretch the image.<p>User agents are expected to use these attributes <a href=#dimRendering>as hints for the rendering</a>.<p>The <dfn id=dom-dim-width title=dom-dim-width><code>width</code></dfn> and <dfn id=dom-dim-height title=dom-dim-height><code>height</code></dfn> DOM attributes on + stretch the image.<p><strong>User agent requirements:</strong> User agents are + expected to use these attributes <a href=#dimRendering>as hints + for the rendering</a>.<p>The <dfn id=dom-dim-width title=dom-dim-width><code>width</code></dfn> and <dfn id=dom-dim-height title=dom-dim-height><code>height</code></dfn> DOM attributes on the <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-object-element>object</a></code>, and <code><a href=#video>video</a></code> elements must <a href=#reflect>reflect</a> the respective content attributes of the same name.</p><!-- XXX check @@ -30148,11 +30081,6 @@ <dd><p>Must be invoked whenever a <code title=event-load><a href=#event-load>load</a></code> event is targeted at or bubbles through the element.</dd> - <dt><dfn id=handler-onmessage title=handler-onmessage><code>onmessage</code></dfn></dt> <!-- new for <eventsource> --> - - <dd><p>Must be invoked whenever a <code title=event-message><a href=#event-message>message</a></code> event is targeted at or bubbles - through the element.</dd> - </dl><hr><p>The following are the event handler attributes that must be supported by <code><a href=#window>Window</a></code> objects, as DOM attributes on the <code><a href=#window>Window</a></code> object, and with corresponding content @@ -37172,130 +37100,164 @@ must be the empty string, the <code title=dom-MessageEvent-origin><a href=#dom-messageevent-origin>origin</a></code> attribute must be the empty string, the <code title=dom-MessageEvent-source><a href=#dom-messageevent-source>source</a></code> attribute must be null, and the <code title=dom-MessageEvent-messagePort><a href=#dom-messageevent-messageport>messagePort</a></code> - attribute must be null.<h3 id=server-sent-events><span class=secno>7.2 </span><dfn>Server-sent events</dfn></h3><!-- eventsource --><p>This section describes a mechanism for allowing servers to - dispatch DOM events into documents that expect it. The - <code><a href=#the-eventsource-element>eventsource</a></code> element provides a simple interface to - this mechanism.<h4 id=the-remoteeventtarget-interface><span class=secno>7.2.1 </span>The <code><a href=#remoteeventtarget>RemoteEventTarget</a></code> interface</h4><p>Any object that implements the <code>EventTarget</code> interface - must also implement the <code><a href=#remoteeventtarget>RemoteEventTarget</a></code> - interface.<pre class=idl>[NoInterfaceObject, ImplementedOn=<span>EventTarget</span>] interface <dfn id=remoteeventtarget>RemoteEventTarget</dfn> { - void <a href=#dom-remoteeventtarget-addeventsource title=dom-RemoteEventTarget-addEventSource>addEventSource</a>(in DOMString src); - void <a href=#dom-remoteeventtarget-removeeventsource title=dom-RemoteEventTarget-removeEventSource>removeEventSource</a>(in DOMString src); -};</pre><p>When the <dfn id=dom-remoteeventtarget-addeventsource title=dom-RemoteEventTarget-addEventSource><code>addEventSource(<var title="">src</var>)</code></dfn> method is invoked, the user agent - must <a href=#resolve-a-url title="resolve a url">resolve</a> the <a href=#url>URL</a> - specified in <var title="">src</var>, relative to the <a href=#first-script>first - script</a>'s <a href=#script-s-base-url title="script's base URL">base URL</a>, and - if that succeeds, add the resulting <a href=#absolute-url>absolute URL</a> to the - <a href=#concept-eventsource-list title=concept-eventsource-list>list of event sources</a> - for that object. The same URL can be registered multiple times. If - the URL fails to resolve, then the user agent must raise a - <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception.<p>When the <dfn id=dom-remoteeventtarget-removeeventsource title=dom-RemoteEventTarget-removeEventSource><code>removeEventSource(<var title="">src</var>)</code></dfn> method is invoked, the user agent - must <a href=#resolve-a-url title="resolve a url">resolve</a> the <a href=#url>URL</a> - specified in <var title="">src</var>, relative to the <a href=#first-script>first - script</a>'s <a href=#script-s-base-url title="script's base URL">base URL</a>, and - if that succeeds, remove the resulting <a href=#absolute-url>absolute URL</a> - from the <a href=#concept-eventsource-list title=concept-eventsource-list>list of event - sources</a> for that object. If the same URL has been registered - multiple times, removing it must remove only one instance of that - URL for each invocation of the <code title=removeEventSource>removeEventSource()</code> method. If the - URL fails to resolve, the user agent does nothing.<h4 id=connecting-to-an-event-stream><span class=secno>7.2.2 </span>Connecting to an event stream</h4><p>Each object implementing the <code>EventTarget</code> and - <code><a href=#remoteeventtarget>RemoteEventTarget</a></code> interfaces has a <dfn id=concept-eventsource-list title=concept-eventsource-list>list of event sources</dfn> that - are registered for that object.<p>When a new <a href=#absolute-url>absolute URL</a> is added to this list, the - user agent should <a href=#queue-a-task>queue a task</a> to run the following - steps with the new <a href=#absolute-url>absolute URL</a>:<ol><li><p>If the entry for the new <a href=#absolute-url>absolute URL</a> has been - removed from the list, then abort these steps.</li> + attribute must be null.<h3 id=server-sent-events><span class=secno>7.2 </span><dfn>Server-sent events</dfn></h3><!-- eventsource --><h4 id=server-sent-events-intro><span class=secno>7.2.1 </span>Introduction</h4><p><em>This section is non-normative.</em><p>To enable servers to push data to Web pages over HTTP or using + dedicated server-push protocols, this specification introduces the + <code><a href=#eventsource>EventSource</a></code> interface.<p class=XXX>An introduction to the client-side and + server-side of using the direct connection APIs.</p><!--BOILERPLATE--><h4 id=the-eventsource-interface><span class=secno>7.2.2 </span>The <code><a href=#eventsource>EventSource</a></code> interface</h4><pre class=idl>[<a href=#dom-eventsource title=dom-EventSource>Constructor</a>(in DOMString url)] +interface <dfn id=eventsource>EventSource</dfn> { + readonly attribute DOMString <a href=#dom-eventsource-url title=dom-EventSource-URL>URL</a>; - <li> + // ready state + const unsigned short <a href=#dom-eventsource-connecting title=dom-EventSource-CONNECTING>CONNECTING</a> = 0; + const unsigned short <a href=#dom-eventsource-open title=dom-EventSource-OPEN>OPEN</a> = 1; + const unsigned short <a href=#dom-eventsource-closed title=dom-EventSource-CLOSED>CLOSED</a> = 2; + readonly attribute long <a href=#dom-eventsource-readystate title=dom-EventSource-readyState>readyState</a>; - <p><a href=#fetch>Fetch</a> the resource identified by that - <a href=#absolute-url>absolute URL</a>.</p> + // networking + attribute <a href=#function>Function</a> <a href=#handler-eventsource-onopen title=handler-EventSource-onopen>onopen</a>; + attribute <a href=#function>Function</a> <a href=#handler-eventsource-onmessage title=handler-EventSource-onmessage>onmessage</a>; + attribute <a href=#function>Function</a> <a href=#handler-eventsource-onerror title=handler-EventSource-onerror>onerror</a>; + void <a href=#dom-eventsource-disconnect title=dom-EventSource-disconnect>disconnect</a>(); +};</pre><p><code><a href=#eventsource>EventSource</a></code> objects must also implement the + <code>EventTarget</code> interface. <a href=#references>[DOM3EVENTS]</a><p>The <dfn id=dom-eventsource title=dom-EventSource><code>EventSource(<var title="">url</var>)</code></dfn> constructor takes one argument, + <var title="">url</var>, which specifies the <a href=#url>URL</a> to + which to connect. When the <code>EventSource()</code> constructor is + invoked, the UA must run these steps:<ol><li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the + <a href=#url>URL</a> specified in <var title="">src</var>, relative to + the <a href=#first-script>first script</a>'s <a href=#script-s-base-url title="script's base + URL">base URL</a>.</li> - <p>As data is received, the <a href=#concept-task title=concept-task>tasks</a> queued by the <a href=#networking-task-source>networking - task source</a> to handle the data must consist of following - the rules given in the following sections.</p> + <li><p>If the previous step failed, then throw a + <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception.</li> - </li> + <li><p>Return a new <code><a href=#eventsource>EventSource</a></code> object, and continue + these steps in the background (without blocking scripts).</li> - </ol><p>When an event source is removed from the list of event sources - for an object, if that resource is still being fetched, then the - relevant connection must be closed.<p>Since connections established to remote servers for such - resources are expected to be long-lived, UAs should ensure that - appropriate buffering is used. In particular, while line buffering - may be safe if lines are defined to end with a single U+000A LINE - FEED character, block buffering or line buffering with different - expected line endings can cause delays in event dispatch.<p>Each event source in the list must have associated with it the - following:<ul><li>The <dfn id=concept-event-stream-reconnection-time title=concept-event-stream-reconnection-time>reconnection + <li><p><a href=#fetch>Fetch</a> the resource identified by the resulting + <a href=#absolute-url>absolute URL</a>, as described below.</li> + + </ol><p>The <dfn id=dom-eventsource-url title=dom-EventSource-URL><code>URL</code></dfn> + attribute must return the value that was passed to the + constructor.<p>The <dfn id=dom-eventsource-readystate title=dom-EventSource-readyState><code>readyState</code></dfn> + attribute represents the state of the connection. It can have the + following values:<dl><dt><dfn id=dom-eventsource-connecting title=dom-EventSource-CONNECTING><code>CONNECTING</code></dfn> (numeric value 0)</dt> + + <dd>The connection has not yet been established, or it was closed + and the user agent is reconnecting.</dd> + + <dt><dfn id=dom-eventsource-open title=dom-EventSource-OPEN><code>OPEN</code></dfn> (numeric value 1)</dt> + + <dd>The user agent has an open connection and is dispatching events + as it receives them.</dd> + + <dt><dfn id=dom-eventsource-closed title=dom-EventSource-CLOSED><code>CLOSED</code></dfn> (numeric value 2)</dt> + + <dd>The connection is not open, and the user agent is not trying to + reconnect. Either there was a fatal error or the <code title=dom-EventSource-disconnect><a href=#dom-eventsource-disconnect>disconnect()</a></code> method was + invoked.</dd> + + </dl><p>When the object is created its <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> must be set to + <code title=dom-EventSource-CONNECTING><a href=#dom-eventsource-connecting>CONNECTING</a></code> (0). The + rules given below for handling the connection define when the value + changes.<p>The <dfn id=dom-eventsource-disconnect title=dom-EventSource-disconnect><code>disconnect()</code></dfn> + method must close the connection, if any, and must set the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute to + <code title=dom-EventSource-CLOSED><a href=#dom-eventsource-closed>CLOSED</a></code>. If the + connection is already closed, the method must do nothing.<p>The following are the <a href=#event-handler-attributes-0>event handler attributes</a> that + must be supported, as DOM attributes, by all objects implementing + the <code><a href=#eventsource>EventSource</a></code> interface:<dl><dt><dfn id=handler-eventsource-onopen title=handler-EventSource-onopen><code>onopen</code></dfn></dt> + + <dd><p>Must be invoked whenever an <code title=event-open>open</code> event is targeted at or + bubbles through the <code><a href=#eventsource>EventSource</a></code> object.</dd> + + <dt><dfn id=handler-eventsource-onmessage title=handler-EventSource-onmessage><code>onmessage</code></dfn></dt> + + <dd><p>Must be invoked whenever a <code title=event-message><a href=#event-message>message</a></code> event is targeted at or + bubbles through the <code><a href=#eventsource>EventSource</a></code> object.</dd> + + <dt><dfn id=handler-eventsource-onerror title=handler-EventSource-onerror><code>onerror</code></dfn></dt> + + <dd><p>Must be invoked whenever an <code title=event-error><a href=#event-error>error</a></code> event is targeted at or + bubbles through the <code><a href=#eventsource>EventSource</a></code> object.</dd> + + </dl><hr><p>In addition to the above, each <code><a href=#eventsource>EventSource</a></code> object + has the following associated with it:<ul><li>A <dfn id=concept-event-stream-reconnection-time title=concept-event-stream-reconnection-time>reconnection time</dfn>, in milliseconds. This must initially be a user-agent-defined value, probably in the region of a few seconds.</li> - <li>The <dfn id=concept-event-stream-last-event-id title=concept-event-stream-last-event-id>last event + <li>A <dfn id=concept-event-stream-last-event-id title=concept-event-stream-last-event-id>last event ID string</dfn>. This must initially be the empty string.</li> - </ul><p>In general, the semantics of the transport protocol specified by - the URLs for the event sources must be followed, including HTTP - caching rules.<p>For HTTP connections, the <code title="">Accept</code> header may + </ul><p>These values are not currently exposed on the interface.<h4 id=processing-model-3><span class=secno>7.2.3 </span>Processing model</h4><p>The resource indicated in the argument to the <code title=dom-EventSource><a href=#dom-eventsource>EventSource</a></code> constructor is <a href=#fetch title=fetch>fetched</a> when the constructor is run.<p>For HTTP connections, the <code title="">Accept</code> header may be included; if included, it must contain only formats of event framing that are supported by the user agent (one of which must be - <code>text/event-stream</code>, as described below).<p>Other formats of event framing may also be supported in addition - to <code>text/event-stream</code>, but this specification does not - define how they are to be parsed or processed.<p class=note>Such formats could include systems like SMS-push; - for example servers could use <code title="">Accept</code> headers - and HTTP redirects to an SMS-push mechanism as a kind of protocol - negotiation to reduce network load in GSM environments.<p>User agents should use the <code>Cache-Control: no-cache</code> - header in requests to bypass any caches for requests of event - sources.<p>If the event source's last event ID string is not the empty + <code>text/event-stream</code>, as described below).<p>If the event source's last event ID string is not the empty string, then a <code title="">Last-Event-ID</code> HTTP header must be included with the request, whose value is the value of the event - source's last event ID string.<p class=XXX>Cross-origin loads are expected to follow the + source's last event ID string.<p>User agents should use the <code>Cache-Control: no-cache</code> + header in requests to bypass any caches for requests of event + sources. User agents should ignore HTTP cache headers in the + response, never caching event sources.<p class=XXX>Cross-origin loads are expected to follow the Access-Control semantics of CORS; without this header, they are - expected to fail as if the site was down.<p>HTTP 200 OK responses with a <a href=#content-type-0>Content-Type</a> header + expected to fail as if the site was down.</p><hr><p>As data is received, the <a href=#concept-task title=concept-task>tasks</a> + queued by the <a href=#networking-task-source>networking task source</a> to handle the data + must act as follows.<p>HTTP 200 OK responses with a <a href=#content-type-0>Content-Type</a> header specifying the type <code>text/event-stream</code> must be processed line by line <a href=#event-stream-interpretation>as described - below</a>.<p>For the purposes of such successfully opened event streams only, - user agents should ignore HTTP cache headers, and instead assume - that the resource indicates that it does not wish to be cached.<p>If such a resource (with the correct MIME type) completes loading + below</a>.<p>When a successful response with a supported MIME type is + received, such that the user agent begins parsing the contents of + the stream, the user agent must <a href=#announce-the-connection>announce the + connection</a>.<p>If such a resource (with the correct MIME type) completes loading (i.e. the entire HTTP response body is received or the connection - itself closes), the user agent should request the event source - resource again after a delay equal to the reconnection time of the - event source. This doesn't apply for the error cases that are listed - below.<p>HTTP 200 OK responses that have a <a href=#content-type-0>Content-Type</a> other + itself closes), the user agent must <a href=#reset-the-connection>reset the + connection</a>. This doesn't apply for the error cases that are + listed below.<p>HTTP 200 OK responses that have a <a href=#content-type-0>Content-Type</a> other than <code>text/event-stream</code> (or some other supported type) - must be ignored.<p>HTTP 204 No Content, and 205 Reset Content responses must be - treated as if they were 200 OK responses with the right MIME type - but no content, and should therefore cause the user agent to refetch - the resource after a delay equal to the reconnection time of the - event source.<p>Other HTTP response codes in the 2xx range <!--201 Created, 202 + must cause the user agent to <a href=#fail-the-connection>fail the connection</a>.<p>HTTP 204 No Content, and 205 Reset Content responses are + equivalent to 200 OK responses with the right MIME type but no + content, and thus must <a href=#reset-the-connection>reset the connection</a>.<p>Other HTTP response codes in the 2xx range <!--201 Created, 202 Accepted, 203 Non-Authoritative Information, and 206 Partial - Content-->must be treated like HTTP 200 OK responses for the - purposes of reopening event source resources. They are, however, - likely to indicate an error has occurred somewhere and may cause the - user agent to emit a warning.<p>HTTP 300 Multiple Choices responses should be handled - automatically if possible (treating the responses as if they were - 302 Found responses pointing to the appropriate resource), and - otherwise must be treated as HTTP 404 responses.<p>HTTP 301 Moved Permanently responses must cause the user agent to + Content-->must similarly <a href=#reset-the-connection>reset the connection</a>. They + are, however, likely to indicate an error has occurred somewhere and + may cause the user agent to emit a warning.<p>HTTP 301 Moved Permanently responses must cause the user agent to reconnect using the new server specified URL instead of the previously specified URL for all subsequent requests for this event - source. (It doesn't affect other event sources with the same URL - unless they also receive 301 responses, and it doesn't affect future - sessions, e.g. if the page is reloaded.)<p>HTTP 302 Found, 303 See Other, and 307 Temporary Redirect + source. (It doesn't affect other <code><a href=#eventsource>EventSource</a></code> objects + with the same URL unless they also receive 301 responses, and it + doesn't affect future sessions, e.g. if the page is reloaded.)<p>HTTP 302 Found, 303 See Other, and 307 Temporary Redirect responses must cause the user agent to connect to the new server-specified URL, but if the user agent needs to again request the resource at a later point, it must return to the previously - specified URL for this event source.<p>HTTP 304 Not Modified responses should be handled like HTTP 200 - OK responses, with the content coming from the user agent cache. A - new request should then be made after a delay equal to the - reconnection time of the event source.<p>HTTP 305 Use Proxy, HTTP 401 Unauthorized, and 407 Proxy + specified URL for this event source.<p>HTTP 305 Use Proxy, HTTP 401 Unauthorized, and 407 Proxy Authentication Required should be treated transparently as for any other subresource.<p>Any other HTTP response code not listed here or network error - (e.g. DNS errors) must be ignored.</p><!-- including: HTTP 400 Bad - Request, 403 Forbidden, 404 Not Found, 405 Method Not Allowed, 406 - Not Acceptable, 408 Request Timeout, 409 Conflict, 410 Gone, 411 - Length Required, 412 Precondition Failed, 413 Request Entity Too - Large, 414 Request-URI Too Long, 415 Unsupported Media Type, 416 - Requested Range Not Satisfiable, 417 Expectation Failed, 500 - Internal Server Error, 501 Not Implemented, 502 Bad Gateway, 503 - Service Unavailable, 504 Gateway Timeout, and 505 HTTP Version Not - Supported responses --><p>For non-HTTP protocols, UAs should act in equivalent ways.<h4 id=parsing-an-event-stream><span class=secno>7.2.3 </span>Parsing an event stream</h4><!-- XXX Wladimir Palant pointed out problems with HTTP chunking with server-sent-events --><p>This event stream format's MIME type is + (e.g. DNS errors) must cause the user agent to <a href=#fail-the-connection>fail the + connection</a>.</p><!-- including: HTTP 300 Multiple Choices, + HTTP 304 Not Modified, HTTP 400 Bad Request, 403 Forbidden, 404 Not + Found, 405 Method Not Allowed, 406 Not Acceptable, 408 Request + Timeout, 409 Conflict, 410 Gone, 411 Length Required, 412 + Precondition Failed, 413 Request Entity Too Large, 414 Request-URI + Too Long, 415 Unsupported Media Type, 416 Requested Range Not + Satisfiable, 417 Expectation Failed, 500 Internal Server Error, 501 + Not Implemented, 502 Bad Gateway, 503 Service Unavailable, 504 + Gateway Timeout, and 505 HTTP Version Not Supported responses --><p>For non-HTTP protocols, UAs should act in equivalent ways.</p><hr><p>When a user agent is to <dfn id=announce-the-connection>announce the connection</dfn>, the + user agent must set the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute to + <code title=dom-EventSource-OPEN><a href=#dom-eventsource-open>OPEN</a></code> and <a href=#queue-a-task>queue a + task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-open>open</code> at the + <code><a href=#eventsource>EventSource</a></code> object.<p>When a user agent is to <dfn id=reset-the-connection>reset the connection</dfn>, the user + agent must set the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute to + <code title=dom-EventSource-CONNECTING><a href=#dom-eventsource-connecting>CONNECTING</a></code>, + <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named + <code title=event-error><a href=#event-error>error</a></code> at the + <code><a href=#eventsource>EventSource</a></code> object, and then <a href=#fetch>fetch</a> the + event source resource again after a delay equal to the reconnection + time of the event source.<p>When a user agent is to <dfn id=fail-the-connection>fail the connection</dfn>, the user + agent must set the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute to + <code title=dom-EventSource-CLOSED><a href=#dom-eventsource-closed>CLOSED</a></code> and <a href=#queue-a-task>queue a + task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-error><a href=#event-error>error</a></code> at the + <code><a href=#eventsource>EventSource</a></code> object.</p><hr><p>The <a href=#task-source>task source</a> for any <a href=#concept-task title=concept-task>tasks</a> that are <a href=#queue-a-task title="queue a + task">queued</a> by <code><a href=#eventsource>EventSource</a></code> objects is the + <dfn id=remote-event-task-source>remote event task source</dfn>.<h4 id=parsing-an-event-stream><span class=secno>7.2.4 </span>Parsing an event stream</h4><p>This event stream format's MIME type is <code>text/event-stream</code>.<p>The event stream format is as described by the <code title="">stream</code> production of the following ABNF, the character set for which is Unicode. <a href=#references>[ABNF]</a></p><!-- XXX ftp://ftp.rfc-editor.org/in-notes/std/std68.txt --><pre>stream = [ bom ] *event @@ -37317,7 +37279,12 @@ ; a Unicode character other than U+000D CARRIAGE RETURN or U+003A COLON</pre><p>Event streams in this format must always be encoded as UTF-8.<p>Lines must be separated by either a U+000D CARRIAGE RETURN U+000A LINE FEED (CRLF) character pair, a single U+000A LINE FEED (LF) - character, or a single U+000D CARRIAGE RETURN (CR) character.<h4 id=event-stream-interpretation><span class=secno>7.2.4 </span>Interpreting an event stream</h4><p>Bytes or sequences of bytes that are not valid UTF-8 sequences + character, or a single U+000D CARRIAGE RETURN (CR) character.<p>Since connections established to remote servers for such + resources are expected to be long-lived, UAs should ensure that + appropriate buffering is used. In particular, while line buffering + with lines are defined to end with a single U+000A LINE FEED + character is safe, block buffering or line buffering with different + expected line endings can cause delays in event dispatch.<h4 id=event-stream-interpretation><span class=secno>7.2.5 </span>Interpreting an event stream</h4><p>Bytes or sequences of bytes that are not valid UTF-8 sequences must be interpreted as the U+FFFD REPLACEMENT CHARACTER.<p>One leading U+FEFF BYTE ORDER MARK character must be ignored if any are present.<p>The stream must then be parsed by reading everything line by line, with a U+000D CARRIAGE RETURN U+000A LINE FEED (CRLF) @@ -37445,10 +37412,7 @@ <li><p>Set the <var title="">data</var> buffer and the <var title="">event name</var> buffer to the empty string.</li> <li><p><a href=#queue-a-task>Queue a task</a> to dispatch the newly created - event at the <code><a href=#remoteeventtarget>RemoteEventTarget</a></code> object to which the - event stream is registered. The <a href=#task-source>task source</a> for this - <a href=#concept-task title=concept-task>task</a> is the <dfn id=remote-event-task-source>remote event - task source</dfn>.</li> + event at the <code><a href=#eventsource>EventSource</a></code> object.</li> </ol><p class=note>If an event doesn't have an "id" field, but an earlier event did set the event source's <span>last event ID @@ -37457,20 +37421,26 @@ <p>The following event stream, once followed by a blank line:</p> <pre>data: YHOO -data: -2 +data: +2 data: 10</pre> <p>...would cause an event <code title=event-message><a href=#event-message>message</a></code> with the interface <code><a href=#messageevent>MessageEvent</a></code> to be dispatched on the - <code><a href=#the-eventsource-element>eventsource</a></code> element, whose <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code> attribute would contain - the string <code>YHOO\n-2\n10</code> (where <code>\n</code> + <code><a href=#eventsource>EventSource</a></code> object. The event's <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code> attribute would contain + the string <code>YHOO\n+2\n10</code> (where <code>\n</code> represents a newline).</p> <p>This could be used as follows: - <pre><eventsource src="http://stocks.example.com/ticker.php" - onmessage="var data = event.data.split('\n'); updateStocks(data[0], data[1], data[2]);"></pre> + <pre>var stocks = new EventSource("http://stocks.example.com/ticker.php"); +stocks.onmessage = function (event) { + var data = event.data.split('\n'); + updateStocks(data[0], data[1], data[2]); +};</pre> + <p>...where <code title="">updateStocks()</code> is a function defined as:</p> + <pre>function updateStocks(symbol, delta, value) { ... }</pre> + <p>...or some such.</p> </div><div class=example> @@ -37525,7 +37495,7 @@ <p>This is because the space after the colon is ignored if present.</p> - </div><h4 id=notes><span class=secno>7.2.5 </span>Notes</h4><p>Legacy proxy servers are known to, in certain cases, drop HTTP + </div><h4 id=notes><span class=secno>7.2.6 </span>Notes</h4><p>Legacy proxy servers are known to, in certain cases, drop HTTP connections after a short timeout. To protect against such proxy servers, authors can include a comment line (one starting with a ':' character) every 15 seconds or so.<p>Authors wishing to relate event source connections to each other @@ -37535,14 +37505,26 @@ individual IP addresses can have multiple clients (due to sharing a proxy server). It is better to include a unique identifier in the document when it is served and then pass that identifier as part of - the URL in the <code title=attr-eventsource-src><a href=#attr-eventsource-src>src</a></code> - attribute of the <code><a href=#the-eventsource-element>eventsource</a></code> element.<p>Implementations that support HTTP's per-server connection + the URL in the <code title=attr-eventsource-src>src</code> + attribute of the <code><a href=#eventsource>eventsource</a></code> element.<p>Authors are also cautioned that HTTP chunking can have unexpected + negative effects on the reliability of this protocol. Where + possible, chunking should be disabled for serving event streams + unless the rate of messages is high enough for this not to + matter.</p><!-- v2 can we get a better solution? --><p>Implementations that support HTTP's per-server connection limitation might run into trouble when opening multiple pages from a - site if each page has an <code><a href=#the-eventsource-element>eventsource</a></code> to the same + site if each page has an <code><a href=#eventsource>EventSource</a></code> to the same domain. Authors can avoid this using the relatively complex mechanism of using unique domain names per connection, or by - allowing the user to enable or disable the <code><a href=#the-eventsource-element>eventsource</a></code> - functionality on a per-page basis.<h3 id=network><span class=secno>7.3 </span><dfn>Web sockets</dfn></h3><h4 id=network-intro><span class=secno>7.3.1 </span>Introduction</h4><p><em>This section is non-normative.</em><p>To enable Web applications to maintain bidirectional + allowing the user to enable or disable the <code><a href=#eventsource>EventSource</a></code> + functionality on a per-page basis.</p><hr><p>Other formats of event framing may also be supported in addition + to <code>text/event-stream</code>, but this specification does not + define how they are to be parsed or processed.<p class=note>Such formats could include systems like SMS-push; + for example servers could use <code title="">Accept</code> headers + and HTTP redirects to an SMS-push mechanism as a kind of protocol + negotiation to reduce network load in GSM environments.<h4 id=garbage-collection-0><span class=secno>7.2.7 </span>Garbage collection</h4><p>An <code><a href=#eventsource>EventSource</a></code> object with an open connection must not + be garbage collected if there are any event listeners registered for + <code title=event-message><a href=#event-message>message</a></code> events.<p>If an <code><a href=#eventsource>EventSource</a></code> object is garbage collected while + its connection is still open, the connection must be closed.<h3 id=network><span class=secno>7.3 </span><dfn>Web sockets</dfn></h3><h4 id=network-intro><span class=secno>7.3.1 </span>Introduction</h4><p><em>This section is non-normative.</em><p>To enable Web applications to maintain bidirectional communications with server-side processes, this specification introduces the <code><a href=#websocket>WebSocket</a></code> interface.<p class=note>This interface does not allow for raw access to the underlying network. For example, this interface could not be used to @@ -37561,7 +37543,7 @@ // networking attribute <a href=#function>Function</a> <a href=#handler-websocket-onopen title=handler-WebSocket-onopen>onopen</a>; attribute <a href=#function>Function</a> <a href=#handler-websocket-onmessage title=handler-WebSocket-onmessage>onmessage</a>; - attribute <a href=#function>Function</a> <a href=#handler-websocket-onclosed title=handler-WebSocket-onclosed>onclosed</a>; + attribute <a href=#function>Function</a> <a href=#handler-websocket-onclose title=handler-WebSocket-onclose>onclose</a>; void <a href=#dom-websocket-postmessage title=dom-WebSocket-postMessage>postMessage</a>(in DOMString data); void <a href=#dom-websocket-disconnect title=dom-WebSocket-disconnect>disconnect</a>(); };</pre><p><code><a href=#websocket>WebSocket</a></code> objects must also implement the @@ -37638,22 +37620,14 @@ <em>is</em> established, then the user agent must <a href=#send-data-using-the-web-socket>send <var title="">data</var> using the Web Socket</a>.<p>The <dfn id=dom-websocket-disconnect title=dom-WebSocket-disconnect><code>disconnect()</code></dfn> method must <a href=#close-the-web-socket-connection>close the Web Socket connection</a> or connection attempt, if any. If the connection is already closed, it - must do nothing. Closing the connection causes a <code title=event-WebSocket-close><a href=#event-websocket-close>close</a></code> event to be fired and + must do nothing. Closing the connection causes a <code title=event-close>close</code> event to be fired and the <code title=dom-WebSocket-readyState><a href=#dom-websocket-readystate>readyState</a></code> attribute's value to change, as <a href=#closeWebSocket>described - below</a>.<h4 id=websocket-events><span class=secno>7.3.3 </span>WebSocket Events</h4><p>The <dfn id=event-websocket-open title=event-WebSocket-open><code>open</code></dfn> - event is fired when the <a href=#web-socket-connection-is-established>Web Socket connection is - established</a>.<p>The <dfn id=event-websocket-close title=event-WebSocket-close><code>close</code></dfn> - event is fired when the connection is closed (whether by the author, - calling the <code title=dom-WebSocket-disconnect><a href=#dom-websocket-disconnect>disconnect()</a></code> method, or by - the server, or by a network error).<p class=note>No information regarding why the connection was - closed is passed to the application in this version of this - specification.<p>The <code title=event-message><a href=#event-message>message</a></code> event is fired - when when data is received for a connection.</p><hr><p>The following are the <a href=#event-handler-attributes-0>event handler attributes</a> that + below</a>.</p><hr><p>The following are the <a href=#event-handler-attributes-0>event handler attributes</a> that must be supported, as DOM attributes, by all objects implementing the <code><a href=#websocket>WebSocket</a></code> interface:<dl><dt><dfn id=handler-websocket-onopen title=handler-WebSocket-onopen><code>onopen</code></dfn></dt> - <dd><p>Must be invoked whenever an <code title=event-WebSocket-open><a href=#event-websocket-open>open</a></code> event is targeted at or + <dd><p>Must be invoked whenever an <code title=event-open>open</code> event is targeted at or bubbles through the <code><a href=#websocket>WebSocket</a></code> object.</dd> <dt><dfn id=handler-websocket-onmessage title=handler-WebSocket-onmessage><code>onmessage</code></dfn></dt> @@ -37661,12 +37635,12 @@ <dd><p>Must be invoked whenever a <code title=event-message><a href=#event-message>message</a></code> event is targeted at or bubbles through the <code><a href=#websocket>WebSocket</a></code> object.</dd> - <dt><dfn id=handler-websocket-onclosed title=handler-WebSocket-onclosed><code>onclosed</code></dfn></dt> + <dt><dfn id=handler-websocket-onclose title=handler-WebSocket-onclose><code>onclose</code></dfn></dt> - <dd><p>Must be invoked whenever an <code title=event-WebSocket-closed>closed</code> event is targeted at or + <dd><p>Must be invoked whenever an <code title=event-close>close</code> event is targeted at or bubbles through the <code><a href=#websocket>WebSocket</a></code> object.</dd> - </dl><h4 id=feedback-from-the-protocol><span class=secno>7.3.4 </span>Feedback from the protocol</h4><p>When the <i><a href=#web-socket-connection-is-established>Web Socket connection is established</a></i>, the user + </dl><h4 id=feedback-from-the-protocol><span class=secno>7.3.3 </span>Feedback from the protocol</h4><p>When the <i><a href=#web-socket-connection-is-established>Web Socket connection is established</a></i>, the user agent must run the following steps:<ol><li> <p>Change the <code title=dom-WebSocket-readyState><a href=#dom-websocket-readystate>readyState</a></code> attribute's value @@ -37677,7 +37651,7 @@ <li> <p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> - named <code title=event-WebSocket-open><a href=#event-websocket-open>open</a></code> at the + named <code title=event-open>open</code> at the <code><a href=#websocket>WebSocket</a></code> object.</p> </li> @@ -37689,23 +37663,27 @@ closed</a></i>, the <code title=dom-WebSocket-readyState><a href=#dom-websocket-readystate>readyState</a></code> attribute's value must be changed to <code title=dom-WebSocket-CLOSED><a href=#dom-websocket-closed>CLOSED</a></code> (2), and the user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire - a simple event</a> named <code title=event-WebSocket-close><a href=#event-websocket-close>close</a></code> at the + a simple event</a> named <code title=event-close>close</code> at the <code><a href=#websocket>WebSocket</a></code> object.</p><hr><p>The <a href=#task-source>task source</a> for all <a href=#concept-task title=concept-task>tasks</a> <a href=#queue-a-task title="queue a task">queued</a> in this section is the <dfn id=web-socket-task-source>Web Socket task - source</dfn>.<h4 id=websocket-protocol title="This protocol enables two-way + source</dfn>.<h5 id=garbage-collection-1><span class=secno>7.3.3.1 </span>Garbage collection</h5><p>A <code><a href=#websocket>WebSocket</a></code> object with an open connection must not + be garbage collected if there are any event listeners registered for + <code title=event-message><a href=#event-message>message</a></code> events.<p>If a <code><a href=#websocket>WebSocket</a></code> object is garbage collected while its + connection is still open, the user agent must <a href=#close-the-web-socket-connection>close the Web + Socket connection</a>.<h4 id=websocket-protocol title="This protocol enables two-way communication between a user agent running untrusted code running in a controlled environment to a remote host that understands the protocol. It is intended to fail to communicate with servers of pre-existing protocols like SMTP or HTTP, while allowing HTTP servers to opt-in to supporting this protocol if desired. It is - designed to be easy to implement on the server side."><span class=secno>7.3.5 </span>The Web Socket + designed to be easy to implement on the server side."><span class=secno>7.3.4 </span>The Web Socket protocol</h4><div class=no-rfc> <p class=note>This section will be extracted into an RFC in due course.</p> - </div><h5 id=introduction-5><span class=secno>7.3.5.1 </span>Introduction</h5><p class=XXX>...<h5 id=client-side-requirements><span class=secno>7.3.5.2 </span>Client-side requirements</h5><p><em>This section only applies to user agents, not to + </div><h5 id=introduction-5><span class=secno>7.3.4.1 </span>Introduction</h5><p class=XXX>...<h5 id=client-side-requirements><span class=secno>7.3.4.2 </span>Client-side requirements</h5><p><em>This section only applies to user agents, not to servers.</em><p class=note>This specification doesn't currently define a limit to the number of simultaneous connections that a client can - establish to a server.<h6 id=handshake><span class=secno>7.3.5.2.1 </span>Handshake</h6><p>When the user agent is to <dfn id=establish-a-web-socket-connection>establish a Web Socket + establish to a server.<h6 id=handshake><span class=secno>7.3.4.2.1 </span>Handshake</h6><p>When the user agent is to <dfn id=establish-a-web-socket-connection>establish a Web Socket connection</dfn> to a host <var title="">host</var>, optionally on port <var title="">port</var>, from an origin <var title="">origin</var>, with a flag <var title="">secure</var>, and with a particular <var title="">resource name</var>, it must run the @@ -38093,7 +38071,7 @@ problem to the user (which would be especially useful for developers). However, user agents must not convey the failure information to the script that attempted the connection in a way - distinguishable from the Web Socket being closed normally.<h6 id=data-framing><span class=secno>7.3.5.2.2 </span>Data framing</h6><p>Once a <a href=#web-socket-connection-is-established>Web Socket connection is established</a>, the + distinguishable from the Web Socket being closed normally.<h6 id=data-framing><span class=secno>7.3.4.2.2 </span>Data framing</h6><p>Once a <a href=#web-socket-connection-is-established>Web Socket connection is established</a>, the user agent must run through the following state machine for the bytes sent by the server.<ol><li> @@ -38182,7 +38160,7 @@ </ol><!-- v2: People often request the ability to send binary blobs over this API; we should also look into allowing name/value pairs, arrays, and numbers using postMessage() instead of just strings and - binary data. --><h5 id=server-side-requirements><span class=secno>7.3.5.3 </span>Server-side requirements</h5><p><em>This section only applies to servers.</em></p><!-- XXX that's not a defined conformance class --><h6 id=minimal-handshake><span class=secno>7.3.5.3.1 </span>Minimal handshake</h6><p class=note>This section describes the minimal requirements for + binary data. --><h5 id=server-side-requirements><span class=secno>7.3.4.3 </span>Server-side requirements</h5><p><em>This section only applies to servers.</em></p><!-- XXX that's not a defined conformance class --><h6 id=minimal-handshake><span class=secno>7.3.4.3.1 </span>Minimal handshake</h6><p class=note>This section describes the minimal requirements for a server-side implementation of Web Sockets.<p>Listen on a port for TCP/IP. Upon receiving a connection request, open a connection and send the following bytes back to the client:<pre>48 54 54 50 2f 31 2e 31 20 31 30 31 20 57 65 62 @@ -38209,7 +38187,7 @@ <pre>WebSocket-Location: ws://example.com:80/demo</pre> </div><p>Send another CRLF pair (0x0d 0x0a).<p>Read (and discard) data from the client until four bytes 0x0d - 0x0a 0x0d 0x0a are read.<p>If the connection isn't dropped at this point, go to the <a href=#ws-sd-framing>data framing</a> section.<h6 id=handshake-details><span class=secno>7.3.5.3.2 </span>Handshake details</h6><p>The previous section ignores the data that is transmitted by the + 0x0a 0x0d 0x0a are read.<p>If the connection isn't dropped at this point, go to the <a href=#ws-sd-framing>data framing</a> section.<h6 id=handshake-details><span class=secno>7.3.4.3.2 </span>Handshake details</h6><p>The previous section ignores the data that is transmitted by the client during the handshake.<p>The data sent by the client consists of a number of fields separated by CR LF pairs (bytes 0x0d 0x0a).<p>The first field consists of three tokens separated by space characters (byte 0x20). The middle token is the path being @@ -38262,7 +38240,7 @@ </dd> - </dl><h6 id=ws-sd-framing><span class=secno>7.3.5.3.3 </span>Data framing</h6><p class=note>This section only describes how to handle content + </dl><h6 id=ws-sd-framing><span class=secno>7.3.4.3.3 </span>Data framing</h6><p class=note>This section only describes how to handle content that this specification allows user agents to send (text). It doesn't handle any arbitrary content in the same way that the requirements on user agents defined earlier handle any content @@ -38295,13 +38273,13 @@ <li><p>Send a 0xff byte to the client to indicate the end of the message.</li> - </ol><h5 id=closing-the-connection><span class=secno>7.3.5.4 </span>Closing the connection</h5><p>To <dfn id=close-the-web-socket-connection>close the Web Socket connection</dfn>, either the user + </ol><h5 id=closing-the-connection><span class=secno>7.3.4.4 </span>Closing the connection</h5><p>To <dfn id=close-the-web-socket-connection>close the Web Socket connection</dfn>, either the user agent or the server closes the TCP/IP connection. There is no closing handshake. Whether the user agent or the server closes the connection, it is said that the <dfn id=web-socket-connection-is-closed>Web Socket connection is closed</dfn>.<p>Servers may <a href=#close-the-web-socket-connection>close the Web Socket connection</a> whenever desired.<p>User agents should not <a href=#close-the-web-socket-connection>close the Web Socket - connection</a> arbitrarily.<h5 id=security-considerations><span class=secno>7.3.5.5 </span>Security considerations</h5><p class=XXX>...<h5 id=iana-considerations><span class=secno>7.3.5.6 </span>IANA considerations</h5><p class=XXX>...(two URI schemes, two ports, HTTP Upgrade keyword)<h3 id=crossDocumentMessages><span class=secno>7.4 </span><dfn>Cross-document messaging</dfn></h3><p>Web browsers, for security and privacy reasons, prevent documents + connection</a> arbitrarily.<h5 id=security-considerations><span class=secno>7.3.4.5 </span>Security considerations</h5><p class=XXX>...<h5 id=iana-considerations><span class=secno>7.3.4.6 </span>IANA considerations</h5><p class=XXX>...(two URI schemes, two ports, HTTP Upgrade keyword)<h3 id=crossDocumentMessages><span class=secno>7.4 </span><dfn>Cross-document messaging</dfn></h3><p>Web browsers, for security and privacy reasons, prevent documents in different domains from affecting each other; that is, cross-site scripting is disallowed.<p>While this is an important security feature, it prevents pages from different domains from communicating even when those pages are @@ -38850,11 +38828,11 @@ elements, RCDATA elements, foreign elements, and normal elements.<dl><dt><dfn id=void-elements>Void elements</dfn></dt> - <dd><code><a href=#the-base-element>base</a></code>, <code><a href=#the-command>command</a></code>, - <code><a href=#the-eventsource-element>eventsource</a></code>, <code><a href=#the-link-element>link</a></code>, <code><a href=#meta>meta</a></code>, - <code><a href=#the-hr-element>hr</a></code>, <code><a href=#the-br-element>br</a></code>, <code><a href=#the-img-element>img</a></code>, - <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-param-element>param</a></code>, <code><a href=#the-area-element>area</a></code>, - <code><a href=#the-col-element>col</a></code>, <code><a href=#the-input-element>input</a></code>, <code><a href=#the-source-element>source</a></code></dd> + <dd><code><a href=#the-base-element>base</a></code>, <code><a href=#the-command>command</a></code>, <code><a href=#the-link-element>link</a></code>, + <code><a href=#meta>meta</a></code>, <code><a href=#the-hr-element>hr</a></code>, <code><a href=#the-br-element>br</a></code>, + <code><a href=#the-img-element>img</a></code>, <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-param-element>param</a></code>, + <code><a href=#the-area-element>area</a></code>, <code><a href=#the-col-element>col</a></code>, <code><a href=#the-input-element>input</a></code>, + <code><a href=#the-source-element>source</a></code></dd> <dt>CDATA elements</dt> @@ -40006,24 +39984,24 @@ <code><a href=#the-command>command</a></code>, <code><a href=#datagrid>datagrid</a></code>, <code><a href=#the-dd-element>dd</a></code>, <code><a href=#the-details-element>details</a></code>, <code><a href=#the-dialog-element>dialog</a></code>, <code>dir</code>, <code><a href=#the-div-element>div</a></code>, <code><a href=#the-dl-element>dl</a></code>, <code><a href=#the-dt-element>dt</a></code>, - <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-eventsource-element>eventsource</a></code>, <code><a href=#the-fieldset-element>fieldset</a></code>, - <code><a href=#the-figure-element>figure</a></code>, <code><a href=#the-footer-element>footer</a></code>, <code><a href=#the-form-element>form</a></code>, - <code>frame</code>, <code>frameset</code>, <code><a href=#the-h1-h2-h3-h4-h5-and-h6-elements>h1</a></code>, - <code><a href=#the-h1-h2-h3-h4-h5-and-h6-elements>h2</a></code>, <code><a href=#the-h1-h2-h3-h4-h5-and-h6-elements>h3</a></code>, <code><a href=#the-h1-h2-h3-h4-h5-and-h6-elements>h4</a></code>, <code><a href=#the-h1-h2-h3-h4-h5-and-h6-elements>h5</a></code>, - <code><a href=#the-h1-h2-h3-h4-h5-and-h6-elements>h6</a></code>, <code><a href=#the-head-element>head</a></code>, <code><a href=#the-header-element>header</a></code>, - <code><a href=#the-hr-element>hr</a></code>, <code><a href=#the-iframe-element>iframe</a></code>, <!-- <code>image</code>, - (commented out because this isn't an element that can end up on the - stack, so it doesn't matter) --> <code><a href=#the-img-element>img</a></code>, - <code><a href=#the-input-element>input</a></code>, <code>isindex</code>, <code><a href=#the-li-element>li</a></code>, - <code><a href=#the-link-element>link</a></code>, <code>listing</code>, <code><a href=#menus>menu</a></code>, - <code><a href=#meta>meta</a></code>, <code><a href=#the-nav-element>nav</a></code>, <code>noembed</code>, - <code>noframes</code>, <code><a href=#the-noscript-element>noscript</a></code>, <code><a href=#the-ol-element>ol</a></code>, - <code><a href=#the-p-element>p</a></code>, <code><a href=#the-param-element>param</a></code>, <code>plaintext</code>, - <code><a href=#the-pre-element>pre</a></code>, <code><a href=#script>script</a></code>, <code><a href=#the-section-element>section</a></code>, - <code><a href=#the-select-element>select</a></code>, <code>spacer</code>, <code><a href=#the-style-element>style</a></code>, - <code><a href=#the-tbody-element>tbody</a></code>, <code><a href=#the-textarea-element>textarea</a></code>, <code><a href=#the-tfoot-element>tfoot</a></code>, - <code><a href=#the-thead-element>thead</a></code>, <code><a href=#the-title-element>title</a></code>, <code><a href=#the-tr-element>tr</a></code>, - <code><a href=#the-ul-element>ul</a></code>, and <code>wbr</code>.</dd> + <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-fieldset-element>fieldset</a></code>, <code><a href=#the-figure-element>figure</a></code>, + <code><a href=#the-footer-element>footer</a></code>, <code><a href=#the-form-element>form</a></code>, <code>frame</code>, + <code>frameset</code>, <code><a href=#the-h1-h2-h3-h4-h5-and-h6-elements>h1</a></code>, <code><a href=#the-h1-h2-h3-h4-h5-and-h6-elements>h2</a></code>, + <code><a href=#the-h1-h2-h3-h4-h5-and-h6-elements>h3</a></code>, <code><a href=#the-h1-h2-h3-h4-h5-and-h6-elements>h4</a></code>, <code><a href=#the-h1-h2-h3-h4-h5-and-h6-elements>h5</a></code>, <code><a href=#the-h1-h2-h3-h4-h5-and-h6-elements>h6</a></code>, + <code><a href=#the-head-element>head</a></code>, <code><a href=#the-header-element>header</a></code>, <code><a href=#the-hr-element>hr</a></code>, + <code><a href=#the-iframe-element>iframe</a></code>, <!-- <code>image</code>, (commented out + because this isn't an element that can end up on the stack, so it + doesn't matter) --> <code><a href=#the-img-element>img</a></code>, <code><a href=#the-input-element>input</a></code>, + <code>isindex</code>, <code><a href=#the-li-element>li</a></code>, <code><a href=#the-link-element>link</a></code>, + <code>listing</code>, <code><a href=#menus>menu</a></code>, <code><a href=#meta>meta</a></code>, + <code><a href=#the-nav-element>nav</a></code>, <code>noembed</code>, <code>noframes</code>, + <code><a href=#the-noscript-element>noscript</a></code>, <code><a href=#the-ol-element>ol</a></code>, <code><a href=#the-p-element>p</a></code>, + <code><a href=#the-param-element>param</a></code>, <code>plaintext</code>, <code><a href=#the-pre-element>pre</a></code>, + <code><a href=#script>script</a></code>, <code><a href=#the-section-element>section</a></code>, <code><a href=#the-select-element>select</a></code>, + <code>spacer</code>, <code><a href=#the-style-element>style</a></code>, <code><a href=#the-tbody-element>tbody</a></code>, + <code><a href=#the-textarea-element>textarea</a></code>, <code><a href=#the-tfoot-element>tfoot</a></code>, <code><a href=#the-thead-element>thead</a></code>, + <code><a href=#the-title-element>title</a></code>, <code><a href=#the-tr-element>tr</a></code>, <code><a href=#the-ul-element>ul</a></code>, and + <code>wbr</code>.</dd> <dt><dfn id=scoping>Scoping</dfn></dt> <dd><p>The following HTML elements introduce new <a href=#has-an-element-in-scope title="has @@ -41833,7 +41811,7 @@ </dd> <dt>A start tag whose tag name is one of: "base", "command", - "eventsource", "link"</dt> + "link"</dt> <dd> <p><a href=#insert-an-html-element>Insert an HTML element</a> for the token. Immediately @@ -42141,8 +42119,7 @@ </dd> <dt>A start tag token whose tag name is one of: "base", "command", - "eventsource", "link", "meta", "noframes", "script", "style", - "title"</dt> + "link", "meta", "noframes", "script", "style", "title"</dt> <dd> <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>" <a href=#insertion-mode>insertion mode</a>.</p> @@ -43218,11 +43195,11 @@ "col", "colgroup", "frame", "head", "tbody", "td", "tfoot", "th", "thead", "tr"</dt> <!--<dt>An end tag whose tag name is one of: "area", "base", - "basefont", "bgsound", "command", "embed", "eventsource", "hr", - "iframe", "image", "img", "input", "isindex", "link", "meta", - "noembed", "noframes", "param", "script", "select", "source", - "spacer", "style", "table", "textarea", "title", "wbr"</dt>--> <!-- - add keygen if we add the start tag --> + "basefont", "bgsound", "command", "embed", "hr", "iframe", "image", + "img", "input", "isindex", "link", "meta", "noembed", "noframes", + "param", "script", "select", "source", "spacer", "style", "table", + "textarea", "title", "wbr"</dt>--> <!-- add keygen if we add the + start tag --> <!--<dt>An end tag whose tag name is "noscript", if the <span>scripting flag</span> is enabled</dt>--> <dd> @@ -44757,8 +44734,7 @@ node at this point.</p> <!-- also, i guess: image, isindex, and keygen, but we don't list those because we don't consider those "elements", more "macros", and thus we should never - serialize them --> <!-- XXX when we get around to it, add - eventsource --> + serialize them --> <p>If <var title="">current node</var> is a <code><a href=#the-pre-element>pre</a></code>, <code><a href=#the-textarea-element>textarea</a></code>, or <code>listing</code> element, append @@ -47369,9 +47345,10 @@ percentage if the dimension was a percentage.<h4 id=display-types><span class=secno>10.2.2 </span>Display types</h4><pre class=css>@namespace url(http://www.w3.org/1999/xhtml); [hidden], area, audio:not([controls]), base, basefont, command, -datalist, eventsource, head, input[type=hidden], link, -menu[type=context], meta, noembed, noframes, param, script, source, -style, title { display: none; } +datalist, head, input[type=hidden], link, menu[type=context], meta, +noembed, noframes, param, script, source, style, title { + display: none; +} address, article, aside, blockquote, body, center, dd, dialog, dir, div, dl, dt, figure, footer, form, h1, h2, h3, h4, h5, h6, header, hr, @@ -49137,9 +49114,10 @@ Dutta, Tantek Çelik, Terrence Wood, Thomas Broyer, Thomas O'Connor, Tim Altman, Tim Johansson, Tommy Thorsen, Travis Leithead, Tyler Close, Vladimir Vukićević, Wakaba, Wayne - Pollock, Wellington Fernando de Macedo, William Swanson, Wolfram - Kriesing, Yi-An Huang, Zhenbin Xu, and Øistein E. Andersen, - for their useful and substantial comments.<p>Thanks also to everyone who has ever posted about HTML5 to their + Pollock, Wellington Fernando de Macedo, William Swanson, Wladimir + Palant, Wolfram Kriesing, Yi-An Huang, Zhenbin Xu, and + Øistein E. Andersen, for their useful and substantial + comments.<p>Thanks also to everyone who has ever posted about HTML5 to their blogs, public mailing lists, or forums, including the <a href=http://lists.w3.org/Archives/Public/public-html/>W3C public-html list</a> and the <a href=http://www.whatwg.org/mailing-list>various WHATWG lists</a>.
Received on Thursday, 26 February 2009 08:38:19 UTC