{"id":434,"date":"2013-03-26T16:18:08","date_gmt":"2013-03-26T16:18:08","guid":{"rendered":"http:\/\/www.muratyaman.co.uk\/wp\/?p=434"},"modified":"2020-04-01T12:37:05","modified_gmt":"2020-04-01T11:37:05","slug":"javascript-framework-hell","status":"publish","type":"post","link":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/2013\/03\/javascript-framework-hell\/","title":{"rendered":"JavaScript Framework Hell"},"content":{"rendered":"<p>Any framework that improves the programming language is welcome by me.<br \/>\ne.g. <a href=\"http:\/\/sugarjs.com\/\" title=\"SugarJs\">SugarJs<\/a> has been programmed with this in mind: I love it!<\/p>\n<p>And any framework that isolates programmer from the language must be avoided at all costs!<br \/>\ne.g. <a href=\"http:\/\/jquery.com\/\" title=\"jQuery\">jQuery<\/a> is a Texas chainsaw!<\/p>\n<pre lang=\"html\">\r\n\r\n<form id=\"frm1\">\r\n    <label for=\"input1\">Input<\/label>\r\n    <input id=\"input1\" name=\"input1\" type=\"text\" value=\"1\" \/>\r\n    <button type=\"button\" id=\"btn1\">Submit jQuery<\/button>\r\n    <button type=\"button\" id=\"btn2\">Submit Native<\/button>\r\n<\/form>\r\n\r\nfunction frm1_onSubmit (_event)\r\n{\r\n    console.log('frm1_onSubmit');\r\n    \/\/do something\r\n    return false;\/\/prevent event propagation\r\n}\r\n\r\nfunction btn1_onClick (_event)\r\n{\r\n    console.log('btn1_onClick');\r\n    $('form#frm1').submit();\r\n}\r\n\r\nfunction btn2_onClick (_event)\r\n{\r\n    console.log('btn2_onClick');\r\n    this.form.submit();\/\/does not trigger 'frm1_onSubmit'\r\n}\r\n\r\n$(function(){\r\n    console.log('attaching events..');\r\n    var frm1 = $('form#frm1');\r\n    frm1.submit(frm1_onSubmit);\/\/add event listener\r\n    frm1.find('button#btn1').click(btn1_onClick);\r\n    frm1.find('button#btn2').click(btn2_onClick);\r\n});\r\n\r\n<\/pre>\n<p>You can check it on <a href=\"http:\/\/jsfiddle.net\/M7Vbv\/3\/\" title=\"jsFiddle\">jsFiddle<\/a>.<\/p>\n<p>Beware, it is a dangerous (programming) world out there!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Any framework that improves the programming language is welcome by me.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[93,94],"class_list":["post-434","post","type-post","status-publish","format-standard","hentry","category-technology","tag-javascript","tag-jquery"],"_links":{"self":[{"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/posts\/434","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=434"}],"version-history":[{"count":4,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/posts\/434\/revisions"}],"predecessor-version":[{"id":948,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/posts\/434\/revisions\/948"}],"wp:attachment":[{"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=434"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=434"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=434"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}