jquery.dashboard.js - Fix bad variable scoping (Possible behavioral change)
authorTim Otten <totten@civicrm.org>
Fri, 13 Nov 2015 19:42:43 +0000 (11:42 -0800)
committerTim Otten <totten@civicrm.org>
Fri, 13 Nov 2015 19:42:43 +0000 (11:42 -0800)
commitf3ac8e2f5d93ce51a83714961ae97b218aad8420
tree7942fa8edfde137dd0532b73b6a5e595231ea7f1
parentce7f49532a1c693a77f730853275ad57bede6d5e
jquery.dashboard.js - Fix bad variable scoping (Possible behavioral change)

These snippets were declaring new variables (eg `if (...) var ids = foo`) in
one scope then accessing them in a later scope - which properly triggers a
warning from jshint. In my mind, this would be a nullop (always leaving `ids`
undefined), although JS does allow values to leak through.

I *suspect* this leaking was *partially* intentional.  The variable (`ids`
or `id`) is clearly intended to be used a few lines later.  However, in the
case where the conditional is *false*, the content of `ids` or `id` is
unclear.  You might expect it to be `undefined` (and it probably would be in
the first few loop-iterations), but eventually you'd would start leaking
values across iterations, and that doesn't seem normal/intentional.
js/jquery/jquery.dashboard.js