Mithril.js: How to set body class?

Created on 2 Dec 2017  路  4Comments  路  Source: MithrilJS/mithril.js

<body class="page1">

Question

All 4 comments

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.

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

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

this ok!

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

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

oncreate: function() {
    document.body.classList.add("layout-auth")
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

tivac picture tivac  路  3Comments

simov picture simov  路  4Comments

mke21 picture mke21  路  3Comments

josephys picture josephys  路  4Comments

barneycarroll picture barneycarroll  路  3Comments