Vanilla Breeze v0.7.4

Vanilla Breeze v0.7.4 released

0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…

Read the release notes

loading

Lazy loading, fetch priority and image decoding hints: three attributes that decide when and how urgently the browser fetches images, iframes and scripts.

Overview

Three native attributes decide when and how urgently the browser fetches a resource. This page covers all three:

  • loading — when to fetch: now, or when the element comes near the viewport.
  • fetchpriority — how urgently to fetch, relative to other resources of the same kind.
  • decoding — whether the image may be decoded without holding up other content.

Applies to: loading on <img> and <iframe>; the spec has added <video> and <audio>, so far only in Chrome. fetchpriority on <img>, <link> and <script>. decoding on <img>.

Values

loading

ValueMeaning
eagerFetch straight away.
lazyWait until the element is near the viewport. The browser decides how near.
Absent or invalid (the default)eager.

fetchpriority

ValueMeaning
highFetch ahead of other resources of the same type.
lowFetch behind other resources of the same type.
auto, absent or invalid (the default)The browser's own priority.

decoding

ValueMeaning
asyncOther content may be shown before this image has decoded.
syncShow this image together with the content around it.
auto, absent or invalid (the default)The browser decides.

Examples

The LCP image

Never lazy-load the Largest Contentful Paint image. Give it fetchpriority="high" so it is fetched ahead of other images found at the same time.

Lazy images with sizes="auto"

A lazy image can let the browser measure its slot instead of a hand-written sizes. See srcset.

Lazy iframes

Maps, video and social embeds below the fold are the biggest wins: each one can pull in megabytes of script. Every iframe needs a title.

Priorities for links and scripts

In Vanilla Breeze

  • data-responsive runs after the parser has requested the image, so loading and fetchpriority must be in your markup to have any effect. It adds decoding="async" when you have not set decoding, and it leaves sizes="auto" on lazy images to the browser (src/utils/responsive-init.js).
  • <youtube-player> renders a lazy, async-decoded thumbnail and only inserts the YouTube iframe (with loading="lazy") when the user presses play.
  • Components that render images set loading="lazy" on them: <image-gallery> thumbnails, <activity-feed> and <comment-thread> avatars, and <social-embed> iframes.
  • data-mock marks the remote placeholder images it generates (photo, placehold and portrait presets) as lazy. VB's own demos use local SVG placeholders from src/assets/placeholders/.
  • Image defaults. src/native-elements/image/styles.css makes images fluid (max-inline-size: 100%; block-size: auto), so width and height attributes reserve the right aspect ratio without fixing the size. That is what lazy images need.

Accessibility

  • Lazy loading does not change alt: assistive technology reads it whether or not the image has loaded.
  • Lazy iframes still need a title describing their content.
  • Reserve space with width and height. Content that jumps as images arrive is hard to read and to click, especially with magnification.

Browser support

loading on images: Chrome 77, Firefox 75, Safari 15.4. On iframes: Chrome 77, Firefox 121, Safari 16.4. On <video> and <audio>: Chrome 150 only, experimental. fetchpriority: Chrome 101, Firefox 132, Safari 17.2. decoding: all current browsers (November 2026). Unsupported values and attributes are ignored, so the resource loads normally.

Gotchas

  • Lazy loading is off when scripting is off. The spec disables it so that lazy images cannot be used to track scroll position without JavaScript. Such images load eagerly.
  • Lazy images need a size. An image with no width/height and no CSS size is 0×0 before it loads, so many of them can sit "in view" at once and all load together.
  • Do not lazy-load above the fold. It delays the images people see first, often including the LCP image.
  • CSS backgrounds are not affected by loading.
  • fetchpriority is relative. Marking everything high is the same as marking nothing. Use it for one or two resources.
  • decoding="sync" rarely helps; leave it at the default unless you have measured a problem.

Related

Which to choose

  • LCP / hero image — eager (no loading) with fetchpriority="high".
  • Images below the fold — loading="lazy", decoding="async", width/height, and sizes="auto" if they have a srcset.
  • Embeds below the fold — loading="lazy", or a facade component such as <youtube-player> that loads nothing until asked.
  • Non-critical scripts — async fetchpriority="low".
↑