From 6b7ef9a4230cbafdf0e1a0f68b2c3024b063145d Mon Sep 17 00:00:00 2001 From: Jinhyuk Jun Date: Fri, 28 Dec 2012 18:59:37 +0900 Subject: [PATCH] tabbar : bug fix in case none li element case Change-Id: Iad36f6ff567f20784b3606e2d9f74fe8563ea960 --- .../tabbar/js/jquery.mobile.tizen.tabbar.js | 42 +++++++++++----------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/src/widgets/tabbar/js/jquery.mobile.tizen.tabbar.js b/src/widgets/tabbar/js/jquery.mobile.tizen.tabbar.js index 29357c2..d5b57be 100755 --- a/src/widgets/tabbar/js/jquery.mobile.tizen.tabbar.js +++ b/src/widgets/tabbar/js/jquery.mobile.tizen.tabbar.js @@ -58,10 +58,9 @@ _create: function () { var $tabbar = this.element, - $tabbtns = $tabbar.find( "a" ), - iconpos = $tabbtns.filter( ":jqmData(icon)" ).length ? - this.options.iconpos : undefined, - textpos = $tabbtns.html().length ? true : false, + $tabbtns, + textpos, + iconpos, theme = $.mobile.listview.prototype.options.theme, /* Get current theme */ ww = window.innerWidth || $( window ).width(), wh = window.innerHeight || $( window ).height(), @@ -75,23 +74,20 @@ $tabbar.removeClass( "ui-landscape-tabbar" ).addClass( "ui-portrait-tabbar" ); } + if ( $tabbar.find( "a" ).length ) { + $tabbtns = $tabbar.find( "a" ); + iconpos = $tabbtns.filter( ":jqmData(icon)" ).length ? this.options.iconpos : undefined; + textpos = $tabbtns.html().length ? true : false; + } + + $tabbar.addClass( "ui-navbar" ) + .find( "ul" ) + .grid( { grid: this.options.grid } ); -/* - $tabbar - .addClass( "ui-navbar" ) - .attr( "role", "navigation" ) - .find( "ul" ) - - .grid( { grid: this.options.grid } ); -*/ - $tabbar.addClass( "ui-navbar" ) - .find( "ul" ) - .grid( { grid: this.options.grid } ); if ( $tabbar.parents( ".ui-footer" ).length ) { $tabbar.find( "li" ).addClass( "ui-tab-btn-style" ); } - /* title tabbar */ if ( $tabbar.siblings( ".ui-title" ).length ) { $tabbar.parents( ".ui-header" ).addClass( "ui-title-tabbar" ); @@ -107,11 +103,13 @@ $tabbar.parents( ".ui-header" ).addClass( "ui-title-tabbar-multiline" ); } - $tabbtns.buttonMarkup({ - corners: false, - shadow: false, - iconpos: iconpos - }); + if ( $tabbar.find( "a" ).length ) { + $tabbtns.buttonMarkup({ + corners: false, + shadow: false, + iconpos: iconpos + }); + } if ( $tabbar.find( ".ui-state-persist" ).length ) { $tabbar.addClass( "ui-tabbar-persist" ); @@ -122,7 +120,7 @@ $( this ).addClass( $.mobile.activeBtnClass ); }); - $tabbar.addClass( "ui-tabbar"); + $tabbar.addClass( "ui-tabbar"); $( document ).bind( "pagebeforeshow", function ( event, ui ) { var footer_filter = $( event.target ).find( ":jqmData(role='footer')" ), -- 2.7.4