<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>16224</bug_id>
          
          <creation_ts>2012-03-04 00:14:17 +0000</creation_ts>
          <short_desc>Change .readyState to use string values rather than numeric constants</short_desc>
          <delta_ts>2012-03-13 03:57:52 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>HISTORICAL - Server-Sent Events (editor: Ian Hickson)</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jonas Sicking (Not reading bugmail)">jonas</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>public-webapps</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>64986</commentid>
    <comment_count>0</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2012-03-04 00:14:17 +0000</bug_when>
    <thetext>Numeric constants sucks when used in javascript. Code like

if (es.readyState == EventSource.CONNECTING) { ... }

is both harder to read and harder to type compared to

if (es.readyState == &quot;connecting&quot;) { ... }

All the uppercase letters are a pain to type and and stick out like a sore thumb.

Additionally there&apos;s a very real risk that people will write code like

if (ws.readyState == 0) { ... }

since &apos;0&apos; is so much easier to write than &apos;EventSource.CONNECTING&apos;.

It&apos;s even likely that comparing to a string is faster than comparing to EventSource.CONNECTING since the latter involves a property lookup.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65433</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-03-13 03:57:52 +0000</bug_when>
    <thetext>While I agree with the design principle, I think it&apos;s not a big enough win to be worth the churn here. People complain all the time that we keep changing things — we should only do it when we have a truly compelling reason (e.g. a security problem).

In practice, little non-debug code will likely end up using eventsource.readyState anyway. It&apos;s easier to use the events. It was mostly added for consistency with XMLHttpRequest, which also uses numbers — and people don&apos;t generally find it onerous to remember which readyState is which for that API.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>