Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing only CR as linebreak inside pre tag doesn't work
    text
    copied!<p>At work, we stumbled upon Bugzilla creating HTML output that led to lines much too long because the browser didn't break the lines. This was happening on Chrome, but not on Firefox 3.5, so we didn't really care. But Firefox 4 behaves just like Chrome, so we had to find another workaround.</p> <p>An example is:</p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;pre&gt; Lorem ipsum dolor sit amet, consetetur sadipscing elitr,&amp;#013;sed diam nonumy eirmod tempor invidunt ut labore et&amp;#013;dolore magna aliquyam erat, sed diam voluptua. At vero eos&amp;#013;et accusam et justo duo dolores et ea rebum. Stet clita kasd&amp;#013;gubergren, no sea takimata sanctus est Lorem ipsum dolor sit&amp;#013;amet.&amp;#013; &lt;/pre&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The server is using only CR as a linebreak which is very uncommon and the usual alternatives (CR+LF, only LF) work correctly, so the right way to fix this is to tell the Bugzilla server to use one of these linebreak methods. Anyway, I'm curious why this doesn't work and ignoring the linebreaks seems to be the "correct" way for browsers.</p> <p>Also, I found a strange local workaround for Chrome and FF 4 using a Greasemonkey script (modified version of <a href="https://stackoverflow.com/questions/1155353/find-and-replace-in-a-webpage-using-javascript/1155933#1155933">this one</a>):</p> <pre><code>var els = document.getElementsByTagName("*"); for(var i = 0, l = els.length; i &lt; l; i++) { var el = els[i]; el.innerHTML = el.innerHTML; } </code></pre> <p>It seems this would've no effect on the page, but with this script, linebreaks suddenly are showing correctly.</p> <p>So my questions are:</p> <ol> <li>Is the Chrome/FF 4 way the "correct" way to handle these kinds of linebreaks inside <code>&lt;pre&gt;</code>?</li> <li>Why is this Greasemonkey script working?</li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload