       textNodes = @select './/text()', node
     privacy.taint (privacy.untaint(node.nodeValue) for node in textNodes).join('')
 
-  #
-  # Returns +true+ if +xpathOrNode+ has class +className+, +false+ otherwise.
-  #
+  # Public: Determines whether an Element has a given class.
+  #
+  # xpathOrNode - If it's an Element, use it to check the class.
+  #               Otherwise it should be a String xpath.
+  # className - The class to check the Element for.
+  #
+  # Examples
+  #
+  #   page.hasClass page.find('//div[@class="section"]'), 'section'
+  #   # => true
+  #
+  #   page.hasClass page.find('//div[@class="section"]'), 'section'
+  #   # => true
+  #
+  # Returns true if the Element has the given class.
+  # Raises DocumentMismatchError given a node not belonging to this page.
+  # Raises NodeNotFoundError given an xpath for which there are no matches.
   hasClass: (xpathOrNode, className) ->
     " #{@findStrict(xpathOrNode).className} ".indexOf(" #{className} ") > -1
 
-  #
-  # Goes back one step in the document's window's history.
-  #
-  # @public
-  #
+  # Public: Goes back one step in the page's history.
+  #
+  # Returns nothing.
   back: ->
     @document.defaultView.history.back()
 
-  #
-  # Inject some javascript into a document by appending a script tag.
-  #
-  # @param script [String]
-  #   JavaScript to be put into the page and executed.
-  #
-  # @public
-  #
+  # Public: Inject some javascript into a document by appending a script tag.
+  #
+  # script - JavaScript to be run in the page.
+  #
+  # Returns nothing.
   inject: (script) ->
     element = @document.createElementNS "http://www.w3.org/1999/xhtml", "script"
     element.setAttribute "type", "text/javascript"

#
# Provides a wrapper around an +HTMLDocument+ to simplify interaction with it.
#

{Pathway} = require 'xpath'
Colorizer = require 'util/Colorizer'
inspect   = require 'util/inspect'


    element.dispatchEvent(event)

  # Public: Determines whether a node is visible.
  #
  # xpathOrNode - If it's a Node, uses it as the Node to check for visibility.
  #               Otherwise it should be a String xpath.
  #
  # Examples
  #
  #   page.visible '//imnotonthispage'
  #   # => false
  #
  #   page.visible '//div[contains(@style, "display:none")]'
  #   # => false
  #
  #   page.visible '//body'
  #   # => true
  #
  #   page.visible '//div[@class="this-class-hides-things"]//a'
  #   # => false
  #
  # Returns a Boolean indicating whether the Node is visible.
  # Raises DocumentMismatchError given a node not belonging to this page.
  visible: (xpathOrNode) ->
    element = privacy.untaint @find(xpathOrNode)

