Why is there no isFocused() in GWT?

前端 未结 2 1772
死守一世寂寞
死守一世寂寞 2020-12-19 03:19

In a programming scenario, I needed to check if my GWT textbox was focused or not. I ended up adding a boolean and a pair of Focus & BlurHandler to manually keep the foc

2条回答
  •  忘掉有多难
    2020-12-19 03:44

    Because there wasn't any cross-browser way of doing it until a few years ago (Firefox 3, Safari 4, to point at the last players in the game having added support document.activeElement).

    GWT still officially supports [1] Safari 3 (I believe Safari 2 support has been deprecated) and maybe even Firefox 2 (no DevMode plugin, but that doesn't mean the browser isn't supported: Opera is supported but has no DevMode either), so it's not possible to provide such a feature that would work in all supported browsers.

    Last, but not least, I think no one ever filed a request for enhancement in the issue tracker (I couldn't find any at least); and as you said, you can already do it today using FocusHandler/BlurHandler (which works cross-browser).

    [1] http://code.google.com/webtoolkit/doc/latest/FAQ_GettingStarted.html#What_browsers_does_GWT_support? I believe that page is a bit out of date, as it still lists Firefox 1.0, whose support (user.agent=gecko, vs. gecko1_8) has been removed in GWT 2.1.0, and doesn't list IE9, whose support has been added in GWT 2.3.0, and last but not least, I believe only the latest version of Opera is supported, whereas the list talks about Opera 9.

提交回复
热议问题