HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleyesod-test-1.6.19Haskell2010

Yesod.Test.TransversingCSS

This module uses HXT to transverse an HTML document using CSS selectors.

The most important function here is findBySelector, it takes a CSS query and a string containing the HTML to look into, and it returns a list of the HTML fragments that matched the given query.

Only a subset of the CSS spec is currently supported:

  • By tag name: table td a

  • By class names: .container .content

  • By Id: #oneId

  • By attribute: [hasIt], [exact=match], [contains*=text], [starts^=with], [ends$=with]

  • Union: a, span, p

  • Immediate children: div > p

  • Get jiggy with it: div[data-attr=yeah] > .mon, .foo.bar div, #oneThing

  • 4 types
  • 4 values
  • Packageyesod-test-1.6.19
  • Exports8
  • LanguageHaskell2010
  • LicenceMIT
  • SourceTransversingCSS.hs

For HXT hackers

4 declarations

These functions expose some low level details that you can blissfully ignore.

Parses a query into an intermediate format which is easy to feed to HXT

  • The top-level lists represent the top level comma separated queries.

  • SelectorGroup is a group of qualifiers which are separated with spaces or > like these three: table.main.odd tr.even > td.big

  • A SelectorGroup as a list of Selector items, following the above example the selectors in the group are: table, .main and .odd