From 4e2e816a8f6a09bdc666bb8fb2f77fc111cdb20b Mon Sep 17 00:00:00 2001 From: Sam Hemelryk Date: Wed, 2 Jun 2010 01:46:40 +0000 Subject: [PATCH] navigation-dock MDL-22560 Fixed bug with first item in dock not being classes correctly --- blocks/dock.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/blocks/dock.js b/blocks/dock.js index b9676333b3a..bdacf774a17 100644 --- a/blocks/dock.js +++ b/blocks/dock.js @@ -184,6 +184,7 @@ M.core_dock.init = function(Y) { this.nodes.body.on('click', this.handleEvent, this, {cssselector:'body', delay:0}); this.on('dock:itemschanged', this.resizeBlockSpace, this); this.on('dock:itemschanged', this.checkDockVisibility, this); + this.on('dock:itemschanged', this.resetFirstItem, this); // Inform everyone the dock has been initialised this.fire('dock:initialised'); return true; @@ -501,6 +502,15 @@ M.core_dock.remove = function(uid) { this.fire('dock:itemschanged', uid); return true; } +/** + * Ensures the the first item in the dock has the correct class + */ +M.core_dock.resetFirstItem = function() { + this.nodes.dock.all('.'+this.css.dockeditem+'.firstdockitem').removeClass('firstdockeditem'); + if (this.nodes.dock.one('.'+this.css.dockeditem)) { + this.nodes.dock.one('.'+this.css.dockeditem).addClass('firstdockitem'); + } +} /** * Removes all nodes and puts them back into conventional page sturcture * @function