During TPAC I discussed with various people how we should tackle CSS values within the CSSOM. I had sort of given up on this myself but it seems that in order to get rid of the current
CSSValue interface and friends we need to find a suitable alternative. And we really want to get rid of those because they are super ugly. Ian pointed this out long ago though unfortunately only in Member-only space. I have since made it available publicly as CSSValue replacement proposal from Ian Hickson so everyone can take a look at it. Hopefully it is clear that Ian no longer stands behind everything that is stated there. In fact, it was more a proof of concept. Having said that, the idea of turning the attributes that currently return a string into some kind of object does have a certain appeal. And if we can make them behave almost identically to strings I think we can make it work. It would be pretty awesome if you can increase the pixel value of the
left property using the following rather than using all kinds of string manipulation:
var ele = document.getElementsByTagName("div") ele.style.left.px++
Theoretically this model can actually work though once we are a little further in drafting the details of the proposal we do have to test it to make sure we are not going to break the Web because that would be bad. For instance, triple-equality checking for these special type of strings would no longer work.
I've always thought direct manipulation of values (instead of strings) via the DOM made sense. Unfortunately SVG+SMIL's DOM was never very pretty:
someRect.x.baseVal.value += 10;
This is because SVG's DOM made the base value and the animated value available to the programmer (a mistake, imo) as well as abstracting the length to yet another interface. It would make things worlds easier if we could just do:
someRect.x += 10;
I realize you're talking about the CSS OM though, which wouldn't allow me to modify geometry of SVG (since those are attributes and not CSS properties).