When trying to 'expand' the reputation (by clicking on the arrow) it shows the AJAX loader.

But nothing happens. It doesn't even make a request to the server :P

cannot expand rep http://img46.imageshack.us/img46/2188/expandrep.png

This is for both expanding the question and the date.

It looks like somebody screw up the javascript (no need to point fingers ;) ):

Uncaught TypeError: Cannot call method 'indexOf' of undefined




JS error http://img843.imageshack.us/img843/6936/jserror.png


Tested in both Chrome Canary and stable

  • 1
    It works for me. – kiamlaluno Jan 3 '12 at 18:18
  • @kiamlaluno platform? – PeeHaa Jan 3 '12 at 18:18
  • I am using Safari 5.1.2 on Mac OS X 10.7.2; if the location can make the difference, I am in Italy. – kiamlaluno Jan 3 '12 at 18:20
  • Works for me in chrome and IE 9. – Josh Darnell Jan 3 '12 at 19:15
  • 2
    @jadarnel27 it was fixed so now it works for everyone. :-) – Shadow Jan 3 '12 at 21:12

It's due to upgrading jQuery to 1.7.1 - there is this line of code:

var p = $(this).closest("td").attr("id");

The .attr() was replaced by .prop() as of jQuery 1.6 so combined with the fact the parent <td> has no ID, it broke the code: prior to 1.6 it returned empty string.. after 1.6 it returns undefined value.

Test case with jQuery 1.5.2

Test case with jQuery 1.7.1

Test case for fixed code.

  • 3
    @balpha Now I feel bad that I posted this question :P Please don't tell them where I live :) – PeeHaa Jan 3 '12 at 18:31
  • LOL! The irony... :D – Shadow Jan 3 '12 at 18:32
  • well at least it is stated clearly in the jQuery documentation so I'm no the one to blame (this is just in my defense of course :D ). – PeeHaa Jan 3 '12 at 18:36
  • Yes indeed and they probably changed this in the "main" JS code, that error occurs in rather "minor" file that was probably overlooked. – Shadow Jan 3 '12 at 21:11
  • 1
    This isn't really true. .attr was not replaced by .prop; they're different methods with different use cases, and .attr is still the correct one to use here. The actuall issue here is that while the DOM specification says getAttribute should return an empty string for non-existent attributes, pretty much all browsers return null instead -- which jQuery then "normalizes" to undefined (of course null would've caused the same issue). elem.id, however, is always a string (even if empty). That's why using prop instead of attr worked. /cc @PeeHaa – balpha Jan 4 '12 at 10:07
  • @balpha thanks, didn't delve so deep into it now I learned some new things. :) – Shadow Jan 4 '12 at 10:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .