<?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>26147</bug_id>
          
          <creation_ts>2014-06-19 15:25:42 +0000</creation_ts>
          <short_desc>Don&apos;t conflate attributes and properties in getElementAttribute</short_desc>
          <delta_ts>2015-08-04 22:45:02 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Browser Test/Tools WG</product>
          <component>WebDriver</component>
          <version>unspecified</version>
          <rep_platform>All</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>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>20860</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Ms2ger">Ms2ger</reporter>
          <assigned_to name="David Burns :automatedtester">dburns</assigned_to>
          <cc>ato</cc>
    
    <cc>dburns</cc>
    
    <cc>jleyba</cc>
    
    <cc>mike</cc>
    
    <cc>simon.m.stewart</cc>
          
          <qa_contact name="Browser Testing and Tools WG">public-browser-tools-testing</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>108083</commentid>
    <comment_count>0</comment_count>
    <who name="Ms2ger">Ms2ger</who>
    <bug_when>2014-06-19 15:25:42 +0000</bug_when>
    <thetext>Attributes are things returned by getAttribute; returning other things is confusing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108146</commentid>
    <comment_count>1</comment_count>
    <who name="">jleyba</who>
    <bug_when>2014-06-20 21:42:39 +0000</bug_when>
    <thetext>+1

getAttribute should map to the getAttribute function from DOM level 2.

A getProperty should be added to access properties.

This increases the surface area of the API, but lends itself to more consistent and less surprising behavior.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108843</commentid>
    <comment_count>2</comment_count>
    <who name="Andreas Tolfsen">ato</who>
    <bug_when>2014-07-10 11:10:07 +0000</bug_when>
    <thetext>The conclusion in our last F2F in London was to gather more data points before a decision is made and to write down the algorithm currently used to favour properties instead of arguments first.

(Who was assigned to do this?  I can&apos;t remember.)

The arguments in favour of conflation are that users get confused by the difference between attributes and properties, and that the primary userbase for the WebDriver spec are fairly non-technical testers who don&apos;t have the willingness to learn that.

Arguments against conflation focus on correctness of the API, semantic problems dealing with conflation, and the sheer number of edge cases that lead to a very complex algorithm, which, arguably is even more difficult to explain both to inexperienced and experienced users.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117053</commentid>
    <comment_count>3</comment_count>
    <who name="David Burns :automatedtester">dburns</who>
    <bug_when>2015-01-13 01:06:26 +0000</bug_when>
    <thetext>I think that burying our head in the sand about this is going to cause us a lot of problems in the future. 

In Web Components we don&apos;t have reflection[2] between properties and attributes that we normally have in the DOM. Below is an example that has come from a Mozilla implementation bug[1]



For the following html

&lt;!DOCTYPE html&gt;
&lt;custom-checkbox id=&quot;check&quot;&gt;This is a custom checkbox that has a checked property&lt;/custom-checkbox&gt;
  &lt;script type=&quot;text/javascript&quot;&gt;

window.GaiaCheckbox = (function(win) {
  // Extend from the HTMLElement prototype
  var proto = Object.create(HTMLElement.prototype);

  /**
   * Proxy the checked property to the input element.
   */
  Object.defineProperty( proto, &apos;checked&apos;, {
    get: function() {
      return this._checked || false;
    },
    set: function(value) {
      this._checked = value;
    }
  });

  // Register and return the constructor
  return document.registerElement(&apos;gaia-checkbox&apos;, { prototype: proto });
})(window);

  &lt;/script&gt;
  &lt;gaia-checkbox id=&quot;check&quot;&gt;&lt;/&lt;gaia-checkbox&gt;

  &lt;script&gt;
    document.getElementById(&apos;check&apos;).checked = true;
  &lt;/script&gt;


if we do 

    &gt; driver.findElement(By.id(&apos;check&apos;)).getAttribute(&apos;checked&apos;);

then we get back false in web components but if we were to make a comparable example with an &lt;input type=checkbox&gt; it would return true because of reflection[2].

I really don&apos;t see how we carry on conflating this when there are other web technologies forcing people to learn the difference between attributes and properties. 

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1113742
[2] https://html.spec.whatwg.org/#reflect</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122459</commentid>
    <comment_count>4</comment_count>
    <who name="David Burns :automatedtester">dburns</who>
    <bug_when>2015-08-04 22:45:02 +0000</bug_when>
    <thetext>I have split out getElementAttribute and getElementProperty for reasons defined in comment 3. 

Landed in 
* https://github.com/w3c/webdriver/commit/3819b63ec5defef42fae013c23e2ed497cca8bfd 
* https://github.com/w3c/webdriver/commit/5ffeced0e854a848aa516c644248473239058a6e</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>