fix: table section tags should implicitly close other table sections#2390
Open
vimzh wants to merge 3 commits intofb55:masterfrom
Open
fix: table section tags should implicitly close other table sections#2390vimzh wants to merge 3 commits intofb55:masterfrom
vimzh wants to merge 3 commits intofb55:masterfrom
Conversation
Opening a <thead>, <tbody>, or <tfoot> should auto-close any currently open table section, including the row and cell elements on top of it. Previously <tfoot> was missing from the close set, and <thead> had no entry at all, so a <tbody> after <tfoot> (or <thead> after <tbody>) would nest incorrectly instead of being siblings under <table>. Expanded tableSectionTags to include tr, td, and th so the top-of-stack close loop can peel off row/cell elements to reach the section beneath. Ref: https://html.spec.whatwg.org/multipage/syntax.html#optional-tags
Owner
|
Thanks @vimzh! |
The `: [string]` annotations are incompatible with vitest's `any[][]` typing for mock.calls, causing the TypeScript lint check to fail.
auto-merge was automatically disabled
March 24, 2026 19:49
Head branch was pushed to by a user without write access
Contributor
Author
|
Hi! I pushed a fix for the TypeScript lint failure the : [string] tuple annotations on the mock.calls.findIndex destructuring were incompatible with vitest's any[][] typing. All checks should be green now. It looks like I accidentally pushed the code and it disabled auto-merge, really sorry about this I'm new to open source hope you understand, thanks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Opening a
<thead>,<tbody>, or<tfoot>should auto-close any currently open table section. This wasn't working for two reasons:<tfoot>was missing fromtableSectionTags, so<tbody>after<tfoot>(or<tfoot>after<tfoot>) would nest instead of being siblings.<thead>had no entry in theopenImpliesClosemap at all, so<thead>after<tbody>would also nest incorrectly.On top of that, the set also needed
tr,td, andthbecause those elements sit above the section tag on the stack. TheopenImpliesClosemechanism only peels from the top, so it needs to be able to close through the row and cell elements to reach the section tag underneath.For
<table><tfoot><tr><td>F<tbody><tr><td>B</table>:<tbody>nested inside<tfoot>><tr>><td><tfoot>and<tbody>are siblings under<table>, matching browser/spec behaviorVerified against parse5 (spec-compliant reference parser) for all combinations of section tag ordering.
Ref: https://html.spec.whatwg.org/multipage/syntax.html#optional-tags