Skip to content

Commit e2b378b

Browse files
authored
fix(Navigation_popups): replace querySelector with getElementById (qiuwenbaike#1770)
* fix(Navigation_popups): replace querySelector with getElementById
1 parent c12e751 commit e2b378b

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

dist/Navigation_popups/Navigation_popups.js

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Navigation_popups/modules/core.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable unicorn/prefer-query-selector */
12
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
23
// @ts-nocheck
34
import {api} from './api';
@@ -204,7 +205,7 @@ const popups = () => {
204205
if (lTitle.toString(true) !== aTitle.toString(true)) {
205206
return false;
206207
}
207-
let el = document.querySelector(`#${anch}`);
208+
let el = document.getElementById(`${anch}`);
208209
while (el && typeof el.nodeName === 'string') {
209210
const nt = el.nodeName.toLowerCase();
210211
if (nt === 'li') {
@@ -1574,10 +1575,10 @@ const popups = () => {
15741575
};
15751576
Insta.dump = function (from, to) {
15761577
if (typeof from === 'string') {
1577-
from = document.querySelector(`#${from}`);
1578+
from = document.getElementById(`${from}`);
15781579
}
15791580
if (typeof to === 'string') {
1580-
to = document.querySelector(`#${to}`);
1581+
to = document.getElementById(`${to}`);
15811582
}
15821583
to.innerHTML = this.convert(from.value);
15831584
};
@@ -3253,7 +3254,7 @@ const popups = () => {
32533254
// console.error('[Popups] popupId is not defined in setPopupHTML, html='+str.substring(0,100));
32543255
popupId = pg.idNumber;
32553256
}
3256-
const popupElement = document.querySelector(`#${elementId}${popupId}`);
3257+
const popupElement = document.getElementById(`${elementId}${popupId}`);
32573258
if (popupElement) {
32583259
if (!append) {
32593260
popupElement.innerHTML = '';
@@ -3427,7 +3428,7 @@ const popups = () => {
34273428
const popTipsSoonFn = (id, when, popData) => {
34283429
when ||= 250;
34293430
const popTips = () => {
3430-
setupTooltips(document.querySelector(`#${id}`), false, true, popData);
3431+
setupTooltips(document.getElementById(`${id}`), false, true, popData);
34313432
};
34323433
return () => {
34333434
setTimeout(popTips, when, popData);
@@ -5537,7 +5538,7 @@ const popups = () => {
55375538
}
55385539
let dragHandle;
55395540
if (handleName) {
5540-
dragHandle = document.querySelector(`#${handleName}`);
5541+
dragHandle = document.getElementById(`${handleName}`);
55415542
}
55425543
dragHandle ||= this.mainDiv;
55435544
const self = this;

0 commit comments

Comments
 (0)