{"action":"created","issue":{"url":"https://api.github.com/repos/krasimir/absurd/issues/113","labels_url":"https://api.github.com/repos/krasimir/absurd/issues/113/labels{/name}","comments_url":"https://api.github.com/repos/krasimir/absurd/issues/113/comments","events_url":"https://api.github.com/repos/krasimir/absurd/issues/113/events","html_url":"https://github.com/krasimir/absurd/issues/113","id":63960890,"number":113,"title":"Event Handling","user":{"login":"anywhichway","id":4958795,"avatar_url":"https://avatars.githubusercontent.com/u/4958795?v=3","gravatar_id":"","url":"https://api.github.com/users/anywhichway","html_url":"https://github.com/anywhichway","followers_url":"https://api.github.com/users/anywhichway/followers","following_url":"https://api.github.com/users/anywhichway/following{/other_user}","gists_url":"https://api.github.com/users/anywhichway/gists{/gist_id}","starred_url":"https://api.github.com/users/anywhichway/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anywhichway/subscriptions","organizations_url":"https://api.github.com/users/anywhichway/orgs","repos_url":"https://api.github.com/users/anywhichway/repos","events_url":"https://api.github.com/users/anywhichway/events{/privacy}","received_events_url":"https://api.github.com/users/anywhichway/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-03-24T10:24:17Z","updated_at":"2015-03-28T13:56:57Z","closed_at":null,"body":"First, EXCELLENT WORK. I had taken to writing my own preprocessor and then someone pointed me to AbsurdJS. I subsequently found the article http://code.tutsplus.com/tutorials/absurdjs-or-why-i-wrote-my-own-css-preprocessor--net-36003. All my reasons were the same.\r\n\r\nThe only thing that puzzles me about AbsurdJS at the moment is what I see as an un-necessarily complex event handling. Why not just use the names of events like any other selector, e.g.\r\n\r\n````\r\n{p: { onclick: function() { alert('paragraph clicked') } } }\r\n````\r\n\r\nor\r\n\r\n````\r\n{clickResponder { onclick: function() { alert('paragraph clicked') } } }\r\n<div class=\"click-responder\"></div>\r\n````\r\n\r\nwhich the prepocessor would morph into:\r\n\r\n````\r\n<div class=\"click-responder\" onclick=refToCompiledFunction></div>\r\n````\r\n\r\nYou can see the start of my work at https://github.com/anywhichway/csxjs for more detail on the above. I will most likely abandon this now in favor of AbsurdJS.\r\n\r\nAlso, have you looked at JSON5? You might consider a fork and modififications to help clean-up the JSON key quoting problem that makes things a little messy at times.\r\n"},"comment":{"url":"https://api.github.com/repos/krasimir/absurd/issues/comments/87232353","html_url":"https://github.com/krasimir/absurd/issues/113#issuecomment-87232353","issue_url":"https://api.github.com/repos/krasimir/absurd/issues/113","id":87232353,"user":{"login":"krasimir","id":528677,"avatar_url":"https://avatars.githubusercontent.com/u/528677?v=3","gravatar_id":"","url":"https://api.github.com/users/krasimir","html_url":"https://github.com/krasimir","followers_url":"https://api.github.com/users/krasimir/followers","following_url":"https://api.github.com/users/krasimir/following{/other_user}","gists_url":"https://api.github.com/users/krasimir/gists{/gist_id}","starred_url":"https://api.github.com/users/krasimir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krasimir/subscriptions","organizations_url":"https://api.github.com/users/krasimir/orgs","repos_url":"https://api.github.com/users/krasimir/repos","events_url":"https://api.github.com/users/krasimir/events{/privacy}","received_events_url":"https://api.github.com/users/krasimir/received_events","type":"User","site_admin":false},"created_at":"2015-03-28T13:56:56Z","updated_at":"2015-03-28T13:56:56Z","body":"Hi @anywhichway \r\n\r\na new version of the library is released - `0.3.4`. I checked the code that we have now and I could say that passing a anonymous function into the HTML template of the component is really difficult to handle. Mainly because the components and the HTML compilation are completely separated processes. Here is what I came up with:\r\n```js\r\nconsole.clear();\r\nvar absurd = Absurd();\r\nabsurd.component('MyComp', {\r\n    showText: function(e, str) {\r\n      console.log(str);\r\n    },\r\n    html: {\r\n      input: {\r\n        $click: 'showText:clicked',\r\n        $keyup: 'showText:keyuppped'\r\n      }\r\n    },\r\n    ready: function(dom) {\r\n        this\r\n        // saying where the element\r\n        // will be attached\r\n        .set('parent', dom('body').el) \r\n        // compiling the css and html\r\n        .populate();\r\n    }\r\n})();\r\n```\r\nThe trick is to define the event with `$` in front. Otherwise it is processed as child node.\r\nHere is a jsfiddle to play with:\r\nhttp://jsbin.com/zudamumuta/1/edit?js,console,output\r\n\r\nLet me know what you think ;)\r\n\r\nP.S.\r\nThe files on the main site are updated too."}}