[thelist] Javascript : cancel bubble with Safari
Bill Moseley
moseley at hank.org
Thu Feb 16 13:15:44 CST 2006
On Thu, Feb 16, 2006 at 09:12:33AM +0000, Christian Heilmann wrote:
> Hmm, I think it is not that easy. The solution is to have an onclick
> handler on both the TR and the As inside and it check the nodeName of
> the element that was activated. Fiddling with Z-index for the links
> might also help.
I'm not sure how to implement that.
It seems to be logical to make sure both the <tr> and the nested <a>
to fire in the bubble phase (so the <a> fires first) and then cancel
the bubble so that the <tr> doesn't fire when the <a> event happens.
How well different browsers support that I'm not sure. But seems to
work in IE/Firefox/Opera/Safari Linux/Win/Mac where I've tested.
> Logically this doesn't make sense: You want a whole area that is not
> interactive clickable and then you want just some of it not clickable
> but leave it to the real interactive elements. This would really
> confuse me as a user, why don't you just make those rows clickable
> that don't have links (or one) in them (and indicate that they are
> clickable via a hover state) and keep those with several links as-is?
Well, that's the big issue. And I think I agree that it can be
confusing. That's left to the designers, I suppose. I'm just trying
to understand the technical aspect of how to control the multiple
(and maybe conflicting) events.
I find it curious that with Safari that AddEvent works yet
assigning via event.onclick does not work. But, if it's just a plain
old bug there's not much to figure out. ;)
--
Bill Moseley
moseley at hank.org
More information about the thelist
mailing list