navigation-dock MDL-22560 Fixed bug with first item in dock not being classes correctly

This commit is contained in:
Sam Hemelryk
2010-06-02 01:46:40 +00:00
parent 3695bce905
commit 4e2e816a8f
+10
View File
@@ -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