 # #
 # EVENT BINDING/HANDLING
 # #
-  
-  
+
+
   setLazyLoader:(threshold=.75)->
     @getOptions().bind += ' scroll' unless /\bscroll\b/.test @getOptions().bind
     @listenTo

    if @parentIsInDom
      child.propagateEvent KDEventType: 'viewAppended'
    @
  
  appendTo:(parent, selector)->
    @$().appendTo parent.$(selector)
    if @parentIsInDom
      @propagateEvent KDEventType: 'viewAppended'
    @
  
  prepend:(child, selector)->
    @$(selector).prepend child.$()
    if @parentIsInDom
      child.propagateEvent KDEventType: 'viewAppended'
    @
  
  prependTo:(parent, selector)->
    @$().prependTo parent.$(selector)
    if @parentIsInDom
      @propagateEvent KDEventType: 'viewAppended'
    @
  
  setPartial:(partial,selector)->
    @$(selector).append partial
    @
    
  updatePartial: (partial, selector) ->
    @$(selector).html partial
  
  # UPDATE PARTIAL EXPERIMENT TO NOT TO ORPHAN SUBVIEWS
  
  # updatePartial: (partial, selector) ->
  #   subViews = @getSubViews()
  #   subViewSelectors = for subView in subViews
  #     subView.$().parent().attr "class"
  # 
  #   @$(selector).html partial
  #   
  #   for subView,i in subViews
  #     @$(subViewSelectors[i]).append subView.$()



    handle = if options.handle and options.handle instanceof KDView then handle else @

    @listenTo
      KDEventTypes       : "mousedown"
      listenedToInstance : handle
      callback           : (pubInst, event)=>

        if "string" is typeof options.handle
          return if $(event.target).closest(options.handle).length is 0

        top    = parseInt @$().css("top"), 10
        right  = parseInt @$().css("right"), 10
        bottom = parseInt @$().css("bottom"), 10
        left   = parseInt @$().css("left"), 10

