My problem is bit complex, I will try my best to explain it.
What I am trying to do?
I want to provide users with a script that they can add to their webpage/blog which will highlight cretain text on their web pages and put a menu/box their which displays on hover. Something like kontera.
To do this, I am doing the following:
1. Parse the HTML of the page where the script is loaded by the following method:
http://stackoverflow.com/questions/3460004/regexp-to-search-replace-only-text-not-in-html-attribute
(see the first answer)
2. If its a text node than check the value of the text node for any keywords present in it. (I have around 1000 keywords) and if a keyword is found, replace it with highlighted text and the needed things.
When I apply this to my blog on blogger.com is hangs the browser as the parser function call itself recursively.
I tried to confirm this by limiting my keywords to only 5 from 100's.
Than to solve it I limited that if the nodes are of type DIV or P or BODY than only call the function recursively, still it hangs.
When I remove DIV and leave only P and BODY, than it works.
Can you help me? Thanks in advance! :)