Skip to content

Editorial: modernize TextTrack members#12648

Merged
annevk merged 2 commits into
mainfrom
annevk/texttrack-getters
Jul 8, 2026
Merged

Editorial: modernize TextTrack members#12648
annevk merged 2 commits into
mainfrom
annevk/texttrack-getters

Conversation

@annevk

@annevk annevk commented Jul 6, 2026

Copy link
Copy Markdown
Member

@annevk
annevk requested a review from noamr July 6, 2026 06:34
Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
attribute must return the <span>text track kind</span> of the <span>text track</span> that the
<code>TextTrack</code> object represents.</p>
<p>The <dfn attribute for="TextTrack"><code data-x="dom-TextTrack-kind">kind</code></dfn> getter
steps are to return <span>this</span>'s <span>text track</span>'s <span data-x="text track

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment applies to this line and also to the other getters and setters modified in this PR:

It's unclear what "this's text track's kind" means in this context. Should it be "this text track's kind"? Or more likely "this's kind", given that this is effectively the text track instance, i.e. it's a text track IDL value, and that this would match the other uses of "this's" elsewhere in the spec?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the object which holds a text track. Made it more explicit now.

@annevk
annevk requested review from nigelmegitt and noamr July 7, 2026 15:07
Comment thread source
Comment on lines +43181 to +43183
<p>A <code>TextTrack</code> object has an associated <dfn data-x="TextTrack text track"
for="TextTrack">text track</dfn> (a <span>text track</span>).</p>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is super confusing. Surely the TextTrack object is the representation of a text track?

I read this as saying:

---
  config:
    class:
      hideEmptyMembersBox: true
---
classDiagram
Media Element "1" --> "*" TextTrack
TextTrack "1" --> "1" text track
Loading

However step 2 of the algorithm that immediately follows, for addTextTrack, says that the text track corresponds to the new TextTrack object constructed in step 1. That's the only place where that TextTrack object is assigned some relationship to the text track being added.

Suggested change
<p>A <code>TextTrack</code> object has an associated <dfn data-x="TextTrack text track"
for="TextTrack">text track</dfn> (a <span>text track</span>).</p>
<p>A <code>TextTrack</code> object has a corresponding <dfn data-x="TextTrack text track"
for="TextTrack">text track</dfn> (a <span>text track</span>).</p>

I get the formal correctness here when there's a "A has B" relationship, but that doesn't seem right here.

(aside: plus it's horrible to read the following sections that have the "this's text track's XYZ" construct when "this" is a TextTrack)

Somehow this situation is avoided with other interfaces, e.g. media, where instead we have the more readable (e.g.) "this's current playback position" and not "This's media resource's current playback position". Similarly the getter for media.volume is simply "this's playback volume".

It's a different scenario for TimeRanges that clearly has a list of time ranges called "ranges", so "this's ranges's size" makes sense.

I'm making the distinction between a direct one to one correspondence, for TextTrack, and an "ownership" relationship (for TimeRanges) and thinking that when there's a direct correspondence, as here, we should be able to make the text more readable without loss of correctness.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not changing anything though. This is just making the existing text more explicit. It does seem like we could maybe flatten this as the specification claims they are 1:1.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would have to be a follow-up change as WebVTT references text track as well.

@annevk
annevk merged commit 74506b6 into main Jul 8, 2026
2 checks passed
@annevk
annevk deleted the annevk/texttrack-getters branch July 8, 2026 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants