Skip to content

Commit

Permalink
Add HTML elements to has_element_in_scope handling
Browse files Browse the repository at this point in the history
  • Loading branch information
sirreal committed Jul 5, 2024
1 parent 6ef9df9 commit 9c59014
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions src/wp-includes/html-api/class-wp-html-open-elements.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ public function has_element_in_specific_scope( $tag_name, $termination_list ) {
* Returns whether a particular element is in scope.
*
* @since 6.4.0
* @since 6.7.0 Add handling for all HTML elements.
*
* @see https://html.spec.whatwg.org/#has-an-element-in-scope
*
Expand All @@ -237,13 +238,27 @@ public function has_element_in_scope( $tag_name ) {
return $this->has_element_in_specific_scope(
$tag_name,
array(

'APPLET',
'CAPTION',
'HTML',
'TABLE',
'TD',
'TH',
'MARQUEE',
'OBJECT',
'TEMPLATE',
/*
* Because it's not currently possible to encounter
* one of the termination elements, they don't need
* to be listed here. If they were, they would be
* unreachable and only waste CPU cycles while
* scanning through HTML.
* Foreign content not yet supported
*
* - MathML mi
* - MathML mo
* - MathML mn
* - MathML ms
* - MathML mtext
* - MathML annotation-xml
* - SVG foreignObject
* - SVG desc
* - SVG title
*/
)
);
Expand Down

0 comments on commit 9c59014

Please sign in to comment.