Skip to content

Commit b2cdf21

Browse files
committed
Merge branch 'lazyloading' of ssh://github.com/bengreenstein/html into lazyloading
2 parents edc1e95 + 8db807c commit b2cdf21

File tree

1 file changed

+110
-10
lines changed

1 file changed

+110
-10
lines changed

source

+110-10
Original file line numberDiff line numberDiff line change
@@ -2795,6 +2795,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
27952795
<li><dfn data-x="concept-request-method" data-x-href="https://fetch.spec.whatwg.org/#concept-request-method">method</dfn></li>
27962796
<li><dfn data-x="concept-request-header-list" data-x-href="https://fetch.spec.whatwg.org/#concept-request-header-list">header list</dfn></li>
27972797
<li><dfn data-x="concept-request-body" data-x-href="https://fetch.spec.whatwg.org/#concept-request-body">body</dfn></li>
2798+
<li><dfn data-x="concept-request-add-range-header" data-x-href="https://fetch.spec.whatwg.org/#concept-request-add-range-header">add a range header</dfn></li>
27982799
<li><dfn data-x="concept-request-client" data-x-href="https://fetch.spec.whatwg.org/#concept-request-client">client</dfn></li>
27992800
<li><dfn data-x="concept-request-current-url" data-x-href="https://fetch.spec.whatwg.org/#concept-request-current-url">current URL</dfn></li>
28002801
<li><dfn data-x="concept-request-reserved-client" data-x-href="https://fetch.spec.whatwg.org/#concept-request-reserved-client">reserved client</dfn></li>
@@ -7211,6 +7212,42 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
72117212
<code>HTMLOrSVGElement</code> must set the <span>[[CryptographicNonce]]</span> slot on the copy
72127213
to the value of the slot on the element being cloned.</p>
72137214

7215+
<h4>Lazy loading attributes</h4>
7216+
7217+
<p>A <dfn>lazy loading attribute</dfn> is an <span>enumerated attribute</span>. The following
7218+
table lists the keywords and states for the attribute &mdash; the keywords in the left column map
7219+
to the states in the cell in the second column on the same row as the keyword.</p>
7220+
7221+
<p>The attribute provides a hint to the user agent to aid in deciding whether to load an element
7222+
immediately or to defer loading until the element will be viewable, according to the attribute's
7223+
current state.</p>
7224+
7225+
<table>
7226+
<thead>
7227+
<tr>
7228+
<th>Keyword
7229+
<th>State
7230+
<th>Description
7231+
<tbody>
7232+
<tr>
7233+
<td><dfn><code data-x="attr-lazyload-on">on</code></dfn>
7234+
<td><dfn data-x="attr-lazyload-on-state">On</dfn>
7235+
<td>Indicates a strong preference to defer fetching the element's resource until it will be
7236+
viewable.
7237+
<tr>
7238+
<td><dfn><code data-x="attr-lazyload-off">off</code></dfn>
7239+
<td><dfn data-x="attr-lazyload-off-state">Off</dfn>
7240+
<td>Indicates the element's resource must be fetched immediately, regardless of viewability.
7241+
<tr>
7242+
<td><dfn><code data-x="attr-lazyload-auto">auto</code></dfn>
7243+
<td><dfn data-x="attr-lazyload-auto-state">Auto</dfn>
7244+
<td>Indicates that the user agent may determine the fetching strategy (the default).
7245+
</table>
7246+
7247+
<p>The attribute's <i data-x="missing value default">missing value default</i> and <i
7248+
data-x="invalid value default">invalid value default</i> are both the <span
7249+
data-x="attr-lazyload-auto-state">Auto</span> state.</p>
7250+
72147251

72157252
<h3 split-filename="common-dom-interfaces">Common DOM interfaces</h3>
72167253

@@ -25711,6 +25748,7 @@ interface <dfn>HTMLSourceElement</dfn> : <span>HTMLElement</span> {
2571125748
<dd><code data-x="attr-dim-height">height</code></dd>
2571225749
<dd><code data-x="attr-img-referrerpolicy">referrerpolicy</code></dd>
2571325750
<dd><code data-x="attr-img-decoding">decoding</code></dd>
25751+
<dd><code data-x="attr-img-lazyload">lazyload</code></dd>
2571425752
<dt><span data-x="concept-element-dom">DOM interface</span>:</dt>
2571525753
<dd w-nodev>
2571625754
<pre><code class="idl" data-x="">[Exposed=Window,
@@ -25732,6 +25770,7 @@ interface <dfn>HTMLImageElement</dfn> : <span>HTMLElement</span> {
2573225770
readonly attribute USVString <span data-x="dom-img-currentSrc">currentSrc</span>;
2573325771
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-img-referrerPolicy">referrerPolicy</span>;
2573425772
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-img-decoding">decoding</span>;
25773+
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-img-lazyLoad">lazyLoad</span>;
2573525774

2573625775
Promise&lt;void&gt; <span data-x="dom-img-decode">decode</span>();
2573725776
};</code></pre>
@@ -25807,6 +25846,10 @@ interface <dfn>HTMLImageElement</dfn> : <span>HTMLElement</span> {
2580725846
default">missing value default</i> and <i data-x="invalid value default">invalid value
2580825847
default</i> are both the <span data-x="attr-img-decoding-auto-state">auto</span> state.</p>
2580925848

25849+
<p>The <dfn data-x="attr-img-lazyload"><code>lazyload</code></dfn> attribute is a <span>lazy
25850+
loading attribute</span>. Its purpose is to indicate the policy for loading images that are
25851+
outside the viewport.
25852+
2581025853
<hr>
2581125854

2581225855
<p>The <code>img</code> element must not be used as a layout tool. In particular, <code>img</code>
@@ -25997,6 +26040,10 @@ interface <dfn>HTMLImageElement</dfn> : <span>HTMLElement</span> {
2599726040
<span>reflect</span> the <code data-x="attr-img-decoding">decoding</code> content
2599826041
attribute, <span>limited to only known values</span>.
2599926042

26043+
<p>The <dfn><code data-x="dom-img-lazyLoad">lazyLoad</code></dfn> IDL attribute must
26044+
<span>reflect</span> the <code data-x="attr-img-lazyload">lazyload</code> content
26045+
attribute, <span>limited to only known values</span>.
26046+
2600026047
</div>
2600126048

2600226049
<dl class="domintro">
@@ -26044,14 +26091,6 @@ interface <dfn>HTMLImageElement</dfn> : <span>HTMLElement</span> {
2604426091

2604526092
</dd>
2604626093

26047-
<dt><var>image</var> . <code subdfn data-x="dom-img-decoding">decoding</code></dt>
26048-
26049-
<dd>
26050-
26051-
<p>Returns the <span>image decoding hint</span> set for this image.</p>
26052-
26053-
</dd>
26054-
2605526094
<dt><var>image</var> . <code subdfn data-x="dom-img-decode">decode</code>()</dt>
2605626095

2605726096
<dd>
@@ -27257,7 +27296,12 @@ was an English &lt;a href="/wiki/Music_hall">music hall&lt;/a> singer, ...</code
2725727296
<p>In a <span>browsing context</span> where <span data-x="concept-bc-noscript">scripting is
2725827297
disabled</span>, user agents may obtain images immediately or on demand. In a <span>browsing
2725927298
context</span> where <span data-x="concept-bc-noscript">scripting is enabled</span>, user agents
27260-
must obtain images immediately.</p>
27299+
must obtain images immediately when the CSS boxes those images intersect the
27300+
<span>viewport</span>, or when the corresponding <code>img</code> element's <code
27301+
data-x="attr-img-lazyload">lazyload</code> attribute is in the <span
27302+
data-x="attr-lazyload-off-state">Off</span> state. Otherwise, they may obtain images immediately
27303+
or on demand, using the current state of the corresponding <code>img</code> element's <code
27304+
data-x="attr-img-lazyload">lazyload</code> attribute to guide the decision.</p>
2726127305

2726227306
<p>A user agent that obtains images immediately must synchronously
2726327307
<span>update the image data</span> of an <code>img</code> element,
@@ -27272,6 +27316,38 @@ was an English &lt;a href="/wiki/Music_hall">music hall&lt;/a> singer, ...</code
2727227316
obtains images on demand, the <code>img</code> element's <span>current request</span>'s <span
2727327317
data-x="img-req-state">state</span> must return to <span data-x="img-none">unavailable</span>.</p>
2727427318

27319+
<p>If the <code>img</code> element's <code data-x="attr-img-lazyload">lazyload</code> attribute is
27320+
not in the <span data-x="attr-lazyload-off-state">Off</span> state, the user agent may immediately
27321+
fetch metadata from the image header. To fetch image metadata, the user agent must run the
27322+
following steps:</p>
27323+
27324+
<ol>
27325+
<li><p>Let <var>request</var> be the result of <span data-x="create a potential-CORS
27326+
request">creating a potential-CORS request</span> given <var>urlString</var>, "<code
27327+
data-x="">image</code>", and the current state of the element's <code
27328+
data-x="attr-img-crossorigin">crossorigin</code> content attribute.</p></li>
27329+
27330+
<li><p>Set <var>request</var>'s <span data-x="concept-request-client">client</span> to the
27331+
element's <span>node document</span>'s <code>Window</code> object's <span>environment settings
27332+
object</span>.</p></li>
27333+
27334+
<li><p>If the element <span data-x="use srcset or picture">uses <code>srcset</code> or
27335+
<code>picture</code></span>, set <var>request</var>'s <span
27336+
data-x="concept-request-initiator">initiator</span> to "<code
27337+
data-x="">imageset</code>".</p></li>
27338+
27339+
<li><p>Set <var>request</var>'s <span data-x="concept-request-referrer-policy">referrer
27340+
policy</span> to the current state of the element's <code
27341+
data-x="attr-img-referrerpolicy">referrerpolicy</code> attribute.</p></li>
27342+
27343+
<li><p>Then <span data-x="concept-request-add-range-header">add a range header</span> to
27344+
<var>request</var> starting at byte 0 and ending with as many bytes of the image file as the
27345+
user agent determines is reasonable to retrieve metatdata.</p></li>
27346+
27347+
<li><p><span data-x="concept-fetch">Fetch</span> <var>request</var>, and use the metadata
27348+
contained in the response as appropriate for the image.</p></li>
27349+
</ol>
27350+
2727527351

2727627352
<h6>Reacting to DOM mutations</h6>
2727727353

@@ -29500,6 +29576,7 @@ href="?audio">audio&lt;/a> test instead.)&lt;/p></code></pre>
2950029576
<dd><code data-x="attr-dim-width">width</code></dd>
2950129577
<dd><code data-x="attr-dim-height">height</code></dd>
2950229578
<dd><code data-x="attr-iframe-referrerpolicy">referrerpolicy</code></dd>
29579+
<dd><code data-x="attr-iframe-lazyload">lazyload</code></dd>
2950329580
<dt><span data-x="concept-element-dom">DOM interface</span>:</dt>
2950429581
<dd w-nodev>
2950529582
<pre><code class="idl" data-x="">[Exposed=Window,
@@ -29515,6 +29592,7 @@ interface <dfn>HTMLIFrameElement</dfn> : <span>HTMLElement</span> {
2951529592
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-dim-width">width</span>;
2951629593
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-dim-height">height</span>;
2951729594
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-iframe-referrerPolicy">referrerPolicy</span>;
29595+
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-iframe-lazyLoad">lazyLoad</span>;
2951829596
readonly attribute <span>Document</span>? <span data-x="dom-iframe-contentDocument">contentDocument</span>;
2951929597
readonly attribute <span>WindowProxy</span>? <span data-x="dom-iframe-contentWindow">contentWindow</span>;
2952029598
<span>Document</span>? <span data-x="dom-media-getSVGDocument">getSVGDocument</span>();
@@ -29713,7 +29791,11 @@ interface <dfn>HTMLIFrameElement</dfn> : <span>HTMLElement</span> {
2971329791
<dt>Otherwise</dt>
2971429792

2971529793
<dd><p>Run the <span>otherwise steps for <code>iframe</code> or <code>frame</code>
29716-
elements</span>.</p></dd>
29794+
elements</span>. If the element's <code data-x="attr-iframe-lazyload">lazyload</code> attribute
29795+
is in the <span data-x="attr-lazyload-on-state">On</span> or <span
29796+
data-x="attr-lazyload-auto-state">Auto</span> states, and the element's CSS layout box does not
29797+
intersect the <span>viewport</span>, then running these steps may be deferred until such
29798+
intersection occurs.</p></dd>
2971729799

2971829800
</dl>
2971929801

@@ -30119,6 +30201,12 @@ interface <dfn>HTMLIFrameElement</dfn> : <span>HTMLElement</span> {
3011930201
used when <span data-x="process the iframe attributes">processing the <code>iframe</code>
3012030202
attributes</span>. <ref spec=REFERRERPOLICY></p>
3012130203

30204+
<hr> <!-- LAZYLOAD ATTRIBUTE -->
30205+
30206+
<p>The <dfn data-x="attr-iframe-lazyload"><code>lazyload</code></dfn> attribute is a
30207+
<span>lazy loading attribute</span>. It indicates the policy for loading <code>iframe</code>
30208+
elements that are outside the viewport.
30209+
3012230210
<hr> <!-- FALLBACK -->
3012330211

3012430212
<p>Descendants of <code>iframe</code> elements represent nothing. (In legacy user agents that do
@@ -30157,6 +30245,10 @@ interface <dfn>HTMLIFrameElement</dfn> : <span>HTMLElement</span> {
3015730245
must <span>reflect</span> the <code data-x="attr-iframe-referrerpolicy">referrerpolicy</code>
3015830246
content attribute, <span>limited to only known values</span>.</p>
3015930247

30248+
<p>The <dfn><code data-x="dom-iframe-lazyLoad">lazyLoad</code></dfn> IDL attribute must
30249+
<span>reflect</span> the <code data-x="attr-iframe-lazyload">lazyload</code> content
30250+
attribute, <span>limited to only known values</span>.
30251+
3016030252
<p>The <dfn><code data-x="dom-iframe-contentDocument">contentDocument</code></dfn> IDL attribute,
3016130253
on getting, must return the <code>iframe</code> element's <span
3016230254
data-x="concept-bcc-content-document">content document</span>.</p>
@@ -118961,6 +119053,14 @@ interface <dfn>External</dfn> {
118961119053
<td> "<code data-x="attr-img-decoding-sync">sync</code>";
118962119054
"<code data-x="attr-img-decoding-async">async</code>";
118963119055
"<code data-x="attr-img-decoding-auto">auto</code>"
119056+
<tr>
119057+
<th> <code data-x="">lazyload</code>
119058+
<td> <code data-x="attr-img-lazyload">img</code>;
119059+
<code data-x="attr-iframe-lazyload">iframe</code>
119060+
<td> Hint to use when determining loading deferral
119061+
<td> "<code data-x="attr-lazyload-on">on</code>";
119062+
"<code data-x="attr-lazyload-off">off</code>";
119063+
"<code data-x="attr-lazyload-auto">auto</code>"
118964119064
<tr>
118965119065
<th> <code data-x="">default</code>
118966119066
<td> <code data-x="attr-track-default">track</code>

0 commit comments

Comments
 (0)