this lib will disappear soon in favour of a new one inspired by pjax.
pushState + fetch
pjax was yesterday (and jquery dependent). pfetch is today.
This library started as an expansion of this snippet by Alex Normand.
Original source: https://github.com/alexnormand/moby-dick-demo/blob/master/chapters/js/main.js
This library left some basic problems:
- clicking an anchor's child would not send a
href
up the event bubbling chain, resulting in normal unajax'd behaviour - fetch is not used
- no graceful degradation is provided
- no 'API' with which to govern how the snippet works (config/init object to pick container element, custom timeouts, etc).
- it has been done. twice. both are solid. and big.
- as IE8 gets shut down, we don't need as much crap in a pjax offshoot, as Alex Normand's original snippet already demonstrated.
- in case the handy line
responseType = 'document'
isn't applicable (cough fetch) we use the HTML parser to polyfill it.