So, I read that jQuery uses document fragments inside to make rendering faster. But I am wondering if anyone knows if jQuery can use createDocumentFragment in this situation when I add img elements to the DOM using each loop?
var displayArray = []; // Lots of img elements $.each(displayArray, function() { $('#imgSection').append(this); });
Or will I need to use this code to reduce the number of browser clicks?
var displayArray = []; // Lots of img elements var imgHolder = $('<div/>'); $.each(displayArray, function() { imgHolder.append(this); }); $('#imgSection').append(imgHolder);
In addition, displayArray is populated with other code, not shown here, that creates img elements based on paths in the JSON file.
Thanks for any advice.
source share