Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Now let's say your data (cars) changes. Due to some interaction, a car gets added to the list.

What the above code will do is completely replace the HTML for the entire list of cars, when really all that needs to happen is appending one to the end. If the list is big, your app is now slow.

If the user has something focused or edited in that list of cars (let's say they're editing the description of one), not only is focus lost on that field now (its DOM node was completely wiped out and replaced), but the user's text they were editing is also lost.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: