meekostuff / HTMLDecor

HTMLDecor means full separation of content from presentation. With CSS you can change the styling of a whole site with one stylesheet. With HTMLDecor you can change everything - banner, navbars, ads, page-layout and stylesheets. This facilitates API-first / HTML-payload sites which are simple, robust and low-bandwidth, plus "pushState assisted navigation" comes for free.
http://meekostuff.net/projects/HTMLDecor/
Mozilla Public License 2.0
23 stars 4 forks source link

pushState() assisted navigation doesn't cover form-submission #3

Open shogun70 opened 12 years ago

shogun70 commented 12 years ago

Currently panning isn't implemented for form submission, because HTMLDecor doesn't intercept submit events.

shogun70 commented 12 years ago

If the request is:

  1. HTTP GET, and the decor of the response page is: a. the same as that of the current page, then handle withhistory.pushState() b. different to the current page, then the response can be cached so handle with location.assign(). (But are GET requests with a query typically tagged as cacheable?)
  2. HTTP POST, and the decor of the response page is: a. the same as that of the current page, then handle with history.pushState() b. different to the current page, then the response cannot be cached, so would have to trigger a normal browser form-submit which would incur another request.

There is no way to detect in advance whether HTTP POST is a) or b), so just ignore it for now. Could fix HTTP GET, but not sure how often caching is enabled for GET form handling.

shogun70 commented 12 years ago

An alternative is to modify HTMLDecor to replace the current decor as well as real content when requested content doesn't have matching decor.

Probably this should be opt-in behavior.

shogun70 commented 11 years ago

As of 2.0.x.5, HTMLDecor handles <form method="GET"> by generating a URL based on @action and the form's input values and then performs normal panning to that page.

Other @methods are not handled by HTMLDecor and will default to the browsers standard behavior. Users of the library are encourage to use AJAX to handle these.