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

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