<?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>16680</bug_id>
          
          <creation_ts>2012-04-10 10:46:10 +0000</creation_ts>
          <short_desc>DOMTokenList assumes clean underlying string</short_desc>
          <delta_ts>2012-04-10 12:16:12 +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>DOM</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</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="Marcos Caceres">w3c</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>mike</cc>
    
    <cc>www-dom</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>66558</commentid>
    <comment_count>0</comment_count>
    <who name="Marcos Caceres">w3c</who>
    <bug_when>2012-04-10 10:46:10 +0000</bug_when>
    <thetext>The DOMTokenList assumes that the underlying string is always &quot;clean&quot; in that it contains no spaces at the start and at the end or in between. However, in the case of HTML&apos;s class attribute, the string can be &quot;dirty&quot;, in that the underlying string is derived from a the class attribute. Consider:

element.className = &quot;   class1  \n class2 \t     class3    \t \n&quot;

In order to get a clean string, the spec needs to define something the following, so whitespace is removed:

//Splits the underlying string into a list of tokens
function splitUnderlyingString() {
  var underString = this.toString();
  var cleanString = underString.replace(/\s\s+/g, &quot;\u0020&quot;).trim();
  return cleanString.split(&quot;\u0020&quot;);
}

Implementation already do the above, it seems. But the above is not clear in the spec.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66559</commentid>
    <comment_count>1</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2012-04-10 10:59:21 +0000</bug_when>
    <thetext>The spec uses http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#split-a-string-on-spaces</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66560</commentid>
    <comment_count>2</comment_count>
    <who name="Marcos Caceres">w3c</who>
    <bug_when>2012-04-10 12:16:12 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; The spec uses
&gt; http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#split-a-string-on-spaces

Ah, my bad. Didn&apos;t notice the &quot;split&quot; link.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>