Re: [matrix][cssom-view] DOMPoint, DOMPointLiteral definitions

On Wed, 25 Sep 2013 07:06:54 +0200, Boris Zbarsky <bzbarsky@mit.edu> wrote:

> On 9/25/13 1:02 AM, Dirk Schulze wrote:
>> Are we discussing if the attributes(whole object) is immutable in  
>> certain situations or in general? I would not agree that DOMRect should  
>> always be immutable or that bottom/right should always be immutable.  
>> That should only be the case for live DOMRect objects where modifying  
>> these two attributes is not possible. And in these situations it is  
>> enough to have a prose saying that the returned object is immutable (or  
>> certain attributes).
>
> This is actually hard-ish to do in prose right now.
>
> The _right_ behavior for an immutable accessor property is to have a  
> getter and no setter.  This will throw on sets in strict mode and  
> silently no-op in non-strict mode.

Lots of DOM things throw in both modes (or no-op in both modes). For  
instance CSSStyleDeclaration#cssText throws when it's readonly. It's  
possible that we should stop doing that for new things. I'll bring this up  
on public-script-coord.

> That behavior is impossible to specify in prose: by the time your setter  
> has been invoked, you have no way to tell what mode the caller was in.
>
> Again, the right solution to this sort of issue is to have separate  
> interfaces for the two different behaviors.  In my opinion.
>
> -Boris
>


-- 
Simon Pieters
Opera Software

Received on Wednesday, 25 September 2013 09:12:43 UTC