[FIX] transition: no crash if added/removed quickly

This commit should fix crashes coming from transition code on nodes.
This does not impact transitions on components.

closes #637
closes #641
This commit is contained in:
Géry Debongnie
2020-02-20 13:46:00 +01:00
committed by aab-odoo
parent b00188c1ce
commit ce052e0992
3 changed files with 51 additions and 0 deletions
+7
View File
@@ -183,6 +183,13 @@ function toMs(s: string): number {
}
function whenTransitionEnd(elm: HTMLElement, cb) {
if (!elm.parentNode) {
// if we get here, this means that the element was removed for some other
// reasons, and in that case, we don't want to work on animation since nothing
// will be displayed anyway.
return;
}
const styles = window.getComputedStyle(elm);
const delays: Array<string> = (styles.transitionDelay || "").split(", ");
const durations: Array<string> = (styles.transitionDuration || "").split(", ");