Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(hydrate): output track elements as void elms (#5720)
* fix(hydrate): output track elements as void elms add `track` to the list of "EMPTY" elements (void elements) that is referenced when we serialize nodes. prior to this fix, the output of running `renderToString` as such: ```js const hydrate = require('./hydrate/index.js'); const src = `<video> <source src="x" type="video/mp4"> <track kind="subtitles" src="x" > </video>`; hydrate.renderToString(src, { prettyHtml: true }) .then(result => console.log(result.html)); ``` would result in the following being printed: ```html <!doctype html> <html class="hydrated" data-stencil-build="shc9pw4e"> <head> <meta charset="utf-8"> </head> <body> <video> <source src="x" type="video/mp4"> <!-- NOTE: track has a closing tag --> <track kind="subtitles" src="x"></track> </video> </body> </html> ``` With this fix applied, we print `track` as a void element: ```html <!doctype html> <html class="hydrated" data-stencil-build="z6oqy2b2"> <head> <meta charset="utf-8"> </head> <body> <video> <source src="x" type="video/mp4"> <track kind="subtitles" src="x"> </video> </body> </html> ``` Fixes: #2994 STENCIL-94: Using hydrate.renderToString produces "invalid" HTML with <track> * review(cb): unit tests
- Loading branch information