W3C home > Mailing lists > Public > www-style@w3.org > August 2013

Re: [cssom-values] Possibility of patching existing CSS strings into Values objects?

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Thu, 08 Aug 2013 19:24:15 -0400
Message-ID: <5204289F.4030105@mit.edu>
To: www-style@w3.org
On 8/8/13 7:18 PM, Tab Atkins Jr. wrote:
> 1. You can't directly compare the object anymore - "el.style.color ==
> el.style.backgroundColor" will be guaranteed false, as they're
> different objects.

This seems fairly risky, sadly.  :(

> 2. You can't use string operations directly on the object -
> "el.style.color.slice(5, 10)" will fail.

Would just putting String.prototype on the proto chain (or your idea of 
adding String methods directly on CSSValue, but the other might be 
cleaner and more forward-compatible when things get added to String) 
work?  As in, are those methods generic enough?

> and by adding indexed getters that retrieve characters from the string
> representation.

Ick.  :(

> This feels hacky, but we do this kind of manual
> core-class emulation already in WebIDL with [MapClass]; adding a
> [StringClass] might not be too bad of an idea.

If we do this, we should definitely do StringClass.

-Boris
Received on Thursday, 8 August 2013 23:24:44 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:30 UTC