Cool, nope I've not noticed any performance issues - I'm in the middle of writing an app (for my employer) that will be shipped as part of a enterprise b2b product at the moment there is about 8 separate stylesheets that are being injected - will probably be at least 10 when finished so any performance issues will become apparent as the dev progresses.
Cheers, Dave On Jan 9, 12:28 pm, Sebastian Beigel <[email protected]> wrote: > Replacing > > globalResources.fooCss().ensureInjected(); > > with > > StyleInjector.inject(globalResources.fooCss().getText(), true); > > solves the problem as well! Thanks Dave. > > In the meanwhile, I wrapped my onModuleLoad code in a > DeferredCommand() (mainly for an UncaughtExceptionHandler) and removed > the DeferredCommand wrap in Widget#onLoad (as described in my previous > post). That also works. > > Anyway, I use both modifications, deferring the onModuleLoad (mainly > for the logger) and ensuring immediate CSS injection -- explicit is > better than implicit :) Or do you see any (performance) issues with > this approach? > > Sebastian > > On Sat, Jan 9, 2010 at 1:25 AM, DaveC > > > > > > <[email protected]> wrote: > > Have you tried StyleInjector.inject(cssText, true) ...? > > > " the DOM will be updated immediately instead of just before returning > > to the event loop. Using this option excessively will decrease > > performance, especially if used with an inject-css-on-init coding > > pattern" > > > I had a similar problem using the gwt-fx library (which parses the > > stylesheets in the DOM looking for selectors I passed in) the styles > > weren't injected in time. > > > Cheers, > > Dave > > > On Jan 8, 4:39 pm, Sebastian Beigel <[email protected]> wrote: > >> I found a "work around", I wrapped the positioning code in my onLoad() > >> method in a DeferredCommand and it works. Is this the preferred > >> solution for this "problem"? > > >> Sebastian > > >> On Fri, Jan 8, 2010 at 4:38 PM, Sebastian Beigel <[email protected]> > >> wrote: > >> > Hi, > > >> > I tried to follow the best practices and moved my static CSS files > >> > from style-tags in the HTML-page to CssResources in a ClientBundle > >> > declared in my EntryPoint and injected in a static initializer. > > >> > Unfortunately, this doesn't work for me because I do some element > >> > positioning in an onLoad-method of a Widget (which is contained in the > >> > UIBinder template of my EntryPoint). The calculations of the > >> > (relative) positions are wrong and I found out that the injected CSS > >> > rules are not evaluated until my positioning code runs. > >> > Profiling the generated JS code shows the following timing: > > >> > - entering onModuleLoad > >> > - entering Widget#onLoad > >> > - leaving onLoad > >> > - leading onModuleLoad > >> > - injecting CSS > > >> > Tested in Webkit and Firefox 3.5 on a Mac with Snow Leopard. > > >> > If I defer the positioning (by triggering it manually via a Button > >> > click in the UI) everything works as expected. > > >> > Is this a bug? Is there a work-around? I really don't want to move my > >> > CSS back to static files and lose all the great advantages from using > >> > ClientBundles. But I need my CSS rules parsed and evaluated *before* > >> > my code runs. > > >> > Thank you, > >> > Sebastian > > >> -- > >> Sebastian Beigelhttp://beigel.de/sebastian > > > -- > > You received this message because you are subscribed to the Google Groups > > "Google Web Toolkit" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group > > athttp://groups.google.com/group/google-web-toolkit?hl=en. > > -- > Sebastian Beigelhttp://beigel.de/sebastian
-- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
