javascript - Uncaught RangeError: Maximum call stack size exceeded with innerHTML -
i'm not experienced javascript, i'm running issue can't understand. code simple:
document.getelementbyid ('chat_line_list').addeventlistener ("domsubtreemodified", localmain, false); function localmain () { var chatlist = document.getelementbyid('chat_line_list').lastchild.lastelementchild.innerhtml; chatlist = chatlist.replace('infothump', '<span class="newemo-1 emoticon"></span>'); chatlist = chatlist.replace('muskmelon', '<span class="newemo-2 emoticon"></span>'); chatlist = chatlist.replace('poisonapple', '<span class="newemo-3 emoticon"></span>'); chatlist = chatlist.replace('poisonbanana', '<span class="newemo-4 emoticon"></span>'); chatlist = chatlist.replace('poisonwatermelon', '<span class="newemo-5 emoticon"></span>'); chatlist = chatlist.replace('poisongrape', '<span class="newemo-6 emoticon"></span>'); chatlist = chatlist.replace('notnippy', '<span class="newemo-7 emoticon"></span>'); document.getelementbyid('chat_line_list').lastchild.lastelementchild.innerhtml = chatlist; } the exception occurs on last line of localmain() function, when replace innerhtml newly-modified string. there in code causes loop or overflow?
you causing infinite loop!
you listening domsubtreemodified on element chat_line_list, update element inside of function attached event!
Comments
Post a Comment