If I understand the question, that's the difference between what I call version 4 and version 5 events. Version 4 events are where you go:
Code:
el.onclick = function(){alert('This a version 4 click event. This el can have only one of these at a time'); alert('It can do more than one thing though.'); return false;};
If you have (also version 4):
Code:
<a href="#" onclick="alert('here'); return false;">Whatever</a>
And that's el, and the code at the top comes last in the parsing of the page, it will overwrite the one hard coded to the tag. If even later you have:
Code:
el.onclick = function(){};
Then there will essentially be no version 4 click event for that element. It's empty and overwrites any v4 event that came before.
Version 5 events are where you do (or similar):
Code:
el.addEventListener('click', function(){alert('Hello World!');}, false);
That will only add to the click queue for that element, it will not overwrite any previous click event and will not be overwritten by any future click event.
For more see:
http://www.dynamicdrive.com/forums/e...rsion-5-Events
However, just looking at the code, I don't think this is what's happening. I think you mean:
Code:
saveCurRng: (function(){return document.selection?
function(el){this.el = el; el.focus(); this.curRng = document.selection.createRange();}:
function(el){this.el = el, this.curRng = typeof el.selectionStart === 'number'?
el.value.substring(el.selectionStart, el.selectionEnd) : null;}
})(),
This is a property being defined by a self executing anonymous function. It will be defined once as the page loads. It will be defined differently in different browsers. It will then be the onchange event for the textarea. This approach allows the script to execute more quickly because it doesn't have to branch each time it's used.
Bookmarks