query-selector
v2.0.0
Published
javascript implementation of querySelectorAll
Downloads
142,656
Readme
query-selector
querySelectorAll in javascript
use on node
require jsdom
var querySelectorAll = require('query-selector');
var jsdom = require("jsdom").jsdom;
var doc = jsdom('<html><div id="t"><span>1</span><span>2</span></div></html>');
var time = Date.now();
console.log(doc.querySelectorAll('#t span', doc).length);
console.log(doc.querySelectorAll('#t span', doc)[0].innerHTML);
console.log(Date.now()-time);
time = Date.now();
console.log(querySelectorAll('#t span', doc).length);
console.log(querySelectorAll('#t span', doc)[0].innerHTML);
console.log(Date.now()-time);
use standalone on browser
<script src="/build/query-selector-standalone-debug.js"></script>
<div id="t">
<span>1</span>
<span>2</span>
</div>
<script>
console.log(querySelectorAll('#t span'));
</script>