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

On Wed, May 29, 2013 at 8:34 PM, Boris Zbarsky <bzbarsky@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

Received on Thursday, 30 May 2013 04:59:38 UTC