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
console.time("foo"); | |
// do stufff | |
console.timeEnd("foo"); | |
// http://codepen.io/KK4OXJ/pen/eNyRYr |
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
// http://youmightnotneedjquery.com/ | |
// Returns first element that matches CSS selector {expr}. | |
// Querying can optionally be restricted to {container}’s descendants | |
function $(expr, container) { | |
return typeof expr === "string"? (container || document).querySelector(expr) : expr || null; | |
} | |
// Returns all elements that match CSS selector {expr} as an array. | |
// Querying can optionally be restricted to {container}’s descendants | |
function $$(expr, container) { |
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
<div id="toggle" class=""> | |
<div class="one"></div> | |
<div class="two"></div> | |
<div class="three"></div> | |
</div> | |
<!-- just toggle the "on" class with js :) --> |
NewerOlder