Two comments--

I should know better than to try to do this quickly without double  
checking, but here goes...

1) Does this solution continue to work when borders are assigned with  
element/class selectors, rather than inline?

2) I seem to recall there is something screwy with how borders are  
handled in IE's broken box model. How would that affect this  
solution, if at all?



TAG

On Apr 24, 2007, at 1:38 AM, ipernity.com wrote:

>
> Yes, this is true, but doing it this way will slow down dragging
> actions
> (with scripe.aculo.us for ex.).
>
> If I'm not wrong it's better to use :
>
>  valueT += parseInt(element.style.borderTopWidth) || 0;
>  valueL += parseInt(element.style.borderLeftWidth) || 0;
>
> cheers,
>
> Christophe.
>
> On 4 mar, 22:42, "Searle" <[EMAIL PROTECTED]> wrote:
>> I can't be bothered to find out how to open a bug report, so I'll  
>> just
>> put it here. Maybe somone cares.
>>
>> cumulativeOffset ignores borders of parent elements, which is wrong.
>> It was hard to find any information because ALL implementations I
>> found were wrong but one. (Astonishing, it's very basic.)
>> cumulativeOffset should read something like this:
>>
>>   cumulativeOffset: function(element) {
>>     var valueT = 0, valueL = 0;
>>     do {
>>       valueT += element.offsetTop  || 0;
>>       valueL += element.offsetLeft || 0;
>>
>> +      valueT += Element.getStyle(element, 'borderTopWidth') || 0;
>> +      valueL += Element.getStyle(element, 'borderLeftWidth') || 0;
>>
>>       element = element.offsetParent;
>>     } while (element);
>>     return [valueL, valueT];
>>   },
>>
>> Sorry, untestet.
>>
>> Cheers,
>> Searle
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to