W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2012

[Bug 16680] New: DOMTokenList assumes clean underlying string

From: <bugzilla@jessica.w3.org>
Date: Tue, 10 Apr 2012 10:46:10 +0000
To: www-dom@w3.org
Message-ID: <bug-16680-4009@http.www.w3.org/Bugs/Public/>

           Summary: DOMTokenList assumes clean underlying string
           Product: WebAppsWG
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DOM
        AssignedTo: annevk@opera.com
        ReportedBy: w3c@marcosc.com
         QAContact: public-webapps-bugzilla@w3.org
                CC: mike@w3.org, www-dom@w3.org

The DOMTokenList assumes that the underlying string is always "clean" in that
it contains no spaces at the start and at the end or in between. However, in
the case of HTML's class attribute, the string can be "dirty", in that the
underlying string is derived from a the class attribute. Consider:

element.className = "   class1  \n class2 \t     class3    \t \n"

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, "\u0020").trim();
  return cleanString.split("\u0020");

Implementation already do the above, it seems. But the above is not clear in
the spec.

Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
Received on Tuesday, 10 April 2012 10:46:17 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:19 UTC