Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #19060
| Newsgroups | comp.lang.javascript |
|---|---|
| Subject | Re: Setting focus |
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
| References | (4 earlier) <91cef6bd-0cf0-4450-b9dd-cb96c95cd9ad@u7g2000yqg.googlegroups.com> <2089218.m2Nog8KiOQ@PointedEars.de> <a1bf9979-c2ca-4d9f-8615-02341d158625@g4g2000yqd.googlegroups.com> <m2zjxl7o0m.fsf@nntp.bednarz.nl> <95f8d3fa-cbf6-4b68-ad2d-88c8e8bca214@y14g2000vbk.googlegroups.com> |
| Date | 2013-03-30 17:55 +0100 |
| Message-ID | <XnsA193B667582BFeejj99@194.109.133.133> (permalink) |
Scott Sauyet wrote on 30 mrt 2013 in comp.lang.javascript:
> Eric Bednarz wrote:
>> Scott Sauyet writes:
>>> [...] In fact, certain style animations would never use
>>> `setTimeout` at all,
>>
>> Right. CSS transitions, animations, keyframes. Or, for scripting,
>> requestAnimationFrame.
>>
>>> choosing `setInterval` instead,
>>
>> Oh my.
>
> Please remember the context: a discussion about whether it was
> necessary to clean up behind a `setTimeout`. I was bringing a class
> of animations into this as an example of code that often made heavy
> uses of `setTimeout` often without doing the cleanup that Thomas
> insisted was necessary. I was not trying to list all the forms of
> animation available.
>
> Thomas claims to have evidence that he's unwilling to share that code
> of this sort is necessary:
>
> var field = …
>
> var t = window.setTimeout(function () {
> field.focus();
> window.clearTimeout(t);
> field = null;
> t = null;
This does not clean up the window.setTimeout,
but only gives another [i.c. null] value
to the variable pointer t.
If the window.setTimeout would still exist,
which I doubt, it just would not be reachable anymore.
And that would make possible garbage collection later?
No I doubt that, in any reasonable javascript implementation.
However if the window.setTimeout is anonymous, as below,
the availability to garbage collection would be the same.
And anyway, a "spent" window.setTimeout,
either fired or reset, should either not need garbage collection,
or should get that independent of any useless still existing pointer.
> }, 50);
>
> and that my alternative is harmful:
>
> (function() {
> var field = …;
> window.setTimeout(function () {
> field.focus();
> }, 50);
> }());
>
> I've never seen any evidence of that. That's the context of these
> discussion. Animations are not really central to the point, just one
> example.
>
> -- Scott
>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread
Setting focus Tim Slattery <Slattery_T@bls.gov> - 2013-02-28 14:30 -0500
Re: Setting focus Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-02-28 20:50 +0100
Re: Setting focus Tim Slattery <Slattery_T@bls.gov> - 2013-02-28 16:05 -0500
Re: Setting focus Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-02-28 22:17 +0100
Re: Setting focus Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2013-02-28 23:16 +0100
Re: Setting focus Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-02-28 23:36 +0100
Re: Setting focus Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2013-03-01 08:21 +0100
Re: Setting focus Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-01 13:10 +0100
Re: Setting focus "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-02-28 23:37 +0100
Re: Setting focus Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2013-03-01 08:18 +0100
Re: Setting focus Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-01 13:12 +0100
Re: Setting focus Bernd Nawothnig <Bernd.Nawothnig@t-online.de> - 2013-03-02 15:16 +0100
Re: Setting focus Scott Sauyet <scott.sauyet@gmail.com> - 2013-03-21 20:06 -0700
Re: Setting focus Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2013-03-22 10:03 +0100
Re: Setting focus Tim Slattery <Slattery_T@bls.gov> - 2013-03-22 08:53 -0400
Re: Setting focus Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-23 15:09 +0100
Re: Setting focus Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-23 15:07 +0100
Re: Setting focus Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2013-03-24 12:38 +0100
Re: Setting focus Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-24 13:42 +0100
Re: Setting focus Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2013-03-24 13:54 +0100
Re: Setting focus Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-23 15:04 +0100
Re: Setting focus Scott Sauyet <scott.sauyet@gmail.com> - 2013-03-23 17:35 -0700
Re: Setting focus Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-24 10:41 +0100
Re: Setting focus Scott Sauyet <scott.sauyet@gmail.com> - 2013-03-24 16:42 -0700
Re: Setting focus Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-30 14:27 +0100
Re: Setting focus Scott Sauyet <scott.sauyet@gmail.com> - 2013-03-30 09:25 -0700
Re: Setting focus Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-30 19:50 +0100
Re: Setting focus Scott Sauyet <scott.sauyet@gmail.com> - 2013-03-30 17:11 -0700
Re: Setting focus Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2013-03-30 01:02 +0100
Re: Setting focus Scott Sauyet <scott.sauyet@gmail.com> - 2013-03-30 09:17 -0700
Re: Setting focus "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-03-30 17:55 +0100
csiph-web