Re: [CSSOM] getClientRects should work on collapsed ranges in elements

On Wed, 18 Aug 2010 23:07:36 +0200, Ojan Vafai <ojan@chromium.org> wrote:
> Those are totally valid concerns. Ideally we could spec this so that it
> would also work in the situations where inserting an empty text node  
> doesn't create a CSS box, which is what IE does, but I'm not sure how.  
> Even without that, I think this would be an improvement. It's  
> incrementally closer to
> what IE does and, in my opinion, gets closer to meeting the use-case for
> this API.

So I looked at this a bit closer and I think it is rather ugly. For the  
purposes of the API we have to pretend there are empty text nodes  
everywhere which somehow cause a box to be generated (although I would  
never expect empty text nodes to do that) in most cases (e.g. not with  
tables) which is then returned by the API. This seems really rather  
fragile and I would rather not do it. At least not in this way.

I suppose we could special case start of an element and end of an element.  
Start of an element gives you top/left of the element with height/width 0  
and end of element gives you bottom/right with height/width 0. That would  
also work for the table scenario, but it might miss others.

Input appreciated.


-- 
Anne van Kesteren
http://annevankesteren.nl/

Received on Tuesday, 31 August 2010 12:01:56 UTC