我是使用 Jade 的新手——到目前为止它很棒。
但是我需要发生的一件事是具有“itemscope”属性的元素:
<header itemscope itemtype="http://schema.org/WPHeader">
我的 Jade 符是:
header(itemscope, itemtype='http://schema.org/WPHeader')
但结果是:
<header itemscope="itemscope" itemtype="http://schema.org/WPHeader">
我怎样才能确保得到正确的结果 --
itemscope
而不是 itemscope="itemscope"
?
最佳答案
我刚刚在 Express.js/Jade 项目中尝试过,得到的结果是:
<header itemscope itemtype="http://schema.org/WPHeader"></header>
我也在 bash 中尝试过,然后得到和你一样的结果。
我会采用以下建议或在 Github 上创建问题。
itemscope="itemscope" will work just as well as just itemscope. It looks like that's the default behavior of Jade. I'd just go with it.
关于attributes - Jade : element attributes without value,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11020142/