Skip to content

Instantly share code, notes, and snippets.

@suissa
Last active November 21, 2017 22:43
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 suissa/cc1b8c380348b1c30f1f69d28887e81a to your computer and use it in GitHub Desktop.
Save suissa/cc1b8c380348b1c30f1f69d28887e81a to your computer and use it in GitHub Desktop.
const $$ = ( selector, context = document ) => {
const elements = context.querySelectorAll( selector )
( selector[ 0 ] === '#' ) // OU COM REGEX?
? elements[ 0 ]
: elements
}
$$( '#myjQuery' ).innerHTML = $$( 'div' ).length
$( '#jQuery' ).innerHTML = $( 'div' ).length
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment