[whatwg] [dom] attributes collection not fully defined?

Michael Day mikeday at yeslogic.com
Wed May 29 21:06:21 PDT 2013

Hi Boris,

Thank you for the detailed explanation. Having the WebIDL named getter 
definition helps to simplify things.

This part still seems inconsistent with current browsers:

> 4)  Setting a property name that is currently exposed does a Reject
>      (which means throw in strict mode, silently do nothing in
>      non-strict mode).  Unless there is a named setter, of course.

If I set the property name which has already been used for an attribute, 
it still seems to store the value:

     div.setAttribute("fruit", "orange");
     div.attributes.fruit = "apple";
     alert(div.attributes.fruit); // apple

except for a very strange bug in Firefox only, where if I *read* the 
value before removing it, the attribute doesn't go away later:

     div.setAttribute("fruit", "orange");
     div.attributes.fruit = "apple";
     alert(div.attributes.fruit.value); // orange
     alert(div.attributes.fruit); // [object Attr] ???

Just adding the extra alert in the middle changes the value after 
removing the attribute, so that the Attr object is still returned.

Anyway, doing nothing or throwing if the user tries to write to a 
property which is currently exposed seems like a much better option.

Best regards,


Prince: Print with CSS!

More information about the whatwg mailing list