- Timestamp:
- 07/05/2024 12:50:19 AM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/html-api/class-wp-html-open-elements.php
r58676 r58677 190 190 * Returns whether an element is in a specific scope. 191 191 * 192 * ## HTML Support193 *194 * This function skips checking for the termination list because there195 * are no supported elements which appear in the termination list.196 *197 192 * @since 6.4.0 198 193 * … … 312 307 * Returns whether a particular element is in select scope. 313 308 * 314 * @since 6.4.0 309 * This test differs from the others like it, in that its rules are inverted. 310 * Instead of arriving at a match when one of any tag in a termination group 311 * is reached, this one terminates if any other tag is reached. 312 * 313 * > The stack of open elements is said to have a particular element in select scope when it has 314 * > that element in the specific scope consisting of all element types except the following: 315 * > - optgroup in the HTML namespace 316 * > - option in the HTML namespace 317 * 318 * @since 6.4.0 Stub implementation (throws). 319 * @since 6.7.0 Full implementation. 315 320 * 316 321 * @see https://html.spec.whatwg.org/#has-an-element-in-select-scope 317 322 * 318 * @throws WP_HTML_Unsupported_Exception Always until this function is implemented.319 *320 323 * @param string $tag_name Name of tag to check. 321 * @return bool Whether given element is inscope.324 * @return bool Whether the given element is in SELECT scope. 322 325 */ 323 326 public function has_element_in_select_scope( $tag_name ) { 324 throw new WP_HTML_Unsupported_Exception( 'Cannot process elements depending on select scope.' ); 325 326 return false; // The linter requires this unreachable code until the function is implemented and can return. 327 foreach ( $this->walk_up() as $node ) { 328 if ( $node->node_name === $tag_name ) { 329 return true; 330 } 331 332 if ( 333 'OPTION' !== $node->node_name && 334 'OPTGROUP' !== $node->node_name 335 ) { 336 return false; 337 } 338 } 339 340 return false; 327 341 } 328 342
Note: See TracChangeset
for help on using the changeset viewer.