Changeset 58679
- Timestamp:
- 07/05/2024 04:37:41 PM (4 weeks ago)
- Location:
- trunk/src/wp-includes/html-api
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/html-api/class-wp-html-processor-state.php
r58656 r58679 49 49 50 50 /** 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 51 111 * In body insertion mode for full HTML parser. 52 112 * … … 61 121 62 122 /** 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 63 207 * In select insertion mode for full HTML parser. 64 208 * … … 85 229 86 230 /** 87 * In table insertion mode for full HTML parser. 88 * 89 * @since 6.7.0 90 * 91 * @see https://html.spec.whatwg.org/#parsing-main-intable 92 * @see WP_HTML_Processor_State::$insertion_mode 93 * 94 * @var string 95 */ 96 const INSERTION_MODE_IN_TABLE = 'insertion-mode-in-table'; 97 98 /** 99 * In caption insertion mode for full HTML parser. 100 * 101 * @since 6.7.0 102 * 103 * @see https://html.spec.whatwg.org/#parsing-main-incaption 104 * @see WP_HTML_Processor_State::$insertion_mode 105 * 106 * @var string 107 */ 108 const INSERTION_MODE_IN_CAPTION = 'insertion-mode-in-caption'; 109 110 /** 111 * In table body insertion mode for full HTML parser. 112 * 113 * @since 6.7.0 114 * 115 * @see https://html.spec.whatwg.org/#parsing-main-intablebody 116 * @see WP_HTML_Processor_State::$insertion_mode 117 * 118 * @var string 119 */ 120 const INSERTION_MODE_IN_TABLE_BODY = 'insertion-mode-in-table-body'; 121 122 /** 123 * In row insertion mode for full HTML parser. 124 * 125 * @since 6.7.0 126 * 127 * @see https://html.spec.whatwg.org/#parsing-main-inrow 128 * @see WP_HTML_Processor_State::$insertion_mode 129 * 130 * @var string 131 */ 132 const INSERTION_MODE_IN_ROW = 'insertion-mode-in-row'; 133 134 /** 135 * In cell insertion mode for full HTML parser. 136 * 137 * @since 6.7.0 138 * 139 * @see https://html.spec.whatwg.org/#parsing-main-incell 140 * @see WP_HTML_Processor_State::$insertion_mode 141 * 142 * @var string 143 */ 144 const INSERTION_MODE_IN_CELL = 'insertion-mode-in-cell'; 145 146 /** 147 * In column group insertion mode for full HTML parser. 148 * 149 * @since 6.7.0 150 * 151 * @see https://html.spec.whatwg.org/#parsing-main-incolumngroup 152 * @see WP_HTML_Processor_State::$insertion_mode 153 * 154 * @var string 155 */ 156 const INSERTION_MODE_IN_COLUMN_GROUP = 'insertion-mode-in-column-group'; 231 * In template insertion mode for full HTML parser. 232 * 233 * @since 6.7.0 234 * 235 * @see https://html.spec.whatwg.org/#parsing-main-intemplate 236 * @see WP_HTML_Processor_State::$insertion_mode 237 * 238 * @var string 239 */ 240 const INSERTION_MODE_IN_TEMPLATE = 'insertion-mode-in-template'; 241 242 /** 243 * After body insertion mode for full HTML parser. 244 * 245 * @since 6.7.0 246 * 247 * @see https://html.spec.whatwg.org/#parsing-main-afterbody 248 * @see WP_HTML_Processor_State::$insertion_mode 249 * 250 * @var string 251 */ 252 const INSERTION_MODE_AFTER_BODY = 'insertion-mode-after-body'; 157 253 158 254 /** … … 169 265 170 266 /** 171 * In headinsertion mode for full HTML parser.172 * 173 * @since 6.7.0 174 * 175 * @see https://html.spec.whatwg.org/#parsing-main- inhead176 * @see WP_HTML_Processor_State::$insertion_mode 177 * 178 * @var string 179 */ 180 const INSERTION_MODE_ IN_HEAD = 'insertion-mode-in-head';181 182 /** 183 * Before headinsertion mode for full HTML parser.184 * 185 * @since 6.7.0 186 * 187 * @see https://html.spec.whatwg.org/# parsing-main-beforehead188 * @see WP_HTML_Processor_State::$insertion_mode 189 * 190 * @var string 191 */ 192 const INSERTION_MODE_ BEFORE_HEAD = 'insertion-mode-before-head';193 194 /** 195 * After headinsertion mode for full HTML parser.196 * 197 * @since 6.7.0 198 * 199 * @see https://html.spec.whatwg.org/# parsing-main-afterhead200 * @see WP_HTML_Processor_State::$insertion_mode 201 * 202 * @var string 203 */ 204 const INSERTION_MODE_AFTER_ HEAD = 'insertion-mode-after-head';205 206 /** 207 * In templateinsertion mode for full HTML parser.208 * 209 * @since 6.7.0 210 * 211 * @see https://html.spec.whatwg.org/#parsing-main-in template212 * @see WP_HTML_Processor_State::$insertion_mode 213 * 214 * @var string 215 */ 216 const INSERTION_MODE_IN_ TEMPLATE = 'insertion-mode-in-template';267 * insertion mode for full HTML parser. 268 * 269 * @since 6.7.0 270 * 271 * @see https://html.spec.whatwg.org/#parsing-main- 272 * @see WP_HTML_Processor_State::$insertion_mode 273 * 274 * @var string 275 */ 276 const INSERTION_MODE_'; 277 278 /** 279 * insertion mode for full HTML parser. 280 * 281 * @since 6.7.0 282 * 283 * @see https://html.spec.whatwg.org/# 284 * @see WP_HTML_Processor_State::$insertion_mode 285 * 286 * @var string 287 */ 288 const INSERTION_MODE_'; 289 290 /** 291 * After insertion mode for full HTML parser. 292 * 293 * @since 6.7.0 294 * 295 * @see https://html.spec.whatwg.org/# 296 * @see WP_HTML_Processor_State::$insertion_mode 297 * 298 * @var string 299 */ 300 const INSERTION_MODE_AFTER_'; 301 302 /** 303 * In insertion mode for full HTML parser. 304 * 305 * @since 6.7.0 306 * 307 * @see https://html.spec.whatwg.org/#parsing-main-in 308 * @see WP_HTML_Processor_State::$insertion_mode 309 * 310 * @var string 311 */ 312 const INSERTION_MODE_IN_'; 217 313 218 314 /** -
trunk/src/wp-includes/html-api/class-wp-html-processor.php
r58677 r58679 755 755 try { 756 756 switch ( $this->state->insertion_mode ) { 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 757 775 case WP_HTML_Processor_State::INSERTION_MODE_IN_BODY: 758 776 return $this->step_in_body(); 759 777 760 case WP_HTML_Processor_State::INSERTION_MODE_IN_HEAD: 761 return $this->step_in_head(); 778 case WP_HTML_Processor_State::INSERTION_MODE_IN_TABLE: 779 return $this->step_in_table(); 780 781 case WP_HTML_Processor_State::INSERTION_MODE_IN_TABLE_TEXT: 782 return $this->step_in_table_text(); 783 784 case WP_HTML_Processor_State::INSERTION_MODE_IN_CAPTION: 785 return $this->step_in_caption(); 786 787 case WP_HTML_Processor_State::INSERTION_MODE_IN_COLUMN_GROUP: 788 return $this->step_in_column_group(); 789 790 case WP_HTML_Processor_State::INSERTION_MODE_IN_TABLE_BODY: 791 return $this->step_in_table_body(); 792 793 case WP_HTML_Processor_State::INSERTION_MODE_IN_ROW: 794 return $this->step_in_row(); 795 796 case WP_HTML_Processor_State::INSERTION_MODE_IN_CELL: 797 return $this->step_in_cell(); 762 798 763 799 case WP_HTML_Processor_State::INSERTION_MODE_IN_SELECT: 764 800 return $this->step_in_select(); 765 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 766 827 default: 767 828 $this->last_error = self::ERROR_UNSUPPORTED; 768 throw new WP_HTML_Unsupported_Exception( " No support for parsing in the '{$this->state->insertion_mode}' state." );829 throw new WP_HTML_Unsupported_Exception( "." ); 769 830 } 770 831 } catch ( WP_HTML_Unsupported_Exception $e ) { … … 869 930 ? count( $this->get_breadcrumbs() ) 870 931 : $this->state->stack_of_open_elements->count(); 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 871 1052 } 872 1053 … … 1495 1676 1496 1677 /** 1497 * Parses next element in the 'in head' insertion mode.1498 * 1499 * This internal function performs the 'in head' insertion mode1678 * Parses next element in the 'in ' insertion mode. 1679 * 1680 * This internal function performs the 'in ' insertion mode 1500 1681 * logic for the generalized WP_HTML_Processor::step() function. 1501 1682 * … … 1504 1685 * @throws WP_HTML_Unsupported_Exception When encountering unsupported HTML input. 1505 1686 * 1506 * @see https://html.spec.whatwg.org/ multipage/parsing.html#parsing-main-inhead1687 * @see https://html.spec.whatwg.org/ 1507 1688 * @see WP_HTML_Processor::step 1508 1689 * 1509 1690 * @return bool Whether an element was found. 1510 1691 */ 1511 private function step_in_head() { 1692 private function step_in_table() { 1693 $this->last_error = self::ERROR_UNSUPPORTED; 1694 throw new WP_HTML_Unsupported_Exception( "No support for parsing in the '{$this->state->insertion_mode}' state." ); 1695 } 1696 1697 /** 1698 * Parses next element in the 'in table text' insertion mode. 1699 * 1700 * This internal function performs the 'in table text' insertion mode 1701 * logic for the generalized WP_HTML_Processor::step() function. 1702 * 1703 * @since 6.7.0 Stub implementation. 1704 * 1705 * @throws WP_HTML_Unsupported_Exception When encountering unsupported HTML input. 1706 * 1707 * @see https://html.spec.whatwg.org/#parsing-main-intabletext 1708 * @see WP_HTML_Processor::step 1709 * 1710 * @return bool Whether an element was found. 1711 */ 1712 private function step_in_table_text() { 1713 $this->last_error = self::ERROR_UNSUPPORTED; 1714 throw new WP_HTML_Unsupported_Exception( "No support for parsing in the '{$this->state->insertion_mode}' state." ); 1715 } 1716 1717 /** 1718 * Parses next element in the 'in caption' insertion mode. 1719 * 1720 * This internal function performs the 'in caption' insertion mode 1721 * logic for the generalized WP_HTML_Processor::step() function. 1722 * 1723 * @since 6.7.0 Stub implementation. 1724 * 1725 * @throws WP_HTML_Unsupported_Exception When encountering unsupported HTML input. 1726 * 1727 * @see https://html.spec.whatwg.org/#parsing-main-incaption 1728 * @see WP_HTML_Processor::step 1729 * 1730 * @return bool Whether an element was found. 1731 */ 1732 private function step_in_caption() { 1733 $this->last_error = self::ERROR_UNSUPPORTED; 1734 throw new WP_HTML_Unsupported_Exception( "No support for parsing in the '{$this->state->insertion_mode}' state." ); 1735 } 1736 1737 /** 1738 * Parses next element in the 'in column group' insertion mode. 1739 * 1740 * This internal function performs the 'in column group' insertion mode 1741 * logic for the generalized WP_HTML_Processor::step() function. 1742 * 1743 * @since 6.7.0 Stub implementation. 1744 * 1745 * @throws WP_HTML_Unsupported_Exception When encountering unsupported HTML input. 1746 * 1747 * @see https://html.spec.whatwg.org/#parsing-main-incolgroup 1748 * @see WP_HTML_Processor::step 1749 * 1750 * @return bool Whether an element was found. 1751 */ 1752 private function step_in_column_group() { 1753 $this->last_error = self::ERROR_UNSUPPORTED; 1754 throw new WP_HTML_Unsupported_Exception( "No support for parsing in the '{$this->state->insertion_mode}' state." ); 1755 } 1756 1757 /** 1758 * Parses next element in the 'in table body' insertion mode. 1759 * 1760 * This internal function performs the 'in table body' insertion mode 1761 * logic for the generalized WP_HTML_Processor::step() function. 1762 * 1763 * @since 6.7.0 Stub implementation. 1764 * 1765 * @throws WP_HTML_Unsupported_Exception When encountering unsupported HTML input. 1766 * 1767 * @see https://html.spec.whatwg.org/#parsing-main-intbody 1768 * @see WP_HTML_Processor::step 1769 * 1770 * @return bool Whether an element was found. 1771 */ 1772 private function step_in_table_body() { 1773 $this->last_error = self::ERROR_UNSUPPORTED; 1774 throw new WP_HTML_Unsupported_Exception( "No support for parsing in the '{$this->state->insertion_mode}' state." ); 1775 } 1776 1777 /** 1778 * Parses next element in the 'in row' insertion mode. 1779 * 1780 * This internal function performs the 'in row' insertion mode 1781 * logic for the generalized WP_HTML_Processor::step() function. 1782 * 1783 * @since 6.7.0 Stub implementation. 1784 * 1785 * @throws WP_HTML_Unsupported_Exception When encountering unsupported HTML input. 1786 * 1787 * @see https://html.spec.whatwg.org/#parsing-main-intr 1788 * @see WP_HTML_Processor::step 1789 * 1790 * @return bool Whether an element was found. 1791 */ 1792 private function step_in_row() { 1793 $this->last_error = self::ERROR_UNSUPPORTED; 1794 throw new WP_HTML_Unsupported_Exception( "No support for parsing in the '{$this->state->insertion_mode}' state." ); 1795 } 1796 1797 /** 1798 * Parses next element in the 'in cell' insertion mode. 1799 * 1800 * This internal function performs the 'in cell' insertion mode 1801 * logic for the generalized WP_HTML_Processor::step() function. 1802 * 1803 * @since 6.7.0 Stub implementation. 1804 * 1805 * @throws WP_HTML_Unsupported_Exception When encountering unsupported HTML input. 1806 * 1807 * @see https://html.spec.whatwg.org/#parsing-main-intd 1808 * @see WP_HTML_Processor::step 1809 * 1810 * @return bool Whether an element was found. 1811 */ 1812 private function step_in_cell() { 1512 1813 $this->last_error = self::ERROR_UNSUPPORTED; 1513 1814 throw new WP_HTML_Unsupported_Exception( "No support for parsing in the '{$this->state->insertion_mode}' state." ); … … 1693 1994 */ 1694 1995 return $this->step(); 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 1695 2156 } 1696 2157
Note: See TracChangeset
for help on using the changeset viewer.