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

How to set body class? #2044

Closed
millken opened this issue Dec 2, 2017 · 4 comments
Closed

How to set body class? #2044

millken opened this issue Dec 2, 2017 · 4 comments
Labels
Type: Question For issues that are purely questions about Mithril, not necessarily bug reports or suggestions

Comments

@millken
Copy link

millken commented Dec 2, 2017

<body class="page1">

@dead-claudia
Copy link
Member

Is there a reason body.classList.add("page1"); m.redraw() wouldn't work?

Note that you can't modify attributes on the node you're rendering to via Mithril alone.

@dead-claudia dead-claudia added the Type: Question For issues that are purely questions about Mithril, not necessarily bug reports or suggestions label Dec 2, 2017
@StephanHoyer
Copy link
Member

StephanHoyer commented Dec 2, 2017

m.redraw() is not even required.
see this

You also may come to the gitter-chat if you have any further questions.

@millken
Copy link
Author

millken commented Dec 2, 2017

this ok!

    view: function() {
        document.body.classList.add("layout-auth");
        return ....

@dead-claudia
Copy link
Member

@millken Try in oncreate/onupdate instead, to save yourself a lot of rendering perf:

oncreate: function() {
    document.body.classList.add("layout-auth")
}

@millken millken closed this as completed Dec 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Question For issues that are purely questions about Mithril, not necessarily bug reports or suggestions
Projects
None yet
Development

No branches or pull requests

3 participants