W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2013

How to specify an object that can be mutable or immutable

From: Simon Pieters <simonp@opera.com>
Date: Wed, 25 Sep 2013 11:21:23 +0200
To: "public-script-coord@w3.org" <public-script-coord@w3.org>
Message-ID: <op.w3ymxxsoidj3kv@simons-macbook-pro.local>
Hi

CSSOM View has a DOMRect interface [1], representing a rectangle. As part  
of adding new features, it was proposed to make the attributes of DOMRect  
mutable (for convenience, instead of having to create a new object), but  
in some situations they should be immutable. The question is how to best  
specify this.

Traditionally, I think DOM specs have just required to either throw or  
no-op in the immutable state, regardless of JS strict mode. CSSOM's  
CSSStyleDeclaration#cssText attribute [2] is an example that always throws.

Boris Zbarsky suggested it might be better to have two separate  
interfaces, with the mutable interface has settable attributes and the  
immutable interface has readonly attributes. [3]

WDYT?

[1] http://dev.w3.org/csswg/cssom-view/#the-domrect-interface
[2] http://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-csstext
[3] http://www.w3.org/mid/52426F6E.5070204@mit.edu
-- 
Simon Pieters
Opera Software
Received on Wednesday, 25 September 2013 09:21:58 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:37:50 UTC