UIbinder using html elements and blur/ focus events

61 views
Skip to first unread message

P.G.Taboada

unread,
Mar 20, 2012, 12:05:52 PM3/20/12
to google-we...@googlegroups.com
Hi,

I am running into the issue that I have a complex widget that I have built using lots of html and css. I went down from 10 widgets to one, performance is ok now. But now I need to capture the blur oand focus event of the input widget deep inside my hierarchy.

Yes I know, blur and focus events are not bubbled. What is the best hack to get them anyway?


Thomas Broyer

unread,
Mar 20, 2012, 12:42:22 PM3/20/12
to google-we...@googlegroups.com
Use DOM.sinkEvents and DOM.setEventListener on the child element on 'attach' of the widget (and make sure to set the EventListener back to 'null' on 'detach' or you'll have memory leaks on IE).

The only alternative I can think of would be to use JSNI to add handlers in the "capture" phase on the widget's root element; except for IE (at least 6/7, maybe 8) where you'd use the focusin and focusout events (still using JSNI, as addBitlessDomHandler doesn't work on IE, on-purpose)
Reply all
Reply to author
Forward
0 new messages