|
48 | 48 | {:else} |
49 | 49 | <img src={src} alt="attribute shorthand test" /> |
50 | 50 | {/if} |
| 51 | +{:else if Object.keys(src.sources).length === 1} |
| 52 | + <img src={src.img.src} alt="attribute shorthand test" srcset={Object.values(src.sources)[0]} width={src.img.w} height={src.img.h} /> |
51 | 53 | {:else} |
52 | | - {#if Object.keys(src.sources).length === 1} |
53 | | - <img src={src.img.src} alt="attribute shorthand test" srcset={Object.values(src.sources)[0]} width={src.img.w} height={src.img.h} /> |
54 | | - {:else} |
55 | | - <picture> |
56 | | - {#each Object.entries(src.sources) as [format, srcset]} |
57 | | - <source {srcset} type={'image/' + format} /> |
58 | | - {/each} |
59 | | - <img src={src.img.src} alt="attribute shorthand test" width={src.img.w} height={src.img.h} /> |
60 | | - </picture> |
61 | | - {/if} |
| 54 | + <picture> |
| 55 | + {#each Object.entries(src.sources) as [format, srcset]} |
| 56 | + <source {srcset} type={'image/' + format} /> |
| 57 | + {/each} |
| 58 | + <img src={src.img.src} alt="attribute shorthand test" width={src.img.w} height={src.img.h} /> |
| 59 | + </picture> |
62 | 60 | {/if} |
63 | 61 |
|
64 | 62 | {#if typeof webp_image === 'string'} |
|
68 | 66 | {:else} |
69 | 67 | <img src={webp_image} alt="single format dynamic test" /> |
70 | 68 | {/if} |
| 69 | +{:else if Object.keys(webp_image.sources).length === 1} |
| 70 | + <img src={webp_image.img.src} alt="single format dynamic test" srcset={Object.values(webp_image.sources)[0]} width={webp_image.img.w} height={webp_image.img.h} /> |
71 | 71 | {:else} |
72 | | - {#if Object.keys(webp_image.sources).length === 1} |
73 | | - <img src={webp_image.img.src} alt="single format dynamic test" srcset={Object.values(webp_image.sources)[0]} width={webp_image.img.w} height={webp_image.img.h} /> |
74 | | - {:else} |
75 | | - <picture> |
76 | | - {#each Object.entries(webp_image.sources) as [format, srcset]} |
77 | | - <source {srcset} type={'image/' + format} /> |
78 | | - {/each} |
79 | | - <img src={webp_image.img.src} alt="single format dynamic test" width={webp_image.img.w} height={webp_image.img.h} /> |
80 | | - </picture> |
81 | | - {/if} |
| 72 | + <picture> |
| 73 | + {#each Object.entries(webp_image.sources) as [format, srcset]} |
| 74 | + <source {srcset} type={'image/' + format} /> |
| 75 | + {/each} |
| 76 | + <img src={webp_image.img.src} alt="single format dynamic test" width={webp_image.img.w} height={webp_image.img.h} /> |
| 77 | + </picture> |
82 | 78 | {/if} |
83 | 79 |
|
84 | 80 | {#each images as image} |
|
89 | 85 | {:else} |
90 | 86 | <img src={image} alt="opt-in test" /> |
91 | 87 | {/if} |
| 88 | +{:else if Object.keys(image.sources).length === 1} |
| 89 | + <img src={image.img.src} alt="opt-in test" srcset={Object.values(image.sources)[0]} width={image.img.w} height={image.img.h} /> |
92 | 90 | {:else} |
93 | | - {#if Object.keys(image.sources).length === 1} |
94 | | - <img src={image.img.src} alt="opt-in test" srcset={Object.values(image.sources)[0]} width={image.img.w} height={image.img.h} /> |
95 | | - {:else} |
96 | | - <picture> |
97 | | - {#each Object.entries(image.sources) as [format, srcset]} |
98 | | - <source {srcset} type={'image/' + format} /> |
99 | | - {/each} |
100 | | - <img src={image.img.src} alt="opt-in test" width={image.img.w} height={image.img.h} /> |
101 | | - </picture> |
102 | | - {/if} |
| 91 | + <picture> |
| 92 | + {#each Object.entries(image.sources) as [format, srcset]} |
| 93 | + <source {srcset} type={'image/' + format} /> |
| 94 | + {/each} |
| 95 | + <img src={image.img.src} alt="opt-in test" width={image.img.w} height={image.img.h} /> |
| 96 | + </picture> |
103 | 97 | {/if} |
104 | 98 | {/each} |
105 | 99 |
|
|
111 | 105 | {:else} |
112 | 106 | <img src={get_image(i)} alt="opt-in test" /> |
113 | 107 | {/if} |
| 108 | +{:else if Object.keys(get_image(i).sources).length === 1} |
| 109 | + <img src={get_image(i).img.src} alt="opt-in test" srcset={Object.values(get_image(i).sources)[0]} width={get_image(i).img.w} height={get_image(i).img.h} /> |
114 | 110 | {:else} |
115 | | - {#if Object.keys(get_image(i).sources).length === 1} |
116 | | - <img src={get_image(i).img.src} alt="opt-in test" srcset={Object.values(get_image(i).sources)[0]} width={get_image(i).img.w} height={get_image(i).img.h} /> |
117 | | - {:else} |
118 | | - <picture> |
119 | | - {#each Object.entries(get_image(i).sources) as [format, srcset]} |
120 | | - <source {srcset} type={'image/' + format} /> |
121 | | - {/each} |
122 | | - <img src={get_image(i).img.src} alt="opt-in test" width={get_image(i).img.w} height={get_image(i).img.h} /> |
123 | | - </picture> |
124 | | - {/if} |
| 111 | + <picture> |
| 112 | + {#each Object.entries(get_image(i).sources) as [format, srcset]} |
| 113 | + <source {srcset} type={'image/' + format} /> |
| 114 | + {/each} |
| 115 | + <img src={get_image(i).img.src} alt="opt-in test" width={get_image(i).img.w} height={get_image(i).img.h} /> |
| 116 | + </picture> |
125 | 117 | {/if} |
126 | 118 | {/each} |
127 | 119 |
|
|
0 commit comments