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

cssom - clientTop, et v

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Sun, 9 Mar 2008 11:39:58 -0800
Message-ID: <c9e12660803091239y2c6ab58s519e82efc6358e8f@mail.gmail.com>
To: Www-style <www-style@w3.org>

There is no way to get the border-right and border-bottom widths.

clientTop - border-top-width
clientLeft - border-left-width
_______  - border-right-width?
_______  - border-bottom-width?


The other problem with the client* properties is that they are rounded
pixel values (at least in IE, Opera, and Safari).

The other problem I have is the name. "clientTop" does not describe a
borderTopWidth.

Would it make sense to:

1) include widths for ALL borders?
2) include floating point pixels (sub-pixels) (to avoid cumulative
rounding issues mentioned in earlier msg)
3) renames these properties to something non-conflicting so as to
avoid compatibility issues with (2)?

element.borderTopWidth
element.borderLeftWidth
element.borderRightWidth
element.borderBottomWidth

This is more complete, but still shows signs of feature envy. The
element wants properties of its style values.

Adapter/Strategy seems more appropriate. The way it would work would
be to abstract parts of the style that the element would be interested
in.

Hypothetical:
 element.getPixelValueFor("border-top-width");
 element.pxProp.marginLeftWidth

Changes would be localized to the would-be Adapter. (marginLeftWidth
is a would-be change);

The method available today is not an instance method:

// wrap in parseFloat( )
document.defaultView.getComputedStyle(element, "").borderLeftWidth;

It's in a strange place - on the defaultView - not the element. It is
too verbose and less natural.

Garrett
Received on Sunday, 9 March 2008 19:40:06 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:02 GMT