js/libs/ember-1.5.1.js
function(start, end) {
        if (start.parentNode !== end.parentNode) {
          end.parentNode.insertBefore(start, end.parentNode.firstChild);
        }
      }
function(start, end) {
        if (start.parentNode !== end.parentNode) {
          end.parentNode.insertBefore(start, end.parentNode.firstChild);
        }
      }
/*
When automatically adding a tbody, Internet Explorer inserts the
tbody immediately before the first <tr>. Other browsers create it
before the first node, no matter what.

This means the the following code:

div = document.createElement("div");
div.innerHTML = "<table><script id='first'></script><tr><td>hi</td></tr><script id='last'></script></table>

Generates the following DOM in IE:

+ div
+ table
- script id='first'
+ tbody
+ tr
+ td
- "hi"
- script id='last'

Which means that the two script tags, even though they were
inserted at the same point in the hierarchy in the original
HTML, now have different parents.

This code reparents the first script tag by making it the tbody's
first child.