From 3da5f05f7516dc5fe72de1b8fec76c6a54031b99 Mon Sep 17 00:00:00 2001 From: scottjehl Date: Thu, 7 Apr 2011 16:50:10 -0400 Subject: [PATCH] wrapped the else if/else in an else to prevent an unnecessary dom walk until we have to make it. --- js/jquery.mobile.navigation.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/js/jquery.mobile.navigation.js b/js/jquery.mobile.navigation.js index fb756f41..2cf58ff8 100644 --- a/js/jquery.mobile.navigation.js +++ b/js/jquery.mobile.navigation.js @@ -237,17 +237,20 @@ //direct focus to the page title, or otherwise first focusable element function reFocus( page ){ - var pageTitle = page.find( ".ui-title:eq(0)" ), - lastClicked = page.jqmData( "lastClicked" ); + var lastClicked = page.jqmData( "lastClicked" ); if( lastClicked && lastClicked.length ){ lastClicked.focus(); } - else if( pageTitle.length ){ - pageTitle.focus(); - } - else{ - page.find( focusable ).eq(0).focus(); + else { + var pageTitle = page.find( ".ui-title:eq(0)" ); + + if( pageTitle.length ){ + pageTitle.focus(); + } + else{ + page.find( focusable ).eq(0).focus(); + } } }