bryntum / support

An issues-only repository for the Bryntum project management component suite which includes powerful Grid, Scheduler, Calendar, Kanban Task Board and Gantt chart components all built in pure JS / CSS / TypeScript
https://www.bryntum.com
54 stars 6 forks source link

EventHelper.onTransitionEnd calls its handler using `globalThis` if `globalThis.callback` exists #9754

Closed ExtAnimal closed 2 months ago

ExtAnimal commented 3 months ago

Forum post

The code which executes the callback just checks for presence of thisObj.callback. If that exists on window, then it will be called.

We should only use that is the thisObj is an instance of our Base class:

Should be

            doCallback        = () => {
                detacher();
                if (!thisObj.isDestroyed) {
                    if (thisObj.$meta?.class.isBase) { // <-- The fix. If it is an instance of our Base class
                        thisObj.callback(handler, thisObj, callbackArgs);
                    }
                    else {
                        handler.apply(thisObj, callbackArgs);
                    }
                }
            },