Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>For reference, this is the "unminified" code:</p> <pre><code>javascript:(function () { var i, t, D = document; for (i = 0; t = D.getElementsByTagName('textarea')[i]; ++i) { t.value = t.value.toUpperCase(); var newSS, styles = '* { text-transform: uppercase; } input, textarea { text-transform: none}'; if (D.createStyleSheet) { D.createStyleSheet("javascript:'" + styles + "'"); } else { newSS = D.createElement('link'); newSS.rel = 'stylesheet'; newSS.href = 'data:text/css,' + escape(styles); D.documentElement.childNodes[0].appendChild(newSS); } } })()</code></pre> <p>I do not have IE 8 handy on my Mac, but try sprinkling in an <code>alert('here at line XXX');</code> for poor man's debugging.</p> <p>Maybe IE 8 does not like a <code>javascript:</code> source for the style sheet?</p> <p>Also, the loop is adding as many style sheets as there are textareas. That is silly. Move it out of the loop, like so:</p> <pre><code>javascript:(function () { var i, t, D = document; for (i = 0; t = D.getElementsByTagName('textarea')[i]; ++i) { t.value = t.value.toUpperCase(); } var styles = '* { text-transform: uppercase; } input, textarea { text-transform: none}'; if (D.createStyleSheet) { D.createStyleSheet("javascript:'" + styles + "'"); } else { var newSS = D.createElement('link'); newSS.rel = 'stylesheet'; newSS.href = 'data:text/css,' + escape(styles); D.documentElement.childNodes[0].appendChild(newSS); } })()</code></pre> <p>There are still some questionable things in that code, mind you. I am not too sure of that loop's condition. What I would do, is get it out of the loop, like this:</p> <pre><code>javascript:(function () { var D = document; var i, t = D.getElementsByTagName('textarea'); for (i = 0; i &lt; t.length; i++) { t[i].value = t[i].value.toUpperCase(); } /* Rest of the code here. */ })()</code></pre> <p>As an exercise to the reader/asker: this only uppercases textareas, not text inputs.</p> <p><strong>EDIT</strong>: Minify this to stay below the maximum length:</p> <pre><code>javascript:(function () { var D = document; var i, t = D.getElementsByTagName('textarea'); for (i = 0; i &lt; t.length; i++) { t[i].value = t[i].value.toUpperCase(); } D.createStyleSheet('javascript:"* { text-transform: uppercase; } input, textarea { text-transform: none}"'); })()</code></pre> <p>Result:</p> <pre><code>javascript:(function(){var D = document;var i,t=D.getElementsByTagName('textarea');for(i=0;i&lt;t.length;i++)t[i].value=t[i].value.toUpperCase();D.createStyleSheet('javascript:"*{text-transform:uppercase;}input,textarea{text-transform:none}"');})()</code></pre> <p>This only has the IE-specific code.</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