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

Anne van Kesteren annevk at opera.com
Fri Oct 15 11:41:52 PDT 2010

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

More information about the whatwg mailing list