Chirayu,
I wonder if checking just for $(e.target).parents().index(g.cEdit) == -1 in not enough for the purpose.