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

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 8 Aug 2013 16:35:51 -0700
Message-ID: <CAAWBYDBx7oSjYX+eq5VYPFCoE1aNPZPd5zQsm653suxLEPM4qg@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: www-style list <www-style@w3.org>
Reading through the last time this was brought up in 2010
<http://lists.w3.org/Archives/Public/public-script-coord/2010JanMar/thread.html#msg21>
makes it seem more difficult to do. :/

On Thu, Aug 8, 2013 at 4:24 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> 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.  :(

This is potentially fixable with TC39's Value Objects thing, which is
getting closer to reality:
<http://esdiscuss.org/topic/typeof-extensibility-building-on-my-value-objects-slides-from-thursday-s-tc39-meeting>.
 You can define the behavior of == here.  We can even fix "typeof".

>> 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?

It would help.  Yes, they're generic.


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

Heh, yeah.

~TJ
Received on Thursday, 8 August 2013 23:36:37 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:33 UTC