Add cacheContents option to enable/disable storing of DOM contents in hi...

The default behavior of caching and restoring the container’s .contents() is incompatible with certain libraries, such as chosen.js and highcharts. The problem is that the restored content no longer has its event bindings.

As an example, chosen.js is unfortunately not idempotent. When called, it replaces select’s with nice-looking div’s, which serve as proxies to the original selects.

Those div’s are what gets cached and restored by pjax to the DOM, but their mousedown events are lost. Calling chosen on those previously-processed DOM does not re-establish those events, so one sees the nice-looking div’s but they don’t have their behavior.

It should therefore be optional to have the contents restored from history, as we cannot assume that such behavior is always desirable.