This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
This is pertinent to http://www.w3.org/TR/2011/WD-eventsource-20110310/, "Server-Sent Events" In the section "Interpreting an event stream" under "dispatch the event," would it not be better to switch numbers 1 and 2 around? Seeing that we want to abort on the empty string, if the only data in the string is LF, it would be stripped by step two, thus dispatching a MessageEvent with the empty string as its data anyways. Currently, the lines are as follows: 1. If the data buffer is an empty string, set the data buffer and the event name buffer to the empty string and abort these steps. 2. If the data buffer's last character is a U+000A LINE FEED (LF) character, then remove the last character from the data buffer. I would suggest: 1. If the data buffer's last character is a U+000A LINE FEED (LF) character, then remove the last character from the data buffer. 2. If the data buffer is an empty string, set the data buffer and the event name buffer to the empty string and abort these steps.
If the data buffer is an empty string in step 1 it means that there were no data: lines and that's why we want to abort. If the data buffer contains only a line feed character in step 2 it means that there was exactly one data: line but it didn't have a value and thus a MessageEvent with an empty string as its data should be dispatched (similarly, two data: lines without values will result in event.data containing a single line feed character).
Exactly what comment 1 says.