Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add throw on every special element
  • Loading branch information
sirreal committed Dec 22, 2023
commit f35453b7efe8128f7672620c2581d81472ee41f0
179 changes: 179 additions & 0 deletions src/wp-includes/html-api/class-wp-html-processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,185 @@ private function step_in_body() {
$op = "{$op_sigil}{$tag_name}";

switch ( $op ) {
/*
* These tags require special handling in the 'in body' insertion mode
* but do not have special handling implemented yet.
*
* We throw the WP_HTML_Unsupported_Exception so we're free to implememnt
* the catch-all handling for any other start and end tag.
*
* @see https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inbody
*/
case '+A':
case '+ADDRESS':
case '+APPLET':
case '+AREA':
case '+ARTICLE':
case '+ASIDE':
case '+B':
case '+BASE':
case '+BASEFONT':
case '+BGSOUND':
case '+BIG':
case '+BLOCKQUOTE':
case '+BODY':
case '+BR':
case '+BUTTON':
case '+CAPTION':
case '+CENTER':
case '+CODE':
case '+COL':
case '+COLGROUP':
case '+DD':
case '+DETAILS':
case '+DIALOG':
case '+DIR':
case '+DIV':
case '+DL':
case '+DT':
case '+EM':
case '+EMBED':
case '+FIELDSET':
case '+FIGCAPTION':
case '+FIGURE':
case '+FONT':
case '+FOOTER':
case '+FORM':
case '+FRAME':
case '+FRAMESET':
case '+H1':
case '+H2':
case '+H3':
case '+H4':
case '+H5':
case '+H6':
case '+HEAD':
case '+HEADER':
case '+HGROUP':
case '+HR':
case '+HTML':
case '+I':
case '+IFRAME':
case '+IMAGE':
case '+IMG':
case '+INPUT':
case '+KEYGEN':
case '+LI':
case '+LINK':
case '+LISTING':
case '+MAIN':
case '+MARQUEE':
case '+MATH':
case '+MENU':
case '+META':
case '+NAV':
case '+NOBR':
case '+NOEMBED':
case '+NOFRAMES':
case '+NOSCRIPT': // scripting flag??
case '+OBJECT':
case '+OL':
case '+OPTGROUP':
case '+OPTION':
case '+P':
case '+PARAM':
case '+PLAINTEXT':
case '+PRE':
case '+RB':
case '+RP':
case '+RT':
case '+RTC':
case '+S':
case '+SCRIPT':
case '+SEARCH':
case '+SECTION':
case '+SELECT':
case '+SMALL':
case '+SOURCE':
case '+STRIKE':
case '+STRONG':
case '+STYLE':
case '+SUMMARY':
case '+SVG':
case '+TABLE':
case '+TBODY':
case '+TD':
case '+TEMPLATE':
case '+TEXTAREA':
case '+TFOOT':
case '+TH':
case '+THEAD':
case '+TITLE':
case '+TR':
case '+TRACK':
case '+TT':
case '+U':
case '+UL':
case '+WBR':
case '+XMP':
case '-A':
case '-ADDRESS':
case '-APPLET':
case '-ARTICLE':
case '-ASIDE':
case '-B':
case '-BIG':
case '-BLOCKQUOTE':
case '-BODY':
case '-BR':
case '-BUTTON':
case '-CENTER':
case '-CODE':
case '-DD':
case '-DETAILS':
case '-DIALOG':
case '-DIR':
case '-DIV':
case '-DL':
case '-DT':
case '-EM':
case '-FIELDSET':
case '-FIGCAPTION':
case '-FIGURE':
case '-FONT':
case '-FOOTER':
case '-FORM':
case '-H1':
case '-H2':
case '-H3':
case '-H4':
case '-H5':
case '-H6':
case '-HEADER':
case '-HGROUP':
case '-HTML':
case '-I':
case '-LI':
case '-LISTING':
case '-MAIN':
case '-MARQUEE':
case '-MENU':
case '-NAV':
case '-NOBR':
case '-OBJECT':
case '-OL':
case '-P':
case '-PRE':
case '-S':
case '-SEARCH':
case '-SECTION':
case '-SMALL':
case '-STRIKE':
case '-STRONG':
case '-SUMMARY':
case '-TEMPLATE':
case '-TT':
case '-U':
case '-UL':
$this->last_error = self::ERROR_UNSUPPORTED;
throw new WP_HTML_Unsupported_Exception( "Cannot process {$tag_name} element." );


/*
* > A start tag whose tag name is "button"
*/
Expand Down