Category Archives: JavaScript
Trash that “Back to Top” Link
It would seem that perfection is attained not when no more can be added, but when no more can be removed.
- Antoine de Saint Exupéry
While most would argue that the principles espoused in the above quote might also be applied to the quote itself, it would serve us better to consider how we can attempt [...]
Quick Performance Tip: jQuery and addClass
Abstractions are helpful and dangerous. But the more we know about a library’s internals, the less danger we’ll be in later. Here’s an issue I ran into where I had assumed that jQuery would be optimized for this case, but it wasn’t. I’ll go over my bad assumption and how to workaround [...]
Performance Caveat with jQuery Selectors and Live Events
Prerequisite: Knowledge/Experience with jQuery Live Events (new in jQuery 1.3), and the concept of Event Delegation.
When developing on the front end, it’s easy to prioritize correctness over performance. Performance is the step child that gets lost while you’re pulling your hair out worrying about cross browser compatibility. It’s very important to regularly benchmark [...]
Scare Your Visitors with this JavaScript Gravatar Plugin
Here's a use case. An unregistered visitor visits your blog, and decides that your content is so good that it merits a comment! Congratulations, you've fooled them! But since they're leaving a comment, why not show them a preview of their gravatar?
DOMContentLoaded Inconsistencies (in Browsers and JavaScript Libraries)
We all know the problem, but we may not all call it the same thing: DOMContentLoaded. Every popular JavaScript library has its own name for the DOMContentLoaded event, and they're all implemented differently. This, of course, partly due to the fact that web browsers are also inconsistent in their implementations. Here's a run-down of those inconsistencies.
Emulating onhashchange without setInterval
There is one limitation that all of the major JavaScript browser history management plugins have to hack around: How to tell when there is a change to the location.hash? Sure, you can tell when you’re modifying the hash yourself, but what if the user hits the back/forward button?
YUI’s History component and Really Simple [...]
Selecting XML Nodes with JavaScript (Peril of getElementsByTagName)
Parsing XML in the browser can be a tricky beast. There are many different wrong ways to do it, which can leave you cold and naked in a snowstorm if you're not careful. So, let's put on the metaphorical electric one-sie of standards based code and let the power of Edison heat our JavaScript code like the innards of a tauntaun.

Subscribe
Follow
Internet Explorer Array.sort Unreliable