Permalink
Browse files

Case #48: Wrap hash searching in a try/catch block.

  • Loading branch information...
1 parent 86a3b44 commit 53d2ac90118360da3d4ddd45306afcc2a7593516 @hopeseekr hopeseekr committed Sep 12, 2013
Showing with 12 additions and 6 deletions.
  1. +12 −6 js/kickstart.js
View
18 js/kickstart.js 100755 → 100644
@@ -94,12 +94,18 @@ jQuery(document).ready(function($){
var wantedTag = window.location.hash;
if (wantedTag != "")
{
- var allTabs = $("ul.tabs a[href^=" + wantedTag + "]").parents('ul.tabs').find('li');
- var defaultTab = allTabs.filter('.current').find('a').attr('href');
- $(defaultTab).hide();
- allTabs.removeClass('current');
- $("ul.tabs a[href^=" + wantedTag + "]").parent().addClass('current');
- $("#" + wantedTag.replace('#','')).show();
+ // This code can and does fail, hard, killing the entire app.
+ // Esp. when used with the jQuery.Address project.
+ try {
+ var allTabs = $("ul.tabs a[href^=" + wantedTag + "]").parents('ul.tabs').find('li');
+ var defaultTab = allTabs.filter('.current').find('a').attr('href');
+ $(defaultTab).hide();
+ allTabs.removeClass('current');
+ $("ul.tabs a[href^=" + wantedTag + "]").parent().addClass('current');
+ $("#" + wantedTag.replace('#','')).show();
+ } catch(e) {
+ // I have no idea what to do here, so I'm leaving this for the maintainer.
+ }
}
/*---------------------------------

0 comments on commit 53d2ac9

Please sign in to comment.