This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 26147 - Don't conflate attributes and properties in getElementAttribute
Summary: Don't conflate attributes and properties in getElementAttribute
Alias: None
Product: Browser Test/Tools WG
Classification: Unclassified
Component: WebDriver (show other bugs)
Version: unspecified
Hardware: All All
: P3 normal
Target Milestone: ---
Assignee: David Burns :automatedtester
QA Contact: Browser Testing and Tools WG
Depends on:
Blocks: 20860
  Show dependency treegraph
Reported: 2014-06-19 15:25 UTC by Ms2ger
Modified: 2015-08-04 22:45 UTC (History)
5 users (show)

See Also:


Description Ms2ger 2014-06-19 15:25:42 UTC
Attributes are things returned by getAttribute; returning other things is confusing.
Comment 1 jleyba 2014-06-20 21:42:39 UTC

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.
Comment 2 Andreas Tolfsen 2014-07-10 11:10:07 UTC
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'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'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.
Comment 3 David Burns :automatedtester 2015-01-13 01:06:26 UTC
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'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

<!DOCTYPE html>
<custom-checkbox id="check">This is a custom checkbox that has a checked property</custom-checkbox>
  <script type="text/javascript">

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, 'checked', {
    get: function() {
      return this._checked || false;
    set: function(value) {
      this._checked = value;

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

  <gaia-checkbox id="check"></<gaia-checkbox>

    document.getElementById('check').checked = true;

if we do 

    > driver.findElement('check')).getAttribute('checked');

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

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

Comment 4 David Burns :automatedtester 2015-08-04 22:45:02 UTC
I have split out getElementAttribute and getElementProperty for reasons defined in comment 3. 

Landed in