The window.clearTimeout function should be able to accept input that
is not necessarily a timeout identifier; likewise with clearInterval.
As an example of this, run the following code at http://caja.appspot.com/
and on your favorite javascript engine

var fn = function(){ console.log('not cleared'); },
    timeout  = setTimeout(  fn, 1000 ),
    interval = setInterval( fn, 1000 ),
    each = [timeout,interval];

for(var i=0, l=each.length; i<l; i++) {
    clearTimeout(  each[i] );
    clearInterval( each[i] );
}

Runtime errors are thrown with the cajoled code and the uncajoled code
should work just fine. The spec (https://developer.mozilla.org/en/DOM/
window.clearTimeout) says that this should be perfectly valid code.
It works correctly, without errors, in all major modern browsers, and
the spec even specifically states that no error should be thrown.

Reply via email to