Skip to content

Commit f95779b

Browse files
committed
more sensible props handling
1 parent e753a04 commit f95779b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/compiler/compile.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,10 @@ function makeChildLinkFn (linkFns) {
381381
* @return {Function} propsLinkFn
382382
*/
383383

384+
// regex to test if a path is "settable"
385+
// if not the prop binding is automatically one-way.
386+
var settablePathRE = /^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*|\[[^\[\]]\])*$/
387+
384388
function compileProps (el, attrs, propNames) {
385389
var props = []
386390
var i = propNames.length
@@ -411,7 +415,10 @@ function compileProps (el, attrs, propNames) {
411415
attrs[name] = null
412416
prop.dynamic = true
413417
prop.value = textParser.tokensToExp(tokens)
414-
prop.oneTime = tokens.length === 1 && tokens[0].oneTime
418+
prop.oneTime =
419+
tokens.length > 1 ||
420+
tokens[0].oneTime ||
421+
!settablePathRE.test(prop.value)
415422
}
416423
props.push(prop)
417424
}

0 commit comments

Comments
 (0)