At work, we stumbled upon Bugzilla, creating HTML output that resulted in lines that were too long because the browser did not break the lines. This happened in Chrome, but not in Firefox 3.5, so we don't care. But Firefox 4 behaves exactly like Chrome, so we had to find another workaround.
Example:
<html> <body> <pre> Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et
dolore magna aliquyam erat, sed diam voluptua. At vero eos
et accusam et justo duo dolores et ea rebum. Stet clita kasd
gubergren, no sea takimata sanctus est Lorem ipsum dolor sit
amet.
 </pre> </body> </html>
The server uses only CR as a string, which is very unusual, and the usual alternatives (CR + LF, only LF) work correctly, so the correct way to fix this is to tell the Bugzilla server to use one of these lines methods. Anyway, I'm curious why not working and ignoring line breaks seems to be the βrightβ way for browsers.
Also, I found a weird local solution for Chrome and FF 4 using the Greasemonkey script (a modified version of this ):
var els = document.getElementsByTagName("*"); for(var i = 0, l = els.length; i < l; i++) { var el = els[i]; el.innerHTML = el.innerHTML; }
It didn't seem to affect the page, but with this script, line-to-line lines suddenly display correctly.
So my questions are:
- Is the Chrome / FF 4 method the βrightβ way to handle these string types inside
<pre> ? - Why does this Greasemonkey script work?
source share