The webResolvers module (deprecated)

8.0+Version 4.2 of QF-Test introduced the webResolvers module which made it possible to execute Javascript based resolver logic in web projects in special cases directly in the browser. Since this can also be done with a classic resolver (see chapter section 53.1) using callJS() (see chapter subsection 53.11.4), the module has been deprecated in QF-Test 8.0.

A name resolving, which calls in case of a missing name the method customFallbackNameProvider on the node in the browser, could have been performed using the webResolvers module with this code:

getNameFunc = """
  function getName(node, name) {
    if (! name) return node.customFallbackNameProvider();
  }
  """

webResolvers.addResolver("myNames", getNameFunc, "DIV")
Example 53.30:  A deprecated webNameResolver is registered via Jython

It is very simple to reformulate the code avoiding the webResolvers module:

def getName(node, name):
  return node.callJS("""
    if (! name) return node.customFallbackNameProvider();
  """, {"node":node,"name":name})

resolvers.addResolver("myNames", getName, "DIV")
Example 53.31:  A NameResolver with Javascript call is registered via Jython

The performance of the resolver can be improved in this case by only conditionally calling the Javascript code in the browser:

def getName(node, name):
    if not name:
        return node.callJS('(node) => node.customFallbackNameProvider()');

resolvers.addResolver("myNames", getName, "DIV")
Example 53.32:  A NameResolver with Javascript call is registered via Jython (optimized)

The transition of other existing webResolvers module calls can be done in the same way.