ColinFine, I couldn't find anything relevant in the spec either. However, my point is not whether or not the elements are being positioned identically. It's whether the position reported by the browser is in fact the rendered position. As far as I understand, it's this apparent incoherence that causes clonePosition to behave improperly.
Tiago On 4 set, 11:07, ColinFine <[email protected]> wrote: > On Sep 4, 3:59 am, Tiago <[email protected]> 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---
