Gitweb indentation wrong in Internet Explorer
I have a report from an MSIE suffering user:
Quoted 3 lines
When I use it (and I believe I've seen this on my laptop as well as my workstation) all left-hand margin whitespace is collapsed to nothingness. Once can still parse the code, but it's harder with no indentations.
A screenshot from a Windows laptop to illustrate the problem is at
http://www.linux-mips.org/~ralf/gitweb.png. It shows the code was preformatted correctly which seems to be an IE bug but the following patch seems to work around it.
*** gitweb.cgi.dist 2006-10-09 19:02:19.561726255 +0100
--- gitweb.cgi 2006-10-09 19:03:31.744837495 +0100
***************
*** 234,239 ****
--- 234,240 ----
my $str = shift;
$str = decode("utf8", $str, Encode::FB_DEFAULT); $str = escapeHTML($str);
+ $str =~ s/ / /g;
return $str;
}
Thanks,
Ralf
Quoted 10 lines · --- Ralf Baechle
I have a report from an MSIE suffering user:
Quoted 3 lines
When I use it (and I believe I've seen this on my laptop as well as my workstation) all left-hand margin whitespace is collapsed to nothingness. Once can still parse the code, but it's harder with no indentations.
A screenshot from a Windows laptop to illustrate the problem is at
http://www.linux-mips.org/~ralf/gitweb.png. It shows the code was preformatted correctly which seems to be an IE bug but the following patch seems to work around it.
Thank you.
Has anyone let MSIE people know about this bug? Or tried latest MSIE?
Luben
Quoted 21 lines
*** gitweb.cgi.dist 2006-10-09 19:02:19.561726255 +0100
--- gitweb.cgi 2006-10-09 19:03:31.744837495 +0100
***************
*** 234,239 ****
--- 234,240 ----
my $str = shift;
$str =decode("utf8", $str, Encode::FB_DEFAULT); $str = escapeHTML($str);(quoted diff) +1
-0+ $str =~ s/ / /g; return $str; }Thanks,
Ralf
-
To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines · Ralf Baechle
I have a report from an MSIE suffering user:
Quoted 3 lines
When I use it (and I believe I've seen this on my laptop as well as my workstation) all left-hand margin whitespace is collapsed to nothingness. Once can still parse the code, but it's harder with no indentations.
A screenshot from a Windows laptop to illustrate the problem is at
http://www.linux-mips.org/~ralf/gitweb.png. It shows the code was preformatted correctly which seems to be an IE bug but the following patch seems to work around it.
Which version of gitweb? We have removed s/ / /g; in esc_html subroutine in favor of using "white-space: pre;" in CSS some time ago, and we have added escaping FORM FEED and ESCAPE characters.
Could you send git patches, by the way? Or at least '-p' diffs?
Signature · 3 lines
Jakub Narebski Warsaw, Poland ShadeHawk on #git
Quoted 4 lines · Jakub Narebski
Quoted 4 lines
Quoted 3 lines
When I use it (and I believe I've seen this on my laptop as well as my workstation) all left-hand margin whitespace is collapsed to nothingness. Once can still parse the code, but it's harder with no indentations.
Quoted 8 lines
Quoted 4 lines
A screenshot from a Windows laptop to illustrate the problem is at
http://www.linux-mips.org/~ralf/gitweb.png. It shows the code was preformatted correctly which seems to be an IE bug but the following patch seems to work around it.Which version of gitweb? We have removed s/ / /g; in
esc_htmlsubroutine in favor of using "white-space: pre;" in CSS some time ago, and we have added escaping FORM FEED and ESCAPE characters.
Anything since since at least June 19 seems affected, including yesterday's version.
Quoted 1 line
Could you send git patches, by the way? Or at least '-p' diffs?
Nope. I'm just forwarding this.
Ralf
Quoted 3 lines · Jakub Narebski
Which version of gitweb? We have removed s/ / /g; in
esc_htmlsubroutine in favor of using "white-space: pre;" in CSS some time ago, and we have added escaping FORM FEED and ESCAPE characters.
The problem here is that "white-space: pre" is only supported by IE6 in standards compliance mode[1], but the DTD declaration for this page:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
surprisingly triggers IE6 quirks mode[2]. A quick fix to this problem would be changing the doctype declaration to use XHTML 1.0 Transitional instead of Strict, as that would trigger IE6 standards-compliance mode.
[1] http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/whitespace.asp
[2] http://hsivonen.iki.fi/doctype/
-- Marcus
PATCH 1/1 Removes the <?xml?> declaration from gitweb.pl
The XML declaration forces IE6 into quirks mode, breaking our nice standards compliant stylesheet.
--- gitweb/gitweb.perl | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
gitweb/gitweb.perl +0 -1
@@ -1357,7 +1357,6 @@ sub git_header_html { print $cgi->header(-type=>$content_type, -charset => 'utf-8', -status=> $status, -expires => $expires); print <<EOF; -<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"> <!-- git web interface version $version, (C) 2005-2006, Kay Sievers
<kay.sievers\@vrfy.org>, Christian Gierke -->
Signature · 1 line
1.4.2.3
Re: [PATCH] Removes the <?xml?> declaration from gitweb.pl
Quoted 2 lines · Pazu
The XML declaration forces IE6 into quirks mode, breaking our nice standards compliant stylesheet.
But isn't it _required_ by XML/XHTML?
Signature · 3 lines
Jakub Narebski Warsaw, Poland ShadeHawk on #git
Re: [PATCH] Removes the <?xml?> declaration from gitweb.pl
onsdag 11 oktober 2006 23:27 skrev Jakub Narebski:
Quoted 5 lines
Quoted 2 lines · Pazu
The XML declaration forces IE6 into quirks mode, breaking our nice standards compliant stylesheet.
But isn't it _required_ by XML/XHTML?
For pure XML document it is required, but not for XHTML, unless the encoding is something other than UTF-8 or (shudder) UTF-16. W3C recommends it though.
-- robin
Re: [PATCH] Removes the <?xml?> declaration from gitweb.pl
Quoted 9 lines · Robin Rosenberg
onsdag 11 oktober 2006 23:27 skrev Jakub Narebski:
Quoted 5 lines
Quoted 2 lines · Pazu
The XML declaration forces IE6 into quirks mode, breaking our nice standards compliant stylesheet.
But isn't it _required_ by XML/XHTML?
For pure XML document it is required, but not for XHTML, unless the encoding is something other than UTF-8 or (shudder) UTF-16. W3C recommends it though.
So what should be our decision? Honor IE quirks ;-) and either remove XML declaration, or use Transitional DTD? Add back SPC to conversion in esc_html? Ignore broken browsers?
Signature · 2 lines
Jakub Narebski Poland
Re: [PATCH] Removes the <?xml?> declaration from gitweb.pl
torsdag 12 oktober 2006 23:21 skrev Jakub Narebski:
Quoted 8 lines
Quoted 7 lines · Robin Rosenberg
onsdag 11 oktober 2006 23:27 skrev Jakub Narebski:
Quoted 5 lines
Quoted 2 lines · Pazu
The XML declaration forces IE6 into quirks mode, breaking our nice standards compliant stylesheet.
But isn't it _required_ by XML/XHTML?
Quoted 7 lines
Quoted 3 lines
For pure XML document it is required, but not for XHTML, unless the encoding is something other than UTF-8 or (shudder) UTF-16. W3C recommends it though.
So what should be our decision? Honor IE quirks ;-) and either remove XML declaration, or use Transitional DTD? Add back SPC to conversion in
esc_html? Ignore broken browsers?
It isn't required by the standard. Why not just drop it?
-- robin
Re: [PATCH] Removes the <?xml?> declaration from gitweb.pl
Quoted 13 lines · Robin Rosenberg
torsdag 12 oktober 2006 23:21 skrev Jakub Narebski:
Quoted 12 lines
Quoted 10 lines · Robin Rosenberg
onsdag 11 oktober 2006 23:27 skrev Jakub Narebski:
Quoted 5 lines
Quoted 2 lines · Pazu
The XML declaration forces IE6 into quirks mode, breaking our nice standards compliant stylesheet.
But isn't it _required_ by XML/XHTML?
For pure XML document it is required, but not for XHTML, unless the encoding is something other than UTF-8 or (shudder) UTF-16. W3C recommends it though.
Quoted 7 lines
Quoted 3 lines
So what should be our decision? Honor IE quirks ;-) and either remove XML declaration, or use Transitional DTD? Add back SPC to conversion in
esc_html? Ignore broken browsers?It isn't required by the standard. Why not just drop it?
An XML declaration is not required in all XML documents; however XHTML document authors are strongly encouraged to use XML declarations in all their documents. Such a declaration is required when the character encoding of the document is other than the default UTF-8 or UTF-16 and no encoding was determined by a higher-level protocol.
So even if it is not required, it is recommended. But yes, removing <?xml?> for bug-compatibility conformance is better idea than mucking with browser detection... if we sould need browser detection to avoid other bugs (like non-W3C CSS box model in IE), then perhaps we could reintroduce <?xml?> in standards-conforming browsers.
Signature · 2 lines
Jakub Narebski Poland
Re: [PATCH] Removes the <?xml?> declaration from gitweb.pl
In reply to Jakub NarebskiQuoted 3 lines · Jakub Narebski
So what should be our decision? Honor IE quirks ;-) and either remove XML declaration, or use Transitional DTD? Add back SPC to conversion in
esc_html? Ignore broken browsers?
My bad here. In my first email I said that using the Transitional DTD would fix the problem, but I was wrong. It doesn't matter the DTD you use, if you add a <?xml?> declaration, IE will get it wrong and activate quirks mode.
-- Marcus
Re: [PATCH] Removes the <?xml?> declaration from gitweb.pl
Quoted 10 lines · Pazu
Quoted 3 lines · Jakub Narebski
So what should be our decision? Honor IE quirks ;-) and either remove XML declaration, or use Transitional DTD? Add back SPC to conversion in
esc_html? Ignore broken browsers?My bad here. In my first email I said that using the Transitional DTD would fix the problem, but I was wrong. It doesn't matter the DTD you use, if you add a <?xml?> declaration, IE will get it wrong and activate quirks mode.
Well, there is yet another solution. Do browser detection, and do not output <?xml ... ?> declaration for IE. Perhaps that would be best solution.
Signature · 3 lines
Jakub Narebski Warsaw, Poland ShadeHawk on #git
Re: [PATCH] Removes the <?xml?> declaration from gitweb.pl
Quoted 2 lines · Jakub Narebski
Well, there is yet another solution. Do browser detection, and do not output <?xml ... ?> declaration for IE. Perhaps that would be best solution.
Well, there's now drawback in removing the XML declaration (no browser requires it), so why even worry about browser detection?
-- Marcus
Re: [PATCH] Removes the <?xml?> declaration from gitweb.pl
In reply to Jakub NarebskiQuoted 4 lines · Jakub Narebski
Quoted 2 lines
The XML declaration forces IE6 into quirks mode, breaking our nice standards compliant stylesheet.
But isn't it _required_ by XML/XHTML?
As far as I know, it isn't. But even if the specs required it, none of the popular browsers do, and since we're talking about a web page intended for presentation (as opposed to automated data processing), that's what matters.
-- Marcus
Re: [PATCH] Removes the <?xml?> declaration from gitweb.pl
In reply to Jakub NarebskiQuoted 1 line · Jakub Narebski
But isn't it _required_ by XML/XHTML?
According to the XML 1.0 specification, section 2.8:
[Definition: XML documents should begin with a XML declaration which specifies the version of XML being used]
I believe that the use of 'should' instead of 'must' here makes it highly recommended, but not strictly required. Anyway, the comments in my previous message (the 'browser support is what really matters' part) remain valid.
-- Marcus