New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
List.js L419 #1
Comments
Ah, good point! Thanks for the heads up. Will add it as soon as possible. I'm trying to focus pretty much at performance, mainly to be able to handle really large list, so all tips are valuable! |
I've been thinking about this for I while and have come to the conclusion that even if innerHTML is less good for performance, it's still needed because the values could sometimes be html-content. E.g. images. |
At the very least provide the option that detects of the argument is a string or an object, and in the case of the latter extend the function to accept a dom fragment and append the node in, that way you can fully support the entire dom, rather than limit users who can write dom-methods and those who don't understand the API to write strings. This way you haven't forced those who can write faster code into a corner, but you've allowed those who work with strings to do what they want. |
Hmm, maybe! Performance is important, but I do not want to put too much options into the script and there by make it more complicated to understand. I will look in to the possibility of adding this function! |
https://github.com/javve/list/blob/master/src/list.js#L419
You can speed it up using native DOM methods, rather than innerHTML. Presently you're demanding the DOM be interpreted as a string and causing the browser to do a lot of re-rendering work, innerHTML is bad for performance, but will assassinate performance when inside a loop.
I'd suggest using text nodes or DOM fragments:
https://developer.mozilla.org/En/DOM/DocumentFragment
You have the opportunity to improve speed where you get the values as well: https://github.com/javve/list/blob/master/src/list.js#L410
The text was updated successfully, but these errors were encountered: