Simon Willison’s Weblog

Subscribe

4 items tagged “petermichaux”

2008

Module Pattern Provides No Privacy... at least not in JavaScript(TM) (via) JavaScript variables hidden inside a closure aren’t as hidden as I thought—it turns out you can pass a closure as the second argument to eval (at least in Firefox) and “steal” private variables back out of it. # 27th June 2008, 7:01 pm

Transitioning from Java Classes to JavaScript Prototypes. Peter Michaux shows how JavaScript’s prototypal inheritance can run rings around traditional Java-style classes once you figure out how to take advantage of it. # 10th February 2008, 3:10 pm

2007

Lazy Function Definition Pattern. Neat JavaScript trick: redefine a function the first time it’s called, for example to switch in different browser implementations based on object detection. # 15th August 2007, 6:57 pm

JavaScript Minifier that doesn’t break code (via) Perl re-implementation of Douglas Crockford’s classic JSMin that doesn’t clobber IE’s conditional comments, by Peter Michaux. # 4th June 2007, 5:44 pm