Changeset 56363
- Timestamp:
- 08/07/2023 01:48:55 PM (16 months ago)
- Location:
- trunk/src/wp-includes/html-api
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/html-api/class-wp-html-active-formatting-elements.php
r56274 r56363 51 51 * @param WP_HTML_Token $token Look for this node in the stack. 52 52 * @return bool Whether the referenced node is in the stack of active formatting elements. 53 *54 53 */ 55 54 public function contains_node( $token ) { … … 150 149 * 151 150 * To start with the most-recently added element and walk towards the top, 152 * @see WP_HTML_Active_Formatting_Elements::walk_up151 * see WP_HTML_Active_Formatting_Elements::walk_up(). 153 152 * 154 153 * @since 6.4.0 … … 177 176 * 178 177 * To start with the first added element and walk towards the bottom, 179 * @see WP_HTML_Active_Formatting_Elements::walk_down178 * see WP_HTML_Active_Formatting_Elements::walk_down(). 180 179 * 181 180 * @since 6.4.0 -
trunk/src/wp-includes/html-api/class-wp-html-open-elements.php
r56274 r56363 111 111 * @return bool Whether the element was found in a specific scope. 112 112 */ 113 public function has_element_in_specific_scope( $tag_name, $termination_list ) { 113 public function has_element_in_specific_scope( $tag_name, $termination_list ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable 114 114 foreach ( $this->walk_up() as $node ) { 115 115 if ( $node->node_name === $tag_name ) { … … 135 135 $tag_name, 136 136 array( 137 137 138 /* 138 139 * Because it's not currently possible to encounter … … 153 154 * @see https://html.spec.whatwg.org/#has-an-element-in-list-item-scope 154 155 * 156 * @throws WP_HTML_Unsupported_Exception Always until this function is implemented. 157 * 155 158 * @param string $tag_name Name of tag to check. 156 159 * @return bool Whether given element is in scope. 157 160 */ 158 public function has_element_in_list_item_scope( $tag_name ) { 161 public function has_element_in_list_item_scope( $tag_name ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable 159 162 throw new WP_HTML_Unsupported_Exception( 'Cannot process elements depending on list item scope.' ); 163 164 return false; // The linter requires this unreachable code until the function is implemented and can return. 160 165 } 161 166 … … 174 179 $tag_name, 175 180 array( 181 176 182 /* 177 183 * Because it's not currently possible to encounter … … 192 198 * @see https://html.spec.whatwg.org/#has-an-element-in-table-scope 193 199 * 200 * @throws WP_HTML_Unsupported_Exception Always until this function is implemented. 201 * 194 202 * @param string $tag_name Name of tag to check. 195 203 * @return bool Whether given element is in scope. 196 204 */ 197 public function has_element_in_table_scope( $tag_name ) { 205 public function has_element_in_table_scope( $tag_name ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable 198 206 throw new WP_HTML_Unsupported_Exception( 'Cannot process elements depending on table scope.' ); 207 208 return false; // The linter requires this unreachable code until the function is implemented and can return. 199 209 } 200 210 … … 205 215 * 206 216 * @see https://html.spec.whatwg.org/#has-an-element-in-select-scope 217 * 218 * @throws WP_HTML_Unsupported_Exception Always until this function is implemented. 207 219 * 208 220 * @param string $tag_name Name of tag to check. 209 221 * @return bool Whether given element is in scope. 210 222 */ 211 public function has_element_in_select_scope( $tag_name ) { 223 public function has_element_in_select_scope( $tag_name ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable 212 224 throw new WP_HTML_Unsupported_Exception( 'Cannot process elements depending on select scope.' ); 225 226 return false; // The linter requires this unreachable code until the function is implemented and can return. 213 227 } 214 228 … … 220 234 * @see https://html.spec.whatwg.org/#has-an-element-in-button-scope 221 235 * 222 * @return bool 236 * @return bool Whether a P is in BUTTON scope. 223 237 */ 224 238 public function has_p_in_button_scope() { … … 321 335 * 322 336 * To start with the most-recently added element and walk towards the top, 323 * @see WP_HTML_Open_Elements::walk_up337 * see WP_HTML_Open_Elements::walk_up(). 324 338 * 325 339 * @since 6.4.0 … … 348 362 * 349 363 * To start with the first added element and walk towards the bottom, 350 * @see WP_HTML_Open_Elements::walk_down364 * see WP_HTML_Open_Elements::walk_down(). 351 365 * 352 366 * @since 6.4.0 -
trunk/src/wp-includes/html-api/class-wp-html-processor.php
r56331 r56363 17 17 * the document. The HTML Processor should never break an HTML document. 18 18 * 19 * While the {@see WP_HTML_Tag_Processor}is a valuable tool for modifying19 * While the `WP_HTML_Tag_Processor` is a valuable tool for modifying 20 20 * attributes on individual HTML tags, the HTML Processor is more capable 21 21 * and useful for the following operations: … … 48 48 * Breadcrumbs represent the stack of open elements from the root 49 49 * of the document or fragment down to the currently-matched node, 50 * if one is currently selected. Call {@see WP_HTML_Processor::get_breadcrumbs}50 * if one is currently selected. Call WP_HTML_Processor::get_breadcrumbs() 51 51 * to inspect the breadcrumbs for a matched tag. 52 52 * … … 122 122 * @since 6.4.0 123 123 * 124 * @see WP_HTML_Tag_Processor 124 125 * @see https://html.spec.whatwg.org/ 125 126 */ … … 233 234 */ 234 235 public static function createFragment( $html, $context = '<body>', $encoding = 'UTF-8' ) { 235 if ( '<body>' !== $context ) {236 if ( '<body>' !== $context || 'UTF-8' !== $encoding ) { 236 237 return null; 237 238 } 238 239 239 $p = new self( $html, self::CONSTRUCTOR_UNLOCK_CODE );240 $p = new self( $html, self::CONSTRUCTOR_UNLOCK_CODE ); 240 241 $p->state->context_node = array( 'BODY', array() ); 241 242 $p->state->insertion_mode = WP_HTML_Processor_State::INSERTION_MODE_IN_BODY; 242 243 243 244 // @TODO: Create "fake" bookmarks for non-existent but implied nodes. 244 $p->bookmarks['root-node'] = new WP_HTML_Span( 0, 0 );245 $p->bookmarks['root-node'] = new WP_HTML_Span( 0, 0 ); 245 246 $p->bookmarks['context-node'] = new WP_HTML_Span( 0, 0 ); 246 247 … … 333 334 * @since 6.4.0 334 335 * 335 * @throws WP_HTML_Unsupported_Exception336 * @throws Exception When unable to allocate a bookmark for the next token in the input HTML document. 336 337 * 337 338 * @param array|string|null $query { … … 411 412 * @since 6.4.0 412 413 * 413 * @throws Exception 414 * @throws Exception When unable to allocate a bookmark for the next token in the input HTML document. 414 415 * 415 416 * @see self::PROCESS_NEXT_NODE … … 497 498 * @since 6.4.0 498 499 * 499 * @throws WP_HTML_Unsupported_Exception 500 * @throws WP_HTML_Unsupported_Exception When encountering unsupported HTML input. 500 501 * 501 502 * @see https://html.spec.whatwg.org/#parsing-main-inbody … … 673 674 * @since 6.4.0 674 675 * 675 * @throws Exception 676 * @throws Exception When unable to allocate requested bookmark. 676 677 * 677 678 * @return string|false Name of created bookmark, or false if unable to create. … … 891 892 * @since 6.4.0 892 893 * 893 * @throws WP_HTML_Unsupported_Exception 894 * @throws WP_HTML_Unsupported_Exception When encountering unsupported HTML input. 894 895 * 895 896 * @see https://html.spec.whatwg.org/#close-a-p-element … … 904 905 * 905 906 * @since 6.4.0 906 *907 * @throws WP_HTML_Unsupported_Exception908 907 * 909 908 * @see https://html.spec.whatwg.org/#generate-implied-end-tags … … 929 928 * 930 929 * See the HTML specification for an explanation why this is 931 * different from {@see WP_HTML_Processor::generate_implied_end_tags}. 932 * 933 * @since 6.4.0 934 * 930 * different from generating end tags in the normal sense. 931 * 932 * @since 6.4.0 933 * 934 * @see WP_HTML_Processor::generate_implied_end_tags 935 935 * @see https://html.spec.whatwg.org/#generate-implied-end-tags 936 936 */ … … 954 954 * @since 6.4.0 955 955 * 956 * @throws WP_HTML_Unsupported_Exception 956 * @throws WP_HTML_Unsupported_Exception When encountering unsupported HTML input. 957 957 * 958 958 * @see https://html.spec.whatwg.org/#reconstruct-the-active-formatting-elements … … 971 971 $last_entry = $this->state->active_formatting_elements->current_node(); 972 972 if ( 973 973 974 /* 974 975 * > If the last (most recently added) entry in the list of active formatting elements is a marker; … … 996 997 * @since 6.4.0 997 998 * 998 * @throws WP_HTML_Unsupported_Exception 999 * @throws WP_HTML_Unsupported_Exception When encountering unsupported HTML input. 999 1000 * 1000 1001 * @see https://html.spec.whatwg.org/#adoption-agency-algorithm … … 1217 1218 'XMP' === $tag_name || 1218 1219 1219 // MathML 1220 // MathML. 1220 1221 'MI' === $tag_name || 1221 1222 'MO' === $tag_name || … … 1225 1226 'ANNOTATION-XML' === $tag_name || 1226 1227 1227 // SVG 1228 // SVG. 1228 1229 'FOREIGNOBJECT' === $tag_name || 1229 1230 'DESC' === $tag_name || … … 1308 1309 * Unlock code that must be passed into the constructor to create this class. 1309 1310 * 1310 * This class extends {@see WP_HTML_Tag_Processor}, which has a public class1311 * This class extends the WP_HTML_Tag_Processor, which has a public class 1311 1312 * constructor. Therefore, it's not possible to have a private constructor here. 1312 1313 * -
trunk/src/wp-includes/html-api/class-wp-html-token.php
r56274 r56363 37 37 * Name of node; lowercase names such as "marker" are not HTML elements. 38 38 * 39 * For HTML elements/tags this value should come from {@see WP_HTML_Processor::get_tag}.39 * For HTML elements/tags this value should come from WP_HTML_Processor::get_tag(). 40 40 * 41 41 * @since 6.4.0 42 * 43 * @see WP_HTML_Processor::get_tag() 42 44 * 43 45 * @var string
Note: See TracChangeset
for help on using the changeset viewer.