Skip to content

Instantly share code, notes, and snippets.

@padolsey
Created August 16, 2009 08:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save padolsey/168587 to your computer and use it in GitHub Desktop.
Save padolsey/168587 to your computer and use it in GitHub Desktop.
/* Place this at the very top of Sizzle() */
var rContextID = /^\s*#(\S+)(?=\s+\S)/;
// Looking for "#id _somethingElseHere_" ...
if (!context && rContextID.test(selector)) {
context = document.getElementById( rContextID.exec(selector)[1] );
selector = selector.replace(rContextID, '');
}
// Then it continues with the remaining selector.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment