Skip to content

Instantly share code, notes, and snippets.

@blivesta
Last active April 1, 2016 06:26
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 blivesta/bef4aa155e1e30f386306eaa074b4622 to your computer and use it in GitHub Desktop.
Save blivesta/bef4aa155e1e30f386306eaa074b4622 to your computer and use it in GitHub Desktop.
<html>
<div class="item">1</div>
<div class="item">2</div>
<div class="item">3</div>
<div class="item">4</div>
<div class="item">5</div>
<div class="item">6</div>
<script src="../src/seek-selector.js"></script>
<script type="text/javascript">
var props = seekSelector('.item')
props.map((node) => {
node.classList.add('on')
})
</script>
</html>
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define([], factory)
} else if (typeof exports === 'object') {
module.exports = factory()
} else {
root.seekSelector = factory()
}
})(this, function () {
function SeekSelector(element) {
var el = document.querySelectorAll(element)
var props = Array.apply(null, el)
return props
}
return SeekSelector
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment