never send empty strings to the document

This commit is contained in:
Fabian Jakobs 2010-09-28 12:10:35 +02:00
commit ce6bfe2f65

View file

@ -26,9 +26,11 @@ var TextInput = function(parentNode, host) {
if (!copied) { if (!copied) {
var value = text.value; var value = text.value;
if (value) { if (value) {
if (value.charCodeAt(value.length-1) == PLACEHOLDER.charCodeAt(0)) if (value.charCodeAt(value.length-1) == PLACEHOLDER.charCodeAt(0)) {
host.onTextInput(value.slice(0, -1)); value = value.slice(0, -1);
else if (value)
host.onTextInput(value);
} else
host.onTextInput(value); host.onTextInput(value);
} }
} }