Jade:多重属性的新警告

我已经更新玉到最新版本,并开始在控制台中看到这个消息

You should not have jade tags with multiple attributes

在这里被称为特征

 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 

我在代码中看到它。 https://github.com/visionmedia/jade/blob/a38aa552f6f53554ac5605299b6b8c7e07cbdf1f/lib/parser.js#L662

但是,这真的意味着什么? 我什么时候会得到这个警告。 例如,什么时候我会根据下面的代码得到错误(它没有警告,但是想知道什么时候会出错,以便我可以和我的代码进行比较)

 mixin link(href, name) a(class=attributes.class, href=href)= name a(href=href, attributes)= name +link('/foo', 'foo')(class="btn") 

多个“属性”并不意味着你可能认为的意思。 这不是我们所知的HTML属性,而是一个“属性”types的标记。

例:

 a(href="#WAT").some-class(title="WAT") 

请注意我有两个属性部分,每个部分都有一个属性。

最好把它们放在一个属性部分:

 a(href="#WAT", title="WAT").some-class 

(我发现这个问题通过谷歌这个警告作为第一个结果之一,因为我想摆脱它…)

上面所接受的答案在下面的例子中没有帮助我,但是它显示了如何在不失去属性function的情况下摆脱这个警告(它不能提供这样解释的原因 ):

 // using mixins similar to +link(param1,param2) above where 'data' and 'class' // below are not named mixin params // OK (without a warning): +link("foo", data="true")(class="bar") // WARNING is shown: +link("foo")(class="bar")(data="true") // ERROR on compiling: +link("foo", class="bar", data="true") 

(对于下面的评论中显示的那么多的误解,我感到抱歉,并希望我的最后一次编辑澄清这是一个有效的,虽然稍微更一般的回答/帮助docpad警告)