handle appendMenuTo option better in KyleMenus
handle appendMenuTo option better in KyleMenus

3 things:

* only appendMenuTo the new location while it is open
  and put it back when it closes, so that if the parent
  is remove()ed it won't leave a kyleMenu <ul> hanging
  out at the bottom of the document.

* proxy clicks back to the original dom location
  so that if you are delegating from a parent
  you still capture the click events in the menu
  appendedTo the body.

* reorganize into a 'class' for better organized code

Change-Id: I6555b37f6ecf60d242d9a1f489280239394278f3
Reviewed-on: https://gerrit.instructure.com/10028
Tested-by: Hudson <dfb64870173313a9a7b56f814c8e3b33e268497a@instructure.com>
Reviewed-by: Ryan Florence <2d8900489f91ac272fd9ce9d5789db6522668ca2@instructure.com>

shidao-fm/canvas-lms,greyhwndz/canvas-lms,tgroshon/canvas-lms,icelab/canvas,usmschuck/canvas,sdeleon28/canvas-lms,juoni/canvas-lms,ShreniiNepal/shrenii_lmp,wrdsb/canvas-lms,whalejasmine/canvas-lms,SwinburneOnline/canvas-lms,djbender/canvas-lms,dgynn/canvas-lms,efrj/canvas-lms,roxolan/canvas-lms,gbleydon/canvas-lms,antoniuslin/canvas-lms,usmschuck/canvas,usmschuck/canvas,rup/Tarrax,sfu/canvas-lms,grahamb/canvas-lms,em2/canvas-lms,sli7246/canvas_branch,jay3126/canvas-lms,Rvor/canvas-lms,instructure/canvas-lms,rup/Tarrax,tgroshon/canvas-lms,sfu/canvas-lms,juoni/canvas-lms,gbleydon/canvas-lms,juoni/canvas-lms,Unow/ins,utkarshx/canvas-lms,shidao-fm/canvas-lms,sfu/canvas-lms,HotChalk/canvas-lms,roxolan/canvas-lms,wrdsb/canvas-lms,venturehive/canvas-lms,wimemx/Canvas,arrivu/qibla-ecampus,ankithbti/canvas_lms,utkarshx/canvas-lms,narigone/canvas,sfu/canvas-lms,fronteerio/canvas-lms,instructure/canvas-lms,djbender/canvas-lms,whalejasmine/canvas-lms,kyroskoh/canvas-lms,dgynn/canvas-lms,arrivu/hoodemo,Unow/ins,juoni/canvas-lms,landonwilkins/canvas-lms,AndranikMarkosyan/lms,gbleydon/canvas-lms,dgynn/canvas-lms,rup/Tarrax,jay3126/canvas-lms,instructure/canvas-lms,efrj/canvas-lms,antoniuslin/canvas-lms,merichar/canvas-lms,samuels410/greatlakes-lms,landonwilkins/canvas-lms,eCNAP/CANVAS,tgroshon/canvas-lms,Jyaasa/canvas-lms,Unow/canvas-lms,roxolan/canvas-lms,sfu/canvas-lms,wye0220/shindig-canvas,sli7246/canvas_branch,shidao-fm/canvas-lms,sli7246/canvas_branch,icelab/canvas,arrivu/arrivu-lms,arrivu/hoodemo,snehakachroo1/LSI_replica,snehakachroo1/LSI_replica,samuels410/greatlakes-lms,nditech/red-innovadores-lms,wimemx/Canvas,greyhwndz/canvas-lms,Rvor/canvas-lms,whalejasmine/canvas-lms,leftplusrightllc/canvas-lms,HotChalk/canvas-lms,fronteerio/canvas-lms,loganrun/pincan,Jyaasa/canvas-lms,narigone/canvas,SwinburneOnline/canvas-lms,merichar/canvas-lms,shidao-fm/canvas-lms,grahamb/canvas-lms,venturehive/canvas-lms,snehakachroo1/LSI_replica,usmschuck/canvas,greyhwndz/canvas-lms,djbender/canvas-lms,grahamb/canvas-lms,eCNAP/CANVAS,greyhwndz/canvas-lms,loganrun/pincan,arrivu/hiring-site,kyroskoh/canvas-lms,AndranikMarkosyan/lms,Jyaasa/canvas-lms,Unow/canvas-lms,sdeleon28/canvas-lms,wrdsb/canvas-lms,grahamb/canvas-lms,loganrun/pincan,HotChalk/canvas-lms,icelab/canvas,ankithbti/canvas_lms,va7map/canvas-lms,instructure/canvas-lms,skmezanul/canvas-lms,landonwilkins/canvas-lms,arrivu/jigsaw-lms,redconfetti/canvas-lms,arrivu/arrivu-lms,arrivu/hiring-site,skmezanul/canvas-lms,va7map/canvas-lms,jay3126/canvas-lms,arrivu/hiring-site,va7map/canvas-lms,AndranikMarkosyan/lms,ShreniiNepal/shrenii_lmp,samuels410/greatlakes-lms,parbros/red-innovadores-lms,fronteerio/canvas-lms,matematikk-mooc/canvas-lms,antoniuslin/canvas-lms,tgroshon/canvas-lms,wrdsb/canvas-lms,efrj/canvas-lms,redconfetti/canvas-lms,utkarshx/canvas-lms,utkarshx/canvas-lms,venturehive/canvas-lms,sdeleon28/canvas-lms,em2/canvas-lms,eCNAP/CANVAS,leftplusrightllc/canvas-lms,Jyaasa/canvas-lms,redconfetti/canvas-lms,va7map/canvas-lms,sfu/canvas-lms,dgynn/canvas-lms,merichar/canvas-lms,landonwilkins/canvas-lms,antoniuslin/canvas-lms,kyroskoh/canvas-lms,skmezanul/canvas-lms,matematikk-mooc/canvas-lms,narigone/canvas,redconfetti/canvas-lms,HotChalk/canvas-lms,AndranikMarkosyan/lms,ankithbti/canvas_lms,matematikk-mooc/canvas-lms,parbros/red-innovadores-lms,ShreniiNepal/shrenii_lmp,skmezanul/canvas-lms,nditech/red-innovadores-lms,arrivu/hoodemo,narigone/canvas,wye0220/shindig-canvas,parbros/red-innovadores-lms,ShreniiNepal/shrenii_lmp,sdeleon28/canvas-lms,snehakachroo1/LSI_replica,instructure/canvas-lms,nditech/red-innovadores-lms,Rvor/canvas-lms,arrivu/qibla-ecampus,arrivu/qibla-ecampus,jay3126/canvas-lms,em2/canvas-lms,roxolan/canvas-lms,Unow/canvas-lms,matematikk-mooc/canvas-lms,wye0220/shindig-canvas,instructure/canvas-lms,Unow/ins,leftplusrightllc/canvas-lms,Rvor/canvas-lms,arrivu/jigsaw-lms,arrivu/jigsaw-lms,samuels410/greatlakes-lms,SwinburneOnline/canvas-lms,grahamb/canvas-lms,kyroskoh/canvas-lms,venturehive/canvas-lms,whalejasmine/canvas-lms,eCNAP/CANVAS,sfu/canvas-lms,arrivu/arrivu-lms,wimemx/Canvas,djbender/canvas-lms,efrj/canvas-lms,instructure/canvas-lms,nditech/red-innovadores-lms,SwinburneOnline/canvas-lms,fronteerio/canvas-lms,leftplusrightllc/canvas-lms