         processor.transformToDocument(xmlDoc)
       else
         processor.transformToFragment(xmlDoc, document)
-    else if xmlDoc.transformNode?
+    else if 'transformNode' of xmlDoc
       return xmlDoc.transformNode(xsltDoc)
     else if activeXSupported
       xslt = createXSLTemplate()

  needsHeader = (str) -> isXml(str) && !hasXmlHeader(str)
  xmlHeader = '<?xml version="1.0" ?>'
  prependHeader = (str) -> xmlHeader + str
  activeXSupported = ActiveXObject? || 'ActiveXObject' in window

  tryCreateActiveX = (objIds...) ->
    return null unless activeXSupported


  newDocument = ->
    d = null
    d ?= createDomDoc()
    d ?= manualCreateElement()
    d ?= document.implementation?.createDocument?("", 'test', null)
