fixed issue with document.adoptNode not releasing its parent

lib/dom/document.js
* fixed issue where the source would erratically be set to the adopting document instead of the node to be adopted
* fixed race condition where the parent would be reset before rearranging its remaining children

test/document.js
* added tests for document.adoptNode to be properly adopted, unattached from parent and re-attached to other parent in other document