Skip to content

Commit

Permalink
Merge pull request #15031 from Snuffleupagus/prefer-modern-dom-apis
Browse files Browse the repository at this point in the history
Enable the `unicorn/prefer-modern-dom-apis` ESLint plugin rule
  • Loading branch information
timvandermeij authored Jun 12, 2022
2 parents 0e1e265 + 4d39898 commit 1a6ae5f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"unicorn/prefer-date-now": "error",
"unicorn/prefer-dom-node-append": "error",
"unicorn/prefer-dom-node-remove": "error",
"unicorn/prefer-modern-dom-apis": "error",
"unicorn/prefer-string-starts-ends-with": "error",

// Possible errors
Expand Down
2 changes: 1 addition & 1 deletion extensions/chromium/contentscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function updateEmbedElement(elem) {
elem.type = "text/html";
elem.src = getEmbeddedViewerURL(elem.src);
if (parentNode) {
parentNode.insertBefore(elem, nextSibling);
nextSibling.before(elem);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/display/annotation_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2559,9 +2559,9 @@ class AnnotationLayer {
if (!firstChild) {
element.append(canvas);
} else if (firstChild.nodeName === "CANVAS") {
element.replaceChild(canvas, firstChild);
firstChild.replaceWith(canvas);
} else {
element.insertBefore(canvas, firstChild);
firstChild.before(canvas);
}
}
annotationCanvasMap.clear();
Expand Down
4 changes: 2 additions & 2 deletions web/pdf_page_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ class PDFPageView {

if (lastDivBeforeTextDiv) {
// The annotation layer needs to stay on top.
div.insertBefore(canvasWrapper, lastDivBeforeTextDiv);
lastDivBeforeTextDiv.before(canvasWrapper);
} else {
div.append(canvasWrapper);
}
Expand All @@ -640,7 +640,7 @@ class PDFPageView {
textLayerDiv.style.height = canvasWrapper.style.height;
if (lastDivBeforeTextDiv) {
// The annotation layer needs to stay on top.
div.insertBefore(textLayerDiv, lastDivBeforeTextDiv);
lastDivBeforeTextDiv.before(textLayerDiv);
} else {
div.append(textLayerDiv);
}
Expand Down

0 comments on commit 1a6ae5f

Please sign in to comment.