mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-12 00:24:34 +00:00
HTML API: Add support for containers elements, including ARTICLE.
There are a handful of elements which behave similarly and are generically container elements. These are the following elements:
ADDRESS, ARTICLE, ASIDE, BLOCKQUOTE, CENTER, DETAILS, DIALOG, DIR,
DL, DIV, FIELDSET, FIGCAPTION, FIGURE, FOOTER, HEADER, HGROUP, MAIN,
MENU, NAV, SEARCH, SECTION, SUMMARY
This patch adds support to the HTML Processor for handling these elements. They do not require any additional logic in the rest of the class, and carry no specific semantic rules for parsing beyond what is listed in their group in the IN BODY section of the HTML5 specification.
Props dmsnell.
Fixes #59914.
git-svn-id: https://develop.svn.wordpress.org/trunk@57115 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -99,12 +99,16 @@
|
||||
*
|
||||
* The following list specifies the HTML tags that _are_ supported:
|
||||
*
|
||||
* - Containers: ADDRESS, BLOCKQUOTE, DETAILS, DIALOG, DIV, FOOTER, HEADER, MAIN, MENU, SPAN, SUMMARY.
|
||||
* - Form elements: BUTTON, FIELDSET, SEARCH.
|
||||
* - Formatting elements: B, BIG, CODE, EM, FONT, I, SMALL, STRIKE, STRONG, TT, U.
|
||||
* - Heading elements: HGROUP.
|
||||
* - Links: A.
|
||||
* - The formatting elements: B, BIG, CODE, EM, FONT, I, SMALL, STRIKE, STRONG, TT, U.
|
||||
* - Containers: DIV, FIGCAPTION, FIGURE, SPAN.
|
||||
* - Form elements: BUTTON.
|
||||
* - Lists: DL.
|
||||
* - Media elements: FIGCAPTION, FIGURE, IMG.
|
||||
* - Paragraph: P.
|
||||
* - Void elements: IMG.
|
||||
* - Sectioning elements: ARTICLE, ASIDE, NAV, SECTION
|
||||
* - Deprecated elements: CENTER, DIR
|
||||
*
|
||||
* ### Supported markup
|
||||
*
|
||||
@@ -621,11 +625,29 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
|
||||
* > "fieldset", "figcaption", "figure", "footer", "header", "hgroup",
|
||||
* > "main", "menu", "nav", "ol", "p", "search", "section", "summary", "ul"
|
||||
*/
|
||||
case '+ADDRESS':
|
||||
case '+ARTICLE':
|
||||
case '+ASIDE':
|
||||
case '+BLOCKQUOTE':
|
||||
case '+CENTER':
|
||||
case '+DETAILS':
|
||||
case '+DIALOG':
|
||||
case '+DIR':
|
||||
case '+DIV':
|
||||
case '+DL':
|
||||
case '+FIELDSET':
|
||||
case '+FIGCAPTION':
|
||||
case '+FIGURE':
|
||||
case '+FOOTER':
|
||||
case '+HEADER':
|
||||
case '+HGROUP':
|
||||
case '+MAIN':
|
||||
case '+MENU':
|
||||
case '+NAV':
|
||||
case '+P':
|
||||
case '+SEARCH':
|
||||
case '+SECTION':
|
||||
case '+SUMMARY':
|
||||
if ( $this->state->stack_of_open_elements->has_p_in_button_scope() ) {
|
||||
$this->close_a_p_element();
|
||||
}
|
||||
@@ -639,11 +661,29 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
|
||||
* > "figcaption", "figure", "footer", "header", "hgroup", "listing", "main",
|
||||
* > "menu", "nav", "ol", "pre", "search", "section", "summary", "ul"
|
||||
*/
|
||||
case '-ADDRESS':
|
||||
case '-ARTICLE':
|
||||
case '-ASIDE':
|
||||
case '-BLOCKQUOTE':
|
||||
case '-BUTTON':
|
||||
case '-CENTER':
|
||||
case '-DETAILS':
|
||||
case '-DIALOG':
|
||||
case '-DIR':
|
||||
case '-DIV':
|
||||
case '-DL':
|
||||
case '-FIELDSET':
|
||||
case '-FIGCAPTION':
|
||||
case '-FIGURE':
|
||||
case '-FOOTER':
|
||||
case '-HEADER':
|
||||
case '-HGROUP':
|
||||
case '-MAIN':
|
||||
case '-MENU':
|
||||
case '-NAV':
|
||||
case '-SEARCH':
|
||||
case '-SECTION':
|
||||
case '-SUMMARY':
|
||||
if ( ! $this->state->stack_of_open_elements->has_element_in_scope( $tag_name ) ) {
|
||||
// @TODO: Report parse error.
|
||||
// Ignore the token.
|
||||
|
||||
Reference in New Issue
Block a user