IIRC there's always an argument added to the function call that contains the 'timeout lateness'. Why is this a problem?
Yes, this is as designed, and this is how setTimeout() and setInterval() have behaved in Netscape since the beginning of their existance, AFAIK. How is this a problem?
In general, I'm against secret parameters passed automatically into user functions. Especially if the parameter is of doubtful usefulness. However, if this is established behavior, then I'm willing to concede. I wonder also if this parameter is working as expected. Although it's often a value like 1, 4, or 7, I fairly frequently see values like 76791831. How is this useful? Our scenario, simplified a bit, was a function that took a variable number of parameters. The function examined arguments.length to determine its behavior. When passed into setTimeout(), it expected to be called with zero parameters, but was not. Yes, I could pass in a string to setTimeout() to suppress the secret parameter, but in this case it's an anonymous function that isn't easily reached from the global namespace. Preferrably, this extra parameter should be documented. I believe that might fall under bug 243630. Thanks for your attention.
Ok, I guess I shouldn't have confirmed this, but I did check the JS 1.5 reference on DevEdge (at least Google's cache of it) and didn't see documentation on the parameter. -> INVALID
Status: NEW → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → INVALID
This is indeed an underdocumented feature of the classic DOM0, which we might someday remedy under the aegis of devmo. In the meantime, you could interpose a wrapper function which explicitly called your user function with zero arguments, and register that with setTimeout. Thanks for the thoughtful comment; the large-number case might indeed be a bug, as there do still lurk some timer gremlins.
> you could interpose a wrapper function which explicitly called > your user function with zero arguments, and register that with setTimeout Yes, I actually ended up overriding setTimeout/setInterval so that's done automatically. Thanks again.
Re: comment 2, IIRC fur actually added the lateness secret actual parameter in Netscape 3 (or was it 4?). My original implementation of setTimeout in Netscape 2 lacked this secret argument (setInterval came later). /be
*** Bug 304771 has been marked as a duplicate of this bug. ***
*** This bug has been marked as a duplicate of 10637 ***
Status: REOPENED → RESOLVED
Last Resolved: 14 years ago → 13 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.