[whatwg] <a onlyreplace>

Markus Ernst derernst at gmx.ch
Mon Oct 19 01:49:47 PDT 2009


Tab Atkins Jr. schrieb:
> On Sun, Oct 18, 2009 at 12:25 PM, Aryeh Gregor <Simetrical+w3c at gmail.com> wrote:
> 
>> Some attention needs to be given to error handling.  What happens if
>> one or more of the requested id's aren't found?  Do they silently
>> fail?  If so, this could result in the link doing absolutely nothing
>> in hard-to-control situations -- like an error page that occurs
>> sporadically, say a 500.  Do they trigger a normal page load?  If so,
>> they have to wait until the entire page has loaded, which would be bad
>> user experience but hard to track down -- a long, inexplicable delay
>> followed by everything working normally.  This could be mitigated by
>> having an HTTP header to say "that id doesn't exist, load the whole
>> page instead", but it would fail in the default case (standard HTTP
>> server unaware of new feature).
>>
>> Also, what happens if some of the given id's are present, but not others?
> 
> I'll think a bit about these issues today.  I'm not sure, off the top
> of my head, what the best response is.

What do you think about:

1. Defining which ids are to be replaced:
- The list of IDs to replace is in <base> tag, as described earlier in 
this thread. <a> and <form> elements can have a boolean @onlyreplace 
attribute that specifically enables or disables the functionality for 
the element.
- If at least one of the IDs is found in the linked document, replace 
the IDs that are found. Ignore IDs that are not present in the linked 
document, or in the document that contains the link (important for 
dynamic applications, so the <head> section is not forced to know the 
state of the <body>).
- If none of the indicated IDs are found, *replace the whole page*. This 
makes it possible to prevent e.g. a wiki or forum from being 
@onlyreplaced by just using different IDs.

2. Possible further additions to the base tag:
- Explicitly exclude parts of a site from @onlyreplace, e.g.:
<base onlyreplaceExcludeDir="/wiki /forum /media/downloads">
- Explicitly specify the links that carry the onlyreplace feature:
<base onlyreplaceLinkContainers="navigation orderform">

When we add more attributes to <base> than just href and target, the 
sentence "There must be no more than one base element per document." in 
4.2.3 of the spec should maybe be removed, as for every possible 
attribute in <base> there will be a note anyway saying "If there are 
multiple base elements with [attributename] attributes, all but the 
first are ignored."


More information about the whatwg mailing list