@@ -56,20 +56,19 @@ export default function visitElement ( generator, block, state, node ) {
56
56
block . builders . create . addLine ( `${ generator . helper ( 'setAttribute' ) } ( ${ name } , '${ generator . cssId } ', '' );` ) ;
57
57
}
58
58
59
- let selectValueAttribute ;
60
-
61
- node . attributes
62
- . sort ( ( a , b ) => order [ a . type ] - order [ b . type ] )
63
- . forEach ( attribute => {
64
- // <select> value attributes are an annoying special case — it must be handled
65
- // *after* its children have been updated
66
- if ( ( attribute . type === 'Attribute' || attribute . type === 'Binding' ) && attribute . name === 'value' && node . name === 'select' ) {
67
- selectValueAttribute = attribute ;
68
- return ;
69
- }
70
-
71
- visitors [ attribute . type ] ( generator , block , childState , node , attribute ) ;
72
- } ) ;
59
+ function visitAttributes ( ) {
60
+ node . attributes
61
+ . sort ( ( a , b ) => order [ a . type ] - order [ b . type ] )
62
+ . forEach ( attribute => {
63
+ visitors [ attribute . type ] ( generator , block , childState , node , attribute ) ;
64
+ } ) ;
65
+ }
66
+
67
+ if ( node . name !== 'select' ) {
68
+ // <select> value attributes are an annoying special case — it must be handled
69
+ // *after* its children have been updated
70
+ visitAttributes ( ) ;
71
+ }
73
72
74
73
// special case – bound <option> without a value attribute
75
74
if ( node . name === 'option' && ! node . attributes . find ( attribute => attribute . type === 'Attribute' && attribute . name === 'value' ) ) { // TODO check it's bound
@@ -116,9 +115,8 @@ export default function visitElement ( generator, block, state, node ) {
116
115
block . builders . update . addLine ( node . lateUpdate ) ;
117
116
}
118
117
119
- if ( selectValueAttribute ) {
120
- const visitor = selectValueAttribute . type === 'Attribute' ? visitAttribute : visitBinding ;
121
- visitor ( generator , block , childState , node , selectValueAttribute ) ;
118
+ if ( node . name === 'select' ) {
119
+ visitAttributes ( ) ;
122
120
}
123
121
124
122
if ( node . initialUpdate ) {
0 commit comments