-
7 Apr 2009 2:23 PM #1
[FIXED][3.0] Menu getItemArgs (isXType vs instanceof)
[FIXED][3.0] Menu getItemArgs (isXType vs instanceof)
I suppose this one may be considered a difference of opinion, but it caused upgrade havoc so I think it is at least worth thinking about. In Menu.js, getItemArgs looks like this now:
Original:
As opposed to this:PHP Code:getItemArgs: function(c) {
var isMenuItem = c.isXType(Ext.menu.Item);
return {
isMenuItem: isMenuItem,
needsIcon: !isMenuItem && (c.icon || c.iconCls),
icon: c.icon || Ext.BLANK_IMAGE_URL,
iconCls: 'x-menu-item-icon ' + (c.iconCls || ''),
itemId: 'x-menu-el-' + c.id,
itemCls: 'x-menu-list-item ' + (this.extraCls || '')
};
}
Proposed:
The side effect of using isXType is that every subclass must register an xtype or the menus get created all wrong. I prefer the way Ext2 did it, which is the proposed change (use instanceof).PHP Code:getItemArgs: function(c) {
var isMenuItem = c instanceof Ext.menu.Item;
return {
isMenuItem: isMenuItem,
needsIcon: !isMenuItem && (c.icon || c.iconCls),
icon: c.icon || Ext.BLANK_IMAGE_URL,
iconCls: 'x-menu-item-icon ' + (c.iconCls || ''),
itemId: 'x-menu-el-' + c.id,
itemCls: 'x-menu-list-item ' + (this.extraCls || '')
};
}
-
7 Apr 2009 3:14 PM #2
Changed back for backwards compat.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote