jQuery

The last few weekends have been pretty busy with respect to updates on this site. As a consequence, this is the first of several posts that I want to get out the door.

Wow, whoda thunk jQuery so easy! Well, a lot of people actually. I had always shied away from it, though, because it was JavaScript and in my mind JavaScript is bloat, introduces security vulnerabilities, and is ugly. I largely stand by these, but when I took a few minutes to look at jQuery, it seemed way too cool and powerful to not at least give it a shot and see what I could do. And, for what I’m doing, I think think the security implications are minimal.

It started when I was looking up some CSS on w3schools.com and noticed their jQuery tutorial. Probably just out of curiosity to see what kinds of things the tutorial walked through, I headed on over to it and was greeted by my good friends DOM lookup and CSS selector. I had no idea this is was jQuery was all about! Well, I probably did way back in the day, but back in the day I didn’t know how to really use CSS selectors. I had played around with, and got utterly frustrated with XPath years ago which probably led me astray.

So with this in hand I started to — like I do with every other cool new trick I learn — add it to my site.

First task: usability. At times I’ve felt like my site loaded too quickly. I would click on a link and the page would load so fast that I wouldn’t know the new page had loaded. To combat this usability edge case, I added a slight fade-in delay when the page loads.

Next up: content loading. I’ve long wanted to dynamically load content into a page. But since I moved from PHP solutions to a static site generator, I’ve resorted to cronjobs to download and insert new data. That’s not ideal and gets to be a pain to manage, though using git certainly helped lessen the pain. But with jQuery, I could now load in some data feeds as they changed on the filesystem.

Is the overhead associated with JavaScript, and more specifically the jQuery library, justifiable for such a small, simple site? Probably not, but it’s definitely worth knowing and learning, and that’s what this site and everything behind it is really about.

This is a personal website. Unless otherwise stated, the content and opinions expressed here are my own and not those of my employer.