lift / framework

Lift Framework
http://liftweb.net
Apache License 2.0
1.27k stars 280 forks source link

CSS selector transforms duplicate attributes when wrapping elements #1114

Open leedm777 opened 13 years ago

leedm777 commented 13 years ago

See thread at http://groups.google.com/group/liftweb/browse_thread/thread/184b7eb51d461b30

I've found what looks like another CSS selector bug. The selector is appending the attributes of the input element to the attributes of the root output element. This is especially problematic when on of those attributes is id :-)

This is with lift-2.4-M4 and scala-2.9.1. From a console:

    scala> import net.liftweb.util.Helpers._ 
    import net.liftweb.util.Helpers._ 
    scala> val input = <div id="foo">content</div> 
    input: scala.xml.Elem = <div id="foo">content</div> 
    scala> val selector = 
         |   "#foo" #> ((ns: xml.NodeSeq) => <wrapper>{ns}</wrapper>) 
    selector: net.liftweb.util.CssSel = // snip 
    scala> println(selector(input)) 
    <wrapper id="foo"><div id="foo">content</div></wrapper> 

You can see that wrapper is mistakenly getting an id attribute. The final output should be:

<wrapper><div id="foo">content</div></wrapper> 
github-importer commented 12 years ago

Imported from Assembla: http://www.assembla.com/spaces/liftweb/tickets/1114