It's not related to jquery, I can tell you that much. It's the underlying JS engine and how it handles things. My guess is outerHTML
products an HTML Fragment and IE7/8 creates those with a newline. Since whitespace between tags isn't taken into consideration for document flow according to the spec, how the HTML is actually generated -- i.e. with or without that leading newline; with or without tag indentation, etc -- is really up to each browser to specify.
http://jsbin.com/izemop/1/ See this example that uses a div that's in the actual document and gotten by the DOM's getElementById
. You get the same results.