on what basis does a check if (document.addEventListener) return false and is there a way we can change this ?
It returns a false value (although not actually false) if it isn't defined.
This is a standard feature (AKA object) detection test.
You could change it by implementing your own version. More usually you'll use this in a wrapper function with the } else { having IE specific handling.
if (document.addEventListener) evaluates to false if there's no addEventListener method in document. This check is usually done to see if you can use this method to attach event to DOM element (works in most browsers except IE).
is there a way we can change this ?
This question I don't completely understand. Probably, you want something like document.attachEvent('onload', callback); for IE. You can't really add addEventListener method to document (well, maybe you can, but it wouldn't make sense).
If this code snippet returns false, this means that the addEventListener method property is not support by the browser. This is the case for Internet Explorer, where attachEvent is used instead:
if (document.addEventListener){
document.addEventListener(...);
} else if (document.attachEvent){
document.attachEvent(...);
}