From 8e977618f8345d357c8f0677b06efb363bc2525c Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Tue, 4 Sep 2012 16:02:54 +0800 Subject: [PATCH] MDL-34975 Accessibility: Collapsible areas captions can be clicked to expand/collapse --- lib/javascript-static.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/javascript-static.js b/lib/javascript-static.js index 6e7042d6cde..42a2ecbb81c 100644 --- a/lib/javascript-static.js +++ b/lib/javascript-static.js @@ -88,17 +88,17 @@ M.util.CollapsibleRegion = function(Y, id, userpref, strtooltip) { // Get the caption for the collapsible region var caption = this.div.one('#'+id + '_caption'); - caption.setAttribute('title', strtooltip); // Create a link var a = Y.Node.create(''); - // 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 + while (caption.hasChildNodes()) { + child = caption.get('firstChild'); + child.remove(); + a.append(child); + } caption.append(a); // Get the height of the div at this point before we shrink it if required -- 2.43.0