Skip to content
This repository has been archived by the owner on Feb 17, 2021. It is now read-only.

Commit

Permalink
Merge pull request #90 from cedrics/prefer_jquery
Browse files Browse the repository at this point in the history
Prefer jQuery and Sizzle when searching for a target
  • Loading branch information
kate2753 committed Jun 14, 2014
2 parents 73b189f + 3f4bb76 commit f928e51
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/js/hopscotch.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,6 @@
if (result) {
return result;
}
if (document.querySelector) {
return document.querySelector(target);
}
if (hasJquery) {
result = jQuery(target);
return result.length ? result[0] : null;
Expand All @@ -361,6 +358,9 @@
result = new Sizzle(target);
return result.length ? result[0] : null;
}
if (document.querySelector) {
return document.querySelector(target);
}
// Regex test for id. Following the HTML 4 spec for valid id formats.
// (http://www.w3.org/TR/html4/types.html#type-id)
if (/^#[a-zA-Z][\w-_:.]*$/.test(target)) {
Expand Down

0 comments on commit f928e51

Please sign in to comment.