def css.cascade
gralha-css-style@0.1.0.1 · css.bend:415
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
415def css.cascade(ds: List<&2, XML.Attr>, +score: U32, +choices: List<&2, CSSChoice>) -> List<&2, CSSChoice>:
416 match ds:
417 case Nil{}: choices
418 case Con{XML.Attr{k, v}, rest}:
419 +value = v
420 +key = k
421 css.cascade(rest, score, U.branch(List<&2, CSSChoice>, U.string.equal(key, "") || U.string.equal(value, ""), _ => choices,
422 _ => css.insert(css.choice.scan(key, css.scan(value, 33), score), choices)))