Skip to content

Instantly share code, notes, and snippets.

@irumiha
Created May 19, 2011 09:29
Show Gist options
  • Save irumiha/980475 to your computer and use it in GitHub Desktop.
Save irumiha/980475 to your computer and use it in GitHub Desktop.
Possible scalate/scuery bug
import org.fusesource.scalate.scuery._
object isitabug {
val testinput =
<html>
<head></head>
<body>
<div class="test">
<div class="real">
<a href="" class="detail">
<img class="bug" src="/somewhere/image.jpg" />
</a>
</div>
</div>
</body>
</html>
def main(args: Array[String]) {
val imgs = List("a","b","c")
object bugfinder extends Transformer {
$("div.test"){ node =>
imgs.flatMap {i =>
new Transform(node) {
$("a.detail").attribute("href","/some/link/")
$("img").attribute("class","someotherclas")
}
}
}
}
println(bugfinder(testinput))
// expected output should contain <img> elements with class="someotherclass"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment