Regarding your concern, I have not used the API. As per the documentation, there are 2 ways to initialise the bootstrap toggle, First Initialise with HTML and second with Code.
In our case, Initialisation with HTML is not possible as we render the backform controls runtime, So, I have used the other option.
Also, the main issue of slow rendering which has been solved through this implementation. The browser hanging issue is due to Backbone collection reset method and I am working on that part with another RM, https://redmine.postgresql.org/issues/3664.
I agreed to that, that's why I wrote when not in edit mode : )
With API mode, we are performing DOM operation on each individual instance (specially in Subnode/Backgrid) which I think we should avoid when we are just displaying to the user.
I agree - it was my concern with the earlier switch control as well.
I was thinking of using switch control based on complete CSS.
1) Do we need to add "editor" class to switch control in backgrid when changing. For eg. in tables->columns if I change not null switch, it adds editor class which makes hover background white. Plus, leaving the switch does not remove editor class. I think we can skip adding editor, what do you think?
This issue was old, not due to my patch but I have fixed it.
2) In Login roles, Create trigger dialogs switch control colors are different. Below is screenshot,
Fixed
3) In Create cast dialog switch control is smaller and so clipping text. Below is screenshot,
Fixed
4) You've removed unnecessary switch control template codes at most places. I would suggest doing the same for Backform.CustomSwitchControl in trigger.js
Done
5) Feature tests are still using bootstrap-switch classes and so failing.