Doesn't Xul'l browser focus event work?
I have this browser element:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window width="400" height="300"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<browser
id="mybrowser"
onclick="dump('CLICKED!\n')"
onfocus="dump('FOCUSED!\n')"
type="content"
src="http://www.google.com/"
flex="1" />
</window>
and the onclick
is working well, but not the onfocus
. Both are inherited from DOM element, so it should work.
Any idea why it's not working?
obs. I know I can make it work by adding a focus listener to the window. But I want to know why the onclick
is corrected inherited and working for the browser element, while the onfocus
not.
The answer is that click events bubble, but focus (and blur) events do not. (Load and unload events are slightly different in that an event handler on a page's [i]frame element will fire as if the event had bubbled. They still don't bubble to a <browser type="content">
.)
I don't know a reference for why these events don't bubble.
精彩评论