News for hackers. Stuff that matters.
Re:Airbnb Releases Infinity.js: A Javascript Library for Smo... by reissbaker on Friday August 17, 2012 @02:27AM (#4395327)
Just one trick, although I use it in both the on and off demos to keep everything fair: I'm adding elements in smaller batches of 70 rows per tick of execution (arbitrary number), and then using a setTimeout to wait a few milliseconds before adding more. The demo loads a tooon of elements upfront -- much more than an ordinary site would -- and Firefox would sometimes complain if I loaded 400 rows of pugs at a single time. Chrome, of course, had no complaints, and IE was surprisingly fine as well.
Re:Airbnb Releases Infinity.js: A Javascript Library for Smo... by hueyp on Friday August 17, 2012 @02:35AM (#4395340)
And from the comment above:

"...but because there are fewer elements in the DOM tree, relayouts are cheaper as well"

If I understand, this also applies? When I add the 400th (or whatever) ListItem it does trigger a layout when its added to the dom (to calculate its dimensions) but its much faster due to only having the currently viewable ListItems contained in the ListView?

Thanks again!

Re:Airbnb Releases Infinity.js: A Javascript Library for Smo... by reissbaker on Friday August 17, 2012 @02:39AM (#4395345)
HN won't let me reply to your last comment -- nesting got too deep, maybe? -- but yup. Relayouts are less expensive as well.