#51 JavaScript definitions inside anonymous functions missing

open
nobody
None
5
2009-11-24
2009-11-24
Lang Martin
No

A common JavaScript pattern introduces an anonymous function around a
set of definitions in order to create a local variable scope. To wit:

(function () {
function util () { return this; }
jQuery.fn.foo = function () {
return util(this);
}
})();

ctags fails to match the inner assignments. If you're using jQuery or
any of several other popular libraries, the anonymous functions may
not be executed in place but passed as an argument. In jQuery:

$(function () { $("#stuff").show(); });

I've just built from subversion revision 749, and I'm using this
version of jscript.c:

$Id: jscript.c 666 2008-05-15 17:47:31Z dfishburn $

Discussion


Log in to post a comment.