bsr bsr - 2 years ago 358
Node.js Question

Jade : New warning on multiple attributes

I have updated jade to latest version, and started seeing this message in console

You should not have jade tags with multiple attributes

It is mentioned as feature, here

0.33.0 / 2013-07-12
Hugely more powerful error reporting (especially with compileDebug set explicitly to true)
Add a warning for tags with multiple attributes

and I see it in the code.

But, what does it really signify. When will I get this warning. For example, when will I get error based on the below code (It works without warning, but to like to know when will I get error so that I can compare with my code)

mixin link(href, name)
a(class=attributes.class, href=href)= name
a(href=href, attributes)= name

+link('/foo', 'foo')(class="btn")

Answer Source

Multiple "attributes" doesn't mean what you probably think it means. It's not an HTML attribute as we know it, but a token of type "attribute".



Note how I have two attribute sections, each with one attribute.

Better put them in one attribute section:

a(href="#WAT", title="WAT").some-class
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download