aboutsummaryrefslogtreecommitdiff
path: root/js/src/util
diff options
context:
space:
mode:
authorNathan Sarang-Walters <[email protected]>2024-07-18 22:05:21 -0700
committerGitHub <[email protected]>2024-07-19 07:05:21 +0200
commit16d80a4ff7b42da57215783cc8ff85d6f0627630 (patch)
tree25ea9aacd094d819c355ab2efe8cef6dd70a2440 /js/src/util
parent74891cb3a601a2da9bd83c905c8a0166ad79d810 (diff)
downloadbootstrap-16d80a4ff7b42da57215783cc8ff85d6f0627630.tar.xz
bootstrap-16d80a4ff7b42da57215783cc8ff85d6f0627630.zip
Fix `this` reference for JavaScript functions (#38725)
Diffstat (limited to 'js/src/util')
-rw-r--r--js/src/util/index.js2
-rw-r--r--js/src/util/template-factory.js2
2 files changed, 2 insertions, 2 deletions
diff --git a/js/src/util/index.js b/js/src/util/index.js
index 2adf19e3b..c271cc536 100644
--- a/js/src/util/index.js
+++ b/js/src/util/index.js
@@ -223,7 +223,7 @@ const defineJQueryPlugin = plugin => {
}
const execute = (possibleCallback, args = [], defaultValue = possibleCallback) => {
- return typeof possibleCallback === 'function' ? possibleCallback(...args) : defaultValue
+ return typeof possibleCallback === 'function' ? possibleCallback.call(...args) : defaultValue
}
const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
diff --git a/js/src/util/template-factory.js b/js/src/util/template-factory.js
index f73589bcc..6d1532b4d 100644
--- a/js/src/util/template-factory.js
+++ b/js/src/util/template-factory.js
@@ -143,7 +143,7 @@ class TemplateFactory extends Config {
}
_resolvePossibleFunction(arg) {
- return execute(arg, [this])
+ return execute(arg, [undefined, this])
}
_putElementInTemplate(element, templateElement) {