Skip to content

Commit

Permalink
fix(getTarget): do not return null; throw (#623)
Browse files Browse the repository at this point in the history
If it returns as it did does, it would be able to return null as it would immediately return and not go into the null check with throws.
  • Loading branch information
TheSharpieOne committed Oct 6, 2017
1 parent e71c427 commit e1d3b5f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ export function getTarget(target) {
}

if (typeof target === 'string' && document) {
const selection = document.querySelector(target);
let selection = document.querySelector(target);
if (selection === null) {
return document.querySelector(`#${target}`);
selection = document.querySelector(`#${target}`);
}
if (selection === null) {
throw new Error(`The target '${target}' could not be identified in the dom, tip: check spelling`);
Expand Down

0 comments on commit e1d3b5f

Please sign in to comment.