I'm still struggling on trying to find out which browser is bestless crappy to develop rich web-based apps.
Every other day I spend hours trying to figure out a weird behavior that is happening on my system, just to find out that either Firefox or IE has a bug/bad-behavior and now I have to work around it.
This time is the turn of Firefox. I spent three hours this afternoon trying to find why my TEXTAREAs were returning CR+LF to the server. Then, there is the undocumented WRAP attribute. And I found an extremely good site with information about it.
But after doing every suggestion on this site, or on any other site that I could find out on Google, I figure out that the problem is not with the TEXTAREA, but with the innerHTML attribute.
TEXTAREA is how I transmit data that is edited in Midas (Firefox's rich HTML editor engine) back to the server, but the way it works is basically like this:
myTextarea.value = myDiv.innerHTML;
Turn out that Firefox adds some CR+LF to the result of innerHTML, some developer in Firefox probably knows why. But that is super annoying.
Look at this simple, repro code:
<div id=orig>This is a test to see what firefox will do if you get the innerHTML from a div. Why does it add a Line Feed (\n) to long lines of text?</div> <script> var di = document.getElementById('orig'); var str = di.innerHTML; alert(str.replace('\n','**N**')); </script>
There is no CR/LF on the DIV, so, you would expect that FF would just display the string as a single line, and no occurrances of **N** on the string, but no, this is the output:
This is a test to see what firefox will do if you get the innerHTML**N**from a div. Why does it add a Line Feed (\n) to long lines of text?