I've been trying to search for a word and add a span to it in order to give it some styling and functionality, and I've found a method of doing this, but it isn't very effective.
I have a content script that is searching for the word searching and then I replace the innerHTML with an added span to the keyword. 
This is my JS file:
function getText(){
return document.body.innerText
}
if(getText().indexOf("searching") > -1) {
  document.body.innerHTML = document.body.innerHTML.replace(new RegExp("searching", "g"),"<span class='spanDetected' id='spanDetected'>"+
    'searching'+"</span>");
  console.log("true");
}
And this is what the outcome is: 

So it seems to work on some level, but then the problem arises that it also changes URLS and Textboxes, like so:

What is a better way of styling and adding functionality to a word?
 
     
    