Skip to content

Commit 90c92fb

Browse files
committed
set property for "muted" in v-bind (fix vuejs#2042)
1 parent e1d6b3e commit 90c92fb

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

src/directives/public/bind.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ import vStyle from '../internal/style'
55
const xlinkNS = 'http://www.w3.org/1999/xlink'
66
const xlinkRE = /^xlink:/
77

8-
// these input element attributes should also set their
9-
// corresponding properties
10-
const inputProps = {
11-
value: 1,
12-
checked: 1,
13-
selected: 1
14-
}
8+
// check for attributes that prohibit interpolations
9+
const disallowedInterpAttrRE = /^v-|^:|^@|^(is|transition|transition-mode|debounce|track-by|stagger|enter-stagger|leave-stagger)$/
10+
11+
// these attributes should also set their corresponding properties
12+
// because they only affect the initial state of the element
13+
const attrWithPropsRE = /^(value|checked|selected|muted)$/
1514

1615
// these attributes should set a hidden property for
1716
// binding v-model to object values
@@ -21,9 +20,6 @@ const modelProps = {
2120
'false-value': '_falseValue'
2221
}
2322

24-
// check for attributes that prohibit interpolations
25-
const disallowedInterpAttrRE = /^v-|^:|^@|^(is|transition|transition-mode|debounce|track-by|stagger|enter-stagger|leave-stagger)$/
26-
2723
export default {
2824

2925
priority: 850,
@@ -90,7 +86,11 @@ export default {
9086
handleObject: vStyle.handleObject,
9187

9288
handleSingle (attr, value) {
93-
if (inputProps[attr] && attr in this.el) {
89+
if (
90+
!this.descriptor.interp &&
91+
attrWithPropsRE.test(attr) &&
92+
attr in this.el
93+
) {
9494
this.el[attr] = attr === 'value'
9595
? value == null // IE9 will set input.value to "null" for null...
9696
? ''

test/unit/specs/directives/public/bind_spec.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ describe('v-bind', function () {
77
var el, dir
88
beforeEach(function () {
99
el = document.createElement('div')
10-
dir = {el: el}
10+
dir = {
11+
el: el,
12+
descriptor: {}
13+
}
1114
_.extend(dir, def)
1215
})
1316

0 commit comments

Comments
 (0)