- // Create a local scoped lamba function to move nodes to a new link
- var movenode = function(node){
- node.remove();
- a.append(node);
- };
- // Apply the lamba function on each of the captions child nodes
- caption.get('children').each(movenode, this);
+ a.setAttribute('title', strtooltip);
+
+ // Get all the nodes from caption, remove them and append them to <a>
+ while (caption.hasChildNodes()) {
+ child = caption.get('firstChild');
+ child.remove();
+ a.append(child);
+ }