Removing leading whitespace in ES6 template strings

Note: this post remains for posterity but rather than using the template tags described here I'd suggest taking a look at common-tags. In some recent code at work we're using fairly large strings for error descriptions. JavaScript has always made it hard to deal with long strings, especially when you…

Back to the future: ES6 + React

I've just recently finished shaving about a billion yaks * to convert a React app over to use ES6 modules and classes so we can start living in the future that is ES6 with a sprinkling of ES7. * Might not be true Transpiling back to the present We're using babel via…

JS: Creating instances without new

During a code review recently I was looking at some code that was using the new keyword to create an instance e.g: var inst = new MyConstructor(); The context object when new isn't used The code contained a safeguard to bail if the new keyword wasn't used. Which is a…

Does setTimeout solve the DOMContentLoaded problem?

I've recently been building a simple framework for testing the performance of arbitrary JavaScript code. Whilst doing so I was looking at the some information on setTimeout in "JavaScript the Definitive Guide" by David Flanagan. One paragraph made me think of the DOMContentLoaded Problem: "In practice, setTimeout() tells…

Basic DOMTool Tutorial

I've had some brilliant feedback on DOMTool and several people have emailed me asking for a basic tutorial on how to use the output. So if you're familiar with using the DOM to add content to a page then this probably won't be terribly exciting and you can carry on…

DOMTool

I've had this idea kicking around for a while that it would be useful to build some kind of utility that took HTML as an input and output the correct DOM methods for inserting that content into a document. To start with I thought this would be some kind of…

O2 thinks Camino is out of Date

I was amused to find when I visited the O2.co.uk website with camino, an alert box popped up saying "Your browser is out of date. Would you like to upgrade it now for a better user experience? (Highly recommended)". Of course I clicked "ok"…