instanceof, HTMLSelectElement and Greasemonkey

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top