This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Document.createElement() creates an element without a parent. You have to attach that element to something before it's part of a DOM tree. In particular, you have to attach one Element to a Document to be its root element: