You are working in a complex space. There is the DOM, there is JQuery, and then there is JSTree. When reading all of the stack overflow answers, there always appear to be multiple ways of doing things.
They publish a long list of functions, but there is no documentation of the internal object model. Sure the functions all work great, but hard to understand a long list of functions, and without an internal object model, hard to understand what is going on inside.
The problem is deeper than just the model. I would argue that the design of the software is fundamentally broken. You cannot ask a node object for an array of child ids. You end up getting an array of child names (strings), and have to call a function to get the actual node object. So you are dealing with a mix of string names, and ids. Worse yet, sometimes you get a DOM object. Quite confusing.
Why is it this way? I do not exactly know. My guess is that they have to service relational databases where a table will have a parent record. So they load up all of the records, keeping the parent objects string id. Then they scan through it, assigning the children string ids to each parent. They should be using object ids instead of string ids. They got their object model wrong. This just makes the whole software too complicated.
I am ready to change to something cleaner, more transparent, more easily modified, but I do not know what to change to.