On Tue, Aug 25, 2009 at 12:53 PM, bombaru<bomb...@gmail.com> wrote:
>
> For some reason, jQuery 1.3 does not like the if statement in the code
> sample - else will never fire.  This works fine "as is" in 1.2.6.
> Does anybody know what could be the culprit here?  I'm assuming the if
> is always returning true, so the else never gets fired... I'm just not
> sure how to get around this though.

Interesting, I've got a similar, although it seems opposite problem.
In this code:

  $.entityFinder.find = function(q) {
    var t = $(q);
    if (t.length > 0) {
      quarry = null;
      $.scrollTo(t);
    } else {
      var inc = incomplete
      if (incomplete) {
        quarry = q;
        $.scrollTo($('#footer'));
      }
    };
  };

The true leg never seems to execute, even if a dom element IS found.

In debugging I changed this to:

  $.entityFinder.find = function(q) {
    var t = $(q);
    var l = t.length;
    var test = (t.length > 0);
    if (test) {
      quarry = null;
      $.scrollTo(t);
    } else {
      var inc = incomplete
      if (incomplete) {
        quarry = q;
        $.scrollTo($('#footer'));
      }
    };
  };

And it does work.

But I can't for the life of me figure out why it doesn't work in the first case.




-- 
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

Reply via email to