aboutsummaryrefslogtreecommitdiff
path: root/js/src
diff options
context:
space:
mode:
authorGeoSot <[email protected]>2021-07-20 17:20:43 +0300
committerGitHub <[email protected]>2021-07-20 17:20:43 +0300
commit5541179b387ed8a1b5e457aeb47a35e6e7c62d4a (patch)
tree21cedc64f3ff71b06b029aea72dc46f7eedb9789 /js/src
parent365b9e5af0fac2a3d92e3ad17dbeb8d31a08baf5 (diff)
downloadbootstrap-5541179b387ed8a1b5e457aeb47a35e6e7c62d4a.tar.xz
bootstrap-5541179b387ed8a1b5e457aeb47a35e6e7c62d4a.zip
Fix `Util.reflow` function and add documentation (#34543)
* add documentation to reflow function * refactor to void as it should be Co-authored-by: XhmikosR <[email protected]>
Diffstat (limited to 'js/src')
-rw-r--r--js/src/util/index.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/js/src/util/index.js b/js/src/util/index.js
index a1af87aa4..f81d64837 100644
--- a/js/src/util/index.js
+++ b/js/src/util/index.js
@@ -188,7 +188,18 @@ const findShadowRoot = element => {
const noop = () => {}
-const reflow = element => element.offsetHeight
+/**
+ * Trick to restart an element's animation
+ *
+ * @param {HTMLElement} element
+ * @return void
+ *
+ * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation
+ */
+const reflow = element => {
+ // eslint-disable-next-line no-unused-expressions
+ element.offsetHeight
+}
const getjQuery = () => {
const { jQuery } = window