Last active
April 1, 2016 06:26
-
-
Save blivesta/bef4aa155e1e30f386306eaa074b4622 to your computer and use it in GitHub Desktop.
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
<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> |
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
(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