Jemt / Fit.UI

Fit.UI is a JavaScript based UI framework built on Object Oriented principles
http://fitui.org
GNU Lesser General Public License v3.0
19 stars 7 forks source link

TypeScript definitions: Control events might receive null #137

Open FlowIT-JIT opened 2 years ago

FlowIT-JIT commented 2 years ago

Control events such as OnChange and OnBlur might receive null instead of a reference to the given control, if the control is disposed from another OnChange or OnBlur event handler.

Either the typescript definition should be updated to reflect this, disposing controls during event execution should be handled differently (e.g. postponed until all event handlers have been executed or by passing the control even though it has been disposed), or event execution should simply be stopped.

FlowIT-JIT commented 2 years ago

Actually event handlers do not receive null - but they might receive a control instance which has been destroyed, in which case it won't work. We can check whether a control has been disposed like this: var disposed = sender.GetDomElement() === null