Using multiple class names

76 views
Skip to first unread message

Fatih ACET

unread,
Oct 10, 2012, 4:05:35 AM10/10/12
to closure-style...@googlegroups.com
For some reason, I cannot use multiple class names such as <div class="icon user">

I am tried goog.getCssName('icon user') but it returned icon-a also goog.getCssName('icon', 'user') returned a-b, as expected.

How can I use multiple class names?

Thanks in advance.

Fatih..

Johannes Nel

unread,
Oct 10, 2012, 4:08:48 AM10/10/12
to closure-style...@googlegroups.com
well in the template you should.
<div class="{css icon} {css user}">
other than that I am not quite sure what you are trying to do.
--
j:pn
\\no comment

Fatih ACET

unread,
Oct 10, 2012, 4:18:20 AM10/10/12
to closure-style...@googlegroups.com
Thanks for your quick reply.

I forgot mention in my question but as you can see in my code snippet I'm not using Closure Templates I'm using Closure Compiler's goog.getCssName method.

Johannes Nel

unread,
Oct 10, 2012, 4:19:04 AM10/10/12
to closure-style...@googlegroups.com
ok, so how are you planning on renaming the css names in your html?

Fatih ACET

unread,
Oct 10, 2012, 4:25:41 AM10/10/12
to closure-style...@googlegroups.com
Ok, you give me the idea and it works. Sometimes need to think more simple.

I just worked goog.getCssName('icon') + ' ' + goog.getCssName('user')

By the way, my application is JavaScript driven one page application. I'm using hash routing and all layout and view is rendered by JavaScript. I have my own template engine solution so I don't need to use Closure Templates. My HTML markups are JavaScript method that returns a string.

Johannes Nel

unread,
Oct 10, 2012, 4:28:59 AM10/10/12
to closure-style...@googlegroups.com
I'll say this for closure templates, it works, well, extremely well and if you are using the rest of the system I will REALLY recommend using that as well.

Fatih ACET

unread,
Oct 10, 2012, 4:34:39 AM10/10/12
to closure-style...@googlegroups.com
Yes you're totally right. I tried Closure Templates and it seems pretty fast and flexible also avoids possible XSS vulnerabilities. It would be better to consider your advice. But I have to make heavy refactoring. Damn!

Thanks.

Johannes Nel

unread,
Oct 10, 2012, 4:39:17 AM10/10/12
to closure-style...@googlegroups.com
you also miss pre-rendering on the server. the decoration phase of the component livecycle is not there for nothing!

fatihacet

unread,
Oct 10, 2012, 9:28:36 AM10/10/12
to closure-style...@googlegroups.com
I cannot understand you clearly. If you talk about using same template files in backend code, we're not using Java so it is out of my concern. Otherwise, I cannot get you.

Johannes Nel

unread,
Oct 10, 2012, 9:29:43 AM10/10/12
to closure-style...@googlegroups.com
yes i mean that the templates can be used in the back end as well. You don't need java, just the jvm, but if you don't use that, no worries.
Reply all
Reply to author
Forward
0 new messages