Use target attribute instead of srcElement
Listen for contextmenu event instead of mouseup