diff --git a/AUTHORS b/AUTHORS index 9be1dce16b..1bd129c129 100644 --- a/AUTHORS +++ b/AUTHORS @@ -16,6 +16,7 @@ AdsWizz <*@adswizz.com> Esteban Dosztal Google Inc. <*@google.com> +Edgeware AB <*@edgeware.tv> Itay Kinnrot Jason Palmer Jesper Haug Karsrud diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 75ce613b14..35a52d31b9 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -50,6 +50,7 @@ Sanborn Hilland Seth Madison Thomas Stephens Timothy Drews +Torbjörn Einarsson Toshihiro Suzuki Vasanth Polipelli Vignesh Venkatasubramanian diff --git a/lib/media/ttml_text_parser.js b/lib/media/ttml_text_parser.js index 0fc934f943..ab0a58ffc0 100644 --- a/lib/media/ttml_text_parser.js +++ b/lib/media/ttml_text_parser.js @@ -254,11 +254,11 @@ shaka.media.TtmlTextParser.parseCue_ = function( // Disregard empty elements: // TTML allows for empty elements like
. - // If cueElement has neither time attributes, nor text, - // don't try to make a cue out of it. + // If cueElement has neither time attributes, nor + // non-whitespace text, don't try to make a cue out of it. if (!cueElement.hasAttribute('begin') && !cueElement.hasAttribute('end') && - cueElement.textContent == '') + /^\s*$/.test(cueElement.textContent)) return null; shaka.media.TtmlTextParser.addNewLines_(cueElement); diff --git a/test/media/ttml_text_parser_unit.js b/test/media/ttml_text_parser_unit.js index db0a3fcc3c..dad2a3d403 100644 --- a/test/media/ttml_text_parser_unit.js +++ b/test/media/ttml_text_parser_unit.js @@ -38,6 +38,10 @@ describe('TtmlTextParser', function() { verifyHelper([], ''); }); + it('supports div with no cues but whitespace', function() { + verifyHelper([], '
\r\n
'); + }); + it('rejects invalid ttml', function() { errorHelper(shaka.util.Error.Code.INVALID_TTML, ''); errorHelper(shaka.util.Error.Code.INVALID_TTML, '');