Add `tagQuery()` `$matches(cssSelector)` functionality

Open
#350 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
38/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
r
Domain
web-dev

Research direction

Start with the existing tagQuery() entry point and read the linked Element.matches(cssSelector) reference to understand the intended vectorized behavior. Determine whether the requested scope includes only a $matches() method or also the proposed tagMatches(x, cssSelector) helper. Done means the agreed functionality is implemented without altering tagAppendAttributes().

Written by the indexing model from the issue text.

Description

After another discussion, tagQuery() will add a method like $matches() similar to a vectorized form of Element.matches(cssSelector).

No alterations will be made to tagAppendAttributes(). Users can use $matches() to help determine their desired behavior in two steps.

Originally posted by @schloerke in https://github.com/rstudio/htmltools/issues/334#issuecomment-1298890730


Should there also be the tag** helper method? tagMatches(x, cssSelector)?

cc @cpsievert

Dominant language
R
Stars
225
Forks
73
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rstudio/htmltools

All issues in rstudio/htmltools

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.