Has anyone seen a function that takes a string, parses any HTML, and returns it as an object with all its nodes?
So, for example this
stringParser("<p>Here is the <strong>string</strong> we want to <em>add</em> to the page.</p>")
would return the elementNode 'p' with it's children the textNodes, elementNodes 'strong' and 'em' and their textNode children. The object could then be added to the document via appendChild.
I'm thinking of developing a help system in which all of the help text is contained as an array in a liked js file, and when help is requested, the HTML is added to the DOM dynamically. Of course, if I don't act on the HTML string, it is printed verbatim in the browser.
Thanks in advance,