jade icon indicating copy to clipboard operation
jade copied to clipboard

`required=true` doesn't render properly

Open codewinch opened this issue 2 years ago • 0 comments

First, this is awesome, thank you for a great library!

Boolean attribute "mirroring" currently works correctly for the "long form"; that is, input(type='checkbox' checked) works fine (see also #23).

For example, input(required=true) renders as required="required", as expected for non-HTML doctypes.

However, the "short form" doesn't work; "if the doctype is html, pug knows not to mirror the attribute". (https://pugjs.org/language/attributes.html#boolean-attributes)

These fail with "function foo not defined":

    input(required)
    input(type='checkbox' checked)

They should be rendered as:

    <input required>
    <input type="checkbox" checked>

Oddly enough, input(checked) results in the mirrored input checked="checked", but breaks once type='checkbox' is added per the example on the above pugjs page.

codewinch avatar May 10 '22 15:05 codewinch