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

Nicholas Zakas nzakas at yahoo-inc.com
Fri Oct 15 11:34:14 PDT 2010

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:

>>If the event name buffer has a value other than the empty string, change the type of the newly created event to equal the value of the event name  buffer.

A few questions about this:

1)       Does this mean that a click event would be fired on the EventSource object, such as that onclick would be called? Or does this still fire the message event but event.type is now "click"?
2)       Why the limitation of events only in the DOM Events spec? It seems that most of those events are irrelevant in the context of a non-UI part of the page.
3)       Assuming I've understood the current spec correctly, what is the use case for named events?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20101015/24190b96/attachment.htm>

More information about the whatwg mailing list