Wednesday, March 26, 2014

Re: Inline style vs class for cell renderer

Performance difference would be too small to justify one over the other. 
The better question is to ask what is more maintainable? 

If this is a unique style specifically for this cell and you won't use it anywhere else than inline style should be just fine. 
If that's a common style which is used in multiple places (cells, etc) than putting it into a CSSResource and assigning a class to the div might be a better approach. 

 


On Tuesday, March 25, 2014 4:00:41 PM UTC+1, Steve C wrote:
I'm wondering if anyone has done any efficiency testing on using inline styles vs class in cell renderers.  Right now I'm using a template with two methods:

      @Template("<div style='text-align:right'>{0}</div>")
      public SafeHtml valid(String value);

      @Template("<div style='text-align:right' class='{1}'>{0}</div>")
      public SafeHtml invalid(String value, String invalidStyle);

I used an inline style for the text-alignment, but it occurred to me that I could use a class for that instead if it would be rendered more efficiently by the browser. Has anyone tried comparing the two approaches?


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment