On Mon, Dec 27, 2021 at 08:38:37AM +0900, Jean-Christophe Helary wrote: > > > > <a> is the "anchor" tag which can represent either > > the source or destination of a link (maybe confusing terminology but > > that's how the word "anchor" is/was used in the context of hypertext). > > Even if the WHATWG don't endorse it there seems to be clear precedent > > for using <a> this way. I don't feel strongly either way whether <span> > > or <a> is better but your argument against <span> seems valid. > > The accepted way to specify a target is just to use "id" in any element. It > seems to me that adding an "invisible" <a> just to set a location before the > element that is the location is adding unnecessary cruft to the html output.
This is not really the issue here. The issue here is whether to use <span> or <a> for a separate anchor. We try to avoid separate anchors and prefer using id in an element output for formatting. However I do not think that using id in any element makes sense. In some case, there is nothing to output, so no formatting element. That's the cases for which we use an invisible element to set a target. This happens for @anchor, index entries, lone @node without associated sectioning command and empty @top. I do not think that using a random nearby element would make sense. As a side note, it would also be problematic in term of code as we try to have the formatting functions redefinable by the user. This means avoid as much as possible interactions between unrelated @-commands formatting. It could be overcome, but it is another reason not to use nearby elements as target, but rather create targets when and where needed. -- Pat
