medillcmip / Radregator

A Context Management System
GNU General Public License v3.0
7 stars 1 forks source link

opening answer drawers results in a js error that causes the formatting to break when using the ANSWER THIS button on the front page #145

Closed shaneshifflett closed 13 years ago

shaneshifflett commented 13 years ago

When trying to expand and hide answer forms, we eventually come to this function.

function earmarkrefresh(toggler) { var newheight = $(toggler).closest("div.comment").height(); var newhalfheight = (newheight / 2); // alert(newheight); $(toggler).closest("div.comment").children("div.earmark").height(newheight); $(toggler).closest("li").children("div.aflag").height(newhalfheight).css("top",newhalfheight+"px"); }

It throws an error on

$(toggler).closest("div.comment").children("div.earmark").height(newheight);

saying

Uncaught Dimensions: jQuery collection is empty

that stems from a null object when we try to access teh closest elements of the toggler object.

$(toggler).closest("div.comment").children("div.earmark"): TypeError: Cannot call method 'closest' of null

that object happens to be a reference to the ANSWER THIS / HIDE THIS a href on each questions.

I've stared at this for probably an hour and I can't figure out what the issue is, since ultimately the code works (answers expand and hide when we click these links).

It's a problem because it causes the Timeline to fail to load and breaks the reporter views. It's only a problem when we click on the big green Answer This button on the front page (presumably because we try and use these methods while some of the page hasn't loaded in that instance).

shaneshifflett commented 13 years ago

fixed in commit - https://github.com/medillcmip/Radregator/commit/fbd8a4f6e83614299b412b856e19aa9a18b85