3 | | Unfortunately it only recognizes one kind of HTML comment and rejects many other kinds which appear as the result of various invalid HTML markup. |
| 3 | In HTML there are many kinds of invalid markup which, according to the specification, are to be interpreted as an HTML comment. These include, but are not limited to: |
| 4 | |
| 5 | - HTML comments with invalid syntax, `<!-->`, `<!-- --!>`, etc… |
| 6 | - HTML closing tags whose tag name is invalid `</3>`, `</%happy>`, etc… |
| 7 | - Things that look like XML CDATA sections, `<![CDATA[…]]>` |
| 8 | - Things that look like XML Processor Instruction nodes, `<?include "blarg">` |
10 | | In an HTML parser these all become comments, and so leaving them in the document should be a benign operation, improving the reliability of detecting comments in Core. These invalid closing tags, which in a browser are interpreted as comments, are one proposal for a placeholder mechanism in the HTML API unlocking HTML templating, a new kind of shortcode, and more. Having these persist in Core is a requirement for exploring and utilizing the new syntax. |
| 15 | These invalid closing tags, which in a browser are interpreted as comments, are one proposal for a placeholder mechanism in the HTML API unlocking HTML templating, a new kind of shortcode, and more. Having these persist in Core is a requirement for exploring and utilizing the new syntax because as long as Core removes them, there's no way to load content from the database and experiment on the full life cycle of potential Bits systems. |
| 16 | |
| 17 | On its own, however, this represents a kind of bug fix for Core, making the implementation of `wp_kses_split()` more closely align with its stated goal of leaving HTML comments as comments. It doesn't attempt to fully fix the mis-parsed comments (because that is a much deeper issue and involves many more questions about existing expectations) but it does propose a couple of hopefully and expectedly minor fixes that hopefully won't break any existing code or projects. |