Skip to content

required=true doesn't render properly #45

@codewinch

Description

@codewinch

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions