Closed Bug 12766 Opened 20 years ago Closed 20 years ago

html.css: XLink links should look like links


(Core :: CSS Parsing and Computation, defect, P3)






(Reporter: dbaron, Assigned: attinasi)




(6 files)

DESCRIPTION:  I think, by default, simple links created using XLink should look
like links.  Otherwise the user will have no idea the links are there.

(At the very least, the pointer should change.  I'd understand if you disagreed
about the color and underline, but I'd still disagree, I think.)

STEPS TO REPRODUCE:  Load attached document.

ACTUAL RESULTS:  The word "link" does not look like a link (blue, underlined),
nor does the pointer change when over it.  However, it does work when clicked.

EXPECTED RESULTS:  The pointer should certainly change when over the link.  I
think it should be blue and underlined as well.

 * Linux, apprunner, 1999-08-28, build from 12:15 PDT

I think this could be fixed by changing ua.css to change all references to
a:link or a:visited (assuming the a:active bug, bug 12765, is fixed first) to
purely :link and :visited (that is, remove the element "a" from the selector).
Depends on: 6306, 12765
Currently, the suggested fix won't work because of bug 6306. However, it is
the correct fix, and should be implemented. You just won't see the change until
bug 6306 is fixed as well...
Moving non-beta 1 items to M15
Reassigning peterl's bugs to myself.
Accepting peterl's bugs that have a Target Milestone
Summary: XLink links should look like links → HTML.CSS: XLink links should look like links
In bug 17518, there is the following comment from  11/
01/99 16:56

Just sub-optimal. I wouldn't back it out unless you implement the fixes
mentioned in bug 12765 and bug 12766.

Having said that, doing those two fixes is easy.

Replace all occurances of...          with...
   a[href]:link                       :link
   a[href]:visited                    :visited
   a[href]:link img                   :link img
   a[href]:visited img                :visited img
   a[href]:active                     :link:active, :visited:active
   a[href]:active img                 :link:active img, :visited:active img
   a[href]:hover                      :link:hover, :visited:hover
   a[href]:hover img                  :link:hover img, :visited:hover img
   a[href]:focus                      :link:focus, :visited:focus
   a[href]:focus img                  :link:focus img, :visited:focus img

I'm not sure what the ":out-of-date" pseudo is, but similar things have to
happen to that too.
Summary: HTML.CSS: XLink links should look like links → html.css: XLink links should look like links
I was just writing this when Pierre wrote the above. Hi Pierre. :-)

I've now found out what the :out-of-date psuedo is (as far as the code is
concerned, anyway) -- it is a link pseudo class mutually exclusive with the
:link and :visited pseudo classes.

So what needs doing now is that the html.css file should have...

 ...all occurances of...            ...replaced with...
   a[href]:link                       :link
   a[href]:visited                    :visited
   a[href]:out-of-date                :out-of-date
   a[href]:link img                   :link img
   a[href]:visited img                :visited img
   a[href]:out-of-date img            :out-of-date img
   a[href]:active                     :link:active, :visited:active
   a[href]:active img                 :link:active img, :visited:active img
   a[href]:hover                      :link:hover, :visited:hover
   a[href]:hover img                  :link:hover img, :visited:hover img
   a[href]:focus                      :link:focus, :visited:focus
   a[href]:focus img                  :link:focus img, :visited:focus img

This will fix both this bug and bug 12765.
Closed: 20 years ago
Resolution: --- → DUPLICATE
Oh, drat. I made a mistake. (See bug 12765.)

Look, since this is basically the same fix as 12765, I'm going to mark it as a
duplicate and stop writing the comments in both bugs all the time.

I hope nobody minds.

*** This bug has been marked as a duplicate of 12765 ***
I mind strongly unless you actually check that the :link selector matches
XLinks, which I believe currently it does not.  (I wasn't aware of that at the
time -- but maybe that's been fixed since I found that out too...)
David: This last issue is already covered by bug 6306, this bug (12766) was
only actually in charge of making XLinks look like HTML A links once XLinks
were recognised as links by the stylesystem at all.

I mentioned this in my first comment to this bug, back in August...
I am reopening this bug so it is tracked properly and can be verified when all
dependencies are fixed.  It is really a dependency (of bug 6306), not a
duplicate (of bug 12765).
Resolution: DUPLICATE → ---
Pushing my M15 bugs to M16
It looks like XLinks don't work after all. CCd Nisheeth who worked on it a few 
weeks ago. Reassigned to Marc like bug 6306.
Assignee: pierre → attinasi
My original testcase uses the old XLink syntax, so it probably shouldn't work.
Target Milestone: M16 → M18
I have made a small change to the SelectorMatches method in the CSSStyleSheet so 
that XML XLinks are treated as links. This change is specific to XLinks: in 
addition to checking if the content is an A with an href, we also now check if 
the element is an XMLElement with a href in the xlink namespace.  This change 
allows xlinks get the :link (and :visited and :out-of-date) style just like an A 
would. I'll attach the diff for review...

Bug 6306 covers the more general case of supporting links in arbitrary DTDs, 
however this fix covers the simple XLink case. If and when we decide to tackle 
bug 6306 this change will probably be rendered obsolete.
In IsXLink(), do you want to test for the type attribute as well?  I'm not sure.
Good catch, David. I think we have to check for the type since the xlink won't 
even act as a link type="simple". I was leary of the extra processing, but since 
it is a requirment for the functioning of the link, I think we had better check 
Fixed. (nsCSSStyleSheet.cpp)
Closed: 20 years ago20 years ago
Resolution: --- → FIXED
Heh, why isn't there vote against option?

But seriously, I wouldn't want us to style XLinks automatically. The only case 
where I'd want that to happen would be if we have NO stylesheet at all. In that 
case it is nice to see the links. Normally I want to have full control over my 
document, and it annoys me when someone does it for me. XML is supposed to be 
completely without style information, remember?

Another point about the implementation. The XLink spec specifically says that 
type="simple" is enough for link check. There is no need to check for href. If 
there is no href attribute then it is simply untraversble link. This is how I 
implemented the handling of simple XLinks.
"XML is supposed to be completely without style information, remember?"

Who said that?! It is my opinion that the most useful XML will be data in known
formats, for example XHTML and MathML. These most certainly _should_ have UA
stylesheets. It is in the interest of the user (the most important person as far
as we are concerned) that links look consistent across all documents. Thus if we
have a default link style, we are doing the user a favour.
The CSS2 spec states: 
 'The document language determines which elements are hyperlink source anchors.' 

Clearly XLinks *are* hyperlink source anchors as defined by the document 
language (XLINK) so we apply the :link selector to them. Section 5.11.2 of the 
CSS2 spec also states that:
 'The :link pseudo-class applies for links that have not yet been visited.' 

I don't see how we can *not* apply the :link selector to XLinks. 

If, on the other hand, we don't want to apply our default link styles to xlinks, 
then we *could* change the rules in html.css to be 'A:link' 'A:visited' etc. 
instead of ':link' and ':visited'. I disagree with this idea, but if somebody 
(Heikki?) wants to make a case for that, then I think it is a separate issue 
from how :link selectors are resolved.

Regarding the comment that an XLink with no href is a valid link: Since the 
xlink spec indicates that the type is enough, then I will remove the href check 
- I was merely following the HTML Anchor logic, which obviously is different. I 
have now read the xlink spec and it is clear enough. I'll open a new bug on 
myself for that. Thanks for educating me on this.
Opened bug 39616 for XLinks not needing the href attribute.
Doh, I wasn't on the CC...

Does CSS (any version) say what the the user agent stylesheet should be like? 
For example that :link should be in the default user agent stylesheet?

Regarding my comment about XML being without style info... HTML comes with 
recommendations/old practices of styling. You expect the browser to style your 
HTML files even if you do not explicitly provide style. But where in the XML 
Recommendation do you see that this and this element should be styled this and 
this? Do you see these guidelines even in the XLink spec?

I opened a new bug for a pref that would handle these issues, see 41659.
CSS2 has a recommended ua style sheet, and there is no :link rule in it. 
However, it is simply an example, not normative. 

The CSS2 spec states: 
 'The document language determines which elements are hyperlink source anchors.' 

XLinks are clearly hyperlink shource anchors, affectionately know as links. 
That's why XLinks automatically get the :link rules applied.
Testing on Windows, Mac and Linux using M18 builds, verified fixed.
You need to log in before you can comment on or make changes to this bug.