Clonar un nodo duplica eventos

I have a DOM fragment on page that I need to display in an overlay.

Using YUI I replace the node and then placing a clone in the overlay with the following line of YUI code:

var overlayContent = content.replace(content.cloneNode(true));

The issue I am experiencing is that now the content seems to send multiple AJAX calls to the server. So when a user clicks a button to increment an item then multiple sets are added instead of singular items and seems to work in multiples of two.

Being new to YUI I am not sure how to prevent this from happening and would appreciate any steer as to prevent this.

preguntado el 28 de agosto de 12 a las 11:08

Have you looked into using Y.Panel and giving it the appropriate #src node? -

2 Respuestas

It is not good idea to clone a node while setting the body content of a YUI overlay. You should pass plain markup (which you can get using getHTML() method) as the body content of the overlay.

Respondido 03 Oct 13, 12:10

We decided to re-engineer the existing implementation and not using cloning at all.

Instead we pulled the existing fragment from the DOM into the overlay and then on overlay close put it back from where it came.

Respondido 30 ago 12, 17:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.