Pages

Saturday, April 26, 2014

JavaScript and Knockout are not Synonymous and Data- Abuse

Example: What is the difference?


Knockout's click:
<button data-bind="click: resetTicket">Clear</button>


Old-Style DOM onclick:
<input type="button" onclick="resetTicket" />


Knockout polluting the Html DOM.


Within the UI window, a lot of support had been placed toward Separation of Concerns. Separating styling and behavior from the DOM. Moving CSS and JavaScript into distinct external files. Moving JavaScript's onclick handler from being DOM inline to being placed into an external JavaScript file.

Surprising, Knockout is gaining big following, but, Knockout has moved JavaScript behavior back into the DOM and they are abusing the data- attribute.


Knockout isn’t the only JavaScript library polluting the DOM. There are many libraries and frameworks polluting a page's DOM and abusing the data- attribute.


I can think one possible reason why Knockout and other libraries are becoming popular, because there still exist a hatred toward JavaScript, however “developers” want non-spaghetti JavaScript code, yet they do not want to fully learn JavaScript.


I don't know if I'm the only one concerned? I believe in time, there will be a movement advocating less corruption of data- attributes and a support for removing this behavior from the DOM.


I don't support KnockoutJS and it is funny, the last job I interviewed for asked if I knew JavaScript. However what they were really asking, if I knew KnockoutJS.


Support Native JavaScript.
This post is for the purpose of my notes only. 
“I invented nothing new. I simply assembled the discoveries of other men behind whom were centuries of work. Had I worked fifty or ten or even five years before, I would have failed. So it is with every new thing. Progress happens when all the factors that make for it are ready and then it is inevitable. To teach that a comparatively few men are responsible for the greatest forward steps of mankind is the worst sort of nonsense.”
Henry Ford

No comments:

Post a Comment