X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Roo%2Fbootstrap%2FMenu.js;fp=Roo%2Fbootstrap%2FMenu.js;h=934534af92e5d4b21adb05734fac8364830dd346;hb=3c96167464480be6d7fa2b0d6fb20adf26193ce0;hp=b0f64f4ae9fcb131e1e9b397843ef0ed23e45ba7;hpb=37528e2dbba25db3cd2bdb8442205d5d16842635;p=roojs1 diff --git a/Roo/bootstrap/Menu.js b/Roo/bootstrap/Menu.js index b0f64f4ae9..934534af92 100644 --- a/Roo/bootstrap/Menu.js +++ b/Roo/bootstrap/Menu.js @@ -154,19 +154,22 @@ Roo.extend(Roo.bootstrap.Menu, Roo.bootstrap.Component, { // Roo.log("ADD event"); // Roo.log(this.triggerEl.dom); - - this.triggerEl.on('click', this.onTriggerClick, this); - - this.triggerEl.on(Roo.isTouch ? 'touchstart' : 'mouseup', this.onTriggerPress, this); - - if (!this.hideTrigger) { - if (this.triggerEl.hasClass('nav-item') && this.triggerEl.select('.nav-link',true).length) { - // dropdown toggle on the 'a' in BS4? - this.triggerEl.select('.nav-link',true).first().addClass('dropdown-toggle'); - } else { - this.triggerEl.addClass('dropdown-toggle'); + if (this.triggerEl) { + + this.triggerEl.on('click', this.onTriggerClick, this); + + this.triggerEl.on(Roo.isTouch ? 'touchstart' : 'mouseup', this.onTriggerPress, this); + + if (!this.hideTrigger) { + if (this.triggerEl.hasClass('nav-item') && this.triggerEl.select('.nav-link',true).length) { + // dropdown toggle on the 'a' in BS4? + this.triggerEl.select('.nav-link',true).first().addClass('dropdown-toggle'); + } else { + this.triggerEl.addClass('dropdown-toggle'); + } } } + if (Roo.isTouch) { this.el.on('touchstart' , this.onTouch, this); } @@ -328,7 +331,10 @@ Roo.extend(Roo.bootstrap.Menu, Roo.bootstrap.Component, { //this.el.show(); this.hideMenuItems(); this.hidden = false; - this.triggerEl.addClass('open'); + if (this.triggerEl) { + this.triggerEl.addClass('open'); + } + this.el.addClass('show');