Show functions are not run in a browser, so you do not have access to a DOM. You will need to parse the HTML as a string.
If you have the option, it may be easier to reverse your design and store JSON in your CouchDB documents then render HTML in a show function, rather than the other way around. If you are with decoding HTML, John Resig wrote a SAX-style parser that you could bundle into your show function: http://ejohn.org/blog/pure-javascript-html-parser/ Justin On Fri, Jun 17, 2011 at 2:01 PM, Greg Johnston <[email protected]>wrote: > Hi all, > > I'm trying to transform some HTML I have stored in a CouchDB document > to another format. It's actually pretty simple to do, really just > looping over the DOM. Normally I'd start out with something like: > > var div = document.createElement("div"); > div.innerHTML = [...] > > ...and be ready to go. Unfortunately it looks like "document" is > undefined in the show function. Am I doing something stupid here, is > there a better way, or does anyone have other suggestions? > > Thanks, > Greg Johnston >
