Using jQuery and nodeType to select untagged text
<p>I've been trying to understand how to use jQuery and nodeType to select untagged text and wrap it in a .</p>

<p>It seems to be working fine for when I only need one tag, but as you see from the code below, I need two different tags. E.g.  for the ".." and  for "2".</p>

<p>The system I'm using wont let me tinker with the pagination source, so there is no other way to add a tag to the current pagination page, which always just shows up as a number without a , .class or #style.</p>

<p>This is the source code:</p>

<pre><code>&lt;span class="pagination" id="pagination"&gt;
   &lt;a href="/_blog/Silly_Creature_of_Cyberspace/page/1/" title="1"&gt;1&lt;/a&gt;
    2  
   &lt;a href="/_blog/Silly_Creature_of_Cyberspace/page/3/" title="3"&gt;3&lt;/a&gt;
   &lt;a href="/_blog/Silly_Creature_of_Cyberspace/page/4/" title="4"&gt;4&lt;/a&gt;
   &lt;a href="/_blog/Silly_Creature_of_Cyberspace/page/5/" title="5"&gt;5&lt;/a&gt;
    .. 
   &lt;a href="/_blog/Silly_Creature_of_Cyberspace/page/6/" title="6"&gt;6&lt;/a&gt;
&lt;/span&gt;
</code></pre>

<p>Hoping there is someone out there who can help me with this. Thanks!</p>

<h3>UPDATE! Added jQuery code used to wrap untagged text:</h3>

<pre><code>$(".wp-pagenavi .pagination").contents().filter(function() {
   return this.nodeType != 1;
}).wrap("&lt;span class='orphan'/&gt;");​
</code></pre>

<p>You can see a jsFiddle here: <a href="http://jsfiddle.net/prodac/qxn8Q/" rel="nofollow">http://jsfiddle.net/prodac/qxn8Q/</a></p>

<h3>UPDATE! I managed to get it working</h3>

<p>By hacking the <a href="http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html" rel="nofollow">Text Highlighting jQuery Plugin</a> together with a mod of the jQuery posted in the question above and some CSS I have something that works for now. You can check it out in this <a href="http://jsfiddle.net/prodac/cH9UN/" rel="nofollow">jsFiddle</a>. But if anyone has abetter solution I would love to see it.</p>
