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
1 changed files with 9 additions and 5 deletions

View File

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