wolferhua / phpquery

Automatically exported from code.google.com/p/phpquery
0 stars 0 forks source link

Clone method isn't working as a real clone #35

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. get an element using <php>$mySecondPQ =
$myFirstPQ->find('#myElement');</php>
2. clone it in a for statement <php>for ($i=0;$i<4;$i++)
$mySecondPQ->_clone()->attr('id','')->addClass($i.',')->insertBefore($mySecondPQ
);</php>
3. <php>echo $myFirstPQ->find('#myElement')->parent()->html();</php>

What is the expected output? What do you see instead?
The expected output is something like that : <display><div
class="0,"></div><div class="1,"></div><div class="2,"></div><div
class="3,"></div><div id="myElement"></div></display>.
Instead of that I've : <display><div class="0,"></div><div class="0,
1,"></div><div class="0, 1, 2,"></div><div class="0, 1, 2, 3,"></div><div
id="myElement"></div></display>

What version of the product are you using? On what operating system?
r51

Please provide any additional information below.

Original issue reported on code.google.com by nicolas....@gmail.com on 17 Sep 2008 at 12:22

GoogleCodeExporter commented 9 years ago
Fixed in r52, test case added.

Thx for catching it ;)

Original comment by tobiasz....@gmail.com on 17 Sep 2008 at 2:20

GoogleCodeExporter commented 9 years ago
Thanks for your work ;).

Original comment by nicolas....@gmail.com on 17 Sep 2008 at 2:38