Skip to content

feat: || and :nth-col() were refused, so columns couldn't be selected - #103

Merged
jamesconwaydev merged 1 commit into
mainfrom
sync-columns
Nov 19, 2026
Merged

jamesconwaydev merged 1 commit into
mainfrom
sync-columns

Conversation

@jamesconwaydev

Copy link
Copy Markdown
Collaborator

Problem

||, :nth-col() and :nth-last-col() were refused (part of #17). They select table cells by column, which only the table model can work out, since colspan and rowspan move a cell away from its place in the row.

Change

Syncs Netweir ff397ba, bringing netweir/netweir#338 by @foothillsdigital.

  • The table model: a table is laid out on the first query that needs it, following the HTML Standard's "forming a table":
    • colgroup and col spans;
    • colspan and rowspan, rowspan=0 included;
    • row groups;
    • nested tables.
  • Caching: the layout is kept per table for the rest of the query.
  • Hostile tables: stay linear. Covered spans are kept as runs, not one slot per column, and || binary-searches the cols.
  • Specificity: :nth-col() counts as a pseudo-class; || adds nothing.
  • ROADMAP marks the column item done.

Part of #17. Namespace prefixes come with netweir/netweir#336.

Tests

  • cargo test --workspace: 234 test groups, 0 failed. Tokenizer 7,045 and tree construction 3,898 passed, 0 failed.
  • The synced table_columns and hostile_tables_lay_out_in_linear_time tests include 1,000 colspan=1000 cells followed by 50,000 rows, which runs in 0.11 s in a debug build.

Syncs Netweir ff397ba, bringing netweir/netweir#338 by foothillsdigital:
the column combinator and :nth-col()/:nth-last-col(), worked out with
the HTML table model (colspan, rowspan including rowspan=0, colgroup
spans), cached per query and linear on hostile tables.
@jamesconwaydev
jamesconwaydev enabled auto-merge (squash) November 19, 2026 10:39
@jamesconwaydev
jamesconwaydev merged commit e5ed82e into main Nov 19, 2026
33 checks passed
@jamesconwaydev
jamesconwaydev deleted the sync-columns branch November 19, 2026 10:43
jamesconwaydev added a commit that referenced this pull request Nov 19, 2026
Syncs Netweir 57a359d (netweir/netweir#336) by foothillsdigital:
SelectorList::parse_with takes ParseOptions declaring prefixes and a
default namespace the way @namespace rules do, so svg|rect matches only
SVG elements. parse declares none and is unchanged. With the column
combinator from #103, that finishes #17.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant