Events Flashcards
Which browser is the addEventListener not compatible with?
addEventListener method will not work with legacy browsers from iexplorer 8 and earlier. You are required to call .attachEvent using arguments of ‘onclick’ and function call , it does not use a propagation parameter.
What is the benefits of using eventListener in comparison to calling by documentbyId
eventListener allows for event propagation meaning that you can write one function to handle events from multiple sources.
What are the key arguments of eventListener?
it takes the event literal , like click , the function and the propagation status (true or false)
How would you set an listener for an event using jquery?
use selector $() and on method , the on method takes the same parameters as addEventListener
What are main examples of coordinate info events?
screen x,y , client x,y , layer x, y, page x,y offset x,y
What is the difference between screenX,Y and clientX,Y ?
screen gives user position relative to the user screen while client gives it relative to window.
What is Event info?
event type, event timestamp and defaultPrevented
What are events related to targeting information
target - element that the event originated from, srcElement - actual element that fired the event.
fromElement and toElement deal which which events?
mouseover and mouseout events.
what is offsetXY
Gives the position relative to the element that fires the event.
What are examples of events that provide key/mouse information?
altKey , charCode/KeyCode , button , ctrKey and shiftKey
What does layerX,Y coordinate info do?
Shows the position of the element relative to another positioned event - not all browsers use this.
What does pageXY coordinate info do?
Will give you the event relative to the HTML document.
charCode/KeyCode
Detects which character was pressed.
Which events handle which modifier code is pressed?
altKey, ctrlKey and shiftKey