"my awesome super String" t" /> "my awesome super String" t" /> "my awesome super String" t"/>

Scala lift's CssBind.calculate does not work for Seq

28 Views Asked by At

i'm having trouble while testing Css selectors.

if i have, let's say, the following CssSel:

val mySelector = ".class *" #> "my awesome super String"

the following works:

mySelector.stringSelector.openOr("") /* Returns ".class"*/
mySelector.calculate(NodeSeq.Empty) /* Returns "my awesome super String"*/

but if i have the following CssSel:

val mySeletorWithSeq = ".class" #> Seq(".number" #> 1, ".number" #> 2)

the following works differently:

mySeletorWithSeq.stringSelector.openOr("") /* Returns ".class"*/
mySeletorWithSeq.calculate(NodeSeq.Empty) /* Returns an NodeSeq (size 2) of empty Nodes*/

What i wanted was to have access to the Seq in the right side of my CssSelector, it really should be easier to acess, just like the left side ("mySelector.stringSelector"), other than having to use the calculate function.

Any tips/teaching on how i can do it?

tons of thanks in advance!

1

There are 1 best solutions below

0
randbw On

in order to chain selectors you need to use the & symbol.

Try

val mySeletorWithSeq = ".class" #> {
  ".number" #> 1 &
  ".number" #> 2
}