From 491c9b4109f430370f119460dfff0cd27a927e62 Mon Sep 17 00:00:00 2001 From: Lee Rowlands <lee.rowlands@previousnext.com.au> Date: Mon, 11 Sep 2023 15:13:51 +1000 Subject: [PATCH] Issue #3291587 by joseph.olstad, lauriii, longwave: Regression fix for (if feasible) uses of the jQuery trim function to use vanillaJS --- core/misc/form.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/misc/form.js b/core/misc/form.js index 0e51d833f93d..3256a17fd82c 100644 --- a/core/misc/form.js +++ b/core/misc/form.js @@ -31,7 +31,14 @@ */ $.fn.drupalGetSummary = function () { const callback = this.data('summaryCallback'); - return this[0] && callback ? callback(this[0]).trim() : ''; + + if (!this[0] || !callback) { + return ''; + } + + const result = callback(this[0]); + + return result ? result.trim() : ''; }; /** -- GitLab