Category Archives: Do This, Not That

Getting A Class From a DOM Element

Lately, if I am searching for a way to do something in Javascript the only results I am getting ways of doing the procedure using jQuery. While, its true jQuery is pretty much the de facto standard for writing JavaScript anymore, understanding the underlying technology is a must. As well as alot of times, I [...]
Posted in Do This, Not That, JavaScript | Tagged as: , | Leave a comment

Patterns for enforcing “new”

Recently I was looking around for a book on JavaScript Patterns. I decided to give the JavaScript Patterns by Stoyan Stefanov a try. If you have been looking for a book on Javascript Patterns, I highly recommend this book. In the 3rd chapter, Literals and Constructors, I noticed this section on "Patterns for enforcing new" [...]
Posted in Do This, Not That, JavaScript | Tagged as: , | Leave a comment

$(“#ID”) is fast enough

We all know that the fastest selector to use is the ID. Something like $("#id") is better than using a class. However, after looking at the last test we did on The Great Assumption - JavaScript I noticed a large discrepancy in $("#ID") versus the native document.getElementById(). Now, I always assumed it was slower, but [...]
Posted in Do This, Not That, jQuery, Performance | Tagged as: , | 6 Comments

The Great Assumption – Javascript

A couple of weeks ago I was sitting down with a Google Frontend Engineer friend of mine, talking about some of the JavaScript best practices we all have come to know and abide by. I found myself in agreement with 90% of everything we were talking about. However, something kept eating at me. Why do [...]
Posted in Do This, Not That, jQuery, Performance | Tagged as: , | Leave a comment