removed unnecessary variable initialization
removed unnecessary check on param
Throwing Error instead of String.
Using target ownerDocument instead of window.document
Using domReady plugin declaration  instead of explicit call of domReady()