Hi,

I am using Chrome Dev 4.0.249.22.

I am creating a small floating menu and I want to detect when someone
clicks outside of it. The way I detect if someone clicks out of the
menu is by registering a window click event (window.addEvent...
('click')) and I test if event.target is equal to the original menu
object (or a child of it). This worked on the Chrome beta version that
I previously installed, but now with the dev version I see that the
event is not the original event element but some type of copy that no
longer validates with a (event.target == paramElement).

sample code:

//creating menu:
var menu = document.createElement('div');
myAddChildren(menu);
window.addEventListener('click', function(event) { removeMenu(event,
menu); }, false);
document.body.appendChild(menu);

//removing menu:
function removeMenu(event, menu) {
if((event.target == menu) || (myIsChild(menu, event.target))
 return //don't remove if click is on menu itself
window.removeEventListener('click', arguments.callee.caller, false);
document.body.removeChild(menu);

I also noticed that if I add a custom variable to the menu object it
doesn't show up under event.target when clicked. I have also verified
that the element clicked is the actual menu as opposed to a child. I
can verify this via the className which is set to the menu class type.
The test that previously passed and *** should *** pass is
(event.target == menu).

The effect is that I want the menu to stay open so long as I've not
clicked out of it. A click inside of it should keep it open. I know
this sounds strange and it's not the way it will be in the end, but
it's important for now.

Thanx,
nachum

--

You received this message because you are subscribed to the Google Groups 
"Chromium-extensions" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/chromium-extensions?hl=en.


Reply via email to