diff --git a/source/Ox.UI/js/Menu/Menu.js b/source/Ox.UI/js/Menu/Menu.js index a530fb43..a6b6b5f8 100644 --- a/source/Ox.UI/js/Menu/Menu.js +++ b/source/Ox.UI/js/Menu/Menu.js @@ -327,15 +327,17 @@ Ox.Menu = function(options, self) { items.forEach(function(item) { var position; if ('id' in item) { + position = that.items.length; that.items.push( Ox.MenuItem(Ox.extend(Ox.clone(item), { maxWidth: self.options.maxWidth, menu: that, - position: position = that.items.length + position: position })) .data('position', position) + // fixme: jquery bug when passing {position: position}? does not return the object? .appendTo(that.$content) - ); // fixme: jquery bug when passing {position: position}? does not return the object?; + ); if (item.items) { that.submenus[item.id] = Ox.Menu({ edge: 'right', @@ -343,10 +345,7 @@ Ox.Menu = function(options, self) { id: Ox.toCamelCase(self.options.id + '/' + item.id), items: item.items, mainmenu: self.options.mainmenu, - offset: { - left: 0, - top: -4 - }, + offset: {left: 0, top: -4}, parent: that, size: self.options.size }); @@ -367,10 +366,7 @@ Ox.Menu = function(options, self) { function renderLine() { return $('').append( - $('', { - 'class': 'OxLine', - colspan: 5 - }) + $('').addClass('OxLine').attr({colspan: 5}) ); } @@ -419,7 +415,7 @@ Ox.Menu = function(options, self) { function renderSpace() { return $('').append( - $('', {'class': 'OxSpace', colspan: 5}) + $('').addClass('OxSpace').attr({colspan: 5}) ); } @@ -747,7 +743,7 @@ Ox.Menu = function(options, self) { remove remove () -> remove menu @*/ - self.superRemove = that.remove; + self.superRemove = that.remove.bind(that); that.remove = function() { Ox.forEach(that.submenus, function(submenu) { submenu.remove();