Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Allows for setTimeout and setInterval to take a string as the first argument #550

Closed
wants to merge 2 commits into from

Conversation

matthewfl
Copy link

SetTimeout and SetInterval should be able to take a string as well as function as their first argument.
https://developer.mozilla.org/en/DOM/window.setTimeout

@ry
Copy link

ry commented Jan 6, 2011

Okay - can you add a test?

setTimeout/setInterval with string will not work with local variables, globals only
@matthewfl
Copy link
Author

I added test for this, and I also rebased/reworked this for the changes you made in moving the timers code.

@aikar
Copy link

aikar commented Jan 22, 2011

Wasn't this discussed on -dev and most people agreed it shouldn't be added since it was a mistake in the first place to allow strings in the browser?

@matthewfl
Copy link
Author

I posted this to the mailing list. There was a lot of back and forth, but I don't think that any official decision came out of it. I am thinking that this is not going to get merged into node, seeing how long it has been here, but it is still here, in case there is some change of mind.

@ry
Copy link

ry commented Jan 27, 2011

rebase please.

@ry
Copy link

ry commented Jan 27, 2011

no need to change wscript.

@ry ry closed this May 6, 2011
@Ayms
Copy link

Ayms commented Jun 22, 2011

If I understand correctly it was decided not to allow strings for timers in nodejs.

Even if it is not good and browsers mistakes, it is used by developpers, so I would think this very small change should be in nodejs or at least should not return an error.

The subject was rapidly discussed here too : https://github.com/tmpvar/jsdom/issues/231 --> the fact that strings are not taken into account provokes third parties scripts (websites scripts loaded in jsdom) execution failure, then global failure if we don't prevent it.

Changes could be made in jsdom for example but probably it would be better that it is in nodejs, thanks to let us know your position.

@Ayms
Copy link

Ayms commented Jun 24, 2011

@ry @MatthewF I don't know if you saw that comment, I would suggest to fix it, very easy to fix compared to problems that it can cause

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants