Tag Archives: javascript

No escape() from JavaScript

A couple of days ago, we got caught out by a few encoding issues in a site at $WORK. The Perl related ones were fairly self explanatory and I’d seen before (e.g. not calling decode_utf8() on the query string parameters). But the JavaScript part was new to me. The problem was that we were using […]

Which whitespace was that again?

We recently saw this at $WORK. It appears corrupted in Internet Explorer only. Firefox and Safari show it normally. After much exploration in the debugger, we eventually found it was caused by using the innerText property in internet explorer. This has the mildly surprising property of turning multiple spaces into U+00A0 (NO-BREAK SPACE) characters (  […]

JavaScript.pm on OSX

Just a quick note… I was looking at RT#48699 when I noticed that MacPorts didn’t have JavaScript.pm in it’s collection. I needed to install it by hand. Unfortunately, the latest version (1.12) doesn’t install cleanly. So I’ve forked it and fixed it (along with a couple of other minor nits). Claes said he’ll apply the […]

jslint.com mirror

Whilst I ensure I have the latest version of JSLint for each release of jslint4java, it’s often difficult to know what’s actually changed between versions. Unfortunately, Douglas Crockford doesn’t maintain a public version control system1 (which is entirely up to him). Nonetheless, it’s kind of useful to be able to look at a version of […]

Google Analytics in XHTML

I’e been attempting to get Google Analytics to work correctly in both FireFox and IE6 for a site at $WORK. This is not normally a problem, apart from the fact that we’re serving up pages to firefox as application/xhtml+xml in order to get MathML support. Now, the sample code from Google is pretty gnarly. <script […]

Time Zones, done better

A few days ago, I signed up to HuffDuffer (love the logo, BTW). However, once I’d registered, my profile page said Huffduffing since November 1st, 2008. Which was a little weird, as when I did this it was October 31st. So I filed a bug report and Jeremy quickly spotted the problem: the server was […]

jslint4java 1.2

I’ve finally gotten around to finishing off the code that I’ve had sitting around in google code for over a year, and released jslint4java 1.2. The changes are actually pretty small: Update to jslint 2008-09-04. This adds several new options. Several updates to the ant task: Move the antlib definition to “antlib:net.happygiraffe.jslint” (incompatible change). Default […]

JavaScript Scope

This is an issue that popped up with a colleague yesterday. Roughly, there was some code like this. function setUpStuff() { var items = cssQuery("#stuff p"); for (var i = 0; i < items.length; i++) { var item = items[i]; item.onclick = function() { alert("item is " + item); }; } } function setUpStuff() { […]

Argumentative

I spent a little while looking at mootools yesterday for a colleague. It’s yet another JavaScript library. My colleague was wondering how to restrict the Accordion effect so it applied once to each area of content on the page, rather than once for the whole page (each content area has multiple bits of content where […]

Clichés are hard

So yesterday, Jeremy asked: Wondering if accents are valid in class names (so I can mark up some text as being of the class “cliché”) It’s a damned good question. And you have to consider: character encodings; CSS; HTML; XHTML; JavaScript; HTTP. Needless to say, it’s more complicated than it looks at first. My first […]