W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2017

Re: [whatwg] JavaScript function for closing tags

From: Roger Hågensen <rh_whatwg@skuldwyrm.no>
Date: Mon, 16 Oct 2017 19:08:57 +0200
To: whatwg@lists.whatwg.org
Message-ID: <6b204f22-fbe3-0c42-02e2-358a7d964e68@skuldwyrm.no>
On 2017-10-14 10:13, Michael A. Peters wrote:
> I use TextTrack API but it's documention does not specify that it closes 
> open tags within a cue, in fact I'm fairly certain it doesn't because 
> some people use it for json and other related none tag related content.
Looking at https://www.html5rocks.com/en/tutorials/track/basics/
it seems JSON can be used, no idea if content type is different or not 
for that.

> Some errors using the tracks in XML were solved by the innerHTML trick 
> where I create a separate html document, append the cue, and then grab 
> the innerHTML but that doesn't always work to close tags when html 
> entities are part of the cue string.

Mixing XML and HTML is not a good idea. Would it not be easier to have 
the server send out proper XML instead of hTML? Valid XML is also valid 
HTML (the reverse is not always true).
And if XML and HTML is giving you issues then use JSON instead.
I did not see JSON mentioned in the W3C spec though.

>>> There does not seem to be a JavaScript API for closing open tags.
>>>
>>> This is problematic when dealing with WebVTT which does not require 
>>> tags be
>>> closed.
>>>
>>> Where it is the biggest problem is when the document is being served as
>>> XML+XHTML

If a XML document is being served with unclosed tags then it's not valid 
XML, so it's no wonder if that then causes issues.


-- 
Unless specified otherwise, anything I write publicly is considered 
Public Domain (CC0). My opinions are my own unless specified otherwise.
Roger Hågensen,
Freelancer, Norway.
Received on Monday, 16 October 2017 17:09:25 UTC

This archive was generated by hypermail 2.3.1 : Monday, 16 October 2017 17:09:26 UTC