Last active
March 11, 2019 10:40
-
-
Save piecioshka/5a9fa52f1c3f90aed97bfb8e0caa8335 to your computer and use it in GitHub Desktop.
Shim for jQuery.not() #jQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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