R
Robert Kühne
Hi!
I have a small problem with instanceof. Since im new to javascript I
can't figure this one out myself.
I have a private function which is registered to be called on mouseover
on some <select> elements. It gets called but unfortunately also when
the mouse is hovering over the opened menu over the <option> elements.
So it gets called for several targets. To catch this I wanted to check
on the type with instanceof. But that does not work at all.
The first if is not working while the second if serves as workaround at
the moment. I do not like that solution though.
var touchy = function(e) {
if (e.target instanceof HTMLSelectElement) {
GM_log("Yes");
}
if (e.target.tagName.toUpperCase() == 'SELECT') {
e.target.value = someNewValue;
}
};
As you may have noticed it is a Greasemonkey script. Now, I have some
suspects to blame: Greasemonkey hiding somehow something or maybe
Firefox (which I am using) for something I don't know.
Any ideas what I'm doing wrong?
Robert Kühne
I have a small problem with instanceof. Since im new to javascript I
can't figure this one out myself.
I have a private function which is registered to be called on mouseover
on some <select> elements. It gets called but unfortunately also when
the mouse is hovering over the opened menu over the <option> elements.
So it gets called for several targets. To catch this I wanted to check
on the type with instanceof. But that does not work at all.
The first if is not working while the second if serves as workaround at
the moment. I do not like that solution though.
var touchy = function(e) {
if (e.target instanceof HTMLSelectElement) {
GM_log("Yes");
}
if (e.target.tagName.toUpperCase() == 'SELECT') {
e.target.value = someNewValue;
}
};
As you may have noticed it is a Greasemonkey script. Now, I have some
suspects to blame: Greasemonkey hiding somehow something or maybe
Firefox (which I am using) for something I don't know.
Any ideas what I'm doing wrong?
Robert Kühne