Raziel Alvarez ha scritto:
> Ok, I won't argue anymore about the clone(), though I think it's not the
> behaviour that anyone expects (think on the cloneNode() function) and
> the documentation then is incorrect or very very confusing: /"Create
> cloned copies of all matched DOM Elements. This does not create a cloned
> copy of this particular jQuery object, instead it creates duplicate
> copies of all DOM Elements." /To me this is completely the opposite that
> you are saying.
>
> Independently of how the clone() should work, then please explain why I
> get two completely different behaviours with this two snippets of code:
>
> ===========================
> <div class="templateDiv">TEMPLATE</div>
> ===========================
>
> var templateDiv = $('.templateDiv');
> var templateDivCopy = templateDiv.clone().get(0); // templateDivCopy is
> a reference of the original templateDiv
>
> and
>
> var templateDivCopy = $('.templateDiv').clone().get(0);
>
>
> with the first one, if I do templateDivCopy.innedHTML = "ANY TEXT", then
> this sets the innerHTML of BOTH elements; but in the second case, if I
> do the same, only the copy is affected!
>
I don't see your behavior.
I've used the code of the first case and appended the cloned element to
body just to see it on the screen.
Here is a live demo:
http://www.fbtools.com/jquery_test/
Renato
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/