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

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