Re: DOMString-like objects for the CSSOM

On Feb 19, 2010, at 8:29 AM, Brendan Eich wrote:

> Mark's right, this is not backward compatible, so why even try?  
> Backward compatibility is pretty much like pregnancy: you are or you  
> aren't.
>
> Better to make new APIs that do not interfere with legacy ones.

I have qualms about Anne's proposal - I told him about some of the  
inevitable string vs. String behavior differences back at TPAC this  
year. But I wouldn't reject outright the possibility that a String- 
like object would be compatible enough for practical purposes. That  
can be determined through some form of testing.

The other alternatives involve creating some parallel API, along one  
of the following lines:

foo.style.topValue.px = 200
foo.style.topPX = 200
foo.styleValues.top.px = 200

Of these options, I think the last one is probably the best, because  
it's easy to feature-test for from script. The only problem is that  
"styleValues" is kind of a bad name. I'm sure there are better  
possibilities though.

REgards,
Maciej

>
> /be
>
> On Feb 19, 2010, at 8:20 AM, Mark S. Miller wrote:
>
>> On Fri, Feb 19, 2010 at 8:15 AM, Boris Zbarsky <bzbarsky@mit.edu>  
>> wrote:
>> On 2/19/10 11:06 AM, Mark S. Miller wrote:
>> Why make your new object be String-like rather than simply  
>> containing a
>> string as a member?
>>
>> I think the reasoning is tat people use |foo.style.top| as a string  
>> right now.
>>
>> Is it a string right now? If it is...
>>
>>  So if we want to allow doing |foo.style.top.px = 200|
>>
>> Why would you want that? I suggest that once you appreciate the  
>> costs of that desire, you will no longer want that.
>>
>>
>> and at the same time allow people to treat foo.style.top as a  
>> string, then it needs to be string-like in some sense.
>>
>> I suspect that just having it toString to the string it is right  
>> now is not sufficient for web compatibility.
>>
>>
>> Why use is-a rather than has-a?
>>
>> Because we're trying to extend a legacy API which currently uses  
>> strings, not designing in a vacuum.
>>
>> -Boris
>>
>>
>>
>> -- 
>>     Cheers,
>>     --MarkM
>

Received on Saturday, 20 February 2010 01:22:45 UTC