Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8563565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:59:18+00:00 2026-06-11T16:59:18+00:00

Following this question I have recently asked : Understanding Document.createElement() Here is the context

  • 0

Following this question I have recently asked : Understanding Document.createElement()

Here is the context :

  • There is a text-zone in my GWT GUI that holds a text
  • Users can select a word (or a sequence of words) in this text-zone and transform it / them into a highlighted text
  • highlighted texts need to be able to listen to users : click, right-click, dragging & dropping operations
  • A scenario with 1000 highlighted text in the text-zone is not impossible.

I was wondering :

  1. Is it a bad approach to manipulate DOM elements directly in GWT ? (Without using Widgets)
  2. Is it a bad approach to do things like that Add listener to SpanElement ? Can it cause memory leaks ?
  3. What is the best approach to achieve such things ? I’ve done some tests with a simple custom widget that uses a span element, and adding 1000 widgets to the RootPanel takes approximatively 6 to 10 seconds in DevMode. When I use DOM elements direclty, this operation duration goes under 1 second (even less than 200ms with optimizations).

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)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T16:59:19+00:00Added an answer on June 11, 2026 at 4:59 pm

    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/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was asked following question in interview recently: Let suppose you have, following grid
This question follows on from the questions here and here . I have recently
Following this question and answer , I still have a bit trouble in the
Following up this question , I have a further problem - I have two
Following on from this question...I'm trying to unit test the following scenario: I have
I have been following the answer of this question: How to update existing object
I have to really ask this question as I donot know Python. Following are
Follow up to this question . I have the following code: string[] names =
Simple question: I have the following markup... <a href='#'> <img src='icon.png'> This is the
Simple regex question. I have a string on the following format: this is a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.