From bf2ad4b13e56007976a86673e54255e77ec3d9e4 Mon Sep 17 00:00:00 2001 From: Jake Marsh Date: Sun, 8 Mar 2015 16:16:02 -0400 Subject: [PATCH] add additional checks to ensure that elements exist before any jQuery logic --- dist/js/Mixin.js | 4 ++-- lib/js/Mixin.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/js/Mixin.js b/dist/js/Mixin.js index e993c1b..8f0f6f5 100644 --- a/dist/js/Mixin.js +++ b/dist/js/Mixin.js @@ -176,8 +176,8 @@ module.exports = function(settings, done) { renderCurrentStep: function() { var element = null; var currentStep = this.settings.steps[this.state.currentIndex]; - var $target = $(currentStep.element); - var cssPosition = $target.css('position'); + var $target = currentStep && currentStep.element ? $(currentStep.element) : null; + var cssPosition = $target ? $target.css('position') : null; if ( $target && $target.length ) { if ( this.state.showTooltip ) { diff --git a/lib/js/Mixin.js b/lib/js/Mixin.js index 4ceb558..a362829 100644 --- a/lib/js/Mixin.js +++ b/lib/js/Mixin.js @@ -176,8 +176,8 @@ module.exports = function(settings, done) { renderCurrentStep: function() { var element = null; var currentStep = this.settings.steps[this.state.currentIndex]; - var $target = $(currentStep.element); - var cssPosition = $target.css('position'); + var $target = currentStep && currentStep.element ? $(currentStep.element) : null; + var cssPosition = $target ? $target.css('position') : null; if ( $target && $target.length ) { if ( this.state.showTooltip ) {