It took me an hour to figure this out, so wanted to document it.
First, why isn't attribute merging disablement documented anywhere? I know I could send a PR but I was just surprised it has been in for years and it hasn't been done.
I had a div:
<div class="col-sm-3 col-artist">
<div class="contact-box">
<a class="artistName lead" href="/artists/TheArtist">Tina Turner</a>
</div>
</div>
I wanted every fourth div to have a clear fix div, so I grouped(4) the artists and added a div after each one. Trouble is, this div, (<div class="clearfix visible-lg"/>) would merge class attributes with the above, giving <div class="col-sm-3 col-artist clearfix visible-lg">
The original CssSel looked like:
def clearLargeRow =
".col-artist !!" #>
".contact-box" #> NodeSeq.Empty &
".col-artist [class]" #> "clearfix visible-lg"
".col-artist" #>
artists.grouped(4).toSeq.flatMap(artists => {
artists.map(artistCompliancy =>
".artistName [href]" #> artistPath(artistCompliancy) &
".artistName *" #> artistCompliancy.getElement.getName
) += clearLargeRow
})
Turns out that having the attribute merging as a child CssSel of another CssSel for the same element didn't work. This did:
def clearLargeRow =
".contact-box" #> NodeSeq.Empty &
".col-artist [class]" #> "clearfix visible-lg"
".col-artist !!" #>
artists.grouped(4).toSeq.flatMap(artists => {
artists.map(artistCompliancy =>
".artistName [href]" #> artistPath(artistCompliancy) &
".artistName *" #> artistCompliancy.getElement.getName
) += clearLargeRow
})
i.e. push the attribute merging to the parent.
Dan