framework icon indicating copy to clipboard operation
framework copied to clipboard

CSS selector transforms duplicate attributes when wrapping elements

Open leedm777 opened this issue 13 years ago • 1 comments

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> 

leedm777 avatar Sep 15 '11 07:09 leedm777

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

github-importer avatar Feb 19 '12 21:02 github-importer