开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜