Simplify some code in handle_click_event.
auto merge of #4501 : Ms2ger/servo/script_task, r=jdm