Skip to content

feat(title): join the text of all elements matched by a selector with |all - #569

Merged
sebastienfontaine merged 1 commit into
masterfrom
feat/selector-all-matches
Oct 14, 2026
Merged

sebastienfontaine merged 1 commit into
masterfrom
feat/selector-all-matches

Conversation

@sebastienfontaine

Copy link
Copy Markdown
Contributor

Closes #552.

Problem

A {css-selector} in a title only reads the first matching element. To show a variable number of tags, users had to chain :nth-of-type(1), :nth-of-type(2)… which breaks when there are more or fewer elements.

Feature

A |all suffix joins the text of every matching element:

Template Result
{.filter-tags-selected-wrap span|all} tag1 tag2 tag3 (space by default)
{.tags span|all:, } tag1, tag2, tag3
-{.filter-tags-exclude-selected-wrap span|all: -} -ex1 -ex2
  • Everything after all: is the separator, spaces included.
  • Empty elements are skipped; no match gives an empty string, like a single selector.
  • Works with wildcard (*) selectors.
  • Without |all, behaviour is unchanged (first match).
  • Documented in the Help pane, next to the CSS selector examples.

Implementation

getTextBySelector is split into querySelectorAll (wildcard expansion, unchanged logic) and getElementText (input value, selected option or text, unchanged logic), so single and |all selectors share the same code.

Tests

  • Unit: default separator, custom separators, empty elements, no match, wildcard + |all, and a full processTitle template combining two |all selectors.
  • Real browser (Playwright, built extension, local test page): the rule {.inc span|all} -{.exc span|all: -} gives tag1 tag2 tag3 -ex1 -ex2. One very first run showed the raw template; I couldn't reproduce it in 4 later runs, so it looks like a one-off.
  • 233 tests, ESLint, Prettier, vue-tsc and build pass.

#552)

{.tags span|all} joins every matched element with a space, and
{.tags span|all:SEP} with a custom separator (taken as-is, spaces
included). Without |all, a selector still uses the first match.
Documented in the Help pane.
@github-actions

Copy link
Copy Markdown

📦 Extension Build Ready!

Version: 1.1.6

📥 Download Extension (tabee.zip)

Installation

  1. Download and extract the zip file
  2. Open Chrome → chrome://extensions/
  3. Enable "Developer mode" (top right)
  4. Click "Load unpacked" → Select the extracted folder

Status

  • ✅ All tests passed
  • ✅ Build successful
  • ✅ Ready for testing

🤖 Auto-generated by GitHub Actions

@github-actions

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 57.1% 595 / 1042
🔵 Statements 57.56% 628 / 1091
🔵 Functions 64.94% 126 / 194
🔵 Branches 53.21% 298 / 560
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/content/TitleService.ts 97.5% 88.46% 100% 97.29% 85-86
Generated in workflow #475 for commit a460f61 by the Vitest Coverage Report Action

@sebastienfontaine
sebastienfontaine merged commit 02ce08e into master Oct 14, 2026
7 checks passed
@sebastienfontaine
sebastienfontaine deleted the feat/selector-all-matches branch October 14, 2026 21:58
@sebastienfontaine sebastienfontaine mentioned this pull request Oct 14, 2026
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.

Support joining/concatenating text from multiple matched elements for a single CSS selector

1 participant