Open jaydenseric opened 8 years ago
button(disabled=#{true})
button(disabled=#{false})
These crash in Pug, too, as they are syntactially wrong. Interpolation is for strings
button(disabled="#{true}")
button(disabled="#{false}")
http://sandbox.jade.talesoft.codes/id-57ceaa51238bc.html
The stated behavior already works when using Jade without expressions.
a(disabled)
It behaves according to HTML standards http://sandbox.jade.talesoft.codes/id-57cea98756cf7.html http://sandbox.jade.talesoft.codes/id-57cea99a0b220.html http://sandbox.jade.talesoft.codes/id-57cea9a4d5c4f.html
It's controlled with the self_repeating_attributes
-option of the compiler (Array of attributes to enable self-repeating on (or rather, array boolean attributes))
What is missing is that this behavior also works on expression results.
What is in already is that
$disabled = false;
a(disabled=$disabled)
will completely omit the attribute
What is missing is that
$disabled = true;
a(disabled=$disabled)
will render <a disabled="disabled">
in XHTML-Mode and <a disabled>
in HTML5-mode.
I'll make a plan to implement this.
Thank your for pointing this out.
Is this issue resolved?
Hello @arunrreddy, it's more that this library isn't maintained actively anymore.
If you're looking for a stable and fresh implementation of Jade/Pug for PHP, I suggest you take a look at Phug. It's made by @kylekatarnls, which is the author of pug-php, and me :)
It seems Tale Jade does not render boolean attributes smart like Pug does.
Renders:
While:
Crashes.
And:
Both render:
Ideally, specifying
true
orfalse
would render:In my component mixins I am resorting to the rather verbose:
To render:
According to the HTML5 spec, boolean attributes should only ever be valueless or contain the exact attribute to indicate
true
, or contain an empty string or be omitted to indicatefalse
.