COTG mimic save and restore

Hiya all,

Currently I am redesigning our COTG forms to make better use of everything. A large part of it was the fact that input information was not always nice stored after they first opened the form. (The root cause laid in the fact we heavily use jQuery in order to make it look pretty… ;-)).

I as a developer am creating the forms outside COTG in order to make it more testable (and making it easy using NPM and sorts…)

I created a mimic script to mimic the save and restore functionality within COTG:
https://gist.github.com/NoxxieNl/3970b23f984362467b442055ea9c9059

My question is, is the mimicing correctly or am I missing something here. (it works as I hope it does, however i am hoping I am not missing out on something).

I know not every COTG element is included for the fill / clear functionality. And maybe not all input elements are refilled on restore event.

The save/restore portion of COTG has been siginificantly improved over the last several versions, so managing those operations manually should no longer be required.