           element = $(element)
           element.on eventName, (event) -> view[methodName](event, element)
 
-      if view.matching(selector)
+      if matchesSelector(view, selector)
         methodName = view[0].getAttribute(eventName)
         do (methodName) ->
           view.on eventName, (event) -> view[methodName](event, view)

  'blur change click dblclick error focus input keydown
   keypress keyup load mousedown mousemove mouseout mouseover
   mouseup resize scroll select submit unload'.split /\s+/

idCounter = 0



jQuery.fn.view = -> @data('view')
jQuery.fn.views = -> @toArray().map (elt) -> $(elt).view()

# Trigger attach event when views are added to the DOM
callAttachHook = (element) ->
