Lets say I have a textarea with this text:
I see the same screwy behavior in IE with .split()
and new lines. You can use your own split function to control it more closely:
function mySplit(str, ch) {
var pos, start = 0, result = [];
while ((pos = str.indexOf(ch, start)) != -1) {
result.push(str.substring(start, pos));
start = pos + 1;
}
result.push(str.substr(start));
return(result);
}
Working example here: http://jsfiddle.net/jfriend00/xQTNZ/.