CKTIS / HTML
HTML concept: loading-performance
HTML loading performance depends on resource discovery, fetch priority, deferral, decoding, and reserved layout space; most controls are hints, not timing guarantees.
Version: WHATWG HTML Living Standard; index snapshot date recorded separately
Syntax
discovery + priority hints + lazy loading + decoding + stable dimensionsThe loading attribute has lazy and eager states; lazy permits deferral until proximity conditions are met, but the browser chooses the threshold. Do not use it for the LCP image or other immediately visible content, and both missing and invalid values mean eager state.
fetchpriority supplies a relative high, low, or auto hint, but cannot force ordering or replace early discovery. decoding values sync and async influence presentation preference; explicitly awaiting image decoding uses the image API promise.
The width and height attributes provide an intrinsic aspect ratio and reserve space, reducing layout shifts; CSS can still change final size. For responsive images, srcset and sizes drive candidate selection, so an inaccurate size can fetch an unnecessarily large resource.
The example awaits decode() for a local data image, then reads naturalWidth, naturalHeight, width, and height. Its result distinguishes natural 2×1 dimensions from reserved 320×180 dimensions and confirms complete decoding without network access.
Examples
<!doctype html>
<meta charset="utf-8">
<img id="hero" loading="lazy" decoding="async" fetchpriority="high" width="320" height="180" alt="">
<output id="result"></output>
<script>
const hero = document.querySelector("#hero");
hero.src = "data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%272%27 height=%271%27%3E%3C/svg%3E";
hero.decode().then(() => {
result.textContent = `complete=${hero.complete}; natural=${hero.naturalWidth}x${hero.naturalHeight}; rendered=${hero.width}x${hero.height}; loading=${hero.loading}; priority=${hero.fetchPriority}`;
});
</script>
Result
complete=true; natural=2x1; rendered=320x180; loading=lazy; priority=high
The executed example verifies decoding and dimensions; it does not prove actual request priority, the lazy threshold, or an LCP improvement in a production document.