4 items tagged “pete-michaux”
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.
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.
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.
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.