From a80fcb9463313b2a5efd9db184ba0efea134dd9f Mon Sep 17 00:00:00 2001 From: nod_ <nod_@598310.no-reply.drupal.org> Date: Wed, 29 Jan 2025 10:06:57 +0100 Subject: [PATCH] Issue #3502664 by tom konda: Some of comparison with Node.nodeType uses magic number --- core/misc/position.js | 5 +++-- core/misc/tableselect.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/misc/position.js b/core/misc/position.js index f9821b96cbac..347482aa9e9c 100644 --- a/core/misc/position.js +++ b/core/misc/position.js @@ -50,7 +50,7 @@ function getDimensions(elem) { const raw = elem[0]; - if (raw.nodeType === 9) { + if (raw.nodeType === Node.DOCUMENT_NODE) { return { width: elem.width(), height: elem.height(), @@ -351,7 +351,8 @@ const withinElement = $(element || window); const isWindow = !!withinElement[0] && withinElement[0] === withinElement[0].window; - const isDocument = !!withinElement[0] && withinElement[0].nodeType === 9; + const isDocument = + !!withinElement[0] && withinElement[0].nodeType === Node.DOCUMENT_NODE; const hasOffset = !isWindow && !isDocument; return { element: withinElement, diff --git a/core/misc/tableselect.js b/core/misc/tableselect.js index 650dca25a987..af1fe5fe11d5 100644 --- a/core/misc/tableselect.js +++ b/core/misc/tableselect.js @@ -154,7 +154,7 @@ for (let i = from[mode]; i; i = i[mode]) { const $i = $(i); // Make sure that we're only dealing with elements. - if (i.nodeType !== 1) { + if (i.nodeType !== Node.ELEMENT_NODE) { continue; } // Either add or remove the selected class based on the state of the -- GitLab