diff --git a/src/directives/public/bind.js b/src/directives/public/bind.js index 4df061d86..9c249229d 100644 --- a/src/directives/public/bind.js +++ b/src/directives/public/bind.js @@ -5,13 +5,12 @@ import vStyle from '../internal/style' const xlinkNS = 'http://www.w3.org/1999/xlink' const xlinkRE = /^xlink:/ -// these input element attributes should also set their -// corresponding properties -const inputProps = { - value: 1, - checked: 1, - selected: 1 -} +// check for attributes that prohibit interpolations +const disallowedInterpAttrRE = /^v-|^:|^@|^(is|transition|transition-mode|debounce|track-by|stagger|enter-stagger|leave-stagger)$/ + +// these attributes should also set their corresponding properties +// because they only affect the initial state of the element +const attrWithPropsRE = /^(value|checked|selected|muted)$/ // these attributes should set a hidden property for // binding v-model to object values @@ -21,9 +20,6 @@ const modelProps = { 'false-value': '_falseValue' } -// check for attributes that prohibit interpolations -const disallowedInterpAttrRE = /^v-|^:|^@|^(is|transition|transition-mode|debounce|track-by|stagger|enter-stagger|leave-stagger)$/ - export default { priority: 850, @@ -90,7 +86,11 @@ export default { handleObject: vStyle.handleObject, handleSingle (attr, value) { - if (inputProps[attr] && attr in this.el) { + if ( + !this.descriptor.interp && + attrWithPropsRE.test(attr) && + attr in this.el + ) { this.el[attr] = attr === 'value' ? value == null // IE9 will set input.value to "null" for null... ? '' diff --git a/test/unit/specs/directives/public/bind_spec.js b/test/unit/specs/directives/public/bind_spec.js index 77ebdfd76..2fc4bea23 100644 --- a/test/unit/specs/directives/public/bind_spec.js +++ b/test/unit/specs/directives/public/bind_spec.js @@ -7,7 +7,10 @@ describe('v-bind', function () { var el, dir beforeEach(function () { el = document.createElement('div') - dir = {el: el} + dir = { + el: el, + descriptor: {} + } _.extend(dir, def) })