jquery/jquery — pull request #926 by orkel (2012-09-10 18:18:00+00:00)
Title: Fixes #12392, #12120, #12503

I united this patches to one pull because they seems connected to each other, if you like, i can separate them.

Bit more information why innerHTML destroys content in disconnected nodes:
```js
div = document.createElement( "div" );
div.parentNode; // null

// but when
div.innerHTML = "test";
div.parentNode; // documentFragment

// same goes for
div = document.createElement( "div" );
div.getElementsByTagName("");

div.parentNode; // documentFragment

// or
div.appendChild( p = document.createElement( "p" ) );
div.removeChild( p );
p.parentNode; // documentFragment

```

This way you can create new document fragment btw, without using createDocumentFragment function.

Apparently, node should have parent to perfom operations with its children, if parent does not exist while trying to work with its children, parent will become a document fragment if not appended to other node, but when innerHTML is used on parent element, all removed children (in contrast with removeChild method) will become parentless i.e. parentNode === null, because of it, all their content is destroyed, which is somewhat logical.

In last IE versions (IE9-10), this was fixed, you can operate on children nodes without having a parent, but innerHTML still removes content of disconnected nodes, it's probably legacy code of some sort, but if textContent (which is avaliable starting from IE 9) property is used for the same purpose, it's makes parentNode to be a null, while saving content of the elements.

In others browsers such problem is not exist. So, parent element being null or document fragment in oldIE, seems logical to me.

Others patches more or less self-explanatory