MCPcopy
hub / github.com/mongodb/node-mongodb-native / highlight

Function highlight

docs/_static/doctools.js:69–88  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

67 */
68jQuery.fn.highlightText = function(text, className) {
69 function highlight(node) {
70 if (node.nodeType == 3) {
71 var val = node.nodeValue;
72 var pos = val.toLowerCase().indexOf(text);
73 if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) {
74 var span = document.createElement("span");
75 span.className = className;
76 span.appendChild(document.createTextNode(val.substr(pos, text.length)));
77 node.parentNode.insertBefore(span, node.parentNode.insertBefore(
78 document.createTextNode(val.substr(pos + text.length)),
79 node.nextSibling));
80 node.nodeValue = val.substr(0, pos);
81 }
82 }
83 else if (!jQuery(node).is("button, select, textarea")) {
84 jQuery.each(node.childNodes, function() {
85 highlight(this);
86 });
87 }
88 }
89 return this.each(function() {
90 highlight(this);
91 });

Callers 1

doctools.jsFile · 0.70

Calls 2

jQueryFunction · 0.50
isMethod · 0.45

Tested by

no test coverage detected