Skip to content

Commit 8a23ca0

Browse files
committed
relax attribute interpolation warning check
1 parent c0db7dd commit 8a23ca0

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

src/deprecations.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ if (process.env.NODE_ENV !== 'production') {
140140

141141
ATTR_INVALID: function (name) {
142142
warn(
143-
'Mustache interpolation found in non-native attribute "' + name + '": ' +
143+
'Mustache interpolation found in vue-specific attribute "' + name + '": ' +
144144
'attribute interpolation will be limited to native attributes only ' +
145-
'in 1.0.0. Use v-bind for custom attributes and props.'
145+
'in 1.0.0. Use v-bind for vue directives and props.'
146146
)
147147
},
148148

src/directives/attr.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,20 @@ var modelProps = {
2020
'false-value': '_falseValue'
2121
}
2222

23+
// check for attribtues that prohibit interpolations
24+
var disallowedInterpAttrRE = /^v-|^:|^@|^(is|transition|transition-mode|debounce|track-by|stagger|enter-stagger|leave-stagger)$/
25+
2326
module.exports = {
2427

2528
priority: 850,
2629

2730
update: function (value) {
2831
if (this.arg) {
29-
3032
if (process.env.NODE_ENV !== 'production') {
31-
var attr = this.arg
32-
if (!(
33-
attr === 'class' ||
34-
/^data-/.test(attr) ||
35-
(attr === 'for' && 'htmlFor' in this.el) ||
36-
_.camelize(attr) in this.el
37-
)) {
38-
_.deprecation.ATTR_INVALID(attr)
33+
if (disallowedInterpAttrRE.test(this.arg)) {
34+
_.deprecation.ATTR_INVALID(this.arg)
3935
}
4036
}
41-
4237
this.setAttr(this.arg, value)
4338
} else if (typeof value === 'object') {
4439
// TODO no longer need to support object in 1.0.0

0 commit comments

Comments
 (0)