mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Enable the unicorn/prefer-dom-node-append
ESLint plugin rule
This rule will help enforce slightly shorter code, especially since you can insert multiple elements at once, and according to MDN `Element.append()` is available in all browsers that we currently support. Please find additional information here: - https://developer.mozilla.org/en-US/docs/Web/API/Element/append - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-dom-node-append.md
This commit is contained in:
parent
d7122becaf
commit
8129815538
39 changed files with 200 additions and 202 deletions
|
@ -43,7 +43,7 @@ function buildSVG(viewport, textContent) {
|
|||
text.setAttribute("transform", "matrix(" + tx.join(" ") + ")");
|
||||
text.setAttribute("font-family", style.fontFamily);
|
||||
text.textContent = textItem.str;
|
||||
svg.appendChild(text);
|
||||
svg.append(text);
|
||||
});
|
||||
return svg;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ async function pageLoaded() {
|
|||
const textContent = await page.getTextContent();
|
||||
// building SVG and adding that to the DOM
|
||||
const svg = buildSVG(viewport, textContent);
|
||||
document.getElementById("pageContainer").appendChild(svg);
|
||||
document.getElementById("pageContainer").append(svg);
|
||||
// Release page resources.
|
||||
page.cleanup();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue