@@ -24,6 +24,52 @@ module.exports = {
24
24
25
25
priority : 850 ,
26
26
27
+ bind : function ( ) {
28
+ var attr = this . arg
29
+ // handle interpolation bindings
30
+ if ( this . descriptor . interp ) {
31
+ // only allow binding on native attributes
32
+ if ( ! (
33
+ // class is allowed globally
34
+ attr === 'class' ||
35
+ // data attributes are allowed globally
36
+ / ^ d a t a - / . test ( attr ) ||
37
+ // for available
38
+ ( attr === 'for' && 'htmlFor' in this . el ) ||
39
+ // camelized prop available
40
+ _ . camelize ( attr ) in this . el
41
+ ) ) {
42
+ process . env . NODE_ENV !== 'production' && _ . warn (
43
+ attr + '="' + this . descriptor . raw + '": ' +
44
+ 'attribute interpolation is allowed only ' +
45
+ 'in valid native attributes. "' + attr + '" ' +
46
+ 'is not a valid attribute on <' + this . el . tagName . toLowerCase ( ) + '>.'
47
+ )
48
+ this . invalid = true
49
+ }
50
+
51
+ if ( process . env . NODE_ENV !== 'production' ) {
52
+ var raw = attr + '="' + this . descriptor . raw + '": '
53
+ // warn src
54
+ if ( attr === 'src' ) {
55
+ _ . warn (
56
+ raw + 'interpolation in "src" attribute will cause ' +
57
+ 'a 404 request. Use v-bind:src instead.'
58
+ )
59
+ }
60
+
61
+ // warn style
62
+ if ( attr === 'style' ) {
63
+ _ . warn (
64
+ raw + 'interpolation in "style" attribtue will cause ' +
65
+ 'the attribtue to be discarded in Internet Explorer. ' +
66
+ 'Use v-bind:style instead.'
67
+ )
68
+ }
69
+ }
70
+ }
71
+ } ,
72
+
27
73
update : function ( value ) {
28
74
if ( this . invalid ) return
29
75
var attr = this . arg
@@ -49,50 +95,3 @@ module.exports = {
49
95
}
50
96
}
51
97
}
52
-
53
- if ( process . env . NODE_ENV !== 'production' ) {
54
- module . exports . bind = function ( ) {
55
- var attr = this . arg
56
- // handle interpolation bindings
57
- if ( this . descriptor . interp ) {
58
- var raw = attr + '="' + this . descriptor . raw + '": '
59
- // only allow binding on native attributes
60
- if (
61
- // data attributes are allowed
62
- ! ( / ^ d a t a - / . test ( attr ) ) &&
63
- // class is allowed
64
- ! ( attr === 'class' ) &&
65
- (
66
- // label for
67
- ( attr === 'for' && ! ( 'htmlFor' in this . el ) ) ||
68
- // other native attributes
69
- ! ( _ . camelize ( attr ) in this . el )
70
- )
71
- ) {
72
- _ . warn (
73
- raw + 'attribute interpolation is allowed only ' +
74
- 'in valid native attributes. "' + attr + '" ' +
75
- 'is not a valid attribute on <' + this . el . tagName . toLowerCase ( ) + '>.'
76
- )
77
- this . invalid = true
78
- }
79
-
80
- // warn src
81
- if ( attr === 'src' ) {
82
- _ . warn (
83
- raw + 'interpolation in "src" attribute will cause ' +
84
- 'a 404 request. Use v-bind:src instead.'
85
- )
86
- }
87
-
88
- // warn style
89
- if ( attr === 'style' ) {
90
- _ . warn (
91
- raw + 'interpolation in "style" attribtue will cause ' +
92
- 'the attribtue to be discarded in Internet Explorer. ' +
93
- 'Use v-bind:style instead.'
94
- )
95
- }
96
- }
97
- }
98
- }
0 commit comments