Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There seem to be a kind of race condition in the loading of css. The following file reproduces the bug here on Chrome (17.0.963.65) on osx 10.6.8. </p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset="utf-8"&gt; &lt;title&gt;Schizophrenic layout&lt;/title&gt; &lt;style type="text/css"&gt; body { background-image:url('gray.png'); } #d0{display:inline-block;} #d1{text-transform:uppercase;} #d2{text-transform:uppercase;} &lt;/style&gt; &lt;script type="text/javascript"&gt; function fill (id, text) { var e = document.getElementById (id); var t = document.createTextNode (text); e.appendChild (t); } function main () { fill ("d1", "First line"); fill ("d2", "Second line"); } window.onload = main; &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="d0"&gt; &lt;div id="d1"&gt;&lt;/div&gt; &lt;div id="d2"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Note that the bug is present even if <code>gray.png</code> is not a 404. You may have to reload the page a few time to witness the bug. Also if you don't GET the file over http, the bug shows only once, the first time you load the page from the disk.</p> <p>There are various ways to make the bug disappear by tweaking the css. Removing only the <code>background-image</code> makes it disappear. Removing only the <code>display</code> makes it disappear. Removing only the two <code>text-transform</code> make it disapear. In the latter case the correct layout can be achieved by adding </p> <pre><code> e.style.textTransform = "uppercase"; </code></pre> <p>at the end of the <code>fill</code> function which is, of course, a very ugly workaround. </p>
 

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