{"action":"created","issue":{"url":"https://api.github.com/repos/lhorie/mithril.js/issues/910","labels_url":"https://api.github.com/repos/lhorie/mithril.js/issues/910/labels{/name}","comments_url":"https://api.github.com/repos/lhorie/mithril.js/issues/910/comments","events_url":"https://api.github.com/repos/lhorie/mithril.js/issues/910/events","html_url":"https://github.com/lhorie/mithril.js/issues/910","id":123261520,"number":910,"title":"How does events handler works ?","user":{"login":"accessibleweb","id":2615311,"avatar_url":"https://avatars.githubusercontent.com/u/2615311?v=3","gravatar_id":"","url":"https://api.github.com/users/accessibleweb","html_url":"https://github.com/accessibleweb","followers_url":"https://api.github.com/users/accessibleweb/followers","following_url":"https://api.github.com/users/accessibleweb/following{/other_user}","gists_url":"https://api.github.com/users/accessibleweb/gists{/gist_id}","starred_url":"https://api.github.com/users/accessibleweb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/accessibleweb/subscriptions","organizations_url":"https://api.github.com/users/accessibleweb/orgs","repos_url":"https://api.github.com/users/accessibleweb/repos","events_url":"https://api.github.com/users/accessibleweb/events{/privacy}","received_events_url":"https://api.github.com/users/accessibleweb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-12-21T11:38:22Z","updated_at":"2015-12-21T13:05:02Z","closed_at":null,"body":"Hi,\r\n\r\n...\r\nm.component(App,\r\n[m.component(Header),\r\nm.component(Content,...), ...]);\r\n...\r\n\r\nIf i add an event handler on one of theses view for exemple onclick.\r\nThe views function (for exemple Header) will be executed in order to do the diff strategy.\r\nI tried to put strategy none but nothing it do it again.\r\nHow can i prevent it ?\r\nThanks\r\n"},"comment":{"url":"https://api.github.com/repos/lhorie/mithril.js/issues/comments/166299673","html_url":"https://github.com/lhorie/mithril.js/issues/910#issuecomment-166299673","issue_url":"https://api.github.com/repos/lhorie/mithril.js/issues/910","id":166299673,"user":{"login":"accessibleweb","id":2615311,"avatar_url":"https://avatars.githubusercontent.com/u/2615311?v=3","gravatar_id":"","url":"https://api.github.com/users/accessibleweb","html_url":"https://github.com/accessibleweb","followers_url":"https://api.github.com/users/accessibleweb/followers","following_url":"https://api.github.com/users/accessibleweb/following{/other_user}","gists_url":"https://api.github.com/users/accessibleweb/gists{/gist_id}","starred_url":"https://api.github.com/users/accessibleweb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/accessibleweb/subscriptions","organizations_url":"https://api.github.com/users/accessibleweb/orgs","repos_url":"https://api.github.com/users/accessibleweb/repos","events_url":"https://api.github.com/users/accessibleweb/events{/privacy}","received_events_url":"https://api.github.com/users/accessibleweb/received_events","type":"User","site_admin":false},"created_at":"2015-12-21T13:05:02Z","updated_at":"2015-12-21T13:05:02Z","body":"Finaly it does not what i would like.\r\nThe commend inside code.\r\n\r\n\r\n```\r\n'use strict';\r\n\r\nmodule.exports = function (ctrl, args) {\r\n\r\n    // How to prevent it ?\r\n\r\n    console.log('Header :: view');\r\n\r\n    return m('.app-header', {\r\n        onclick: args.onclick || function (e) {\r\n            window.history.back();\r\n        }\r\n    }, ctrl.title());\r\n};\r\n```\r\n\r\n```\r\n'use strict';\r\n\r\nmodule.exports = function (ctrl, args) {\r\n\r\n    var Header, Popin;\r\n\r\n    Header = require('../Header/index.js');\r\n    Popin  = require('../Popin/index.js');\r\n\r\n    return m('.page.page-settings-screensaver', [\r\n        m.component(Header, {title: 'TITLE'}),\r\n        m('.content', m('.content-inner', [\r\n            m('section', [\r\n                m('.app-title', 'TITLE'),\r\n                m('.field.text', m('input', {\r\n                    oninput:m.withAttr(\"value\", ctrl.screensaverTimeout), value: ctrl.screensaverTimeout(),\r\n                    type: 'text',\r\n                    required: true,\r\n                    placeholder: '0',\r\n                    pattern: '[0-9]+'\r\n                }))\r\n            ]),\r\n            m('section',\r\n                m('.app-title', 'TITLE'),\r\n                m('.field.radio.no-margin', m('ul', ctrl.screensavers().map(function (screensaver) {\r\n                    return m('li' + (ctrl.currentId() === screensaver ? '.on' : ''),\r\n                        {\r\n                            onclick: function () {\r\n                                \r\n                                // Prevent diff and redraw of the application but just redraw the part depending on the currenId (.on class)\r\n\r\n                                m.redraw.strategy('none');\r\n                                \r\n                              ctrl.currentId(screensaver);\r\n                            }\r\n                        }\r\n                        , screensaver.split('-')[1])\r\n                })))),\r\n            m('section', m('.app-align-center', [\r\n                m('.app-btn.btn-disable', 'BTN'),\r\n                m('.app-btn.btn-save', 'BTN')\r\n            ])),\r\n            ctrl.isInError() ? m('.overlay') : null,\r\n            ctrl.isInError() ? m.component(Popin) : null\r\n        ]))\r\n    ]);\r\n\r\n};\r\n```"}}