Wiki has become rather twisty with key logic spread all over. We'll be straightening it out over a period of months.
DOM based spaghetti is common with many single page applications that have grown up around jQuery. There are many suggestions of the way forward. Most involve starting over with someone else's spaghetti. We've tried that twice without success.
After several failed attempts to rationalize the core module responsibilities I realized that importing wiki was the source of many dependency cycles. In a heroic all night refactor all core modules were made to import from each other and export to wiki. The number of modules doubled. github
Two days of code reading have lead me to a plan captured in issue #19. Key components and interactions are captured in a diagram that we'll keep updated. github
Lineup. We'll connect the DOM and the pageObjects by fabricating random keys. The lineup manages keys for a row of visible pages. A single object can appear multiple times, always with a new key.
Become. A click to a non-existent page opens a "future" which promises to become the page you want. It might be pristine empty page, or it might be a clone of some template. This is the first case were we actually use the lineup to find and transform a pageObject.
Pete Hodgson and I had a go at incrementally introducing a pageObject. This proved to be a difficult step taking months to find obscure bugs. However, with it in place, further refactoring becomes easier.
Pete Hodgson and I explored Models for SFW at a CRC level. In retrospect I can see that I was most concerned with the computational model. Pete, the basic representation and separation of concerns.
Pete also had a go at a Backbone implementation but didn't find it satisfying work except when commuting on the train.