gpt4 book ai didi

javascript - Jade : New warning on multiple attributes

转载 作者:IT老高 更新时间:2023-10-28 22:59:51 27 4
gpt4 key购买 nike

我已将 Jade 更新到最新版本,并开始在控制台中看到此消息

你不应该有多个属性的 Jade 标签

它被称为功能,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

我在代码中看到了它。 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 属性,而是“属性”类型的标记。

例子:

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

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

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

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

关于javascript - Jade : New warning on multiple attributes,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19184755/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com