def css.simple.scan

gralha-css-style@0.1.0.1 · css.bend:175

import gralha-css-style@0.1.0.1/css.bend as Css
import Base
import gralha-text-scan@0.1.0.1/scan.bend as U
import gralha-xml-doc@0.1.0.1/xml.bend as XML

175# Simple selectors compose by conjunction; unsupported pseudo-classes do not match.
176def css.simple.scan(scan: U.Scan, +context: CSSContext, +kind: U32, next: String -> Bool) -> Bool:
177  U.Scan{h, t} = scan
178  CSSContext{XML.Element{n, as, kids, txt}, parents, previous, index, count} = context
179  +name = h
180  Bool.not(U.string.equal(name, "")) && U.choose(Bool, U32.is_eq(kind, 35), U.string.equal(XML.attr.get(as, "id", ""), name),
181    U.choose(Bool, U32.is_eq(kind, 46), css.words(U.trim(XML.attr.get(as, "class", "")), name), U.string.equal(n, name))) && next(t)

Uses (14)

Used by (1)