title: How to only modify "text" while modifying the dom using javascript
body: <p>I'm trying to write an "unbreakable" class using jQuery, so that: </p>
  
  <pre><code>&lt;span class=unbreakable&gt;
     some text in here 
     maybe with a &lt;span title="tag"&gt;tag&lt;/span&gt; or something
  &lt;/span&gt;
  </code></pre>
  
  <p>would have each space replaced with <code>&amp;nbsp;</code>. The problem is, if I do something like </p>
  
  <pre><code>$(".unbreakable").html
  (   replaceAll($(".unbreakable").html(), " ", "&amp;nbsp;")
  );
  </code></pre>
  
  <p>It'll replace the spaces in tags as well - no good. So I'm looking for a way to avoid the tags without writing an html parser myself. Anyone know a good way to do this?</p>