On Sep 4, 3:59 am, Tiago <tiago.torr...@gmail.com> wrote:
> This may not be Prototype's fault after all. I made a very simple test
> now. I compared the rendering of two pieces of HTML code separately:
>
> (1)
> <span id="test">
> <input type="text" value="Some text" />
> </span>
>
> (2)
> <div id="test">
> <input type="text" value="Some text" />
> </div>
>
> I measured both inputs with a "pixel ruler" and I realized their
> rendering is identical. Not a single pixel of difference. In both
> cases, the distance between the top of the browser window and the top
> of the input is 8 pixels.
>
> Then, I used a native method to obtain the position from the top:
>
> document.getElementById('test').offsetTop
>
> In case (1), the command returned 11 pixels. In case (2), the command
> returned 8 pixels.
>
> For some reason, the browser reports a wrong offsetTop when a span is
> used (even though the element is properly placed). Because Prototype's
> implementation of the clonePosition method relies on such values, the
> end result is inaccurate. Any thoughts why this happens?
>
> My tests were performed in Firefox 3.5.2.

If you can work out what should happen from the CSS spec [1] you're a
better man than I am. But I note that the 'visual formatting model'
distinguishes inline from block elements, so it is not necessarily to
be expected that they would be positioned identically.

[1] http://www.w3.org/TR/CSS21/visudet.html#Computing_heights_and_margins

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to