HTML / Element / Initial coverage

<tr>要素

状態: 初期Coverage 対象: HTML Living Standard 仕様確認日: 2026-10-11

Technical Summary

trはtableの1行を表し、行に属するtdとthを子として持ちます。行番号にはtable全体に対するrowIndexと、親要素のrows collectionに対するsectionRowIndexがあり、親要素は通常row groupですが、条件を満たすtableそのものの場合もあります。

table直下にtrを書いたHTMLは、parserが暗黙のtbodyを補ってDOMを作ります。これは書いたソースと構築されたDOMの差です。実装観測とWPT結果は、HTML-AAMに定めるrole mappingとは別のEvidenceとして記録します。

定義・配置条件・content model

tr要素の基本定義
項目仕様上の定義条件・範囲
意味table内のcell row各cellの意味はtdまたはthが示す
配置先thead、tbody、tfootの子。または条件を満たす場合はtableの子tableにtbodyの子がないこと、既存要素との順序などの条件がある。HTML markupでは別の構文制約も適用される
content model0個以上のtd、th、script-supporting elements空の行もcontent model上は許される
content category特定のcategoryに分類されないtable model上のrowとして定義される
content attributesGlobal attributestr固有のcontent attributeは定義されない
終了タグ条件下で省略可能次が別のtr、または親要素内に後続内容がない場合
DOM interfaceHTMLTableRowElement行の位置、cell collection、cellの挿入・削除を提供する

HTML Standardのcontent modelは条件付きでtable直下のtrを扱いますが、HTML構文の適合性規則ではtableにtrを直接含めないよう定めています。ソースに直接書かれたtrは、parserがtbody開始タグを補う特別な処理を受けます。新しいmarkupではrow groupを明示すると、構造を読み取りやすくできます。

Row groupとparserのDOM構築

表の行をまとめる要素
要素役割行との関係
thead表の見出し部分子に見出し行を持つ
tbody表の本体複数のrow groupを分けて表せる
tfoot表のまとめ部分子にまとめの行を持つ
<table>
  <thead><tr><th>項目</th><th>値</th></tr></thead>
  <tbody><tr><th>合計</th><td>3</td></tr></tbody>
</table>

このコードでは各trの親がrow groupです。rowspan="0"のcellは同じrow groupの残りの行をまたぐため、複数のtbodyを使う表ではgroup境界がtable modelに関係します。

HTMLTableRowElementと行API

行に関する主なIDL member
member戻り値・動作範囲・境界
rowIndextableのrows collection内の位置0始まり。tableに属さない場合は-1
sectionRowIndex親tableまたはrow groupのrows collection内の位置0始まり。対応する親に属さない場合は-1
cells行の子であるtdとthのHTMLCollection子孫のnested tableにあるcellは含めない
insertCell(index)新しいtdを作り、行に挿入する省略値は-1。範囲外indexはIndexSizeError
deleteCell(index)指定位置のtdまたはthを削除する-1は最後のcell。範囲外indexはIndexSizeError
const row = document.querySelector("tbody tr");
row.rowIndex;          // table全体に対する位置
row.sectionRowIndex;   // 親tbodyに対する位置
row.cells;             // この行のth・td
row.insertCell(-1);    // 末尾にtdを追加
row.deleteCell(-1);    // 末尾のcellを削除

rowIndexは視覚上の列位置でも、section内の番号でもありません。複数のrow groupがある場合はtable全体と親groupを区別し、行がtableの直接の子ならsectionRowIndexもtableのrowsを基準にします。また、insertCell()が作るのは常にtdです。

Accessibility role

HTML-AAMはtrの暗黙のroleをrowに対応付けます。実際のbrowser Accessibility treeでの露出、platform API上の値、支援技術が読み上げる文言は同一の測定ではありません。このTopicのImplementation Evidenceには、実測した環境と範囲だけを記録します。

Fact / Evidence(主張 / 根拠)

主要な仕様上の主張を適用条件と根拠位置に対応付けます。実装観測、WPT、Accessibility role queryは下のImplementation Evidenceに分けています。

trの主要Factと根拠位置
種別Fact / 主張条件・範囲状態根拠
SPECtrはtable内のcell rowで、子にtd・th・script-supporting elementsを持つ。配置コンテキスト、content model、global attributes、終了タグを扱う場合。仕様確認済みHTML Standard: the tr element
SPECrowIndexとsectionRowIndexは異なるrows collectionに対する位置を返す。table全体、親row group、tableを直接の親とする行、table外の場合を区別する。仕様確認済みHTML Standard: the tr element
SPECcellsは行の直接のtd・thを返し、insertCell()はtdを作る。collectionの範囲、挿入位置、index範囲エラーを含む。仕様確認済みHTML Standard: the tr element
SPECHTML構文でtable内に直接書いたtrの前に、parserはtbody開始タグを補う。ソース上の表現と、構築後DOMの親子関係を分けて扱う。仕様確認済みHTML Standard: restrictions on content models
AAMHTML-AAMはtrにrow roleを対応付ける。仕様上のmappingと、特定browserのAccessibility tree観測を混同しない。仕様確認済みHTML-AAM: tr

Evidence

  1. HTML Standard: The tr element — meaning, context, content model, attributes, and row APIs
  2. HTML Standard: The table element — row groups and table child ordering
  3. HTML Standard: Restrictions on content models — implied tbody for a tr written under table
  4. HTML Accessibility API Mappings: tr — implicit row role and platform mappings
  5. Web Platform Tests: the-tr-element — row collection, indexing, and cell methods

Implementation Evidence

仕様上の要求と、選定環境でのbrowser観測、WPT実行、Accessibility role queryを分けて記録します。各結果は指定したfixture・browser・テスト範囲に限られます。

trのImplementation Evidence register
種別再現確認の範囲記録条件状態
IMPL HTMLTableRowElement、cells、rowIndex、sectionRowIndex、table parserの暗黙tbody、insertCell() / deleteCell() 2026-10-11 JST / Chrome UA 155.0.0.0(Windows NT 10.0 UA)/ viewport 1280×720 / navigator.language=ja。build-config/yugien/research-results/tr-v1/をloopback 127.0.0.1:4196で表示し、fixture checks 14/14 pass。直接のtd/thだけがcellsに含まれnested table内のcellは除外、rowIndexは表全体、sectionRowIndexはrow group内で数えること、直接書かれたtrの前にparserがtbodyを補うこと、detached rowのindexが-1になること、insert/deleteと境界外IndexSizeErrorを確認。1 browser環境のみ。OS buildと他browserは未測定。 部分観測(Chrome 155 / fixture 14/14)
WPT trのcell collection、cell insertion/deletion、rowIndex、sectionRowIndexに関する選定WPT 2026-10-11 JST / Chrome UA 155.0.0.0 / wpt.live。cells.html 1/1 pass、deleteCell.html 6/6 pass、insertCell.html 7/7 pass、rowIndex.html 12/12 pass、sectionRowIndex.html 19/19 pass。合計45/45 pass。wpt.liveが配信したupstream revisionは特定できないためwptRevisionは未記録。選定外WPTと他browserは未実施。
再測定(2026-10-11): Chrome 154.0.8037.98 / Windows build 26300。このページに挙げたテストファイル5件を実行し、45項目が成功、0項目が失敗、0項目が時間切れ、0項目は未実行でした。詳細: docs/atlas/wpt-results-2026-10-11.md。このページに挙げたもの以外のテストと、他のブラウザーは未確認です。 このSHAは2026-10-11の再測定だけに当てはまります。以前の実行版は未記録です。

実行したテストの版: ddb25fdfff7766af4cd75eac3fb3b6ac206140ce。テストファイルへのリンクは、この版のファイルを開きます。

一部のテストだけ実行(テスト版を記録)
AAM Chromeのbrowser role queryによるnative table、row group、row、column header、data cellの公開 2026-10-11 JST / Chrome UA 155.0.0.0(Windows NT 10.0 UA)/ viewport 1280×720 / navigator.language=ja。fixtureのnamed table Fruit prices todayをqueryし、table 1、row 5、row group 4、column header 2、row header 0、data cell 8を確認。row nameはFruit / Price、Apples / $1.20、Pears / $1.45、Oranges / $0.80、Items / 3。これはbrowser role queryによる観測であり、HTML-AAMの全mapping、Windows UIAなどのplatform API、スクリーンリーダーの発話は未測定。 部分観測(Chrome 155 browser role query / 1環境)

ブラウザーのrole・name queryはplatform Accessibility APIやスクリーンリーダーの発話と同じ測定ではありません。実施した層と未測定の範囲を分けて扱います。

Coverage / Open Issues

  • 確認済み要素の意味・配置・content model、row group、HTMLTableRowElementの主要member、HTML-AAM role mapping
  • 未完了実装観測は選定fixtureとbrowser 1環境に限る。複数table・section境界・detached rowの全分岐は未網羅
  • 未完了選定WPT以外、他browser engine、固定したWPT revisionでの結果
  • 未完了platform Accessibility API、Windows UI Automation、支援技術の読み上げ、他OS、Expert-gap Review

このTopicは初期Coverageです。選定した測定の成功は、すべてのHTML構造、browser、OS、支援技術で同じ結果になることを示しません。

関連Surface

初心者向けの行の例はYugienのtr要素ページ、行をまとめる表本体はYugienのtbody要素ページ、表のまとめの行はYugienのtfoot要素ページを参照してください。表全体のmodelはtable Topic、行グループの仕様とAPIはtbody Topicとtfoot Topic、見出しセルはth Topic、データセルはtd Topic、表題はcaption Topicで扱います。