 # relativeRoot - The root node for the xpath
 #
 # Returns a string
-simpleXPathJQuery = (relativeRoot) ->
-  jq = this.map ->
+simpleXPathJQuery = ($el, relativeRoot) ->
+  jq = $el.map ->
     path = ''
     elem = this
 

    xpath = xpath.replace /\/$/, ''
    xpath

  jq = this.map ->
    path = getPathTo this

    path

    tmp = tmp.previousSibling
  pos

fromNode = ($el, relativeRoot) ->
  try
    result = simpleXPathJQuery $el, relativeRoot
  catch exception
    console.log("jQuery-based XPath construction failed! Falling back to
                 manual.")
    result = simpleXPathPure $el, relativeRoot
  result

# Public: Finds an Element Node using an XPath relative to the document root.
