querycomments
Version:
A querycomments library
8 lines (7 loc) • 963 B
JavaScript
/*!
* Querycomments v1.0.0 (https://github.com/victornpb/querycomments)
* Copyright (c) victornpb
* @license apache-2
*/
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o():"function"==typeof define&&define.amd?define(o):(e="undefined"!=typeof globalThis?globalThis:e||self).querycomments=o()}(this,(function(){"use strict";return function(e,o){var n=document.createNodeIterator(e||document,NodeFilter.SHOW_COMMENT,{acceptNode:function(e){return NodeFilter.FILTER_ACCEPT}}),r={abort:!1,breakOnFirst:!1},t=[];if("function"==typeof o)for(;n.nextNode()&&(!o.call(r,n.referenceNode.nodeValue,n.referenceNode)||(t.push(n.referenceNode),!r.breakOnFirst))&&!r.abort;);else if(o instanceof RegExp)for(r.breakOnFirst=!o.global;n.nextNode()&&(null===o.exec(n.referenceNode.nodeValue)||(t.push(n.referenceNode),!r.breakOnFirst)););else for(;n.nextNode();)t.push(n.referenceNode);return t}}));
//# sourceMappingURL=querycomments.js.map