git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG/RFH] gitweb: Trouble with ref markers being hyperlinks because of illegally nested links
@ 2009-01-12  1:15 Jakub Narebski
  2009-01-12  2:59 ` Giuseppe Bilotta
  0 siblings, 1 reply; 8+ messages in thread
From: Jakub Narebski @ 2009-01-12  1:15 UTC (permalink / raw)
  To: git; +Cc: Giuseppe Bilotta

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-01-14 13:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-12  1:15 [BUG/RFH] gitweb: Trouble with ref markers being hyperlinks because of illegally nested links Jakub Narebski
2009-01-12  2:59 ` Giuseppe Bilotta
2009-01-13  0:13   ` Jakub Narebski
2009-01-13  0:59     ` Giuseppe Bilotta
2009-01-14  0:17       ` [RFC/PATCH] gitweb: Fix nested links problem with ref markers Jakub Narebski
2009-01-14  3:56         ` Giuseppe Bilotta
2009-01-14 10:39           ` Jakub Narebski
2009-01-14 13:52             ` Giuseppe Bilotta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).