Following this question I have recently asked : Understanding Document.createElement()
Here is the context :
highlighted text
highlighted texts
need to be able to listen to users : click, right-click, dragging & dropping operationshighlighted text
in the text-zone is not impossible.I was wondering :
EDIT
Performance should not be a problem, according to some real tests I did after @Gilberto advices. http://jmichelgarciagwt.appspot.com/DOMTesting.html
Still, I would love to have feedbacks for questions 1) and 2)
Adding listeners/handlers to hundreds of span elements/widgets is definitely a bad approach.
If you stay with GWT, you can attach a single event handler to your "text zone" widget, and then find which element has been the source of the click: http://comments.gmane.org/gmane.org.google.gwt/61911
If you go with DOM elements, you can attach a single event listener to your "text zone" element and find out the event source when it bubbles to it. For example: http://icant.co.uk/sandbox/eventdelegation/