Tim Poulsen wrote:

> If you set clipping values for an element without units, NS6.1
> incorrectly assign units when you read those clipping values with code.
> 
> So, with this DIV:
> 
> <div id="clippedDIV" style="
>  position: absolute;
>  top: 125;
>  left: 175;
>  height: 90;
>  width: 250;
>  clip:rect(0 250 90 0);">This is a DIV named clippedDIV. It is filled
> with some meaningless text designed to fill up space so that you can see
> clipping in action.</div>
> 
> This statement:
> 
> alert(document.getElementById("clippedDIV").style.clip)
> 
> Produces the output:
> 
> rect(0pt 250px 90px 0pt)
> 
> NS 6.1 assigns points as the units for the zero-value attributes and
> pixels for those set with values.
> 
> I know that the W3C spec calls for units in the clip statement. But Nav
> 4.x and versions 4-6 of Internet Explorer all correctly apply the pixel
> units to all four values if you don't specify units.
> 
> Also, all of the browsers default to pixels if you leave of the units
> specifiers for attributes like top, left, height, and width (as shown
> above). So, one would be led to believe that pixels was the default unit
> for all of these length measurements.
> 
> So, does it not seem inappropriate that NS6 applies points to the
> zero-value attributes and pixels to the non-zero attributes?


It is weird, but on the other hand, it is also correct. 0px = 0pt.


> (I won't call this a bug, as all of the browsers are being helpful in
> interpreting my incorrectly-written code. But, I guess I'll say I don't
> agree with the NS implementation.)


Actually, accepting non-zero numbers without units IS a bug since CSS 
says you should ignore them. Try it with a DOCTYPE that invokes 
"strict" mode. Mozilla should Do The Right Thing and ignore them.

Rob


Reply via email to