Stefan said:
Looks like I owe you a Kipferl!
I've never had one of those.
I've never encountered any errors with Mozilla tooltips; probably
because the combination relatedTarget+tooltip never came up.
event.relatedTarget is indeed null when the mouse enters a tooltip. I'm
not sure if that's really a problem, it just means that our script can't
always tell where the mouse cursor went (or came from).
Right.
The pointer is either over the tooltip or outside the window. If the
pointer is over the tooltip, it's as good as being over the element, as
far as the program should be concerned.
However, if the pointer is *outside the window*, then it is not over the
element and the program should probably want to know about that.
I don't know a simple way to discriminate between these two, but
getRelatedTarget should be able to do that.
[...]
Why do you want the target returned instead of the relatedTarget?
If it is outside the window, I don't.
I'm going to reassess that piece of code and the code that the
workaround was introduced for.
One possibility is to return null when relatedTarget is null.
The downside to doing that is that the caller won't know where the
pointer is. Is it on the element's toolip? Outside the window?
Another downside to returning null is that the caller must perform a
null check before passing that value to other methods. This is not so
much of a problem, and it makes sense when the `event.relatedTarget`
really outside the document's window (and not on a "tooltip" window).
I see the jQuery code you posted catches the problem in "withinElement"
function.
They add, at the bottom of that function:
| // assuming we've left the element since we most likely mousedover a
| // xul element
| } catch(e) { }
- This assumption seems wrong. If the pointer was over an XUL element,
it was probably over the element's tooltip, and by implication, "within"
the element.
Other Gecko relatedTarget bugs not related to this problem:
Bug 225462 - Exception thrown trying to get text input mouseover event
relatedTarget properties
<
https://bugzilla.mozilla.org/show_bug.cgi?id=225462>
Bug 382735 - mouseOver & mouseUp from/to option elements within select
generate spurious events with bad relatedTargets
I know your APE library, although I have to admit that it's been over a
year since I last looked at it, and I have used parts of APE as an
inspiration for the code I'm using here. I'm currently working on other
(non-JS-related) projects, but if things are going as planned, I will
be doing an overhaul of the agglommeration of random code I sometimes
call a library, probably in late summer or autumn. When I'm in "library
mode" again, I'll be glad to contribute if I can.
Over the past year, it has had a major refactoring, a lot of bug fixes,
and new widgets (Autocomplete and Calendar). The outdated documentation
has been taken down.