[whatwg] <a onlyreplace>

Tab Atkins Jr. jackalmage at gmail.com
Fri Oct 16 14:29:36 PDT 2009


On Fri, Oct 16, 2009 at 4:10 PM, Markus Ernst <derernst at gmx.ch> wrote:
> Yes it looks like an AJAX killer.

Well, for a particular common, useful pattern.  AJAX will still be
alive and well for solving more general classes of problems.

> Actually the problem I mentioned for Aryehs first proposal remains - still,
> a web designer could go wrong, for example when making a static website by
> changing another one he/she has made earlier:
>
> The body of page1.html could look like:
>
> <div id="pageHeader">Recipies for vegetarians</div>
> <div id="content">
>  <h1>Lovely broccoli</h1>
>  <p>Take the broccoli and do the following:</p>
>  ...
> </div>
> <ul id="navigation">
>  <li><span>Broccoli</span></li>
>  <li><a href="page2.html" onlyreplace="content">Leak</a></li>
> </ul>
>
> The body of page2.html:
>
> <div id="pageHeader">Recipies for meat eaters</div>
> <div id="content">
>  <h1>Lovely leak</h1>
>  <p>Take the leak and do the following:</p>
>  ...
> </div>
> <ul id="navigation">
>  <li><a href="page1.html" onlyreplace="content">Broccoli</a></li>
>  <li><span>Leak</span></li>
> </ul>
>
> Note that the author forgot to change the page header of the meat eaters
> site he/she had used as raw material. The author will test the site and
> always see it correctly, while someone who comes from a deep link will see
> the meat eaters header.
>
> Anyway I think that this error is much less likely to be made with the <a
> onlyreplace> solution. In many cases, such as template-based CMS sites, the
> static elements are made in one place only, anyway. I think this is a
> problem we could live with, in view of the benefits that this solution
> brings.

Ah, right, that is a potential issue.  A non-obvious change that can
missed even by an author doing proper checks.

Still, as you say, most sites these days are produced by CMSes that
centralize the static template, so a change in one place would be
properly reflected everywhere.

(Also, in your examples you probably want @onlyreplace="content
navigation", since your nav is changing from page to page as well.
That's a bug that would be found out immediately, though.)

~TJ


More information about the whatwg mailing list