- From: Garrett Smith <dhtmlkitchen@gmail.com>
- Date: Mon, 23 Mar 2009 11:07:02 -0800
- To: Ludger Buenger <ludger.buenger@realobjects.com>
- Cc: Innovimax SARL <innovimax@gmail.com>, www-style@w3.org
On Mon, Mar 23, 2009 at 10:20 AM, Ludger Buenger <ludger.buenger@realobjects.com> wrote: > > > This is already possible in a slightly different way, so please read the > fine standard! > > > > Try this: > > In what? Not a browser, obviously. If changed to:- var prop = document.defaultView.getComputedStyle(document.body, '').getPropertyCSSValue('width') var value = prop.getFloatValue(CSSPrimitiveValue.CSS_PX); It would work in some browsers. Replacing CSS_PX with CSS_EM should result in error. CSS_EMS might work in some browsers. The API is designed in a way that pretty much requires try-catch because:- | getFloatValue | This method is used to get a float value in a specified unit. | If this CSS value doesn't contain a float value or can't be converted | into the specified unit, a DOMException is raised. It doesn't work reliably. What happens if an error is thrown? > For convenience, I omitted instance, type null and other checks… > I am not saying you have a bad idea, but can you explain why you need this to work? > > > Ludger > [...] Garrett
Received on Monday, 23 March 2009 19:07:38 UTC