Re: Maybe we should think about Interface.isInterface functions again

On 7/20/13 12:08 PM, Anne van Kesteren wrote:
> So why does the attribute getter in
> http://dev.w3.org/2006/webapi/WebIDL/#dfn-attribute-getter throw?

The main reasons are that the UAs that had such getters threw in this 
situation and the boolean attribute issue...  If we don't care about 
this, we could just give all getters the LenientThis behavior, I suppose.

> Could you give an example of how that would go wrong?

Sure:

   if (stylesheet.disabled) {
   }

if your object happens to not be a stylesheet but rather the StyleSheet 
prototype, you'll get back undefined with the LenientThis behavior and 
then it'll test as enabled... which is a bit odd.  But maybe this really 
is an edge case.

I would be willing to try making all getters LenientThis and seeing what 
happens.

For setters, I think throwing on incorrect this still makes sense, 
though, right?

-Boris

Received on Saturday, 20 July 2013 20:45:13 UTC