[webvtt] Unclear requirements around VTTRegion id

zcorpan has just created a new issue for https://github.com/w3c/webvtt:

== Unclear requirements around VTTRegion id ==
https://github.com/w3c/webvtt/pull/349 introduced VTTRegion id

In https://github.com/w3c/web-platform-tests/pull/6885 I tried to write a test for it.

The spec says that the identifier (in the model) is: https://w3c.github.io/webvtt/#webvtt-region-identifier
> An arbitrary string of one or more characters other than U+0020 SPACE or U+0009 CHARACTER TABULATION character. The string must not contain the substring "-->" (U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS, U+003E GREATER-THAN SIGN). An identifier is required for a region to exist.

One or more characters means it can't be the empty string. So what is then the initial value when creating a `VTTRegion` with the constructor?

This part also doesn't make sense to me:

> An identifier is required for a region to exist.

"required" is an RFC2119 keyword, but what is this requiring, from whom (author or UA)? If it's intended to be a statement of fact, which requirements does it follow from?

>From parsing, a region can well be created with an empty identifier:
https://w3c.github.io/webvtt/#collect-a-webvtt-block
> Let region’s identifier be the empty string.

So I think we can choose one of the following approaches:
1. Allow empty identifiers, but say that from parsing, a cue cannot be associated with a region if the identifier is the empty string, but they can be associated with the API.
2. Enforce non-empty identifiers during parsing and in the API. The parser would drop the region on the floor as a last step in https://w3c.github.io/webvtt/#collect-webvtt-region-settings if the identifier is the empty string. In the API we would add a required argument to the constructor and have it throw if the empty string is given, and the `id` setter would also throw if it's set to the empty string.

I don't see what the value is of (2) over (1); when using the API there's no reason to mint an identifier, and the change to require a non-empty identifier would be a breaking change. So I suggest we opt for (1).

Please view or discuss this issue at https://github.com/w3c/webvtt/issues/353 using your GitHub account

Received on Tuesday, 15 August 2017 05:36:27 UTC