Hey, I just want to make sure that when I remove an element I don't
have to worry about the events listeners I added previously to the
element. For example:
// get the element by its id
elem = document.getEle mentById('elemI d');
// attach the event listener
if (elem.addEventL istener) { // std
elem.addEventLi stener(eventNam e, functionRef, false );
} else if (elem.attachEve nt) { // ie
elem.attachEven t(eventName, functionRef );
} // end if
.... // whatever functionality makes use of the element and its event
(s)
// delete the element
elem.parentNode .removeChild(el em);
In this case, does the browser automatically destroy the events I
added previously, or do have to remove them myself?
Thanks.
have to worry about the events listeners I added previously to the
element. For example:
// get the element by its id
elem = document.getEle mentById('elemI d');
// attach the event listener
if (elem.addEventL istener) { // std
elem.addEventLi stener(eventNam e, functionRef, false );
} else if (elem.attachEve nt) { // ie
elem.attachEven t(eventName, functionRef );
} // end if
.... // whatever functionality makes use of the element and its event
(s)
// delete the element
elem.parentNode .removeChild(el em);
In this case, does the browser automatically destroy the events I
added previously, or do have to remove them myself?
Thanks.
Comment