Open zcorpan opened 8 years ago
Hmm TextTrack
already exposes the "fallback" language in https://html.spec.whatwg.org/multipage/embedded-content.html#dom-texttrack-language
DocumentFragment
has the advantage of being able to be cloned and handed around more cheaply. Maybe make a div
node inside the DocumentFragment
that all the rest is appended to?
In #257 I made it possible for the "List of WebVTT Node Objects" object to have an "applicable language", but this can't be exposed in
getCueAsHTML()
since that object maps to aDocumentFragment
, which can't have alang
attribute.One way to make this work is to change from
DocumentFragment
to an HTMLdiv
orspan
element, and setlang
on it if is has an "applicable language".Existing scripts that just insert whatever comes out of
getCueAsHTML()
to the document should continue to work, it would just get an extra element. I supposespan
is a bit more versatile thandiv
because it is allowed in more places (e.g. in ap
element). OTOH, just dumping all cues and have them be separated from each other by default could be nice.An alternative could be to have the fallback language be a property of
TextTrack
, and have JS be responsible for setting alang
attribute on a container element in which it inserts cues withgetCueAsHTML()
.