[whatwg] Comments on <event-source> and addEventSource()

Anne van Kesteren annevk at opera.com
Tue Feb 27 01:44:15 PST 2007

On Tue, 27 Feb 2007 04:21:30 +0100, Ian Hickson <ian at hixie.ch> wrote:
> On Wed, 23 Aug 2006, Anne van Kesteren wrote:
>> * A problem with the event-source element is that the resource is loaded
>> before you can attach event listeners to the document. Perhaps the
>> loading should start after the load event is dispatched? Unless the
>> element was inserted into the document of course (that's actually also a
>> bit unclear).
> The "onmessage" (previously "onevent") attribute is intended to address
> this. Does it not?

As I understand it 'message' is only dispatched when the Event field is  
not set to something else. However, I suppose if you want full control you  
can use the slightly more complicated DOM APIs.

There's one problem with 'message' though. It conflicts with cross  
document messaging. Now it's possible that they both dispatch and  
implement a different interface but it might be confusing to authors.

>> * It might be better to replace the BNF with something similar as the
>> HTML parsing specification currently has. That provides a much more
>> clear processing model.
> Really? You find an explicit prose state machine easier to read than BNF?
> Wow. I really don't. :-) I can't see what a state machine describes at
> all. At least with BNF you can see at a glance what the syntax is.

Well, for syntax something different would have to be used I guess. But as  
an implementor and also as a person making testcases having an explicit  
state machine makes things much easier. With implementing it's just  
translating the prose to some lines of code and with making testcases it  
easily allows you to identify the edge cases and such. However, the BNF  
works good enough I suppose.

>> * What happens for other line feed characters? Are they treated as
>> fields? Won't that give lots of problems for authors coding in non-Unix
>> formats? HTTP for example allows both.
> What other line feed characters? There's only one U+000A LINE FEED
> character.

I meant CR / CRLF. I see you now allow that to be used, great!

The example that contains the following:

   Target: #image1

should probably be clarified to see that an event does actually dispatch.  
Since Event defaults to 'message'.

Editorial: in the "Message events" section the definition "message" is not  
marked up with <code>. And the "onmessage" event handler points doesn't  
point to it.

The rest looks good, thanks!

Anne van Kesteren

More information about the whatwg mailing list