[BUG/RFH] gitweb: Trouble with ref markers being hyperlinks because of illegally nested links

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit 4afbaef by Giuseppe Bilotta (gitweb: ref markers link to named 
shortlogs) turned ref markers for tags and heads into links to    
appropriate views for the ref name.

Unfortunately the code didn't take into account the fact that nesting 
links (A elements) is illegal in (X)HTML:

  12.2.2 Nested links are illegal

  Links and anchors defined by the A element must not be nested;
  an A element must not contain any other A elements.

(from http://www.w3.org/TR/html401/struct/links.html#h-12.2.2), and that 
some browsers (e.g. Mozilla 1.17.2 I still use) in the very strict 
conformance mode (application/xhtml+xml mimetype and XML + XHTML DTD) 
_enforce_ this requirement by moving inner link immediately outside the 
end of outer link, i.e. for the HTML source looking like the following
  <a ...> some text <a ...>v1.5.1</a></a>
rendered HTML (which you can see using "View Selection Source") is 
instead
  <a ...> some text </a><a ...>v1.5.1</a>
And of course SPAN elements which wraps inner link (inner A element) is 
_not_ moved.


This is quite easy to fix for hyperlinked ref markers in 'shortlog' and 
'history' views: just close the "title" hyperlink before printing 
$extra, i.e. ref markers. I have even made a patch doing that. Then 
instead of incorrect
  _Merge branch into maint_ [] _maint_
where _aaa_ means that 'aaa' is hyperlink, and [xxx] is a fer marker,
we will have correct:
  _Merge branch into maint_ [_maint_]
See that we have two separate and not nested links...


What is more complicated is the issue of ref marker from 
git_print_header_div e.g. in 'commit'/'commitdiff' view, and in 'log' 
view.  There link is made into block element using "display: block;"
CSS rule (div.title, a.title), so that you can click _anywhere_ on the 
header block.  This breaks layout even worse, making hyperlinked ref 
marker text appear *below* header div:

  -----------------------------------------------------------
  |_Merge branch into maint_ []                             |
  -----------------------------------------------------------
  _maint_

To preserve current layout and behavior it would be needed to do some 
deep HTML + CSS positioning hackery, perhaps with additional link block 
without any text... But I don't know exactly how to do this; all [few] 
experiments I did failed.

I see possible the following alternate solutions:
 * Ignore this issue (e.g. if it does not affect modern browsers)
 * Revert 4afbaef (we lose feature, but how often used is it?)
 * Always use quirks mode, or check browser and use quirks mode if it
   would break layout
 * Use extra divs and links and CSS positioning to make layout which
   looks like current one, and behaves as current one, but is more
   complicated.


P.S. From what I have checked neither kernel.org nor repo.or.cz
have this issue.
-- 
Jakub Narebski
Poland
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux