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

Jonas Sicking jonas at sicking.cc
Wed May 29 21:58:37 PDT 2013


On Wed, May 29, 2013 at 8:34 PM, Boris Zbarsky <bzbarsky at mit.edu> wrote:
>>      div.attributes.fruit = "apple";
>>      alert(div.attributes.fruit); // apple
>>      div.setAttribute("fruit", "orange");
>>      alert(div.attributes.fruit); // [object Attr]
>>      div.removeAttribute("fruit");
>>      alert(div.attributes.fruit); // apple (!!!)
>>
>> Firefox and Chrome seem to be inconsistent on this, but at least in some
>> situations they will shadow the property with an attribute, then restore
>> the original property when the attribute is removed.
>
> That is also the normal behavior for WebIDL things with a named getter.

And this is why we should make named getter/setters a thing of the
past. New specs are still being written which use these WebIDL
features and almost all of them end up with confusing behavior like
this.

/ Jonas



More information about the whatwg mailing list