mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 09:20:06 +02:00
Replace the remaining Node.removeChild()
instances with Element.remove()
Using `Element.remove()` is a slightly more compact way of removing an element, since you no longer need to explicitly find/use its parent element. Furthermore, the patch also replaces a couple of loops that're used to delete all elements under a node with simply overwriting the contents directly (a pattern already used throughout the viewer). See also: - https://developer.mozilla.org/en-US/docs/Web/API/Node/removeChild - https://developer.mozilla.org/en-US/docs/Web/API/Element/remove
This commit is contained in:
parent
e4f97a2a91
commit
4ef1a129fa
6 changed files with 9 additions and 14 deletions
|
@ -462,9 +462,7 @@ const Stepper = (function StepperClosure() {
|
|||
var Stats = (function Stats() {
|
||||
let stats = [];
|
||||
function clear(node) {
|
||||
while (node.hasChildNodes()) {
|
||||
node.removeChild(node.lastChild);
|
||||
}
|
||||
node.textContent = ""; // Remove any `node` contents from the DOM.
|
||||
}
|
||||
function getStatIndex(pageNumber) {
|
||||
for (let i = 0, ii = stats.length; i < ii; ++i) {
|
||||
|
@ -490,8 +488,7 @@ var Stats = (function Stats() {
|
|||
}
|
||||
const statsIndex = getStatIndex(pageNumber);
|
||||
if (statsIndex !== false) {
|
||||
const b = stats[statsIndex];
|
||||
this.panel.removeChild(b.div);
|
||||
stats[statsIndex].div.remove();
|
||||
stats.splice(statsIndex, 1);
|
||||
}
|
||||
const wrapper = document.createElement("div");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue