1

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.

1
  • 1
    Have you looked into using Y.Panel and giving it the appropriate #src node?
    – olan
    Aug 30, 2012 at 11:07

2 Answers 2

1

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.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.