- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Mon, 11 Apr 2011 16:29:36 -0700
- To: "Tab Atkins Jr." <jackalmage@gmail.com>
- CC: www-style list <www-style@w3.org>
On 4/11/11 3:47 PM, Tab Atkins Jr. wrote: > (I thought getComputedStyle() was supposed to return the used value of > 'width'? That should be an actual number for every element, right? > The only transformation left is the conversion from used->actual, > which is just pixel rounding.) getComputedStyle in Gecko returns CSS2.0 computed style, more or less, which is neither "computed style" nor "used style" in terms of CSS 2.1. > Yeah, but that's a separate and more-or-less irrelevant issue. If > you're asking for the width of non-rendered elements you're doing > something wrong. Welcome to the web! ;) >>> Right now, there are two ways to get the position of an element: >>> elem.offsetTop/Left (gives you coords relative to the element's >>> positioning root), and >>> elem.getBoundingClientRect().top/right/bottom/left (post-transform >>> coords of the bounding box relative to the viewport). >> >> Again, that's not actually what those do in all browsers. > > I'm assuming the difference is again relative to whether transforms are honored? For getBoundingClientRect(), yes. For offset* the behavior is so screwed up that I'm not sure there's any one-sentence summary that can possibly be correct. > The problem, of course, is ensuring that the people designing the API > have a sufficient understanding of CSS to make the right choices here. Yes, agreed. I think we need both sets of people here. -Boris
Received on Monday, 11 April 2011 23:30:08 UTC