getClientRects result in IE versus Mozilla

Martin Honnen <[email protected]>
Newsgroups gmane.comp.mozilla.devel.dom
Organization Liberty Development
Message-ID <geudnfF7xdrO2C3VnZ2dnUVZ_uudnZ2d__26669.6920306005$1219512931$gmane$org@mozilla.org>
I am confused as to what getClientRects() called on an element object 
returns in Mozilla. For IE, as far as I understand it, it returns a 
collection of TextRectangle objects, one for each rendered line of text 
in the element. For Mozilla I always get a collection of one rectangle.

Test case is here:
http://home.arcor.de/martin.honnen/javascript/2008/08/test2008082301.html

For IE 6 the output is

'P' element has 3 line(s).

'P' element has 4 line(s).

'UL' element has 3 line(s).

(where the result for the first 'P' element obviously depends on the 
browser window width).

For Mozilla the output however is

'P' element has 1 line(s).

'P' element has 1 line(s).

'UL' element has 1 line(s).

Tested with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) 
Gecko/2008070208 Firefox/3.0.1

The documentation at 
http://developer.mozilla.org/en/DOM/element.getClientRects also has a 
code example saying

   var rects = obj.getClientRects();
   var numLines = rects.length;

which with numLines suggests there should be a rectangle for each line 
of text.

Is the result Mozilla gives the intended result? How would the markup 
look for an element where getClientRects() in Mozilla would return a 
collection with more than one rectangle?



-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.