Defect #27728
closed
Internal wiki anchors with "name" are deprecated and don't work with last Chrome versions
Added by Mattia Gentilini over 7 years ago.
Updated over 7 years ago.
Description
When I create a heading in a Redmine wiki page, it is rendered as such:
<a name="Heading-title"></a>
Using name
attribute to create fragment HTML anchors is deprecated; Furthermore, current Chrome versions do not support linking to this, so the TOC links don't work. These anchors should be created using id
attribute instead, better if added to the <h1>
, <h2>
... tag without creating an empty <a>
tag.
I can't determine which Redmine version I'm using so I don't know if this is fixed in a newer release.
Testing this with both Chrome stable (currently version 62) and Chrome Canary (currently version 65) in macOS, everything seems to work as before, that is: the links work fine. In addition to that, I found no mention of the ability to link to <a name="title">
anchors being removed from Chrome. Do you have an authoritative source for that? It appears all modern browsers support the name
attribute even in HTML5.
In general, while creating anchors with this technique might not be done often now, it has the advantage that we are not polluting our global ID namespace with user-defined content. Since the IDs are important for the interaction of our JavaScript with the DOM, if we were to change the anchors to use IDs instead, we would have to be very careful not to introduce name clashes with internal IDs. Doing this generically would probably mean that about all existing anchors would have to change which would be a rather large compatibility burden for our users.
Testing this with both Chrome stable (currently version 62) and Chrome Canary (currently version 65) in macOS, everything seems to work as before
You're right about that, I see that the Redmine used here works fine in Chrome with name
attribute, but it doesn't work in our 3.3.0 installation (on Chrome, while on Firefox it works), can you have some possible explanations to this? It started to happen at some point in time, I don't think there was a Redmine update when this started.
Also, the bug happens in normal page rendering but not in preview mode, i.e. anchors shown in view mode work fine.
In general, while creating anchors with this technique might not be done often now, it has the advantage that we are not polluting our global ID namespace with user-defined content. Since the IDs are important for the interaction of our JavaScript with the DOM, if we were to change the anchors to use IDs instead, we would have to be very careful not to introduce name clashes with internal IDs. Doing this generically would probably mean that about all existing anchors would have to change which would be a rather large compatibility burden for our users.
I understand your point, the #ID
DOM selector gets id
attribute and not name
attribute so using id
would cause name clashing.
- Status changed from New to Resolved
This is getting weirder and weirder... Just upgraded to the newly-published Chrome 63, the links work. I'll check Chrome Changelog to see the differences.
- Status changed from Resolved to Closed
- Resolution set to Invalid
Also available in: Atom
PDF