- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Tue, 22 Sep 2009 11:38:19 -0500
- To: Garrett Smith <dhtmlkitchen@gmail.com>
- Cc: www-style <www-style@w3.org>
On Tue, Sep 22, 2009 at 11:27 AM, Garrett Smith <dhtmlkitchen@gmail.com> wrote: > New Proposal: > var height = x.getStyleAs("height", "px"); > height = parseInt(height, 10); > > For color:- > var color = x.getStyleAs("color", "rgba"); > if(!color) { > // failed. > color = x.getStyleAs("color", "rgb"); > } > > This addresses the problem of reading a style value. The > primitiveValue is defined in the relevant CSS specification for the > property. I highly support this, as I've currently got a program that's both slightly broken (because I don't hack around the issue for lengths) and annoyingly complicated (because I do hack around the issue for colors). The color issue is especially annoying, since I'm having to reimplement a full <color> parser in my PHP. IIRC, every single rendering engine returns something different when I do $(elem).css("color") for an element with "color:blue" set in CSS. > A corresponding method to set a value would not seem to be necessary, > as any value could be set with: > > x.style.color = "papayawhip"; Hahaha, this makes me laugh every time. ~TJ
Received on Tuesday, 22 September 2009 16:39:16 UTC