Get all elements by inner text
<p>I'm stuck with a problem:
I want to search for a string in a html document. So far I tried with window.find(..) method, but I can't get back the node of the found elements. Just for example i can highlight all the matching texts.
But I want to put all the nodes in an array, and I can't find a method, which can return me the node of the selected text.
The following code only highlights the matching texts, I want to get the (parent) node of it.</p>

<pre><code>function doSearchAdam(text) {
if (window.find &amp;&amp; window.getSelection) {
    document.designMode = "on";
    var sel = window.getSelection();
    sel.collapse(document.body, 0);
    while (window.find(text)) {
        document.execCommand("HiliteColor", false, "yellow");
        sel.collapseToEnd();
    }
    document.designMode = "off";
} else if (document.body.createTextRange) {
    var textRange = document.body.createTextRange();
    while (textRange.findText(text)) {
        textRange.execCommand("BackColor", false, "yellow");
        textRange.collapse(false);
    }
}
</code></pre>

<p>}</p>

<p>Thanks guys!
Adam</p>
