Ben Nadel
On User Experience (UX) Design, JavaScript, ColdFusion, Node.js, Life, and Love.


Member since Jan 14, 2009

Recent Blog Comments By James

  • jQuery Event Bindings On Javascript Objects With A Length Property

    Posted on Apr 26, 2010 at 9:49 AM

    I decided to dig into this myself and I think I've narrowed it down to the jQuery.merge function which is used when you pass ANYTHING with a non-null (not undefined or null) length property as the first argument to $(). jQuery.merge will assume that it's an array-like object and will continue to go... read more »

  • Using jQuery's Animate() Step Callback Function To Create Custom Animations

    Posted on Feb 21, 2010 at 4:32 AM

    Very nice work! I love these kind of experiments! It seems that you're using the "animate()" method as a pure looping mechanism - i.e. one that will run for the specified duration every 30 or so milliseconds. Since you're not using an easing function, this is just a straight animation loop with equ... read more »

  • Using Logical Operators To Perform Ternary Operations In Javascript

    Posted on Nov 18, 2009 at 11:47 AM

    Nice post Ben. I think it's okay to use basic stuff like: function runFn(fn) { return fn && typeof fn === 'function' && fn(); } It may not seem readable to a JS beginner, but frankly, I write code assuming that another developer reading it will be proficient in the area. For me, a&&b&&b() is m... read more »

  • jQuery Live() Method And Event Bubbling

    Posted on Nov 10, 2009 at 7:23 AM

    @Thomas, I believe jQuery 1.4 (yet to be released) will support both the blur and focus events in its "live" mechanism.... read more »

  • Using PushStack() In jQuery Plugins To Create New Collections

    Posted on Oct 30, 2009 at 7:44 AM

    Nice write-up Ben! Before I knew about pushStack() I used to just return a new jQuery collection, i.e. jQuery.fn.plugin = function(){ return $(something); } It worked in most cases but obviously didn't retain the original jQuery instance. This can be misleading - the jQuery instance really shouldn... read more »

  • Using Javascript's IN Operator To Test For Object Property Existence

    Posted on Oct 1, 2009 at 11:03 AM

    @Ben, thanks for the heads up on that list! You should have been on there! :) Also, AFAIK, hasOwnProperty() is supported just about everywhere, except Safari 2. Though, I don't think anyone uses that browser any more...... read more »

  • Using Javascript's IN Operator To Test For Object Property Existence

    Posted on Oct 1, 2009 at 9:25 AM

    Nice tip Ben! The "in" operator is definitely good to know about. The reason that your first example only spits out "truthy" values is because this: if (jill[ key ]){ .... } ... is essentially the same as this: if (jill[ key ] == true){ .... } (Notice the NON-strict equality operator) If you t... read more »

  • June 1st 2009 - 2nd Annual (Inter)?National Regular Expression Day!

    Posted on Jun 1, 2009 at 12:09 PM

    Block all requests to retweet/digg etc. /please\s+?(RT|retweet|read|digg|stumble|fav|bookmark|upvote|comment)/i And, to block all retweets: /(^|\s)(RT|retweet(ing)?)\s/i... read more »

  • Using Super Constructors Is Critical In Prototypal Inheritance In Javascript

    Posted on Apr 17, 2009 at 10:43 AM

    Great post Ben! Just ordered "Pro Javascript Design Patterns" off Amazon.... read more »

  • How To Build A Custom jQuery Selector

    Posted on Jan 14, 2009 at 8:47 AM

    @Ben "Do not fear eval(). It is the basis for all JSON work in Javascript and without it, we could not have JSON-based AJAX. It is awesome." JSON and the decoding of JSON can be achieved without the use of eval. In fact, eval is one of more dangerous approaches when using JSON because it runs the ... read more »

  • How To Build A Custom jQuery Selector

    Posted on Jan 14, 2009 at 3:15 AM

    An interesting approach but like it's been said this can already be done with CSS attr selectors. I realize that your extension offers a little more because it can accept multiple titles. Just a word though, I would avoid 'eval' at all costs; it's probably okay using it here but in other situation i... read more »