@@ -87,17 +87,14 @@ Globals.assign({
87
87
}
88
88
89
89
const { style, children, scrollTop, scrollLeft, ...attributes } = props !
90
- const filter =
91
- instance . nodeName === 'filter' ||
92
- ( instance . parentNode && instance . parentNode . nodeName === 'filter' )
93
90
94
91
if ( scrollTop !== void 0 ) instance . scrollTop = scrollTop
95
92
if ( scrollLeft !== void 0 ) instance . scrollLeft = scrollLeft
96
93
97
94
// Set textContent, if children is an animatable value
98
95
if ( children !== void 0 ) instance . textContent = children
99
96
100
- // Set styles ...
97
+ // Apply CSS styles
101
98
for ( let styleName in style ) {
102
99
if ( ! style . hasOwnProperty ( styleName ) ) continue
103
100
var isCustomProperty = styleName . indexOf ( '--' ) === 0
@@ -111,18 +108,23 @@ Globals.assign({
111
108
else instance . style [ styleName ] = styleValue
112
109
}
113
110
114
- // Set attributes ...
111
+ const isFilterElement =
112
+ instance . nodeName === 'filter' ||
113
+ ( instance . parentNode && instance . parentNode . nodeName === 'filter' )
114
+
115
+ // Apply DOM attributes
115
116
for ( let name in attributes ) {
116
117
// Attributes are written in dash case
117
- const dashCase = filter
118
- ? name
119
- : attributeCache [ name ] ||
120
- ( attributeCache [ name ] = name . replace (
121
- / ( [ A - Z ] ) / g,
122
- n => '-' + n . toLowerCase ( )
123
- ) )
124
- if ( typeof instance . getAttribute ( dashCase ) !== 'undefined' )
125
- instance . setAttribute ( dashCase , attributes [ name ] )
118
+ const attributeName =
119
+ isFilterElement || instance . hasAttribute ( name )
120
+ ? name
121
+ : attributeCache [ name ] ||
122
+ ( attributeCache [ name ] = name . replace (
123
+ / ( [ A - Z ] ) / g,
124
+ n => '-' + n . toLowerCase ( )
125
+ ) )
126
+
127
+ instance . setAttribute ( attributeName , attributes [ name ] )
126
128
}
127
129
} ,
128
130
} )
0 commit comments