scalatags icon indicating copy to clipboard operation
scalatags copied to clipboard

Attribute selectors supported?

Open chipsenkbeil opened this issue 8 years ago • 2 comments

I want to be able to write something like

.myClass input[type="radio"] {
  /* ... */
}

There doesn't appear to be any documentation for attribute selectors nor do I see anything for them in the source code.

chipsenkbeil avatar Jan 02 '17 19:01 chipsenkbeil

Looks like I can do the following for now:

object MyStyle extends CascadingStyleSheet {
  lazy val myClass: Cls = cls(
    Selector("input[type='radio']")(
      // My specific CSS content
    )
  )
}

chipsenkbeil avatar Jan 02 '17 21:01 chipsenkbeil

lol I didn't even realize you could do that.

I guess we could document it, or maybe even include it as part of the base-syntax if we could find a nice way of representing. Maybe input(type := "radio") or something. This might clash with the existing use of input.apply to mean building up a frag, so it might take some refactoring to separate the inputs we see in CascadingStyleSheet from the inputs we see in scalatags.Text.all._ so we can make that syntax work

lihaoyi avatar Jan 03 '17 01:01 lihaoyi