On Jun 19, 11:15 am, APinter <[email protected]> wrote:
> I'm pretty sure, you are right with your suggestion.
> But i have failed to tell the event, where to find my "foo". That's
> the reason why i came up with Firebug.Cocoon3ProfilingModule.alertStuff
> (currentIndex);");

But Firebug is an object in the scope of browser.xul...

>
> alert(foo); or alert(Firebug.Cocoon3ProfilingModule.alertStuff);
> doesn't result in any output at ally.
> alert(window.location) writes "chrome://firebug/content/panel.html".

...and you are in the scope of panel.html when you run the select
handler.

>
> But the good news:
> the eventHandler-thingie works great!
>
> I'm curious why onselect does not know where to look, while
> addEventListener does.

Because onselect takes a string expression which is evaluated in the
other window (and fails), while the addEventListener takes a function
compiled in the window of the 'foo'.

>
> Last thing to look at is passing arguments to the EventListener, which
> shouldn't be that much of a problem, should it?

On the contrary, it's not possible. The event listener has fixed
argument: 'event'. Rather you have to "close" over values in the scope
of the addEventListener call.
var bar = 5;
function handler(event) {
   alert("Meet me in the bar at "+bar);  // bar is bound from one
scope and used in another.
}
elt.addEventListener('select', handler, true);

jjb
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Firebug" 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/firebug?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to