SitePen/dgrid — Issue #85: DOMException when rendering the grid multiple times within a short amount of time
Author: swiftdemise
Created: 2012-02-15 17:16:27+00:00
State: open

This is probably the same issue as: https://github.com/SitePen/dgrid/issues/81

If you go to http://sitepen.github.com/dgrid/dgrid/test/JsonRest.html and type this into the console:

for (var i = 0; i < 10; i++) {
grid.refresh();
}

you'll get flooded by DOMExceptions.

I've temporarily "fixed" this by modifying whenDone() in renderArray() of dgrid/List.js to look like this:

function whenDone(resolvedRows){
// Fix for DOMExceptions caused by querying the grid too fast
try {
(beforeNode && beforeNode.parentNode || self.contentNode).insertBefore(rowsFragment, beforeNode || null);
lastRow = resolvedRows[resolvedRows.length - 1];
lastRow && self.adjustRowIndices(lastRow);
} catch (exception) {
if (!exception instanceof DOMException) {
console.error(exception);
}
}
return rows = resolvedRows;
}

I have a feeling this might lead to memory leaks. Hopefully someone can come up with a better solution!