I develop and host wikis where users enter free-form text, and my
server-side parsers create WISIWYG HTML from this.

Of course, users can, and do, submit almost anything, and on the
server-side I do a pretty good job of marking it up properly.  But
addressing edge-cases makes the server-side parsing increasingly
heavy.

One such edge case is islands of text that are not in any tag other
than the global containing DIV.  Like this:

<div class="container">
  <h3>I am text within a tag</h3>
  I am a text island child of the "container" div wrapper.  <--- My
edge case
  <p>I am also text within a tag</p>
</div>

QUESTION: Using jQuery, how would you select orphan text inside a DIV
in order to $.wrap() it, say, in a "<p>" tag?

I'm thinking I could ask the client browsers to address some of these
edge-cases for me.

Ideas?  Something like $
(".container").textFragmentsNotInsideAnyOtherTag()

**--**  Steve

Reply via email to