Css.css.attr.test: def of gralha-css-style@0.1.0.1 Import: import gralha-css-style@0.1.0.1/css.bend as Css Lines 121-129 of gralha-css-style@0.1.0.1/css.bend: https://jend.leeeet.dev/read.txt?path=gralha-css-style@0.1.0.1/css.bend&start_line=121&end_line=129 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 def css.attr.test(scan: U.Scan, +as: List<&2, XML.Attr>) -> Bool: U.Scan{k, tail} = scan +key = k +rest = U.trim(tail) +op = U.choose(String, U.prefix(rest, "="), "=", U.choose(String, U.prefix(rest, "~="), "~=", U.choose(String, U.prefix(rest, "|="), "|=", U.choose(String, U.prefix(rest, "^="), "^=", U.choose(String, U.prefix(rest, "$="), "$=", "*="))))) +v = U.trim(U.drop(rest, op)) +actual = XML.attr.get(as, key, "#missing-css-attribute#") U.branch(Bool, U.string.equal(rest, ""), _ => Bool.not(U.string.equal(actual, "#missing-css-attribute#")), _ => Bool.not(U.string.equal(actual, "#missing-css-attribute#")) && css.attr.compare(XML.value(v), actual, op)) Uses (16): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.not https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=gralha-css-style@0.1.0.1/css.bend&name=css.attr.compare https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=Scan https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=branch https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=choose https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=drop https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=prefix https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=string.equal https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=trim https://jend.leeeet.dev/definition.txt?path=gralha-xml-doc@0.1.0.1/xml.bend&name=Attr https://jend.leeeet.dev/definition.txt?path=gralha-xml-doc@0.1.0.1/xml.bend&name=attr.get https://jend.leeeet.dev/definition.txt?path=gralha-xml-doc@0.1.0.1/xml.bend&name=value