Changeset 58677
- Timestamp:
- 07/05/2024 12:50:19 AM (4 weeks ago)
- Location:
- trunk
- Files:
-
- 6 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 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 -
trunk/src/wp-includes/html-api/class-wp-html-processor.php
r58676 r58677 102 102 * - Containers: ADDRESS, BLOCKQUOTE, DETAILS, DIALOG, DIV, FOOTER, HEADER, MAIN, MENU, SPAN, SUMMARY. 103 103 * - Custom elements: All custom elements are supported. :) 104 * - Form elements: BUTTON, DATALIST, FIELDSET, INPUT, LABEL, LEGEND, METER, PROGRESS, SEARCH.104 * - Form elements: BUTTON, DATALIST, FIELDSET, INPUT, LABEL, LEGEND, METER, . 105 105 * - Formatting elements: B, BIG, CODE, EM, FONT, I, PRE, SMALL, STRIKE, STRONG, TT, U, WBR. 106 106 * - Heading elements: H1, H2, H3, H4, H5, H6, HGROUP. … … 757 757 case WP_HTML_Processor_State::INSERTION_MODE_IN_BODY: 758 758 return $this->step_in_body(); 759 760 761 762 763 764 759 765 760 766 default: … … 1335 1341 case '+SOURCE': 1336 1342 case '+TRACK': 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1337 1385 $this->insert_html_element( $this->state->current_token ); 1338 1386 return true; … … 1379 1427 case 'NOSCRIPT': 1380 1428 case 'OBJECT': 1381 case 'OPTGROUP':1382 case 'OPTION':1383 1429 case 'PLAINTEXT': 1384 1430 case 'RB': … … 1388 1434 case 'SARCASM': 1389 1435 case 'SCRIPT': 1390 case 'SELECT':1391 1436 case 'STYLE': 1392 1437 case 'SVG': … … 1447 1492 } 1448 1493 } 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1449 1695 } 1450 1696 … … 2037 2283 * 2038 2284 * @since 6.4.0 2285 2039 2286 * 2040 2287 * @see https://html.spec.whatwg.org/#generate-implied-end-tags … … 2047 2294 'DT', 2048 2295 'LI', 2296 2297 2049 2298 'P', 2299 2300 2301 2302 2050 2303 ); 2051 2304 2052 $current_node = $this->state->stack_of_open_elements->current_node(); 2305 $no_exclusions = ! isset( $except_for_this_element ); 2306 2053 2307 while ( 2054 $current_node && $current_node->node_name !== $except_for_this_element&&2308 && 2055 2309 in_array( $this->state->stack_of_open_elements->current_node(), $elements_with_implied_end_tags, true ) 2056 2310 ) { … … 2066 2320 * 2067 2321 * @since 6.4.0 2322 2068 2323 * 2069 2324 * @see WP_HTML_Processor::generate_implied_end_tags … … 2072 2327 private function generate_implied_end_tags_thoroughly() { 2073 2328 $elements_with_implied_end_tags = array( 2329 2330 2074 2331 'DD', 2075 2332 'DT', 2076 2333 'LI', 2334 2335 2077 2336 'P', 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2078 2347 ); 2079 2348 -
trunk/tests/phpunit/tests/html-api/wpHtmlProcessor.php
r58363 r58677 407 407 'NOSCRIPT' => array( 'NOSCRIPT' ), 408 408 'OBJECT' => array( 'OBJECT' ), 409 'OPTGROUP' => array( 'OPTGROUP' ),410 'OPTION' => array( 'OPTION' ),411 409 'PLAINTEXT' => array( 'PLAINTEXT' ), 412 410 'RB' => array( 'RB' ), … … 416 414 'SARCASM' => array( 'SARCASM' ), 417 415 'SCRIPT' => array( 'SCRIPT' ), 418 'SELECT' => array( 'SELECT' ),419 416 'STYLE' => array( 'STYLE' ), 420 417 'SVG' => array( 'SVG' ), -
trunk/tests/phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php
r58592 r58677 190 190 'NOSCRIPT', 191 191 'OBJECT', 192 'OPTGROUP',193 'OPTION',194 192 'PLAINTEXT', // Neutralized. 195 193 'RB', // Neutralized. … … 198 196 'RTC', // Neutralized. 199 197 'SCRIPT', 200 'SELECT',201 198 'STYLE', 202 199 'SVG', -
trunk/tests/phpunit/tests/html-api/wpHtmlSupportRequiredHtmlProcessor.php
r57508 r58677 59 59 */ 60 60 public function test_generate_implied_end_tags_needs_support() { 61 $this->ensure_support_is_added_everywhere( 'OPTGROUP' );62 $this->ensure_support_is_added_everywhere( 'OPTION' );63 61 $this->ensure_support_is_added_everywhere( 'RB' ); 64 62 $this->ensure_support_is_added_everywhere( 'RP' ); … … 80 78 $this->ensure_support_is_added_everywhere( 'CAPTION' ); 81 79 $this->ensure_support_is_added_everywhere( 'COLGROUP' ); 82 $this->ensure_support_is_added_everywhere( 'OPTGROUP' );83 $this->ensure_support_is_added_everywhere( 'OPTION' );84 80 $this->ensure_support_is_added_everywhere( 'RB' ); 85 81 $this->ensure_support_is_added_everywhere( 'RP' ); -
trunk/tests/phpunit/tests/html-api/wpHtmlSupportRequiredOpenElements.php
r57508 r58677 309 309 */ 310 310 $this->ensure_support_is_added_everywhere( 'SVG' ); 311 312 // These elements are specific to SELECT scope.313 $this->ensure_support_is_added_everywhere( 'OPTGROUP' );314 $this->ensure_support_is_added_everywhere( 'OPTION' );315 311 } 316 312 }
Note: See TracChangeset
for help on using the changeset viewer.