Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML API: Add table support #6040

Closed
wants to merge 59 commits into from
Closed
Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
9ec4b31
Work on table support
sirreal Feb 2, 2024
ab408c1
table processing
sirreal Feb 4, 2024
5ec8ffe
Disable FRAME / HEAD
sirreal Feb 4, 2024
2be4e63
In table body rules
sirreal Feb 5, 2024
0c0484c
prep step_in_row
sirreal Feb 6, 2024
b91df28
Remove unsupported table element tests
sirreal Jul 3, 2024
84b3c74
phpcbf and implement in row
sirreal Jul 4, 2024
1a90c26
Add clear_up_to_last_marker to active formatting
sirreal Jul 4, 2024
dafe4ea
Add step_in_cell method
sirreal Jul 4, 2024
cd8d7e7
Use class name for processor state constants access
sirreal Jul 4, 2024
a7b565b
Update since tags
sirreal Jul 4, 2024
3971e2b
Add close_cell method
sirreal Jul 4, 2024
6316e4b
Pop from open elements instead of removing items
sirreal Jul 4, 2024
cff5faa
Complete cases in step_in_table
sirreal Jul 4, 2024
6ef9df9
Implement in_table_scope
sirreal Jul 4, 2024
9c59014
Add HTML elements to has_element_in_scope handling
sirreal Jul 4, 2024
2ded522
Merge remote-tracking branch 'upstream/trunk' into html-api/add-table…
sirreal Jul 16, 2024
fce641d
Use insert_marker over set_marker
sirreal Jul 16, 2024
693a791
Use newly implemented step_in_X methods
sirreal Jul 16, 2024
d688c10
Clean whitespace
sirreal Jul 16, 2024
39eba92
Use bail method in case of foster parenting
sirreal Jul 16, 2024
2a3d7d4
Add mising cell insertion mode on enter td,th
sirreal Jul 16, 2024
ff7541c
PHPCBF
sirreal Jul 16, 2024
2cf10df
Use todo comments for parse errors
sirreal Jul 16, 2024
a216d55
Remove EOF comment
sirreal Jul 16, 2024
7d7f688
Move stack methods to stack class
sirreal Jul 16, 2024
e171589
Add and use form_element pointer
sirreal Jul 16, 2024
fbd635d
Handle presumptuous tags as if they were comments
sirreal Jul 16, 2024
af1142a
Add test for table > form > #comment
sirreal Jul 16, 2024
a7f5a22
Pop FORM elements off the stack in tables
sirreal Jul 16, 2024
a6a7c7d
Be more consistent in parse error comments
sirreal Jul 16, 2024
345b776
Remove outdated "stub implementation" notes
sirreal Jul 16, 2024
4966e7a
Add return types
sirreal Jul 16, 2024
c111a74
Handle whitespace in TABLE text
sirreal Jul 16, 2024
c7f6da6
Fix table start tag handling
sirreal Jul 16, 2024
d14eaf3
Remove "COL" from void tags test
sirreal Jul 17, 2024
0ce8fc4
Merge remote-tracking branch 'upstream/trunk' into html-api/add-table…
sirreal Jul 17, 2024
eaa8359
Fix handling of table text according to specification
sirreal Jul 17, 2024
380b9c6
Expand text processing comment and whitespace special character form
sirreal Jul 18, 2024
9957194
Fix comment whitespace
sirreal Jul 18, 2024
ffd0e1c
Clarify empty check after processing and null-remove
sirreal Jul 19, 2024
f49812e
Use consistent "\n" style character escapes
sirreal Jul 19, 2024
d9aa8fb
Merge branch 'trunk' into html-api/add-table-support
dmsnell Jul 23, 2024
40b55b4
Remove redundant null byte text replacement
sirreal Jul 23, 2024
9046cb3
Apply suggestion to compare multiple elements against node name
sirreal Jul 23, 2024
e4b874c
Add spec quote when generating a COLGROUP token
sirreal Jul 23, 2024
1cca15f
Add spec quote when generating a TBODY token
sirreal Jul 23, 2024
b29e1d3
Use goto for safer move to "anything else" condition
sirreal Jul 23, 2024
3f780fc
Revert "Remove "COL" from void tags test"
sirreal Jul 23, 2024
b44f7a3
fixup! Apply suggestion to compare multiple elements against node name
sirreal Jul 23, 2024
085950e
Add comment for no-quirks p table nesting
sirreal Jul 23, 2024
e057ff9
Remove strspn default args
sirreal Jul 23, 2024
dc752ff
Remove assertion in implementation from HTML spec
sirreal Jul 23, 2024
2cfe504
Adjust code after review.
dmsnell Jul 23, 2024
9590793
Remove typo.
dmsnell Jul 23, 2024
cf16373
Fix HTML spec quoting close_cell method
sirreal Jul 24, 2024
4c4bfc8
Use pop instruction for form elements that are immediately popped in …
sirreal Jul 24, 2024
0686de8
Remove unwanted change to expects-closer
dmsnell Jul 24, 2024
d43c220
Merge remote-tracking branch 'upstream/trunk' into html-api/add-table…
dmsnell Jul 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions src/wp-includes/html-api/class-wp-html-open-elements.php
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,80 @@ public function after_element_pop( WP_HTML_Token $item ): void {
}
}

/**
* Clear the stack back to a table context.
*
* > When the steps above require the UA to clear the stack back to a table context, it means
* > that the UA must, while the current node is not a table, template, or html element, pop
* > elements from the stack of open elements.
*
* @see https://html.spec.whatwg.org/multipage/parsing.html#clear-the-stack-back-to-a-table-context
*
* @since 6.7.0
*/
public function clear_to_table_context(): void {
foreach ( $this->walk_up() as $item ) {
if (
'TABLE' === $item->node_name ||
'TEMPLATE' === $item->node_name ||
'HTML' === $item->node_name
) {
break;
}
$this->pop();
}
}

/**
* Clear the stack back to a table body context.
*
* > When the steps above require the UA to clear the stack back to a table body context, it
* > means that the UA must, while the current node is not a tbody, tfoot, thead, template, or
* > html element, pop elements from the stack of open elements.
*
* @see https://html.spec.whatwg.org/multipage/parsing.html#clear-the-stack-back-to-a-table-body-context
*
* @since 6.7.0
*/
public function clear_to_table_body_context(): void {
foreach ( $this->walk_up() as $item ) {
if (
'TBODY' === $item->node_name ||
'TFOOT' === $item->node_name ||
'THEAD' === $item->node_name ||
'TEMPLATE' === $item->node_name ||
'HTML' === $item->node_name
) {
break;
}
$this->pop();
}
}

/**
* Clear the stack back to a table row context.
*
* > When the steps above require the UA to clear the stack back to a table row context, it
* > means that the UA must, while the current node is not a tr, template, or html element, pop
* > elements from the stack of open elements.
*
* @see https://html.spec.whatwg.org/multipage/parsing.html#clear-the-stack-back-to-a-table-row-context
*
* @since 6.7.0
*/
public function clear_to_table_row_context(): void {
foreach ( $this->walk_up() as $item ) {
if (
'TR' === $item->node_name ||
'TEMPLATE' === $item->node_name ||
'HTML' === $item->node_name
) {
break;
}
$this->pop();
}
}

/**
* Wakeup magic method.
*
Expand Down
Loading
Loading