- 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.
> 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
> var newScript = document.createElement('script');
> newScript.text = scriptNodes[i].text;
> 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
> script-blocks? Why does the fresh menu not work correctly? The
> constructor is called, and I also don't see any errors happening.