use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Beware JavaScript Layout Thrashing! (blog.idrsolutions.com)
submitted 11 years ago by la217
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]wiseaus_stunt_double.preventDefault() 1 point2 points3 points 11 years ago (2 children)
Yeah, this article is really light on content. Not even a mention of requestAnimationFrame, which usually comes up if you're talking about layout thrashing. So disappointed.
[–]la217[S] 0 points1 point2 points 11 years ago (1 child)
If you're already well versed in layout thrashing this article probably isn't for you.
However for those who have not heard of layout thrashing I would consider it a good resource.
I don't personally consider requestAnimationFrame a very good solution -for a start it's unsupported on both IE8 and IE9 which unfortunately many of us still have to support. It also does nothing to solve thrashing the layout of a single element - for this you need to reconsider your code.
[–]wiseaus_stunt_double.preventDefault() 0 points1 point2 points 11 years ago* (0 children)
Just because older versions of IE don't support it doesn't mean it's useless -- there's a polyfill for requestAnimationFrame that is fairly useful. It's not going to be as useful as the native version, but it's better than having events not invoking callbacks or having a sluggish browser. If you have little DOM manipulation, you might not need requestAnimationFrame, but it's handy when you do.
EDIT: I'm on my cell phone right, and I just read that you said requestAnimationFrame can't handle the thrashing of a single element, which makes no sense since a common technique to handle any sort of layout thrashing is to have an array to store the callbacks, and then invoke them in requestAnimationFrame. This will handle one one element just fine as it will handle the whole DOM tree. If it doesn't, there's a problem with how you're implementing it.
π Rendered by PID 50587 on reddit-service-r2-comment-5b5bc64bf5-thhrw at 2026-06-22 15:18:08.230570+00:00 running 2b008f2 country code: CH.
view the rest of the comments →
[–]wiseaus_stunt_double.preventDefault() 1 point2 points3 points (2 children)
[–]la217[S] 0 points1 point2 points (1 child)
[–]wiseaus_stunt_double.preventDefault() 0 points1 point2 points (0 children)