Don't add a node if it's already there

Try not to double-add a node on Ajax submit. Normally not a big deal,
but may happen if the CometPlugin (or in the future Strophe or other
auto-update plugins) is enabled.
This commit is contained in:
Evan Prodromou 2009-04-26 21:16:09 -04:00
parent 192bc42c91
commit 7405d9dfa6

View File

@ -188,11 +188,15 @@ $(document).ready(function(){
alert(result);
}
else {
$("#notices_primary .notices").prepend(document._importNode($("li", xml).get(0), true));
li = $("li", xml).get(0);
id = li.id;
if ($("#"+li.id).length == 0) {
$("#notices_primary .notices").prepend(document._importNode(li, true));
$("#notices_primary .notice:first").css({display:"none"});
$("#notices_primary .notice:first").fadeIn(2500);
NoticeHover();
NoticeReply();
}
}
$("#notice_data-text").val("");
counter();