Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions dist/js/shepherd.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! tether-shepherd 1.5.1 */
/*! tether-shepherd 1.5.2 */

(function(root, factory) {
if (typeof define === 'function' && define.amd) {
Expand Down Expand Up @@ -67,7 +67,6 @@ function matchesSelector(el, sel) {
var positionRe = /^(.+) (top|left|right|bottom|center|\[[a-z ]+\])$/;

function parsePosition(str) {

if (typeof str === 'object') {
if (str.hasOwnProperty("element") && str.hasOwnProperty("on")) {
return str;
Expand Down Expand Up @@ -208,17 +207,18 @@ var Step = (function (_Evented) {
key: 'getAttachTo',
value: function getAttachTo() {
var opts = parsePosition(this.options.attachTo) || {};
var selector = opts.element;

if (typeof selector === 'string') {
opts.element = document.querySelector(selector);

if (!opts.element) {
throw new Error('The element for this Shepherd step was not found ' + selector);
var returnOpts = extend({}, opts);

if (typeof opts.element === 'string') {
// Can't override the element in user opts reference because we can't
// guarantee that the element will exist in the future.
returnOpts.element = document.querySelector(opts.element);
if (!returnOpts.element) {
console.error('The element for this Shepherd step was not found ' + opts.element);
}
}

return opts;
return returnOpts;
}
}, {
key: 'setupTether',
Expand Down
Loading