From: Alan Knowles Date: Thu, 19 Aug 2021 03:55:07 +0000 (+0800) Subject: fix button # triggering url change X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=102ba0fb3c5a9e3c1282974f7573064921d8357d fix button # triggering url change --- diff --git a/Roo/bootstrap/nav/Item.js b/Roo/bootstrap/nav/Item.js index 8becd8cf2b..003fdaa7d6 100644 --- a/Roo/bootstrap/nav/Item.js +++ b/Roo/bootstrap/nav/Item.js @@ -196,10 +196,11 @@ Roo.extend(Roo.bootstrap.nav.Item, Roo.bootstrap.Component, { } if( - this.preventDefault || - this.href == '#' + this.preventDefault || + this.href === false || + this.href === '#' ){ - Roo.log("NavItem - prevent Default?"); + //Roo.log("NavItem - prevent Default?"); e.preventDefault(); } diff --git a/docs/src/Roo_bootstrap_Button.js.html b/docs/src/Roo_bootstrap_Button.js.html index 108bbaf7f8..cd4ab4dc4b 100644 --- a/docs/src/Roo_bootstrap_Button.js.html +++ b/docs/src/Roo_bootstrap_Button.js.html @@ -355,7 +355,7 @@ } Roo.log('button on click '); - if(this.preventDefault){ + if(this.href === '' || this.preventDefault){ e.preventDefault(); } diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index fa3311216d..eb8c55881d 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -6542,8 +6542,9 @@ Roo.extend(Roo.bootstrap.nav.Item, Roo.bootstrap.Component, { } if( - this.preventDefault || - this.href == '#' + this.preventDefault || + this.href === false || + this.href === '#' ){ Roo.log("NavItem - prevent Default?"); e.preventDefault(); diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index dda79bfa8f..f8253afbb0 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -279,7 +279,7 @@ if(this.href){A.href=this.href;}if(this.fa){A.html=' '+A.cn[0].html+'';}else if(this.glyphicon){A.cn[0].html=' '+A.cn[0].html;}else{A.cn[0].cls+=" nav-html"; }if(this.menu){A.cn[0].html+=" ";}if(this.badge!==''){A.cn[0].html+=' '+this.badge+'';}}return A;},onRender:function(ct,A){if(Roo.bootstrap.version==4&&ct.dom.type!='ul'){this.tag='div'; }var B=Roo.bootstrap.nav.Item.superclass.onRender.call(this,ct,A);this.navLink=this.el.select('.nav-link',true).first();this.htmlEl=this.el.hasClass('nav-html')?this.el:this.el.select('.nav-html',true).first();return B;},initEvents:function(){if(typeof(this.menu)!='undefined'){this.menu.parentType=this.xtype; -this.menu.triggerEl=this.el;this.menu=this.addxtype(Roo.apply({},this.menu));}this.el.on('click',this.onClick,this);this.parent().register(this);},onClick:function(e){if(e.getTarget('.dropdown-menu-item')){return;}if(this.preventDefault||this.href=='#'){Roo.log("NavItem - prevent Default?"); +this.menu.triggerEl=this.el;this.menu=this.addxtype(Roo.apply({},this.menu));}this.el.on('click',this.onClick,this);this.parent().register(this);},onClick:function(e){if(e.getTarget('.dropdown-menu-item')){return;}if(this.preventDefault||this.href===false||this.href==='#'){Roo.log("NavItem - prevent Default?"); e.preventDefault();}if(this.disabled){return;}var tg=Roo.bootstrap.TabGroup.get(this.navId);if(tg&&tg.transition){Roo.log("waiting for the transitionend");return;}if(this.fireEvent('click',this,e)===false){return;};if(this.tagtype=='span'){return;}var A=this.el.select('a',true).first(); if(A&&this.animateRef&&this.href.indexOf('#')>-1){if(A.dom.href.split("#")[0]!=document.location.toString().split("#")[0]){return;}Roo.log("NavItem - prevent Default?");e.preventDefault();this.scrollToElement(e);}var p=this.parent();if(['tabs','pills'].indexOf(p.type)!==-1&&p.pilltype){if(typeof(p.setActiveItem)!=='undefined'){p.setActiveItem(this); }}if(p.parentType=='NavHeaderbar'&&!this.menu){p.parent().el.select('.roo-navbar-collapse',true).removeClass('in');}},isActive:function(){return this.active},setActive:function(A,B,C){if(this.active&&!A&&this.navId){this.was_active=true;var nv=Roo.bootstrap.nav.Group.get(this.navId);