For reference, this is the "unminified" 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);
}
}
})()
I do not have IE 8 handy on my Mac, but try sprinkling in an alert('here at line XXX');
for poor man's debugging.
Maybe IE 8 does not like a javascript:
source for the style sheet?
Also, the loop is adding as many style sheets as there are textareas. That is silly. Move it out of the loop, like so:
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);
}
})()
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:
javascript:(function () {
var D = document;
var i, t = D.getElementsByTagName('textarea');
for (i = 0; i < t.length; i++) {
t[i].value = t[i].value.toUpperCase();
}
/* Rest of the code here. */
})()
As an exercise to the reader/asker: this only uppercases textareas, not text inputs.
EDIT:
Minify this to stay below the maximum length:
javascript:(function () {
var D = document;
var i, t = D.getElementsByTagName('textarea');
for (i = 0; i < t.length; i++) {
t[i].value = t[i].value.toUpperCase();
}
D.createStyleSheet('javascript:"* { text-transform: uppercase; } input, textarea { text-transform: none}"');
})()
Result:
javascript:(function(){var D = document;var i,t=D.getElementsByTagName('textarea');for(i=0;i<t.length;i++)t[i].value=t[i].value.toUpperCase();D.createStyleSheet('javascript:"*{text-transform:uppercase;}input,textarea{text-transform:none}"');})()
This only has the IE-specific code.