-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Improve TableWalker yielded options. #6785
Comments
Another usefull information is to get anchor column / row for spanned cell. |
Issue to handle when fixing this: #3275. |
After F2F talk we agreed on const tableSlot = {
row: 1,
column: 2,
// Below is OK. Also might be a getter.
isAnchor: () => { return this.row === this.anchorRow && ... },
cell: TableCell( { colspan: 2, rowspan: 2 } ),
cellAnchorRow: 0, // More fluent.
cellAnchorColumn: 0, // More fluent.
// Below are OK as in line with HTML table specs.
cellWidth: () => { this.cell.getAttribute( 'colspan' ) || 1 },
cellHeight: () => { this.cell.getAttribute( 'rowpsan' ) || 1 },
cellIndex // Keep it as is for now (or try to remove if no big work involved)
} As for new TableWalker( table, {
includeAllSlots: false, // (default value)
startRow: 0, // (default value)
endRow: tableHeight - 1, // (default value)
startColumn: 0, // (default value)
endColumn: tableWidth - 1, // (default value)
} );
// OR
new TableWalker( table, {
includeAllSlots: true,
row: 0, // (default value is undefined)
column: 0, // (default value is undefined)
} ); |
📝 Provide a description of the improvement
TableWalker - intro
The purpose of the table walker is to iterate over a table "slots" not only table cells. The latter is a trivial task.
Iterating over table "slots" is required to handle operations on cells covering many "slots" (ie table cell with
rowspan
and/orcolspan
attributes).TableWalker is used in two "modes":
The idea of "slots" is defined in W3C/WHATWG docs about tables and it makes sense to use that lingo.
Current
TableWalkerValue
The most confusing here is
isSpanned
andcell
. For slots that are covered by a table cell anchored in another slot we setisSpanned = true
and thecell
holds reference to the cell that spans over given slot.Proposal
The language used in
TableWalkerValue
is hard to grasp. The better idea is to use "slot" definition form processing table model specification.Introduce
TableSlot
typedefThe
TableSlot
is a name that is in line with docs describing table model - it describes over what we actually iterate.However, we could drop
anchor
here to have a bit more compact names:Creating a table walker - restricting yield slots
In most cases we do not need whole table information. Some algorithms operate on rows while others on columns. However, some will operate on a table section constrained by rows and columns.
Modifying table problem
Moved to: #7326
If you'd like to see this improvement implemented, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: