dollarx

for reddit comment expander

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.org/scripts/27469/175838/dollarx.js

function $x(p, context, doc, nsResolver) {
	if (!nsResolver) nsResolver=null;
	if (!doc) doc=document;
	if (!context) context=doc;
	var arr=[];
	var xpr=doc.evaluate(
		p, context, nsResolver, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null
	);
	for (var i=0; item=xpr.snapshotItem(i); i++) { arr.push(item); }
	return arr;
}