Skip to content
This repository has been archived by the owner on Dec 25, 2017. It is now read-only.

press "Delete" key, the caret position will auto jump to the end of the input!!!! #142

Closed
hldgaofeng opened this issue Jan 21, 2016 · 4 comments
Labels

Comments

@hldgaofeng
Copy link

found a bug?

when validate on a input type="text", input some text, press "home" or use mouse click move the caret to the input begining position,
then press "Delete" key, the caret position will auto jump to the end of the input!!!!

@hldgaofeng
Copy link
Author

      key: 'manageElement',
      value: function manageElement(el) {
        var _this = this;

        var _ = exports$1.Vue.util;

        var scope = this._getScope();
        var model = attr(el, 'v-model');
        if (model) {
          el.value = scope.$get(model) || '';
          this._unwatch = scope.$watch(model, _.bind(function (val, old) {
            if (val !== old) {
              //el.value = val; // press "delete" key in a <input type="text /> will cause the caret jump to the end
              _this.handleValidate(el);
            }    
          }, this));
        }    
      }    

@hldgaofeng
Copy link
Author

          this._unwatch = scope.$watch(model, _.bind(function (val, old) {
            if (val !== old) {
              //el.value = val; // el.value is already equal to val, why this code doing? thanks!
              _this.handleValidate(el);
            }    
          }, this));
        }    
      }    

@kazupon
Copy link
Owner

kazupon commented Jan 21, 2016

Thanks for your reporting ...

Oh ... 😱
Sorry.

I'll try to fix.

@kazupon
Copy link
Owner

kazupon commented Jan 22, 2016

release v2.0.0-alpha.16 ⬆️
https://github.com/vuejs/vue-validator/releases/tag/v2.0.0-alpha.16

please try it. 😺

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants