I looked at James Edwards' post, and I'm not seeing how this function is all
that useful. (I mean no offense to pd; it's always worth looking at
interesting bits of code like this, and I appreciate it being brought up.)
 
Half of the code merely duplicates what JavaScript does for you and could be
replaced by a simple "!" operator. Undefined? Null? The number zero? The
boolean value false? All built in, so why bother with all that code?
 
The other half implements a fairly specialized notion of what "empty" means.
A string whose value is '0', or '', or only whitespace? An empty array? An
object with no enumerable properties?
 
Well, sure, if that's exactly what you need to test for. But why not just
test for the specific thing you need instead of using a general pupose
function with its own ideas of what is true and false that may or may not
match your needs?
 
-Mike



  _____  

From: chris thatcher

you should cc the jquery-dev list for this idea as well, to ensure those
developers see it.

thatcher


On Wed, Oct 22, 2008 at 7:34 PM, pd <[EMAIL PROTECTED]> wrote:



Hi All

This idea by James Edwards seems like a winner and an ideal candidate
for a new jQuery core utility method:

http://www.sitepoint.com/blogs/2008/10/16/techy-treasures-1/

Obviously his choice of name conflicts with the jQuery .empty() method
however another name could be used such as:

hasValue()

This method would simply return a boolean response.

What does everyone think?

pd




-- 
Christopher Thatcher


Reply via email to