This post is the first in an ongoing series about things I learned from my recent Winamp2-js project.
As I was working on Winamp2-js, using jQuery, I realized that I was only using jQuery for a few very simple things: selecting DOM elements and performing simple CSS manipulation. As an exercise I decided to try removing it.
To my surprise, the process was painless. Selecting DOM elements with
document.getElementById() was actually perfect for this project, and
modifying element’s classes via
element.classList felt logical and clean.
The resulting code not only loaded faster, since it didn’t need to load jQuery, but it was more explicit and was simpler to work on. By removing a layer of abstraction, I was able to make my code feel more taut. I trusted it better, because I could see everything it was doing.