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

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>111307</bug_id>
          
          <creation_ts>2013-03-04 05:56:32 -0800</creation_ts>
          <short_desc>div.classList.add(&apos;a&apos;, &apos;a&apos;) creates duplicate entries</short_desc>
          <delta_ts>2015-08-28 11:20:17 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://jsfiddle.net/m_gol/xje3k/</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Michał Gołębiowski-Owczarek">m.goleb+bugzilla</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>andrea.giammarchi</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>846377</commentid>
    <comment_count>0</comment_count>
    <who name="Michał Gołębiowski-Owczarek">m.goleb+bugzilla</who>
    <bug_when>2013-03-04 05:56:32 -0800</bug_when>
    <thetext>div.classList.add(&apos;a&apos;, &apos;a&apos;) should IMHO add only one instance of &apos;a&apos; to div.classList.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>846779</commentid>
    <comment_count>1</comment_count>
    <who name="Michał Gołębiowski-Owczarek">m.goleb+bugzilla</who>
    <bug_when>2013-03-04 13:20:48 -0800</bug_when>
    <thetext>One result of this issue is that results of invoking:

div.classList.add(sth1, sth2);

and:

div.classList.add(sth1);
div.classList.add(sth2);

are different, which is unintuitive.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>846786</commentid>
    <comment_count>2</comment_count>
    <who name="Michał Gołębiowski-Owczarek">m.goleb+bugzilla</who>
    <bug_when>2013-03-04 13:23:39 -0800</bug_when>
    <thetext>(In reply to comment #1)
&gt; One result of this issue is that results of invoking:
&gt; 
&gt; div.classList.add(sth1, sth2);
&gt; 
&gt; and:
&gt; 
&gt; div.classList.add(sth1);
&gt; div.classList.add(sth2);
&gt; 
&gt; are different, which is unintuitive.

Correction: results CAN be different, not ARE different, of course.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>847368</commentid>
    <comment_count>3</comment_count>
    <who name="Michał Gołębiowski-Owczarek">m.goleb+bugzilla</who>
    <bug_when>2013-03-05 00:18:29 -0800</bug_when>
    <thetext>OK, this is not only my view, this is what spec dictates:
http://dom.spec.whatwg.org/#domtokenlist
&quot;A DOMTokenList object has an associated list of unique tokens, which is initially empty.&quot;
So it&apos;s clearly WebKit&apos;s bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>877363</commentid>
    <comment_count>4</comment_count>
    <who name="Michał Gołębiowski-Owczarek">m.goleb+bugzilla</who>
    <bug_when>2013-04-17 10:37:17 -0700</bug_when>
    <thetext>Chromium ticket: https://code.google.com/p/chromium/issues/detail?id=232448</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>937782</commentid>
    <comment_count>5</comment_count>
    <who name="Andrea Giammarchi">andrea.giammarchi</who>
    <bug_when>2013-10-08 18:42:41 -0700</bug_when>
    <thetext>confirmed and fixed/verified through the test 74 in here: http://webreflection.github.io/dom4/test/

The check is basically this one:

div.classList.add(&apos;a&apos;, &apos;b&apos;, &apos;a&apos;);
assert(div.className === &apos;a b&apos;);

the test against to verify it works is the one showed here:
div.classList.add(&apos;a&apos;, &apos;a&apos;);
assert(div.className === &apos;a&apos;);

Very weird this bus hasn&apos;t been confirmed yet since it&apos;s clearly stated about being unique tokens.

What would be the reason to have twice the same class otherwise, having an `!important` effect ?

Thanks for fixing this, I don&apos;t really want to rely on JS to fix such simple CSS classList core gotcha.

Best Regards</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>963242</commentid>
    <comment_count>6</comment_count>
    <who name="Michał Gołębiowski-Owczarek">m.goleb+bugzilla</who>
    <bug_when>2013-12-29 14:17:34 -0800</bug_when>
    <thetext>The issue has been fixed in Chrome over two months ago, I also got some feedback in a sensible time after reporting. Meanwhile, here no one seems to bother.

Could sb at least triage this? Important, not important, some milestone? This lack of response is disheartening.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1121762</commentid>
    <comment_count>7</comment_count>
    <who name="Michał Gołębiowski-Owczarek">m.goleb+bugzilla</who>
    <bug_when>2015-08-28 11:20:17 -0700</bug_when>
    <thetext>I wish someone looked at those bug reports. :(

Thankfully, this has been fixed in Safari 8.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>