Last active
December 10, 2015 22:59
-
-
Save kensnyder/4506420 to your computer and use it in GitHub Desktop.
Quick and Dirty jQuery-like function for Casper
This file contains hidden or 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
function qsa(sel, each) { | |
return [].map.call(document.querySelectorAll(sel) || [], each || function(el) {return el}); | |
} | |
// usage: | |
qsa('a[href*="/reports/"], .legend', function(el) { | |
el.style.visibility = 'hidden'; | |
}); | |
// or | |
var hrefs = qsa('a[href]', function(el) { | |
return el.href; | |
}); | |
// or | |
var divs = qsa('div'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment