Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

required=true doesn't render properly #45

Open
codewinch opened this issue May 10, 2022 · 0 comments
Open

required=true doesn't render properly #45

codewinch opened this issue May 10, 2022 · 0 comments

Comments

@codewinch
Copy link

codewinch commented May 10, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant