Run operation on all text nodes in a document which are not children of an element with a tagName in a list of tags
<p>I have been trying different methods of doing this, however they are all quite slow.</p>

<p>noGlobalTags is an array containing three tags.</p>

<p>Method 1:</p>

<pre><code>var textNodeWalker = document.createTreeWalker(node, NodeFilter.SHOW_TEXT, function(node){return (noGlobalTags.indexOf(node.tagName)==-1)? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT;}, false);
var cn;
while(cn = textNodeWalker.nextNode()){
  textNodeEmoteParser(cn);
}
return;
</code></pre>

<p>Method 2:</p>

<pre><code>function getTextNodes(node) {
    if(node.nodeType == 3) {
        textNodeEmoteParser(node);
    } else {
        for(var i = 0, len = node.childNodes.length; i &lt; len; ++i) {
            if(noGlobalTags.indexOf(node.childNodes[i].tagName)!=-1) {
                continue;
            }
            getTextNodes(node.childNodes[i]);
        }
    }
}

getTextNodes(node);
</code></pre>

<p>I had expected method 1 to be the quickest, however it took double as long as the second method. Am I doing something stupid here? If not, can I make it faster than the second method?</p>
