[mochikit] Re: MochiKit.DOM.isChildNode and isParent

2008-10-19 Thread Per Cederberg

Ok, since r1433 MochiKit.DOM.isParent is no more.

/Per

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
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
-~--~~~~--~~--~--~---



[mochikit] Re: MochiKit.DOM.isChildNode and isParent

2008-10-18 Thread Christoph Zwerschke

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.

You can merge the functions by using an additional flag (e.g. 
direct=true), but it's probably easier to have two separate functions. 
However, they certainly need better names  documentation.

-- Christoph

Per Cederberg schrieb:
  Noone has opinions on this?
 
  Cheers,
 
  /Per
 
  On Wed, Oct 8, 2008 at 3:51 PM, Per Cederberg [EMAIL PROTECTED] 
wrote:
  The two functions MochiKit.DOM.isChildNode and isParent have both been
  added in version 1.4 of MochiKit (not yet stable). But they are
  virtually identical (except for a few bugs I'm in fixing right now).
  The only difference, according to the API docs, as far as I can tell
  is:
 
  isChildNode(node, node) -- true
  isParent(node, node) -- false
 
  Is it not pointless to keep both functions around? Since isChildNode()
  is more tested (and probably more used), I'd suggest removing
  isParent() from the API before the 1.4 release. Possibly, in order to
  simplify the transition, we could just alias isParent to isChildNode
  (and remove the API doc specification so that noone will use it from
  now on).
 
  Opinions?
 
  Cheers,
 
  /Per

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
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
-~--~~~~--~~--~--~---



[mochikit] Re: MochiKit.DOM.isChildNode and isParent

2008-10-18 Thread Per Cederberg

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 mochikit@googlegroups.com
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
-~--~~~~--~~--~--~---



[mochikit] Re: MochiKit.DOM.isChildNode and isParent

2008-10-18 Thread Christoph Zwerschke

Per Cederberg wrote:
 Both actually do that.

Ah, right. Overlooked the recursive call in the last line of isParent. 
Then both names are really misleading. It's completely unusual to call a 
not direct ancestor parent or a not direct descendant child.

And there's really no reason to keep them both, or making one the alias 
of the other. If both functions are there, then they should have least 
swapped arguments, like here:
http://publib.boulder.ibm.com/infocenter/idshelp/v111/index.jsp?topic=/com.ibm.dbext.doc/dbext270.htm

-- Christoph




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
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
-~--~~~~--~~--~--~---



[mochikit] Re: MochiKit.DOM.isChildNode and isParent

2008-10-17 Thread Per Cederberg

Noone has opinions on this?

Cheers,

/Per

On Wed, Oct 8, 2008 at 3:51 PM, Per Cederberg [EMAIL PROTECTED] wrote:
 The two functions MochiKit.DOM.isChildNode and isParent have both been
 added in version 1.4 of MochiKit (not yet stable). But they are
 virtually identical (except for a few bugs I'm in fixing right now).
 The only difference, according to the API docs, as far as I can tell
 is:

 isChildNode(node, node) -- true
 isParent(node, node) -- false

 Is it not pointless to keep both functions around? Since isChildNode()
 is more tested (and probably more used), I'd suggest removing
 isParent() from the API before the 1.4 release. Possibly, in order to
 simplify the transition, we could just alias isParent to isChildNode
 (and remove the API doc specification so that noone will use it from
 now on).

 Opinions?

 Cheers,

 /Per

 PS. I just discovered that Google Groups silently dropped all my
 emails that used another sender address, so I'm currently resending
 all my recent postings. Hence the sudden email bombing...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
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
-~--~~~~--~~--~--~---



[mochikit] Re: MochiKit.DOM.isChildNode and isParent

2008-10-17 Thread Jason Bunting

Who is Noone? :P

Personally, I agree that it seems pointless to have isParent around when
isChild will do the same thing. I don't even think the alias is needed, if
someone wanted the semantics that would provide, let them alias it
themselves, I say.

There is my opinion, for what little it is worth.

Jason Bunting


 -Original Message-
 From: mochikit@googlegroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of Per Cederberg
 Sent: Friday, October 17, 2008 2:29 PM
 To: MochiKit
 Subject: [mochikit] Re: MochiKit.DOM.isChildNode and isParent
 
 
 Noone has opinions on this?
 
 Cheers,
 
 /Per
 
 On Wed, Oct 8, 2008 at 3:51 PM, Per Cederberg [EMAIL PROTECTED] wrote:
  The two functions MochiKit.DOM.isChildNode and isParent have both been
  added in version 1.4 of MochiKit (not yet stable). But they are
  virtually identical (except for a few bugs I'm in fixing right now).
  The only difference, according to the API docs, as far as I can tell
  is:
 
  isChildNode(node, node) -- true
  isParent(node, node) -- false
 
  Is it not pointless to keep both functions around? Since isChildNode()
  is more tested (and probably more used), I'd suggest removing
  isParent() from the API before the 1.4 release. Possibly, in order to
  simplify the transition, we could just alias isParent to isChildNode
  (and remove the API doc specification so that noone will use it from
  now on).
 
  Opinions?
 
  Cheers,
 
  /Per
 
  PS. I just discovered that Google Groups silently dropped all my
  emails that used another sender address, so I'm currently resending
  all my recent postings. Hence the sudden email bombing...
 
 
  
 
 No virus found in this incoming message.
 Checked by AVG - http://www.avg.com
 Version: 8.0.173 / Virus Database: 270.8.1/1730 - Release Date: 10/17/2008
 8:07 AM


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
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
-~--~~~~--~~--~--~---