W3C home > Mailing lists > Public > www-style@w3.org > March 2009

[CSSOM] GetComputedStyle : choose the unit

From: Innovimax SARL <innovimax@gmail.com>
Date: Mon, 23 Mar 2009 18:07:37 +0100
Message-ID: <546c6c1c0903231007o54534f5fpa126865ee5d3b357@mail.gmail.com>
To: www-style@w3.org

For the moment in http://dev.w3.org/csswg/cssom/

We can find

interface ViewCSS {
  CSSStyleDeclaration getComputedStyle(in Element elt);
  CSSStyleDeclaration getComputedStyle(in Element elt, in DOMString
The getComputedStyle method must return a live CSSStyleDeclaration object
that contains the computed style declaration block for elt, when the
pseudoElt argument is null, the empty string or omitted. Otherwise, for the
pseudo-element pseudoElt of elt. [CSS]

And then
interface CSSStyleDeclaration {
           attribute DOMString cssText;
  DOMString getPropertyValue(in DOMString property);
  DOMString getPropertyPriority(in DOMString property);
  DOMString removeProperty(in DOMString property);
  void setProperty(in DOMString property, in DOMString value);
  void setProperty(in DOMString property, in DOMString value, in DOMString
  readonly attribute unsigned long length;
  DOMString item(in unsigned long index);
  readonly attribute CSSRule parentRule;

So it means, if I want to have access to the width of an element
getComputedStyle(el, "").getPropertyValue("width");

I propose to add a new parameter to getPropertyValue so that you can choose
the unit

something like

getComputedStyle(el, "").getPropertyValue("width", "px");

And even to get information with respect to relative value

getComputedStyle(el, "").getPropertyValue("width", "em");



Innovimax SARL
Consulting, Training & XML Development
9, impasse des Orteaux
75020 Paris
Tel : +33 9 52 475787
Fax : +33 1 4356 1746
RCS Paris 488.018.631
SARL au capital de 10.000 
Received on Monday, 23 March 2009 17:08:18 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 11 February 2015 12:34:24 UTC