Closed Bug 270926 Opened 21 years ago Closed 21 years ago

navigation fails with duplicate anchor NAMEs (works with duplicate IDs)

Categories

(Core :: DOM: HTML Parser, defect)

x86
Windows 2000
defect
Not set
minor

Tracking

()

RESOLVED INVALID

People

(Reporter: miken32, Unassigned)

Details

(Whiteboard: testcase)

Attachments

(4 files)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-CA; rv:1.7.5) Gecko/20041107 Firefox/1.0 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-CA; rv:1.7.5) Gecko/20041107 Firefox/1.0 If a page has elements with duplicate NAME attributes (not valid HTML I know) you cannot navigate to either of the elements. However, if the ID attribute is used instead, a link will take you to the first occurence of the specified ID, which I would think is the preferred behaviour. This may be the same issue demonstrated by bug 217235 but I'm not sure. Reproducible: Always Steps to Reproduce: 1.Load first test case 2.Click the link Actual Results: No navigation Expected Results: Navigates to first image
Whiteboard: testcase
You're setting the name attribute on img elements. I don't think they are valid destination anchors. See: http://www.w3.org/TR/REC-html40/struct/links.html#h-12.1.1 "Destination anchors in HTML documents may be specified either by the A element (naming it with the name attribute), or by any other element (naming with the id attribute)." So I think this bug is invalid. Note that you first example doesn't work even with one name attribute. But it does work when the named elements are anchors.
This test case shows that duplicate anchors using name do in fact work. The browser scrolls to the first occurence.
If however the first anchor among duplicates is styled not to display (display:none) then the browser does not scroll do anything with the #test link. The behaviour is clearly to scroll to the first of a set of duplicates, if that happens to be "display:none" then it gives up. A more tolerant behaviour would be to scroll to the first VISIBLE anchor among duplicates. The same problem exists with duplicate ID attributes too. If the first of the duplicates is "display:none" then the browser does nothing. Michael.
Closing per comment 3 I was under the mistaken belief that NAME and ID were largely interchangeable when it came to named anchors. The issue described in comment 4 and 5 may warrant a separate bug.
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: