PerformanceElementTiming: element プロパティ
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: これは実験的な機能です。
本番で使用する前にブラウザー互換性一覧表をチェックしてください。
element
は PerformanceElementTiming
インターフェイスの読み取り専用プロパティで、監視されている要素へのポインターである Element
を返します。
値
例
監視対象の要素のログ出力
この例では、 elementtiming
属性を追加して <img>
要素を監視しています。また、 PerformanceObserver
は "element"
型のパフォーマンス項目をすべて取得するために登録され、オブザーバー作成前のデータにアクセスするために buffered
フラグが使用されます。監視された DOM 要素はコンソールにログ出力されます。
html
<img src="image.jpg" alt="a nice image" elementtiming="big-image" />
js
const observer = new PerformanceObserver((list) => {
list.getEntries().forEach((entry) => {
if (entry.identifier === "big-image") {
console.log(entry.element);
}
});
});
observer.observe({ type: "element", buffered: true });
仕様書
Specification |
---|
Element Timing API # ref-for-dom-performanceelementtiming-element |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
element |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- Experimental. Expect behavior to change in the future.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.