Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the purpose the different *Target properties?

In the MouseEvent class there are multiple *Target events:

  • target
  • currentTarget
  • relatedTarget

What is their purpose in the context of a MouseEvent?

like image 407
João Pinto Avatar asked Apr 23 '13 14:04

João Pinto


People also ask

What are target properties?

Definition and Usage The target event property returns the element that triggered the event. The target property gets the element on which the event originally occurred, opposed to the currentTarget property, which always refers to the element whose event listener triggered the event.

What are different tracing levels in Informatica?

Informatica tracing levels can be configured at the transformation session levels and has 4 different types of tracing levels. Terse – Log initialization information, error messages and notification of rejected data in the session log file.

What is Informatica target?

Target definitions define the structure of tables in the target database or the structure of file targets the Integration Service creates when you run a session. If you add a relational target definition to the repository that does not exist in a database, you need to create target table.

What is target load order in Informatica?

A target load order group is the collection of source qualifiers, transformations, and targets linked together in a mapping. You can set the target load order if you want to maintain referential integrity when inserting, deleting, or updating tables that have the primary key and foreign key constraints.


1 Answers

These properties are equivalent to the JavaScript mouse events. JavaScript events traverse the DOM (called "bubbling"). target is the object on which the event was originally dispatched on. currentTarget is the object on which your event handler has been attached.

Example

You have this HTML structure:

<ul id="list">
  <li>Entry 1</li>
  <li>Entry 2</li>
</ul>

and you add a click handler to the <ul> element (either via JavaScript or Dart, the concept is the same).

When you then click on "Entry 2", your click handler will be called (because the event "bubbles up" to it). target will be the <li> element, while currentTarget will be the <ul> element. Which one you have to use depends on what you want to do in your handler - for example, you could hide "Entry 2" itself by using target, or the whole list by using currentTarget.

The element referenced by relatedTarget depends on the type of your MouseEvent - a list can be found here: event.relatedTarget. In the above example, it would be null, because click events don't have any related target.

Related MDN links: event.currentTarget, event.target

like image 189
MarioP Avatar answered Sep 21 '22 16:09

MarioP