From ae76dc7f4aa127123a16264b559a1603c3fefa5d Mon Sep 17 00:00:00 2001 From: Silvio Date: Sat, 3 Oct 2009 17:23:02 -0300 Subject: Almost working version with code cleanup (3) --- finder_menu.js | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/finder_menu.js b/finder_menu.js index 2b20d68..1a56a51 100644 --- a/finder_menu.js +++ b/finder_menu.js @@ -58,14 +58,8 @@ function ul2finder() ul = this.parentNode.getElementsByTagName('ul')[0]; for(var i=0;i= 0) { return true; } return false; } - function isparent_std(par, child) { - if (par == child) { + + /* + * connected + * written by Silvio - s1lv10 at uol.com.br + * checks if two elements are connect via DOM, either by one being + * child of parent of the another. + */ + function connected(a, b) { + if (isparent(a, b) || isparent(b, a)) { return true; - } else if (par.hasChildNodes()) { - children = par.childNodes; - for (var i=0;i