Stop looping over childNodes
, in PDFThumbnailView.reset
, when removing the thumbnail
A loop is less efficient than just overwriting the content, which is what we've generally been using (for years) in other parts of the code-base (see e.g. `BaseViewer` and `PDFThumbnailViewer`).
This commit is contained in:
parent
8ea83f7030
commit
32a00b9b2b
@ -181,10 +181,7 @@ class PDFThumbnailView {
|
||||
|
||||
this.div.removeAttribute("data-loaded");
|
||||
const ring = this.ring;
|
||||
const childNodes = ring.childNodes;
|
||||
for (let i = childNodes.length - 1; i >= 0; i--) {
|
||||
ring.removeChild(childNodes[i]);
|
||||
}
|
||||
ring.textContent = ""; // Remove the thumbnail from the DOM.
|
||||
const borderAdjustment = 2 * THUMBNAIL_CANVAS_BORDER_WIDTH;
|
||||
ring.style.width = this.canvasWidth + borderAdjustment + "px";
|
||||
ring.style.height = this.canvasHeight + borderAdjustment + "px";
|
||||
|
Loading…
x
Reference in New Issue
Block a user