@@ -45,9 +45,7 @@ export function attr(dom, attribute, value) {
45
45
attributes [ attribute ] = dom . getAttribute ( attribute ) ;
46
46
47
47
if ( attribute === 'src' || attribute === 'href' || attribute === 'srcset' ) {
48
- if ( DEV ) {
49
- check_src_in_dev_hydration ( dom , attribute , value ) ;
50
- }
48
+ check_src_in_dev_hydration ( dom , attribute , value ) ;
51
49
52
50
// If we reset these attributes, they would result in another network request, which we want to avoid.
53
51
// We assume they are the same between client and server as checking if they are equal is expensive
@@ -204,15 +202,9 @@ export function spread_attributes(dom, prev, attrs, lowercase_attributes, css_ha
204
202
}
205
203
206
204
if ( setters . includes ( name ) ) {
207
- if ( DEV ) {
205
+ if ( hydrating && ( name === 'src' || name === 'href' || name === 'srcset' ) ) {
208
206
check_src_in_dev_hydration ( dom , name , value ) ;
209
- }
210
-
211
- if (
212
- ! hydrating ||
213
- // @ts -ignore see attr method for an explanation of src/srcset
214
- ( dom [ name ] !== value && name !== 'src' && name !== 'href' && name !== 'srcset' )
215
- ) {
207
+ } else {
216
208
// @ts -ignore
217
209
dom [ name ] = value ;
218
210
}
@@ -311,9 +303,7 @@ function get_setters(element) {
311
303
* @param {string | null } value
312
304
*/
313
305
function check_src_in_dev_hydration ( dom , attribute , value ) {
314
- if ( ! hydrating ) return ;
315
- if ( attribute !== 'src' && attribute !== 'href' && attribute !== 'srcset' ) return ;
316
-
306
+ if ( ! DEV ) return ;
317
307
if ( attribute === 'srcset' && srcset_url_equal ( dom , value ) ) return ;
318
308
if ( src_url_equal ( dom . getAttribute ( attribute ) ?? '' , value ?? '' ) ) return ;
319
309
0 commit comments