silverstripe/sapphire — pull request #497 by chillu (2012-05-30 14:40:10+00:00)
Title: #7176: Multi-fragment loading for PJAX in CMS

See http://open.silverstripe.org/ticket/7176

The commits aren't entirely isolated, but I figured the step-by-step commits show the changes better (no move+edit which is hard to review).

* The PJAX fragment identifiers are separate from HTML id or class attributes. This adds a bit of definition overhead, but makes their purpose clearer. Worth the tradeoff?
* Are you OK with the "fragment" terminology? Sam suggested this originally. Alternatives would be "region" or "section", I guess. "Partial" is too overloaded with template rendering meaning already.
* Do you think it OK to send JSON back even if only a single fragment is requested? If we send back HTML it undermines the PJAX logic, because it relies on the client selector assumptions when the request is sent, even if the server decides to return a different fragment.
* Removed `` style, you have to set a PJAX fragment now. Same for the removed `data.selector` argument to `loadPanel()`. IMHO that's acceptable because its just a shortcut anyway, you can create your own replacement logic without PJAX with standard $.ajax().
* You can declare a DOM element with multiple PJAX sections, e.g. `

`. That's analogous with the duplicate entwine roles, e.g. `

`. A bit confusing, and makes node selection more tricky, but don't see a way around this since the DOM hierarchy is determined by jsLayout (no "intermediate" wrapper nodes without their own layout).