       s = "{"
       first = true
       for key of object
-        if object.hasOwnProperty key
+        # Access hasOwnProperty through Object.prototype to work around bug
+        # in IE6/7/8 when calling hasOwnProperty on a DOM element
+        if Object.prototype.hasOwnProperty.call(object, key)
           if first
             first = false
           else

    delete window.beAnInstanceOf
    delete window.equal
    delete window.include
}
      Spec.expectations.push exp
      exp
    
    # Allows an assertion on a non-object value
    window.expect = (object) ->
      {
