I think that line was used to do the following:
var parent = $("one");
var descendant = $("two");
getElementPosition(parent, descendant);
I.e, we can send another node as the relativeTo value. Not just an
object with x and y properties.
Cheers,
/Per
On Mon, Dec 15, 2008 at 12:17 PM, Amit Mendapara
<[email protected]> wrote:
>
> What does this line really intended for?
>
> relativeTo = arguments.callee(relativeTo);
>
> I have removed this line and that error was gone...
>
> - Amit
>
> On Dec 12, 8:08 pm, "Per Cederberg" <[email protected]> wrote:
>> Hi,
>>
>> I ran across a weird bug in MochiKit.Style.getElementPosition causing
>> FF to throw evil C++ exceptions into the console:
>>
>> http://trac.mochikit.com/ticket/332
>>
>> Debugging the MochiKit code I ended up looking at the following piece
>> of black magic:
>>
>> getElementPosition: function (elem, /* optional */relativeTo) {
>> var self = MochiKit.Style;
>> var dom = MochiKit.DOM;
>> elem = dom.getElement(elem);
>>
>> if (!elem ||
>> (!(elem.x && elem.y) &&
>> (!elem.parentNode === null ||
>> self.getStyle(elem, 'display') == 'none'))) {
>> return undefined;
>> }
>>
>> Question: What does the if-statement really do? And what was the real
>> intention?
>>
>> It seems the getStyle() function is called even though I send in a {
>> x: 0, y: 0 } object. I guess that is not the real intention.
>> Especially I like the "!elem.parentNode === null" check. What does
>> that even mean??? Weird that the previous test cases haven't caught
>> anything here...
>>
>> Cheers,
>>
>> /Per
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" 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/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---