CTRL Z Issue
There is an issue in Firefox with textareas in Ctrl+z adding a /n
HTML
For this example you need to install Firebug to see in the console.log outputs on the Console Tab.
<br><br>
1. Notice that "9 Delete Me" is the first thing that is outputted.<br>
2. Highlight the Delete Me text in the Test textarea below and hit the delete key.<br>
3. Tab out and you should see "0" on the Console tab.<br>
4. Return to the text area and and hit Ctrl+z to restore the "Delete Me" text.<br>
5. Tab out and you will notice that the Log output will have "10 Delete Me" = an extra newline was added<br><br><br>
<p>Test textarea:</p>
<textarea id="ctrlztest" name="ctrlztest"></textarea>
<p>Log:</p>
<textarea disabled id="log" rows="4" cols="50"></textarea>
JavaScript
window.onload = function () {
var textarea = document.getElementById("ctrlztest");
var log = document.getElementById("log");
textarea.value = "Delete Me";
function logTextArea() {
log.value += "LOG: " + (textarea.value.length +
' "' + textarea.value + '"' ) + "\n";
}
logTextArea();
textarea.addEventListener("change", logTextArea, false);
}