Attempting two answers in one below...
On Sat, Oct 18, 2008 at 12:23 AM, Jason Bunting
<[EMAIL PROTECTED]> wrote:
> Who is Noone? :P
Sigh... The endless joys we bring you native English speakers... ;-)
On Sat, Oct 18, 2008 at 5:54 PM, Christoph Zwerschke <[EMAIL PROTECTED]> wrote:
> Hm, if I read the code correctly, then there is another difference,
> namely that isChildNode also returns true if the second node is not the
> direct parent, but also for grandparents and any ancestors. So it should
> be actually renamed to something like isDescendant or isAncestor.
Both actually do that. But isParent() does it through recursion
instead of iteration:
isParent: function (child, element) {
var self = MochiKit.DOM;
if (typeof(child) == "string") {
child = self.getElement(child);
}
if (typeof(element) == "string") {
element = self.getElement(element);
}
if (child == null || element == null) {
return false;
} else if (!child.parentNode || child == element) {
return false;
} else if (child.parentNode == element) {
return true;
} else {
return self.isParent(child.parentNode, element);
}
},
I totally agree on the naming. Should be named as you propose, but I
don't see us changing the API right now though... :-(
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
-~----------~----~----~----~------~----~------~--~---