Normally the button below would toggle the background color between yellow and purple but since the mouseup and mousedown events are captured and handled by the document the events are never allowed to reach the button level.