tabbar : bug fix in case none li element case
authorJinhyuk Jun <jinhyuk.jun@samsung.com>
Fri, 28 Dec 2012 09:59:37 +0000 (18:59 +0900)
committerMinkyu Kang <mk7.kang@samsung.com>
Fri, 4 Jan 2013 11:19:31 +0000 (20:19 +0900)
Change-Id: Iad36f6ff567f20784b3606e2d9f74fe8563ea960

src/widgets/tabbar/js/jquery.mobile.tizen.tabbar.js

index 29357c2..d5b57be 100755 (executable)
                _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(),
                                $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" );
                                $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" );
                                $( 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')" ),