Created
February 6, 2014 08:10
-
-
Save snowman-repos/8840099 to your computer and use it in GitHub Desktop.
Selectors API, without 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
element = document.querySelector "div" | |
elements = document.querySelectorAll ".container div" | |
navigation = document.querySelector "nav" | |
links = navigation.querySelectorAll "a" | |
# This gives us simple dollar function and event binding | |
$ = document.querySelectorAll.bind document | |
Element::on = Element::addEventListener | |
# This is how you use it | |
$(".element")[0].on "touchstart", handleTouch, false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment