PerformanceElementTiming: identifier プロパティ
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: これは実験的な機能です。
本番で使用する前にブラウザー互換性一覧表をチェックしてください。
identifier
は PerformanceElementTiming
インターフェイスの読み取り専用のプロパティで、その要素の elementtiming
属性の値を返します。
値
文字列です。
例
identifier
の使用
この例では、elementtiming
属性を追加して <img>
要素を監視しています。 PerformanceObserver
は "要素"
型のパフォーマンス項目をすべて取得するために登録され、オブザーバー作成前のデータにアクセスするために buffered
フラグを用います。elementtiming
の値は big-image
です。したがって entry.identifier
を呼び出すと文字列 big-image
を返します。
html
<img
src="image.jpg"
alt="a nice image"
elementtiming="big-image"
id="myImage" />
js
const observer = new PerformanceObserver((list) => {
list.getEntries().forEach((entry) => {
if (entry.identifier === "big-image") {
console.log(entry.naturalWidth);
}
});
});
observer.observe({ type: "element", buffered: true });
仕様書
Specification |
---|
Element Timing API # ref-for-dom-performanceelementtiming-identifier |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
identifier |
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.