[whatwg] <a onlyreplace>
Nelson Menezes
flying.mushroom at gmail.com
Sun Oct 18 08:07:15 PDT 2009
2009/10/18 Tab Atkins Jr. <jackalmage at gmail.com>:
> On Sun, Oct 18, 2009 at 6:45 AM, tali garsiel <t_garsiel at hotmail.com> wrote:
>> It seems the browser will need to make a distinction between a regular request and a request invoked by a bookmark.
>> In case of a bookmark the server should not strip content so the browser must let him know that.
>
> There's no need to make a distinction. Only requests with onlyreplace
> semantics trigger the special behavior. Typing an address into your
> browser won't add those semantics, nor will a bookmark; only links
> with @onlyreplace (or links on a page with <base onlyreplace> that
> don't override their own @onlyreplace with the empty string) carry the
> semantics.
I guess the <base> @onlyreplace would probably be an important part of
making this truly useful. There might be too many maintainability
problems stemming from having @onlyreplace all over the place on links
(imagine having 5 sections on the page that need updating and dozens
of links... and then adding a 6th section).
>> In a single page application AJAX updates can be originated in 2 roots:
>> 1. The user clicks something in the navigation panel
>> 2. The user clicks an action button inside the content panel
>>
>> An example of use case #2 can be clicking a "save" button.
>> In this case the "<a>" tag is usually not used but a button, this means that other tags the "<a>" should have the "onlyreplace" attribute.
>
> I thought it would be interesting to be able to put @onlyreplace on
> forms, or perhaps form submission inputs.
The two traditional triggers for navigation are anchors <a> and <form>
submissions. The @onlyreplace semantics should not be available
anywhere else since that would be changing the semantics of
non-navigation elements. Any custom UI wizardry should be handled by
Javascript, and the semantics of @onlyreplace would be available via
something like window.location.assignOnlyReplace(url, [ids]);
>> In this example the URL should not be remembered by the history.
>
> Then you should use ordinary AJAX to do so. @onlyreplace is supposed
> to be merely an optimization on normal navigation. The url *must* be
> remembered by the history.
Agreed, as above.
I wonder, though, if there might be a problem with this after all...
picture this:
...
<a onlyreplace="div1 div2" href="ingredients.html">Ingredients</a>
<a onlyreplace="div2" href="nutrition.html">Nutrition</a>
<a onlyreplace="div3" href="preparation.html">Preparation</a>
...
<div id="div1"></div>
<div id="div2"></div>
<div id="div3"></div>
...
Let's say I click the links in order (Ingredients, Nutrition,
Preparation), and now bookmark the page (it's now preparation.html).
When I return to it, #div1 and #div2 will only be populated if
preparation.html is guaranteed to contain the same content as the
other two documents. There are a lot of testing paths to guarantee
that's the case... does this make the mechanism too fragile?
Nelson Menezes
http://fittopage.org
More information about the whatwg
mailing list