     testDoc = createDocumentUsingParser '<html><body><p>test'
 
   if testDoc?.body?.childNodes.length is 1
-    createDocumentUsingParser
+    createDocument = createDocumentUsingParser
   else
-    createDocumentUsingWrite
+    createDocument = createDocumentUsingWrite
+
+  createDocument html
 
 
 handleClick = (event) ->


ignoreClick = (event, link) ->
  samePageLink(link) or crossOriginLink(link) or anchoredLink(link) or
  nonHtmlLink(link)  or remoteLink(link)      or noTurbolink(link)  or 
  newTabClick(event)



  title = doc.querySelector 'title'
  [ title?.textContent, doc.body ]

createDocument = (html) ->
  createDocumentUsingParser = (html) ->
    try
      (new DOMParser).parseFromString html, 'text/html'

  createDocumentUsingWrite = (html) ->
    doc = document.implementation.createHTMLDocument ''
