mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-22 06:13:36 -07:00
Update patch to avoid Mootools
This commit is contained in:
parent
a229f9b2d1
commit
4cbc89ec4f
1 changed files with 14 additions and 5 deletions
|
@ -44,14 +44,23 @@ window.qBittorrent.MonkeyPatch ??= (() => {
|
||||||
const patchMootoolsDocumentId = () => {
|
const patchMootoolsDocumentId = () => {
|
||||||
// Override MooTools' `document.id` (used for `$(id)`), which prevents it
|
// Override MooTools' `document.id` (used for `$(id)`), which prevents it
|
||||||
// from allocating a `uniqueNumber` for elements that don't need it.
|
// from allocating a `uniqueNumber` for elements that don't need it.
|
||||||
// This is also more efficient than the original.
|
// MooTools and MochaUI use it internally.
|
||||||
document.id = el => {
|
|
||||||
switch (typeOf(el)) {
|
if (document.id === undefined)
|
||||||
|
return;
|
||||||
|
|
||||||
|
document.id = (el) => {
|
||||||
|
if ((el === null) || (el === undefined))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
switch (typeof el) {
|
||||||
|
case "object":
|
||||||
|
return el;
|
||||||
case "string":
|
case "string":
|
||||||
return document.getElementById(el);
|
return document.getElementById(el);
|
||||||
case "element":
|
|
||||||
return el;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue