W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2010

[whatwg] Question regarding event: in server-sent events

From: Anne van Kesteren <annevk@opera.com>
Date: Fri, 15 Oct 2010 20:41:52 +0200
Message-ID: <op.vkmrj1tw64w2qv@anne-van-kesterens-macbook-pro.local>
On Fri, 15 Oct 2010 20:34:14 +0200, Nicholas Zakas <nzakas at yahoo-inc.com>  
> In reading through the spec, it looks like this is legal in the event  
> stream:
> event: foo
> data: bar
> And then processed as:
>>> If the event name buffer is not the empty string but is also not a  
>>> valid event type name, as defined by the DOM Events specification, set  
>>> the data  buffer and the event name buffer to the empty string and  
>>> abort these steps.
> If I'm reading this correctly, an event name of "foo" would fail this  
> step in the process and not cause a message event to be fired. However,  
> if the event name were for example "click", then this would be okay and  
> the following step would be taken:

"foo" is a valid event type name. This would only fail when  
Event.initEvent(event name buffer, ...) fails. It seems per the current  
draft of DOM Events that will be never so maybe this ought to be reworded  
some. But then DOM Events is not done yet so...

> 3)       Assuming I've understood the current spec correctly, what is  
> the use case for named events?

To make dispatching to different parts of the code easier. Without having  
to create some kind of logic that parses the data first.

Anne van Kesteren
Received on Friday, 15 October 2010 11:41:52 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:01 UTC