MCPcopy
hub / github.com/Justineo/github-hovercard / getNextTextNode

Function getNextTextNode

src/hovercard.js:804–825  ·  view source on GitHub ↗
(node, context)

Source from the content-addressed store, hash-verified

802 }
803
804 function getNextTextNode(node, context) {
805 let filter = NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT
806 let walker = document.createTreeWalker(context || document.body, filter)
807 while (walker.nextNode()) {
808 if (walker.currentNode === node) {
809 while (walker.nextNode()) {
810 let current = walker.currentNode
811 if (
812 current.nodeType === Node.TEXT_NODE &&
813 !(
814 node.compareDocumentPosition(current) &
815 Node.DOCUMENT_POSITION_CONTAINED_BY
816 ) &&
817 trim(current.nodeValue)
818 ) {
819 return current
820 }
821 }
822 }
823 }
824 return null
825 }
826
827 // '<span>ecomfe/</span><em>ecomfe</em>.github.io'
828 function fixRepoSlug(html) {

Callers 1

extractElemFunction · 0.70

Calls 1

trimFunction · 0.70

Tested by

no test coverage detected