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
Dear,

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
pseudoElt);
};
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
priority);
  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");


Regards,

Mohamed ZERGAOUI

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

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:17 GMT