I am trying to dynamically update a tooltip made with Prototip and Prototype. The way I am trying to do this is probably not the best way (so if you know a better way that would be helpful), but the only way i could think to do it would be to hold the javascript in a div element and update the javascript inside the div element in order to update the tooltip. However, this seems to be a memory leak since each time the javascript is updated, a new Tip object is created and stored in the memory. If there isn't a better way of doing this, how can I clear the memory?
I made this simple script to test the memory leak, now I need to figure out how to make it so that the memory leak is patched in this example.
for (i=0; i<1000; i++) {
$('testdiv').update("<script type='text/javascript'> new Tip('chips_tip', 'Your Chips', {style: 'creamy',stem: 'topLeft',hook: { mouse: true, tip: 'topLeft' },offset: { x: 10, y: 16 },delay: 0.04,width: 85}); <\/script>");
}
Here is what the javascript for the tooltip is normally:
new Tip('element', "Description", {
style: 'creamy',
stem: 'topLeft',
hook: { mouse: true, tip: 'topLeft' },
offset: { x: 10, y: 16 },
delay: 0.04,
width: 85
});