Loading ...
Sorry, an error occurred while loading the content.
 

Re: [ydn-javascript]

Expand Messages
  • Todd Kloots
    You cannot reuse DOM elements for Buttons or Menus without destroying them first. Call the destroy method before any use of YAHOO.util.Connect that results
    Message 1 of 2 , Apr 30 7:51 AM
      You cannot reuse DOM elements for Buttons or Menus without destroying
      them first. Call the "destroy" method before any use of
      YAHOO.util.Connect that results in new data for Buttons and Menus.

      Frank wrote:
      >
      > I have parts of a document, that get exchanged via a
      > YAHOO.util.Connect and then adding the response to innerHTML of some
      > <div> element.
      >
      > The parts also have <script> blocks, e.g. creating buttons and menus.
      > The variable names in the new script block are the same as in the one
      > that was just replaced and they also use the same dom-nodes to render
      > into, just new versions from the ajax call. I also have to walk
      > through the new html tree and tell the browser to add the javascript by
      >
      > for (allJavascriptNodes in node...){
      > var newScript = document.createElement('script');
      > newScript.type = "text/javascript";
      > newScript.text = scriptNodes[i].text;
      > node.appendChild(newScript);
      > }
      >
      > Somehow, the menu already has the entries from the last instance,
      > which should be gone already. That was easy to fix by calling
      > clearContent() before adding the new items, but also the menus
      > behavior is quite broken. Mouseovered elements are not marked and the
      > click events are not fired.
      >
      > Anybody any idea how to work with that kind of thing? Is there a way
      > to clean javascript stuff, before removing a dom node that contains
      > script-blocks? Why does the fresh menu not work correctly? The
      > constructor is called, and I also don't see any errors happening.
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.