Am 28.01.2013 22:45, schrieb Matej Nanut:


I found this in the Jade documentation, but can't get it to work here.


- if (autofocus)
   input(type="text", autofocus="#{autofocus ? "autofocus" : null}")

The autofocus element should disappear if autofocus == false, but it leaves it there with an empty

If this isn't implemented, how can I get optional attributes without exponentially blowing up if

Thanks, Matej

A similar way to do this has just been implemented in the latest version. If autofocus is a
boolean value then this should work:

input(type="text", autofocus=autofocus)

Arbitrary D-expressions are now supported for attribute values. It doesn't work inside of a string
interpolation or using a ternary operator, though, because of D's statically typed nature.