WardCunningham/Smallest-Federated-Wiki — pull request #135 by nrn (2012-02-19 08:06:08+00:00)
Title: History

Getting my hands dirty with some client side stuff.

The first commit is an easy one, just made external links go to a new tab by default. Living with it for a while it seems to be the desired behavior for single page apps like this. Also adds safety for trailing slash in urls on client side.

The second commit is a big one. I started out trying to get hidden state out of the history. It seemed to be odd behavior that the forward and back buttons would scroll the page, and it was very hard to reason about how that information was being passed around with the history changes. So I got rid of all the stuff that was being passed around in the history state, instead relying on the dom as truth.

I also removed history.js. This change has the disadvantage of making a certain class of oldish browsers not update their urls, however it has the advantage of allowing an even broader range of browsers to navigate around the page correctly. History.js doesn't seem to be maintained anymore, and the direct history api seems to really be what we want to use in the future. I think the trade off for a more graceful degradation instead of pollyfilling just for mid-old browsers is a good one.

So I hope this achieves my initial goal of making this part of the code easier to reason about, it seems to from my perspective, but that may just be because I wrote it :)