Flyweight version of Element? Trying to implement find an element by CSS Selector

2010-06-24 Thread Paul Schwarz
In Mootools et al. it is really easy to select all elements in the DOM with a given attribute, such as CSS class. In Mootools this is var listOfDivsWithClassRED = $$(.RED) I have a need to select all the elements on a page with a given attribute and value and I'm trying to mimic Mootools

Re: Flyweight version of Element? Trying to implement find an element by CSS Selector

2010-06-24 Thread Chris Lercher
How about using GWTQuery? It's easy to use (very similar to your Mootols example), and it's highly optimized for speed (individually for different browser). http://code.google.com/p/gwtquery/ On Jun 24, 11:46 am, Paul Schwarz paulsschw...@gmail.com wrote: In Mootools et al. it is really easy to

Re: Flyweight version of Element? Trying to implement find an element by CSS Selector

2010-06-24 Thread Thomas Broyer
On 24 juin, 11:46, Paul Schwarz paulsschw...@gmail.com wrote: In Mootools et al. it is really easy to select all elements in the DOM with a given attribute, such as CSS class. In Mootools this is var listOfDivsWithClassRED = $$(.RED) I have a need to select all the elements on a page with a

Re: Flyweight version of Element? Trying to implement find an element by CSS Selector

2010-06-24 Thread Paul Schwarz
Thanks for your replies. @Thomas, I see now how they are of course raw DOM elements. I will try compile and run in a browser and measure the performance, it ought to be a lot quicker. I took a brief look at GWTQuery, it looks good, but seems to be an implementation of the entire jQuery library?

Re: Flyweight version of Element? Trying to implement find an element by CSS Selector

2010-06-24 Thread Chris Lercher
Don't worry about adding the entire GWTQuery library - the GWT compiler takes care of outputting only the code parts it needs from that library. This often means, that your code size will only increase by a few hundred bytes. On Jun 24, 12:47 pm, Paul Schwarz paulsschw...@gmail.com wrote:

Re: Flyweight version of Element? Trying to implement find an element by CSS Selector

2010-06-24 Thread Paul Schwarz
Got ya! Just testing the speed of the compiled version of my implementation now and then I'll move onto GWTQuery in a few minutes. On Jun 24, 1:54 pm, Chris Lercher cl_for_mail...@gmx.net wrote: Don't worry about adding the entire GWTQuery library - the GWT compiler takes care of outputting

Re: Flyweight version of Element? Trying to implement find an element by CSS Selector

2010-06-24 Thread Paul Schwarz
Oh I'm such a tool! There I was trying to shave 5500ms down to 3000ms and down even further... I compiled into javascript and tested in Chrome and my execution times hover anywhere between 0ms and 2ms!!! High 5's all around! But getting back to GWTQuery, it looks interesting, but now that I've

Re: Flyweight version of Element? Trying to implement find an element by CSS Selector

2010-06-24 Thread Chris Lercher
On Jun 24, 1:08 pm, Paul Schwarz paulsschw...@gmail.com wrote: But getting back to GWTQuery, it looks interesting, but now that I've solved my Element selector woes why else should I delve into GWTQuery? No need to do that, but GWTQuery provides the easy selector syntax you mentioned in your

Re: Flyweight version of Element? Trying to implement find an element by CSS Selector

2010-06-24 Thread Paul Schwarz
Thanks very much for that info, I'm sure it will come in handy any day now. For the moment I have kept aside my home-made selector system in favour of simply keeping an ArrayList of element IDs. I know the IDs of the elements I'm creating because as I create the elements I am giving them and ID