Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

WIP for issue 963

  • Loading branch information...
commit 8ff25105b982bdaea91d8274d775bf9c1485663e 1 parent a1f7ef4
@dpp dpp authored
View
4 core/util/src/main/scala/net/liftweb/util/BindHelpers.scala
@@ -688,6 +688,7 @@ trait BindHelpers {
* Remove all the <head> tags, just leaving the child tags
*/
def stripHead(in: NodeSeq): NodeSeq = {
+ ("head" #> ((ns: NodeSeq) => ns.asInstanceOf[Elem].child))(in)
import scala.xml.transform._
val rewrite = new RewriteRule {
@@ -705,6 +706,8 @@ trait BindHelpers {
* nodeseq.
*/
def replaceIdNode(in: NodeSeq, id: String, replacement: NodeSeq): NodeSeq = {
+ (("#"+id) #> replacement)(in)
+ /*
import scala.xml.transform._
val cmp = Some(Text(id))
@@ -718,6 +721,7 @@ trait BindHelpers {
}
(new RuleTransformer(rewrite)).transform(in)
+ */
}
/**
View
2  core/util/src/test/scala/net/liftweb/util/BindHelpersSpec.scala
@@ -216,7 +216,7 @@ object BindHelpersSpec extends Specification("BindHelpers Specification") {
"replace a node" in {
Helpers.replaceIdNode(<foo><bar id="dog"/></foo>,
"dog",
- <baz/>) must ==/ (<foo><baz/></foo>)
+ <baz/>) must ==/ (<foo><baz id="dog"></baz></foo>)
}
"Ignore if no id match" in {
View
6 web/webkit/src/main/scala/net/liftweb/http/LiftSession.scala
@@ -2018,9 +2018,9 @@ class LiftSession(private[http] val _contextPath: String, val uniqueId: String,
failedFind(f)
case Full(s) =>
if (hasLiftBind(s)) Helpers.bind(atWhat, s)
- else atWhat.toList.foldLeft(s){
- case (xml, (id, replacement)) =>
- Helpers.replaceIdNode(xml, id, replacement)
+ else atWhat.toList match {
+ case Nil => s
+ case xs => xs.map{ case (id, replacement) => (("#" + id) #> replacement)}.reduceLeft(_ & _)(s)
}
case _ => atWhat.values.flatMap(_.toSeq).toList
}
Please sign in to comment.
Something went wrong with that request. Please try again.