The code: http://hastebin.com/fivudaraje.coffee
When trying to run this script - the program crashes. When I ommit the inserting to the 9th child element it works fine. That tells me - that adding new subitem only works on the last created child to the root node. Is that expected behavior and I just missed to realise it? But how can I add a subitem to, let say, the 5th root element or the 9th like in the example?
Please give me a hint what I'm missing here!