Category Archive for 'Javascript'

Javascript files don’t auto-update

Friday, August 28th, 2009

On a panel of 4 Javascript library developers at Ajax Experience 2008, a question came up about how their libraries use browser detection. When John Resig suggested that libraries should strive for full feature detection (hardly used at all at the time) instead of browser/object detection, the other developers reacted like he was crazy. They [...]

The Quickening of Facebook

Friday, July 31st, 2009

If you’ve used Facebook in Opera and Firefox, you might have noticed that Facebook is several magnitudes faster in FF, but this has nothing to do with FF’s speed. For FF and IE users, Facebook uses a client-side architecture called “Quickening” that basically makes a few popular pages into full AJAX applications that stay loaded [...]

Where’s the code?

Monday, October 13th, 2008

Google’s free open source project hosting has been awesome for Minify, so when I was looking around for Subversion hosting for my personal code, I figured why not host it there? So here’s a bunch of my PHP and Javascript code. Hopefully some of it will be useful to people. A few PHP highlights:

HashUtils implements [...]

Minify 2.1 on mrclay.org

Friday, September 19th, 2008

A new release of Minify is finally out, and among several new features is the “min” application that makes 2.1 a snap to integrate into most sites. This post walks through the installation of Minify 2.1 on this site.

Javascript humor

Wednesday, September 10th, 2008

hasthelargehadroncolliderdestroyedtheworldyet.com has a news feed. It also has this in the source:
if (!(typeof worldHasEnded == “undefined”)) {
document.write(“YUP.”);
} else {
document.write(“NOPE.”);
}
Folks without Javascript get a more definite answer:
<noscript>NOPE.</noscript>
Also appreciated:
<!– if the lhc actually destroys the earth & this page isn’t
yet updated please email mike@frantic.org to receive a full
refund –>

Case of the NS_ERROR_DOM_SECURITY_ERR

Saturday, September 6th, 2008

Working on a bookmarklet, I ran across “security errors” in Firefox and Opera (may happen in others, I didn’t check). In Firefox the code threw “Security error (NS_ERROR_DOM_SECURITY_ERR)” and in Opera it was something similarly vague.
The culprit code was trying to access the cssRules property of a style sheet from a different domain (my CSS [...]

Minifying Javascript and CSS on mrclay.org

Thursday, March 27th, 2008

Update: Please read the new version of this article. It covers Minify 2.1, which is much easier to use.
Minify v2 is coming along, but it’s time to start getting some real-world testing, so last night I started serving this site’s Javascript and CSS (at least the 6 files in my WordPress templates) via a [...]

Thoughts on a Javascript “validator”

Monday, July 16th, 2007

(X)HTML and CSS have their own validators, but we need one for Javascript as well. JSLint could be part of it, but what I’m imagining would flag the use of “native” objects/interfaces not defined by W3C or ECMA standards. E.g., document.layers or window.ActiveXObject.
The hard part in doing this is finding a full Javascript interpreter with [...]

Hacking a 3rd party script for bookmarklet fun

Wednesday, June 27th, 2007

A few weeks ago I created a simple bookmarklet that loads del.icio.us’s PlayTagger script into the current page. This post covers how some problems with this script were worked through.
Too late
The first challenge was that PlayTagger was designed to initialize itself (let’s call this method “init“) on window.onload: If a user fired the bookmarklet after [...]

Kill these DOM0 shortcuts

Monday, June 25th, 2007

A problem a decade in the making

You can refer to a form’s elements in your code by using the element’s name (from the NAME attribute)
– an ancient Javascript spec.

This means myForm.myElement is a shortcut for myForm.elements['myElement']. I’m sure this was seen as handy and harmless at the time, but the problem is that references to [...]