Facebook app: don't add FBJS event listeners to notice input box if it's not on the page

This commit is contained in:
Zach Copley 2009-02-05 07:10:11 +00:00
parent e5b075b912
commit 61b17b4c02
1 changed files with 6 additions and 4 deletions

View File

@ -19,10 +19,12 @@
var max = 140;
var noticeBox = document.getElementById('notice_data-text');
noticeBox.addEventListener('keyup', keypress);
noticeBox.addEventListener('keydown', keypress);
noticeBox.addEventListener('keypress', keypress);
noticeBox.addEventListener('change', keypress);
if (noticeBox) {
noticeBox.addEventListener('keyup', keypress);
noticeBox.addEventListener('keydown', keypress);
noticeBox.addEventListener('keypress', keypress);
noticeBox.addEventListener('change', keypress);
}
// Do our the countdown
function keypress(evt) {