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

Commit

Permalink
fix(validator): fix textarea placeholder bug in IE10/11
Browse files Browse the repository at this point in the history
Closes #172
  • Loading branch information
kazupon committed Mar 17, 2016
1 parent 508bb4e commit ee11193
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/directives/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Validator from '../validator'
export default function (Vue) {
const _ = Vue.util
const FragmentFactory = Vue.FragmentFactory
const parseTemplate = Vue.parsers.template.parseTemplate
const vIf = Vue.directive('if')
const camelize = Vue.util.camelize

Expand Down Expand Up @@ -82,7 +83,7 @@ export default function (Vue) {
this.anchor = _.createAnchor('vue-validator')
_.replace(this.el, this.anchor)
_.extend(vm.$options, { _validator: this.validatorName })
this.factory = new FragmentFactory(vm, this.el.innerHTML)
this.factory = new FragmentFactory(vm, parseTemplate(this.el, true))
vIf.insert.call(this)
})

Expand Down
18 changes: 18 additions & 0 deletions test/specs/directives/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,4 +365,22 @@ describe('validator element directive', () => {
})
})
})

// # issue 172
describe('textarea', () => {
beforeEach((done) => {
el.innerHTML = '<validator name="validator1">'
+ '<form novalidate>'
+ '<textarea v-validate:field1="{ maxlength: 100 }" placeholder="this is placeholder"></textarea>'
+ '</form>'
+ '</validator>'
vm = new Vue({ el: el })
vm.$nextTick(done)
})

it('should not be filled with placeholder value', () => {
let field = el.getElementsByTagName('textarea')[0]
assert(field.value !== 'this is placeholder')
})
})
})

0 comments on commit ee11193

Please sign in to comment.