You may have come across some scripts out in the wild that have different versions available for a few libraries and wondered how it’s done – surely the author didn’t write the same script 5 times, how on Earth would he remember to roll out the bug fixes across all the versions? You may also […]
Author Archives: Skateside
Simple CSS Transitions
One of my coding heros, Christian Heilmann, recently wrote a new article on Smashing Magazine. The article is a pretty good tutorial for event-driven JavaScript. However, in true-to-myself fashion, I have completely missed the point of that article and noticed one minor thing that Chris did that I think is incredibly cool. Check out his […]
A quick review of SMACSS
If you haven’t heard of this yet, SMACSS stands for Scalable and Modular Architecture for CSS. There have been a lot of people saying a great many positive things about it and I’d just like to add my voice to that crowd with this short review of the book. The printed version of the book […]
My shim was not to standards
Almost 8 months ago I showed a complete shim for Array.prototype.forEach. I thought it was pretty good and I’ve used it in a few projects, but there is one problem: I got it wrong. Not hugely wrong, but wrong enough. Like I said last time: a shim should only ever be to standards. As well […]
How I Learned JavaScript
The thing with JavaScript is that no-one learns it. Everyone just jumps in (these days with copy-and-paste jQuery plugins) and struggles to take that knowledge further and learn more about the language. In this post I’ll describe my the key moments I’ve had (“JavaScript epiphanies” if you like) while learning; hopefully someone looking for the […]
Number.prototype.times
Anyone who has ever worked with the PrototypeJS library will recognise this little beauty. It’s a gem of an addition and something that I firmly believe should be added to the ECMAScript standard. It allows a function to be called a set number of times, such as the following example: var n = 4; // […]
Do you comment your DOM manipulation?
I’m not talking about commenting your code, although you should be doing that anyway. JavaScript has the ability to create HTML comments: var comment = document.createComment(‘the comment itself’); document.getElementById(‘foo’).appendChild(comment); You can even do it in jQuery: $(‘<!–the comment itself–>’).appendTo(‘#foo’); Now, I know what you’re thinking: why, why would anyone want to create something that doesn’t […]
How JavaScript animation works
I often find myself looking at certain things that the major libraries do and thinking “I wonder how they do that?” Animation was one of those, so I looked through jQuery and YUI to see how they did it, built my own animation function to teach myself and now that it’s working, I’ll show everyone […]
Using JavaScript to detect CSS Support
Have you ever had a client that explicitly asked for rounded corners and drop shadows on their design? It’s a royal pain in the … well, it’s a royal pain. Every modern piece of CSS you want to use: box-shadow, box-radius, :nth-child(even), all blown to hell because you know your client will be checking in […]
Please only shim to standards
I’ve made this mistake myself so I’m desperate to ensure it doesn’t happen again. If you’re going to shim JavaScript, please only do it to standards. Whoa, just a second… shim? JavaScript allows us to shim (or patch) it, to fill in any missing pieces of functionality that aren’t supported by the current browser. Now […]