Closed Bug 201418 Opened 23 years ago Closed 23 years ago

XHTML, nested anchors and :visited / :link

Categories

(Core :: CSS Parsing and Computation, defect)

x86
Windows 98
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 127903

People

(Reporter: ernestcline, Assigned: dbaron)

References

Details

User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.3) Gecko/20030312 Build Identifier: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.3) Gecko/20030312 In HTML, nested anchors cannot occur. In XHTML1, they should not occur, but the XML grammar cannot prohibit them from occurring. In the case of nested anchors, Mozilla chooses to only allow linking from the outer link, which is a reasonable interpretation of how to handle that. However, formatting for :visited is applied based on whether the inner and not the outer anchor has been visited. Reproducible: Always Steps to Reproduce: 1. Write an XHTML page with nested anchors where you have visited neither link. 2. Load the page in Mozilla. 3. Click on the link and then reload. Actual Results: The link appears as if unvisited, because the inner link has not been visited. Expected Results: The link should appear visited, since the outer link has been visited. It is easier to see the effect of this if the page has code like this: <a href="good.xhtml">Good &amp;<a href="evil.xhtml">Evil</a></a> Despite the fact that the link can never go to evil.html, the word Evil is styled as visited according to whether evil.xhtml has been visited or not.
> In the case of nested anchors, Mozilla chooses to only allow linking from the > outer link That's bug 127903, actually. We should be following the innermost link.
Depends on: 127903
Bug 127903 is certainly similar, however it is not the same. There is no prohibition of <a> containing a form control in HTML or XHTML. There is a prohibition against <a> containing another <a>, which is unenforceable under XML. The spec does not state what should be done in such a case, so following either the outer or inner link could be justified. With the current behavior that Mozilla displays for nested anchors, the way it handles :visited in this case is a bug. If it chose the inner link then it would be correct. One or the other needs to be fixed. I also don't think that Bug 127903 should be the one that this bug is dependent upon, but rather the root bug, Bug 185768, so I'm changing the dependency.
Depends on: 185758
No longer depends on: 127903
Sorry about that, I meant Bug 185758, not Bug 185768.
Depends on: 127903
No longer depends on: 185758
Is Bug 110817 possibly also a related bug of the event flow bug? BTW, I still disagree with the choice of Bug 127903 as the one which bug this depends on. Any dependency from that bug is IMO, for resaons that I've already given, due solely to the effects of Bug 185758 upon which Bug 127903 depends.
It depends on bug 127903 because the fix for bug 127903 will be to make <a> look at the "consumed" status of an event before triggering.... This can probably be fixed without fixing bug 185758, in fact. That said, you reported this bug, so you can change any fields you want if you feel like it. ;)
I'm not convinced this is valid. Regardless of which link consumes which events, there are two elements here, both of which are links, and both of which should therefore be styled accordingly. If you change the markup and stylesheet to be: <a href="" class="link">Outer <a href="" class="visited">inner</a></a> .link { color: blue; } .visited { color: purple; } ...then you'd get the same result. I think this is correct.
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → INVALID
If you could follow the inner <a>, I would agree with you, and that is one method of resolving this bug. It certainly would be my preferred method. However, the inner <a> cannot be followed at present. If you place the mouse over the inner <a>, the status text tells you that clicking on it will take you someplace tells you that it goes to the URI of the href attribute of the outer <a>, which is what it does. To quote from the CSS 2 specification: "The document language determines which elements are hyperlink source anchors. For example, in HTML 4.0, the link pseudo-classes apply to A elements with an "href" attribute." The way Mozilla handles nested <a> elements in XHTML 1 at present is to only treat the outermost <a> with an href attribute as a link. Therefore, the inner <a> IS NOT a link. Hence, the inner <a> SHOULD NOT be receiving either the :link or :visited styling. However, because it is inside a link (the outermost <a> with an href attribute) it should receive the link styling associated with that outermost <a>, depending upon whether its href has been visited.
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
Summary: XHTML, nested anchors and :visited → XHTML, nested anchors and :visited / :link
Fine, then. *** This bug has been marked as a duplicate of 127903 ***
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago23 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.