W3C home > Mailing lists > Public > www-style@w3.org > July 2012

Re: [CSS2.1][CSSOM] "Used Value" and "auto"

From: Øyvind Stenhaug <oyvinds@opera.com>
Date: Fri, 13 Jul 2012 17:47:27 +0200
To: "Mike Sherov" <mike.sherov@gmail.com>
Cc: "www-style@w3.org" <www-style@w3.org>
Message-ID: <op.whd55djwbunlto@oyvinds-desktop>
On Fri, 13 Jul 2012 14:30:15 +0200, Mike Sherov <mike.sherov@gmail.com>  

> On Jul 13, 2012, at 7:58 AM, "Øyvind Stenhaug" <oyvinds@opera.com> wrote:
>> On Thu, 12 Jul 2012 21:46:56 +0200, Glenn Adams <glenn@skynav.com>  
>> wrote:
>>> In contrast, the following length valued properties that accept 'auto'  
>>> have
>>> a distinct used value when display is not none:
>>> bottom
>>> height
>>> left
>>> right
>>> top
>>> width
>> Not quite, I think. I don't see any part of CSS 2.1 that defines the  
>> used value of bottom/left/right/top for non-positioned elements.
> What does Opera currently return in that case? "auto"?

Well, nothing will give you the used value per current specs. But for  
getComputedStyle, yes, "auto". So does IE, Firefox and Chrome.

> That's an
> interesting question, although I personally am not concerned about it,
> because asking for position values on non-positioned elements doesn't
> *seem* useful to me.

Content can end up relying on a lot of strange things (possibly in an  
indirect fashion), if it happened to "work" when the author tested it.

Anyway, the point is that while computed values are reasonably well  
defined, used values generally are not. So if the bottom/left etc  
properties are simply added to the CSSOM list alongside height etc, the  
definition would be incomplete.

> If I ever saw a bug report in jquery from a user saying "I am getting
> a nonsensical response from .css('left') from position:static
> elements", I'd close it and say "insane inputs produce insane
> outputs".
> With all that said, if I needed to define it, I'd return 0 on
> position:static, or whatever the easiest thing to do here is. Again,
> for me, it's about pragmatism. Anyone asking for CSS position on
> non-positioned elements deserve nonsense in response :)

But in the browser world, it's not necessarily the developer who will face  
the consequences. Maybe it's the user who happens to be using something  
that the developer didn't test.

Interoperability is good, specs leaving things undefined is not. Sure, if  
it really is an unimportant case, picking whatever's easiest will work.  
But it should define *something*, just in case. That's my opinion :)

Øyvind Stenhaug
Core Norway, Opera Software ASA
Received on Friday, 13 July 2012 15:48:01 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:01 UTC