do not add \x00 characters to document

This commit is contained in:
nightwing 2012-04-21 12:25:41 +04:00
commit a3053c8353

View file

@ -72,16 +72,14 @@ var TextInput = function(parentNode, host, listenElement) {
if (!copied) { if (!copied) {
var value = valueToSend || text.value; var value = valueToSend || text.value;
if (value) { if (value) {
if (value.charCodeAt(value.length-1) == PLACEHOLDER.charCodeAt(0)) { if (value.length > 1) {
value = value.slice(0, -1); if (value.charAt(0) == PLACEHOLDER)
if (value) { value = value.substr(1);
if (pasted) else if (value.charAt(value.length - 1) == PLACEHOLDER)
host.onPaste(value); value = value.slice(0, -1);
else
host.onTextInput(value);
}
} }
else {
if (value && value != PLACEHOLDER) {
if (pasted) if (pasted)
host.onPaste(value); host.onPaste(value);
else else