def css.pseudo

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

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

165def css.pseudo(+key: String, +arg: String, +context: CSSContext) -> Bool:
166  CSSContext{XML.Element{n, as, kids, txt}, parents, previous, index, count} = context
167  U.choose(Bool, U.string.equal(key, "root"), css.is.root(parents),
168    U.choose(Bool, U.string.equal(key, "first-child"), U32.is_eq(index, 1),
169      U.choose(Bool, U.string.equal(key, "last-child"), U32.is_eq(index, count),
170        U.choose(Bool, U.string.equal(key, "only-child"), U32.is_eq(count, 1),
171          U.choose(Bool, U.string.equal(key, "nth-child"), css.nth(arg, index),
172            U.choose(Bool, U.string.equal(key, "nth-last-child"), css.nth(arg, (count + 1 - index : U32)),
173              U.string.equal(key, "empty") && css.empty(kids)))))))

Uses (14)

Used by (1)