diff options
Diffstat (limited to 'devdocs/html/attributes%2Felementtiming.html')
| -rw-r--r-- | devdocs/html/attributes%2Felementtiming.html | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/devdocs/html/attributes%2Felementtiming.html b/devdocs/html/attributes%2Felementtiming.html new file mode 100644 index 00000000..b4a5d860 --- /dev/null +++ b/devdocs/html/attributes%2Felementtiming.html @@ -0,0 +1,26 @@ +<header><h1>HTML attribute: elementtiming</h1></header><div class="section-content"> +<p>The <code>elementtiming</code> attribute is used to indicate that an element is flagged for tracking by <a href="https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver"><code>PerformanceObserver</code></a> objects using the <code>"element"</code> type. For more details, see the <a href="https://developer.mozilla.org/en-US/docs/Web/API/PerformanceElementTiming"><code>PerformanceElementTiming</code></a> interface.</p> <p>This attribute may be applied to <a href="../element/img"><code><img></code></a>, <a href="https://developer.mozilla.org/en-US/docs/Web/SVG/Element/image"><code><image></code></a> elements inside an <a href="https://developer.mozilla.org/en-US/docs/Web/SVG/Element/svg"><code><svg></code></a>, poster images of <a href="../element/video"><code><video></code></a> elements, elements which have a <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/background-image"><code>background-image</code></a>, and elements containing text nodes, such as a <a href="../element/p"><code><p></code></a>.</p> <p>In the DOM, this attribute is reflected as <a href="https://developer.mozilla.org/en-US/docs/Web/API/Element/elementTiming"><code>Element.elementTiming</code></a>.</p> +</div> +<h2 id="usage">Usage</h2> +<div class="section-content"> +<p>The value given for <code>elementtiming</code> becomes an identifier for the observed element.</p> <div class="code-example"> +<p class="example-header"><span class="language-name">html</span></p> +<pre data-signature="w87uhoL1QZvo2KwrTNuXDIr4E9WacRy37Vr05EEFP1o=" data-language="html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>img</span> <span class="token attr-name">alt</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>alt<span class="token punctuation">"</span></span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>img.jpg<span class="token punctuation">"</span></span> <span class="token attr-name">elementtiming</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>label for element<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span> +</pre> +</div> <p>Good contenders for elements you might want to observe are:</p> <ul> <li>The main image for an article.</li> <li>A blog post title</li> <li>Images in a carousel for a shopping site.</li> <li>The poster image for the main video on a page.</li> </ul> +</div> +<h2 id="examples">Examples</h2> +<div class="section-content"><div class="code-example"> +<p class="example-header"><span class="language-name">html</span></p> +<pre data-signature="YX9Ph3kJBCGuX2XRXVEKuZTv4qBwpwoXKEAsTW3eKeE=" data-language="html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>img</span> <span class="token attr-name">alt</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>Alt for a main blog post image<span class="token punctuation">"</span></span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>my-massive-image.jpg<span class="token punctuation">"</span></span> <span class="token attr-name">elementtiming</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>Main image<span class="token punctuation">"</span></span><span class="token punctuation">></span></span> + +<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>p</span> <span class="token attr-name">elementtiming</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>important-text<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>Some very important information.<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>p"</span><span class="token punctuation">></span></span> +</pre> +</div></div> +<h2 id="see_also">See also</h2> +<div class="section-content"><ul> <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/PerformanceElementTiming"><code>PerformanceElementTiming</code></a></li> <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Element/elementTiming"><code>Element.elementTiming</code></a></li> </ul></div><div class="_attribution"> + <p class="_attribution-p"> + © 2005–2023 MDN contributors.<br>Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.<br> + <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/elementtiming" class="_attribution-link">https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/elementtiming</a> + </p> +</div> |
