I’ve just spent a very painful hour or so debugging a jQuery issue that turned out to be a self inflicted problem! The site I was working on had been working perfectly all morning, then a particular page began to fail on a refresh (browser F5). It was possible to browse to the page and it displayed correctly, but press F5 to refresh the page and it failed on the statement below. Checking the contents of document showed it to be populated, but $(document) failed with an error saying it was either null or not an object.
$(document).ready(function() { AttachCloseEvents(); });
It just didn’t make sense, going to the page everything would work as expected but refreshing the very same page caused it to fail – it didn’t matter if it was the start up page of the visual studio project or not. In one of the many attempts to isolate / identify the problem I cleared out the browser cache. Amusingly this now broke the entire site – the error occurred every time the page was viewed.
…………It was at this point that I noticed I’d accidently moved the projects localised copy of jQuery. The requests to the page that had worked originally had been using a browser cached copy of the file – it was the refresh of the page that was acting correctly.
Just a note about TypeScript Playground, an online REPL for TypeScript. Been around a while, but really useful for trying out a quick bit of TypeScript.
I’ve started playing with the JavaScript SVG library RaphaelJS. It looks a really nice library but the very first hurdle I came across was how to set the background colour of the paper. There didn’t seem to be any help in the documentation and trying ‘paper.attr(“fill”, “#f00”);’ resulted in the error Uncaught TypeError: Object #<a> has no method ‘attr’. A less than optimal solution might be to create a rectangle on the paper that is . . .