The top part of a.html has a textarea called "userInputArea".
A friend and I tested entering lines in the textarea, and checking the content of outputNode on the web page. On Windows XP, running Firefox 3.08 and Internet Explorer 8, it ran fine. It also ran fine on Mac OS X 10.5, running Firefox 3.08 and Opera 9.27.
However, I had a problem running Safari 3.21 on Leopard. I put some alerts into a.html, which tell what some counts are. The alerts are triggered by keystrokes. (After you see the alerts, cancel them by clicking on the "OK" button. If you type Enter to cancel the alert, the web page run setResult() becuase you typed a key.)
The problem is that whenever the most recent line that I enter is a blank line, Safari seems to think that there is an extra blank line at the end - a blank line that I didn't enter. Then when I enter a non-blank line, the extra blank line at the end goes away.
Suppose I type the letter "a". The alerts will say that there is one character in the textarea - the letter "a".
Now I type the "return" key. The alerts will say that I have typed three characters - the letter "a", followed by two carriage returns.
Now I type the letter "b". The alerts will say that I have typed three characters - the letter "a", followed by a carriage return, followed by the letter "b".
If you comment out the alerts so that you're not distracted by them, and the run the test again, you'll see this: After you type a blank line at the end, the "End of the data that you entered" line goes down one line too far, and after you type the "b", the "End of the data that you entered" line moves back up where it should be.
I also tried this on the Safari 4 public beta for Mac OS X. The test worked better with that browser, but it still wasn't right. After I typed a blank line, the "End of the data that you entered" line went down one line too far, and then immediately jumped up to where it should be.
Safari works as I would expect when there are embedded blank lines. I just have problems when the last line is blank.
Am I doing something wrong? Is there a workaround? (This is a simplified version of a web page, which needs the newlines to be correct.)
Thank you very much.
Forget Steve. Look at this tiny ad:
how do I do my own kindle-like thing - without amazon