title: document.documentElement.outerHTML returns a different HTML
body: <p>I'm trying to make a js app that reads and checks HTML/JS code inserted by the user. I'm using document.[some div].outerHTML to retrieve the full html contained in that element.</p>
  
  <p>But, I noticed that IE10 (and other versions of IE) modify HTML returned by .outerHTML property. In particular, it changes the order of parameters of any element. For example:</p>
  
  <pre><code>Original code:
  &lt;a id="test" class="myclass" name="test" href="mylink"&gt;link&lt;/a&gt;
  </code></pre>
  
  <p>Becames something like:</p>
  
  <pre><code>HTML returned by .outerHTML
  &lt;a name="test" href="mylink" id="test" class="myclass"&gt;link&lt;/a&gt;
  </code></pre>
  
  <p>As you see, the name and href params are reordered.
  The odd thing is that, if I inspect the code via "view source" on IE, the code is correct and not-reordered.
  How come this happens only with .outerHTML? I tried with other browsers, and only IE seems to have this behavior.</p>
  
  <p>Is there a way to retrieve same HTML as "view source" by JS?</p>
  
  <p>Thanks in advance,</p>