- From: Mark S. Miller <erights@google.com>
- Date: Fri, 19 Feb 2010 07:25:44 -0800
- To: Anne van Kesteren <annevk@opera.com>
- Cc: "public-script-coord@w3.org" <public-script-coord@w3.org>
- Message-ID: <4d2fac901002190725u2bb617ddyc55f0c80d105f367@mail.gmail.com>
On Fri, Feb 19, 2010 at 6:57 AM, Anne van Kesteren <annevk@opera.com> wrote: > For the CSSOM the CSS WG has an idea on how we can extend the current > string-based interface to CSS property values to become an object-based > interface in a mostly backwards compatible way. > > The way this would work is that the attributes on the CSSStyleDeclaration > interface (you can get access to an object implementing that interface > through e.g. document.body.style) no longer return a DOMString but a > DOMString-like object. This DOMString-like object has all the functionality > of DOMString but also supports additional features. E.g. in the case of a > CSS color property it would have red/green/blue/alpha members that allow > reading and direct manipulation of various aspects of the color value. > > I wondering whether there was some shorthand that we could introduce in Web > IDL for this. E.g. allow an interface to inherit from DOMString. Thoughts? > DOMString is WebIDL shorthand for string, not for String. Unless you are proposing a new primitive string-like data type be added to JS -- which should be about as fun as adding decimal as a new primitive numeric type -- then your new DOMString-like data type would be WebIDL shorthand for a String-like data type, which isn't string-like at all. Mapping backwards, it would therefore not be DOMString-like, no matter what WebIDL might claim to the contrary. For example, is the ! of an empty DOMString-like object true or false? This is yet another example of why WebIDL is a bad language for designing JavaScript APIs. The choices encouraged by WebIDL, and that seem natural in WebIDL, often result in bad JavaScript API designs. > > > -- > Anne van Kesteren > http://annevankesteren.nl/ > > -- Cheers, --MarkM
Received on Friday, 19 February 2010 15:26:17 UTC