If I’ve got something like:
var x = <div><span>hello</span><span>world</span></div>
and add it to some other expression, it gets rendered as:
<div>
<span>hello</span>
<span>world</span>
</div>
But in HTML, the whitespace between </span> and <span> is significant.
Is there a way to turn off the auto-indentation that E4X does?
I’m using Rhino JS, but obviously a standard mechanism would be preferred.
Yes, just set
XML.prettyIndent = 0. If you want to turn off pretty printing entirely, just setXML.prettyPrinting = false. You can read about more switches on the MDC E4X tutorial.