BenLalor / LTS_ComplianceSoftware_VanillaJavascript

https://lts-vanillajs.azurewebsites.net/
0 stars 0 forks source link

Replace Mutation Observer With Event Listener #82

Open BenLalor opened 1 year ago

BenLalor commented 1 year ago

Mutation Observers do much better at reacting when anything is changed. When we use event listeners, we need to call the function from all possible locations, but when we use event listeners, it changes the value whenever anything else is changed. For example, C03 uses an event listener, and when F03 is changed via the reset button, C03 is also changed even though we didn't call the C03 function on an event listener for the rest button. However, there may be significant performance issues with mutation observers, so you will need to gauge that in your decision.

BenLalor commented 12 months ago

Contrary to the comment above, all fields are not input with readonly as needed, so event listener works better.