From 031c373e5aba6c1ea7123510f8274e8f92e80fe6 Mon Sep 17 00:00:00 2001 From: Chris Meller Date: Wed, 17 Oct 2012 19:40:12 -0500 Subject: [PATCH] Fix errors when there is no class on the selected element. If you are using a selector other than a CSS class, this is necessary. --- .../foundation/jquery.foundation.tooltips.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/vendor/assets/javascripts/foundation/jquery.foundation.tooltips.js b/vendor/assets/javascripts/foundation/jquery.foundation.tooltips.js index 6a31610f3..6ce15b3da 100644 --- a/vendor/assets/javascripts/foundation/jquery.foundation.tooltips.js +++ b/vendor/assets/javascripts/foundation/jquery.foundation.tooltips.js @@ -127,15 +127,15 @@ tip.width(column.outerWidth() - 25).css('left', 15).addClass('tip-override'); objPos(nub, -nubHeight, 'auto', 'auto', target.offset().left); } else { - if (classes.indexOf('tip-top') > -1) { + if (classes && classes.indexOf('tip-top') > -1) { objPos(tip, (target.offset().top - tip.outerHeight() - nubHeight), 'auto', 'auto', target.offset().left, width) .removeClass('tip-override'); objPos(nub, 'auto', 'auto', -nubHeight, 'auto'); - } else if (classes.indexOf('tip-left') > -1) { + } else if (classes && classes.indexOf('tip-left') > -1) { objPos(tip, (target.offset().top + (target.outerHeight() / 2) - nubHeight), 'auto', 'auto', (target.offset().left - tip.outerWidth() - 10), width) .removeClass('tip-override'); objPos(nub, (tip.outerHeight() / 2) - (nubHeight / 2), -nubHeight, 'auto', 'auto'); - } else if (classes.indexOf('tip-right') > -1) { + } else if (classes && classes.indexOf('tip-right') > -1) { objPos(tip, (target.offset().top + (target.outerHeight() / 2) - nubHeight), 'auto', 'auto', (target.offset().left + target.outerWidth() + 10), width) .removeClass('tip-override'); objPos(nub, (tip.outerHeight() / 2) - (nubHeight / 2), 'auto', 'auto', -nubHeight); @@ -145,11 +145,12 @@ }, inheritable_classes : function (target) { var inheritables = ['tip-top', 'tip-left', 'tip-bottom', 'tip-right', 'noradius'], - filtered = $.map(target.attr('class').split(' '), function (el, i) { - if ($.inArray(el, inheritables) !== -1) { - return el; - } - }).join(' '); + classes = target.attr('class'), + filtered = classes ? $.map(classes.split(' '), function (el, i) { + if ($.inArray(el, inheritables) !== -1) { + return el; + } + }).join(' ') : ''; return $.trim(filtered); }, -- 2.47.3