Skip to content

Instantly share code, notes, and snippets.

@piecioshka
Last active March 11, 2019 10:40
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 piecioshka/5a9fa52f1c3f90aed97bfb8e0caa8335 to your computer and use it in GitHub Desktop.
Save piecioshka/5a9fa52f1c3f90aed97bfb8e0caa8335 to your computer and use it in GitHub Desktop.
Shim for jQuery.not() #jQuery
const element = $('.file-box:nth-child(2)')
const list = $$('.file-box')
function not($list, element) {
const list = Array.from($list);
const index = list.indexOf(element);
return list.slice(index);
}
Array.from(not(list, element))
.forEach(e => e.style.background = 'red')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment