From: Alan Knowles Date: Mon, 29 Jul 2019 03:46:41 +0000 (+0800) Subject: fix whitespace removal X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=db5aeb8074a2601ca02f590250a3a289a1df001f fix whitespace removal --- diff --git a/roojs-all.js b/roojs-all.js index 5596869e24..aa18255778 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -1612,7 +1612,7 @@ Roo.form.TextField=function(A){Roo.form.TextField.superclass.constructor.call(th }Roo.form.TextField.superclass.initEvents.call(this);if(this.validationEvent=='keyup'){this.validationTask=new Roo.util.DelayedTask(this.validate,this);this.el.on('keyup',this.filterValidation,this);}else if(this.validationEvent!==false){this.el.on(this.validationEvent,this.validate,this,{buffer:this.validationDelay} );}if(this.selectOnFocus){this.on("focus",this.preFocus,this);}if(!this.allowLeadingSpace){this.on('blur',this.cleanLeadingSpace,this);}if(this.maskRe||(this.vtype&&this.disableKeyFilter!==true&&(this.maskRe=Roo.form.VTypes[this.vtype+'Mask']))){this.el.on("keypress",this.filterKeys,this); }if(this.grow){this.el.on("keyup",this.onKeyUp,this,{buffer:50});this.el.on("click",this.autoSize,this);}if(this.el.is('input[type=password]')&&Roo.isSafari){this.el.on('keydown',this.SafariOnKeyDown,this);}},processValue:function(A){if(this.stripCharsRe){var B=A.replace(this.stripCharsRe,''); -if(B!==A){this.setRawValue(B);return B;}}return A;},filterValidation:function(e){if(!e.isNavKeyPress()){this.validationTask.delay(this.validationDelay);}},onKeyUp:function(e){if(!e.isNavKeyPress()){this.autoSize();}},cleanLeadingSpace:function(e){this.setValue(this.getValue().replace(/^\s+/,'')); +if(B!==A){this.setRawValue(B);return B;}}return A;},filterValidation:function(e){if(!e.isNavKeyPress()){this.validationTask.delay(this.validationDelay);}},onKeyUp:function(e){if(!e.isNavKeyPress()){this.autoSize();}},cleanLeadingSpace:function(e){this.setValue((this.getValue()+'').replace(/^\s+/,'')); },reset:function(){Roo.form.TextField.superclass.reset.call(this);},preFocus:function(){if(this.selectOnFocus){this.el.dom.select();}},filterKeys:function(e){var k=e.getKey();if(!Roo.isIE&&(e.isNavKeyPress()||k==e.BACKSPACE||(k==e.DELETE&&e.button==-1))){return; }var c=e.getCharCode(),cc=String.fromCharCode(c);if(Roo.isIE&&(e.isSpecialKey()||!cc)){return;}if(!this.maskRe.test(cc)){e.stopEvent();}},setValue:function(v){Roo.form.TextField.superclass.setValue.apply(this,arguments);this.autoSize();},validateValue:function(A){if(A.length<1){if(this.allowBlank){this.clearInvalid(); return true;}else{this.markInvalid(this.blankText);return false;}}if(A.lengththis.maxLength){this.markInvalid(String.format(this.maxLengthText,this.maxLength)); diff --git a/roojs-debug.js b/roojs-debug.js index ff6e523a6a..8541c8ddde 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -39532,7 +39532,7 @@ Roo.extend(Roo.form.TextField, Roo.form.Field, { // private - clean the leading white space cleanLeadingSpace : function(e) { - this.setValue(this.getValue().replace(/^\s+/,'')); + this.setValue((this.getValue() + '').replace(/^\s+/,'')); }, /** * Resets the current field value to the originally-loaded value and clears any validation messages. diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js index 51530c3b9b..ac4042bc59 100644 --- a/roojs-ui-debug.js +++ b/roojs-ui-debug.js @@ -17081,7 +17081,7 @@ Roo.extend(Roo.form.TextField, Roo.form.Field, { // private - clean the leading white space cleanLeadingSpace : function(e) { - this.setValue(this.getValue().replace(/^\s+/,'')); + this.setValue((this.getValue() + '').replace(/^\s+/,'')); }, /** * Resets the current field value to the originally-loaded value and clears any validation messages. diff --git a/roojs-ui.js b/roojs-ui.js index 6ddac1b4e7..7898f28567 100644 --- a/roojs-ui.js +++ b/roojs-ui.js @@ -743,7 +743,7 @@ Roo.form.TextField=function(A){Roo.form.TextField.superclass.constructor.call(th }Roo.form.TextField.superclass.initEvents.call(this);if(this.validationEvent=='keyup'){this.validationTask=new Roo.util.DelayedTask(this.validate,this);this.el.on('keyup',this.filterValidation,this);}else if(this.validationEvent!==false){this.el.on(this.validationEvent,this.validate,this,{buffer:this.validationDelay} );}if(this.selectOnFocus){this.on("focus",this.preFocus,this);}if(!this.allowLeadingSpace){this.on('blur',this.cleanLeadingSpace,this);}if(this.maskRe||(this.vtype&&this.disableKeyFilter!==true&&(this.maskRe=Roo.form.VTypes[this.vtype+'Mask']))){this.el.on("keypress",this.filterKeys,this); }if(this.grow){this.el.on("keyup",this.onKeyUp,this,{buffer:50});this.el.on("click",this.autoSize,this);}if(this.el.is('input[type=password]')&&Roo.isSafari){this.el.on('keydown',this.SafariOnKeyDown,this);}},processValue:function(A){if(this.stripCharsRe){var B=A.replace(this.stripCharsRe,''); -if(B!==A){this.setRawValue(B);return B;}}return A;},filterValidation:function(e){if(!e.isNavKeyPress()){this.validationTask.delay(this.validationDelay);}},onKeyUp:function(e){if(!e.isNavKeyPress()){this.autoSize();}},cleanLeadingSpace:function(e){this.setValue(this.getValue().replace(/^\s+/,'')); +if(B!==A){this.setRawValue(B);return B;}}return A;},filterValidation:function(e){if(!e.isNavKeyPress()){this.validationTask.delay(this.validationDelay);}},onKeyUp:function(e){if(!e.isNavKeyPress()){this.autoSize();}},cleanLeadingSpace:function(e){this.setValue((this.getValue()+'').replace(/^\s+/,'')); },reset:function(){Roo.form.TextField.superclass.reset.call(this);},preFocus:function(){if(this.selectOnFocus){this.el.dom.select();}},filterKeys:function(e){var k=e.getKey();if(!Roo.isIE&&(e.isNavKeyPress()||k==e.BACKSPACE||(k==e.DELETE&&e.button==-1))){return; }var c=e.getCharCode(),cc=String.fromCharCode(c);if(Roo.isIE&&(e.isSpecialKey()||!cc)){return;}if(!this.maskRe.test(cc)){e.stopEvent();}},setValue:function(v){Roo.form.TextField.superclass.setValue.apply(this,arguments);this.autoSize();},validateValue:function(A){if(A.length<1){if(this.allowBlank){this.clearInvalid(); return true;}else{this.markInvalid(this.blankText);return false;}}if(A.lengththis.maxLength){this.markInvalid(String.format(this.maxLengthText,this.maxLength));