File tree Expand file tree Collapse file tree 2 files changed +15
-13
lines changed
test/unit/specs/directives Expand file tree Collapse file tree 2 files changed +15
-13
lines changed Original file line number Diff line number Diff line change @@ -68,19 +68,7 @@ module.exports = {
68
68
69
69
setAttr : function ( attr , value ) {
70
70
if ( inputProps [ attr ] && attr in this . el ) {
71
- if ( ! this . valueRemoved ) {
72
- this . el . removeAttribute ( attr )
73
- this . valueRemoved = true
74
- }
75
71
this . el [ attr ] = value
76
- } else if ( value != null && value !== false ) {
77
- if ( xlinkRE . test ( attr ) ) {
78
- this . el . setAttributeNS ( xlinkNS , attr , value )
79
- } else {
80
- this . el . setAttribute ( attr , value )
81
- }
82
- } else {
83
- this . el . removeAttribute ( attr )
84
72
}
85
73
// set model props
86
74
var modelProp = modelProps [ attr ]
@@ -92,5 +80,20 @@ module.exports = {
92
80
model . listener ( )
93
81
}
94
82
}
83
+ // do not set value attribute for textarea
84
+ if ( attr === 'value' && this . el . tagName === 'TEXTAREA' ) {
85
+ this . el . removeAttribute ( attr )
86
+ return
87
+ }
88
+ // update attribute
89
+ if ( value != null && value !== false ) {
90
+ if ( xlinkRE . test ( attr ) ) {
91
+ this . el . setAttributeNS ( xlinkNS , attr , value )
92
+ } else {
93
+ this . el . setAttribute ( attr , value )
94
+ }
95
+ } else {
96
+ this . el . removeAttribute ( attr )
97
+ }
95
98
}
96
99
}
Original file line number Diff line number Diff line change @@ -30,7 +30,6 @@ if (_.inBrowser) {
30
30
dir . el = document . createElement ( 'input' )
31
31
dir . arg = 'value'
32
32
dir . update ( 'what' )
33
- expect ( dir . el . hasAttribute ( 'value' ) ) . toBe ( false )
34
33
expect ( dir . el . value ) . toBe ( 'what' )
35
34
dir . el = document . createElement ( 'input' )
36
35
dir . el . type = 'checkbox'
You can’t perform that action at this time.
0 commit comments