From 94376c6910629f418c77c75681eb1ae0d78515a4 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Thu, 18 Jun 2020 19:19:41 +0800 Subject: [PATCH] MDL-69086 theme_boost: Improve pendingJs checks for bootstrap Where an element, like an `alert`, is closed it is removed from the DOM before the event fires (this is a correct behaviour). This means that the final event confirming that the action happened (i.e. close => closed) fires, but does not bubble up the DOM to the document.body. This change moves the end event listener to only be added after a start event has been fired, and to attach directly to the HTMLElement where it will be fired. This means that the Event handler will still be called, even though it has been removed from the DOM, because it does not need to bubble up to the body. --- theme/boost/amd/build/pending.min.js | Bin 2107 -> 2104 bytes theme/boost/amd/build/pending.min.js.map | Bin 4980 -> 5016 bytes theme/boost/amd/src/pending.js | 8 ++++---- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/theme/boost/amd/build/pending.min.js b/theme/boost/amd/build/pending.min.js index 3630be6a88f8a8d954987146ec7e23982277c974..8aff8447a5054dbd3b4da23f6b03469bf8d4781e 100644 GIT binary patch delta 67 zcmdljutQ+O9CqVG&1zr0(vr*^y{zK+g4Dc}%)E4s6isUl1Dzzjl+?7u(wq`ajYPeY X#G>@n5>37Qywu58*tI7AVYdeWD~K2U delta 35 rcmdlXuv=im9QMh#*?G7NQu9(W^U^g^G;1g4vnx%$z^*y@H@htW@XZYx diff --git a/theme/boost/amd/build/pending.min.js.map b/theme/boost/amd/build/pending.min.js.map index 09b04e7ca1750c7b23c94cf023a3d642989daef5..1d1b9b99f52685adc6726f61e15be4970da1ab04 100644 GIT binary patch delta 258 zcmeyOHbZ>_FC$~>WG+T&o|43(^wbh19i{xd)XhqaJ*;BEj*gDrI?j%c&LF}QNH~`` zJ5S!prdS^U63KDWadmWd)Jb-9^asg8)H!?V_&Pd<0Hqu=ot$;t9UZfrK$3+{At0&< z%+Yqz33YVz1qwK4IV0?FcGmH9baVr$1DY7_=m@qa*C`Ank_Xc1>;WX)_+5acJBaB6 zV)<{*WEbHE`lDXRQ9=O-vI0v}iz+oz^&p8O+J=;-e}xt~qNA0+Bn1ybOc>#PIQUgYcv5^)9-&N`lsj&2~PzpGBTqhkPAu@jie zLpIvk(S36py9oE>|3Z?JWrVpV?-5d%93#v>xll-H@-HDdpqTb#Z(-ia*}}R2$M7?( diff --git a/theme/boost/amd/src/pending.js b/theme/boost/amd/src/pending.js index 4b3a5480fef..ad036d4f11f 100644 --- a/theme/boost/amd/src/pending.js +++ b/theme/boost/amd/src/pending.js @@ -121,13 +121,13 @@ export default () => { pairs.forEach(pair => { const eventStart = `${pair.start}.bs.${key}`; const eventEnd = `${pair.end}.bs.${key}`; - jQuery(document.body).on(eventStart, () => { + jQuery(document.body).on(eventStart, e => { M.util.js_pending(eventEnd); + jQuery(e.target).one(eventEnd, () => { + M.util.js_complete(eventEnd); + }); }); - jQuery(document.body).on(eventEnd, () => { - M.util.js_complete(eventEnd); - }); }); }); }; -- 2.43.0