Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HTML API: Add
expects_closer()
method to HTML Processor
This patch adds a new method, `WP_HTML_Processor->expects_closer()` to indicate if the currently-matched node expects to find a closing token. For example, a `DIV` element expects a closing `</div>` tag, but an `<img>` expects none, because it's a void element. Similarly, `#text` nodes and HTML comments only appear as unitary nodes on the stack of open elements. Once proceeding further in the document they are immediately removed without any closing tag. This new method serves as a helper to indicate whether or not to expect the closer, as this can be more complicated than it seems, and calling code shouldn't have to build custom interpretations and implementations. Instead, the HTML Processor ought to export its internal knowledge to make it easy for consuming code and projects. Developed in WordPress/wordpress-develop#6600 Discussed in https://core.trac.wordpress.org/ticket/61257 Fixes #61257. Props dmsnell, jonsurrell. Built from https://develop.svn.wordpress.org/trunk@58192 git-svn-id: https://core.svn.wordpress.org/trunk@57655 1a063a9b-81f0-0310-95a4-ce76da25c4cd
- Loading branch information