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

Null "value" gets rendered #18

Closed
jrvidal opened this issue Jun 17, 2015 · 3 comments
Closed

Null "value" gets rendered #18

jrvidal opened this issue Jun 17, 2015 · 3 comments

Comments

@jrvidal
Copy link

jrvidal commented Jun 17, 2015

Example:

var m = require("mithril"),
    render = require("mithril-node-render"),

    html = render(
        m("input[type=text]", {
            value: null
        })
    );

console.log(html); // <input type="text" value="null">

This is inconsistent with DOM rendering, where null values are equivalent to the empty string.

@StephanHoyer
Copy link
Member

hi @jrvidal,

Thanks for reporting. This is an easy fix.

Do you want to create a PR for this?

regards
Stephan

@jrvidal
Copy link
Author

jrvidal commented Jun 17, 2015

Sure. I didn't do it right away because I'm not sure about the scope of the change. Can you think of any other attributes that would interpret null as "don't render"?

@StephanHoyer
Copy link
Member

I think all attributes should not be rendered if attribute is null.

Refer to the way mithril renders this.

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

2 participants