<?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>28109</bug_id>
          
          <creation_ts>2015-02-26 16:58:49 +0000</creation_ts>
          <short_desc>Inconsistent argument naming in createElementNS and createAttributeNS</short_desc>
          <delta_ts>2015-11-30 14:44:31 +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>FIXED</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="Philip Jägenstedt">philipj</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>crimsteam</cc>
    
    <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>118185</commentid>
    <comment_count>0</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-02-26 16:58:49 +0000</bug_when>
    <thetext>https://dom.spec.whatwg.org/#document

Element createElementNS(DOMString? namespace, DOMString qualifiedName)

vs

Attr createAttributeNS(DOMString? namespace, DOMString name);

The algorithms look very similar, it seems like createAttributeNS should call its argument qualifiedName too. Maybe. Blink&apos;s IDL files do anyway.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>118195</commentid>
    <comment_count>1</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-02-27 08:18:20 +0000</bug_when>
    <thetext>Well there&apos;s a difference. Attributes actually have a slot called &quot;name&quot;. For elements &quot;qualifiedName&quot; is a combination of the internal prefix and local name slot.

It might be that attributes should follow that though...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>118197</commentid>
    <comment_count>2</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-02-27 10:48:31 +0000</bug_when>
    <thetext>OK, right, Attr.name is a thing. I guess it&apos;s a difference between naming the input for what it is, or how it is used.

Anything is OK by me, it just looked like an accidental difference to me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>118203</commentid>
    <comment_count>3</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-02-27 15:04:00 +0000</bug_when>
    <thetext>Well, tagName is a thing too... I guess I should check if we actually need an internal slot for name... If we don&apos;t I should probably define it in a way similar to elements.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>118212</commentid>
    <comment_count>4</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-03-01 00:34:55 +0000</bug_when>
    <thetext>Do you mean removing Attr.name entirely?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>118213</commentid>
    <comment_count>5</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-03-01 00:50:41 +0000</bug_when>
    <thetext>I see that setAttributeNS(DOMString? namespace, DOMString name, DOMString value) also doesn&apos;t match getAttributeNS(DOMString? namespace, DOMString localName), but in that case it doesn&apos;t seem odd to me.

(See https://crbug.com/460722 for why I&apos;m noticing these things.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>118214</commentid>
    <comment_count>6</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-03-01 00:55:31 +0000</bug_when>
    <thetext>No wait that is odd, why wouldn&apos;t setAttributeNS and getAttributeNS have the same first two arguments?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>118220</commentid>
    <comment_count>7</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-03-01 08:27:34 +0000</bug_when>
    <thetext>&gt; Do you mean removing Attr.name entirely?

No, I meant to drop the internal slot and instead compute it based on prefix and local name.

&gt; No wait that is odd, why wouldn&apos;t setAttributeNS and getAttributeNS have the
&gt; same first two arguments?

I&apos;m not sure, is that not what implementations do?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>118228</commentid>
    <comment_count>8</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-03-02 03:41:18 +0000</bug_when>
    <thetext>(In reply to Anne from comment #7)
&gt; &gt; Do you mean removing Attr.name entirely?
&gt; 
&gt; No, I meant to drop the internal slot and instead compute it based on prefix
&gt; and local name.

Oh. FWIW, as implemented in Blink, there&apos;s just a QualifiedName (which is a prefix+localName+namespace) used to compute name, localName and namespaceURI. name is prefix + &quot;:&quot; + localName (or just localName if not prefix) so it sounds like the name slot isn&apos;t needed.

&gt; &gt; No wait that is odd, why wouldn&apos;t setAttributeNS and getAttributeNS have the
&gt; &gt; same first two arguments?
&gt; 
&gt; I&apos;m not sure, is that not what implementations do?

OK, actually setAttributeNS takes a qualifiedName while getAttributeNS takes a localName. That&apos;s because when setting you can give a prefix but when getting the prefix doesn&apos;t matter. There&apos;s always more subtlety to namespaces than I realize.

I found an incompatibility here:

var elem = document.createElement(&apos;b&apos;);
elem.setAttributeNS(&apos;https://example.com&apos;, &apos;a:name&apos;, &apos;value&apos;);
elem.setAttributeNS(&apos;https://example.com&apos;, &apos;b:name&apos;, &apos;value&apos;);
alert(elem.attributes[0].prefix);

Blink/WebKit say a, IE and Gecko say b. I think the spec says b?

In any event, I&apos;m wrong, getAttributeNS and setAttributeNS don&apos;t have the same two first arguments. Whether or not just &quot;name&quot; is a good name for setAttributeNS&apos;s second argument I&apos;ll leave to you.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>118232</commentid>
    <comment_count>9</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-03-02 13:27:28 +0000</bug_when>
    <thetext>The specification says &quot;a&quot; for that case as far as I can tell. Since an attribute is found only the value is changed. Prefix is not mutable in the specification I think.

I think I will rename name to qualifiedName when I remove the name internal slot.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124305</commentid>
    <comment_count>10</comment_count>
    <who name="Arkadiusz Michalski (Spirit)">crimsteam</who>
    <bug_when>2015-11-29 01:30:21 +0000</bug_when>
    <thetext>So this was done by https://github.com/whatwg/dom/issues/110 and can be close here?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124306</commentid>
    <comment_count>11</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-11-29 10:53:04 +0000</bug_when>
    <thetext>No, we still name one argument qualifiedName and the other name. This bug is about changing the argument to getAttribute() et al from name to qualifiedName for editorial consistency and to make things easier to read and understand.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124319</commentid>
    <comment_count>12</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-11-30 14:44:31 +0000</bug_when>
    <thetext>https://github.com/whatwg/dom/commit/e5b0aaf24e27f2b18e8e7cfe0e7847d62082f45b</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>