Your sample code is stopping straight-away though as it immediately finds a (parent) LI and targ is still referring to the A that I clicked.
I'm a bit tired to correct it though at this time, soz. Try
Code:
while ((targ = targ.parentNode) && /* etc. */ )
/* empty statement */ ;