GRRR @ script.aculo.us

Posted in: Site updates

Well... that didn't take long. After discovering my website Chrome/Safari (WebKit) woes earlier this week (although only making that blog post last night), I fixed the menu bar rendering issues last night, and then fixed the Twitter script issues just now.

For those technical minded amongst you, the culprit was in the following lines of JavaScript which used script.aculo.us, a JavaScript library for cool effects/animations (like the sliding fade-in effect of the Twitter items on the right-hand side). I use script.aculo.us's Builder class which is handy for inserting HTML elements into a document, like the Twitter feed:

twitterdiv.appendChild(Builder.node('script', {
  src: 'http://twitter.com/statuses/user_timeline/u1traq.json?' +
       'callback=twitter.callback&count=5',
  type: 'text/javascript'
}));

Chrome just didn't like the Builder.node() function in this case (I use it in a bunch of other places without issues), maybe because it was trying to insert a <script/> node, I dunno. But by replacing it with standard DOM functions, it did the trick:

scriptnode = document.createElement('script');
scriptnode.setAttribute('type', 'text/javascript');
scriptnode.setAttribute('src', 'http://twitter.com/statuses/user_timeline/u1traq.json?' +
  'callback=twitter.callback&count=5');
twitterdiv.appendChild(scriptnode);

Now all those browsers are happy, and so am I.