Bunoon: TESS | Manual | Event

This area contains a set of functions that are used for handling and manipulating the events of DOM elements. You can easily assign new events to any element that you passed through, while the area keeps track of all assign events for you. You can assign bubbling to elements (preventing events leaking down to the next level), while offering support to get details about the events that have been assigned to an element.

As a bonus, you can also trigger events assigned to a specific element as well, as long as you know the event handler its assigned to.

Looks up an element by ID (or just the element itself) and tries to assign a function to a specific event in the element.

The main arguments for this function are as follows:

  • oIdentifier [Object] - The ID of the element or the element itself.
  • sType [String] - States the event type we should be assigned the function to.
  • oFunction [Object] - States the function that should be assigned to the event type.
  • bCapture [Boolean] - States if the event should always be captured (for addEventListener only). Set to false as default.

The return value for this function is as follows:

  • [Boolean] - A boolean of true/false to state of we have completed the operation.

Below is an example of how to use this function:

function TestEvent () {

alert('Click Test!');

};


var bWasAssigned = $T.Event.Assign('divTest', 'click', function (e) { TestEvent() });

Looks up an element by ID (or just the element itself) and tries to remove a function in a specific event in the element.

The main arguments for this function are as follows:

  • oIdentifier [Object] - The ID of the element or the element itself.
  • sType [String] - States the event type we had a function assigned to.
  • bCapture [Boolean] - States if the event was set to always be captured (for addEventListener only). Set to false as default.

The return value for this function is as follows:

  • [Boolean] - A boolean of true/false to state of we have completed the operation.

Below is an example of how to use this function:

var bWasRemoved = $T.Event.Remove('divTest', 'click');

Looks up an element by ID (or just the element itself) and allows/prevents bubbling's of a specific event down to the element(s) underneath it.

The main arguments for this function are as follows:

  • oIdentifier [Object] - The ID of the element or the element itself.
  • sType [String] - States the event type.
  • bAllow [Boolean] - States if the bubbling of events should be allowed or not.

The return value for this function is as follows:

  • [Boolean] - A boolean of true/false to state of we have completed the operation.

Below is an example of how to use this function:

var bWasSet = $T.Event.SetBubbling('divTest', 'mousedown', true);

Cancels the bubble effects for a specific elements event.

The main arguments for this function are as follows:

  • e [Object] - The elements event details.

Below is an example of how to use this function:

function TestEvent (e) {

m_TESS.Event.CancelBubble(e);


alert('Click Test!');

};


var bWasAssigned = $T.Event.Assign('divTest', 'click', function (e) { TestEvent(e) });

Looks up an element by ID (or just the element itself) and looks up the event specified and calls it (if it is actually being used).

The main arguments for this function are as follows:

  • oIdentifier [Object] - The ID of the element or the element itself.
  • sEvent [String] - States the event to call.

The return value for this function is as follows:

  • [Boolean] - A boolean of true/false to state of we have completed the operation.

Below is an example of how to use this function:

var bWasTriggered = $T.Event.Trigger('divTest', 'click');

Looks up an element by ID (or just the element itself) and looks up the event details (the event function string and if it exists).

The main arguments for this function are as follows:

  • oIdentifier [Object] - The ID of the element or the element itself.
  • sEvent [String] - States the event we want the details for.

The return value for this function is as follows:

  • [Object] - An object containing details about the event (.Exists and .Value).

Below is an example of how to use this function:

var oEventDetails = $T.Event.Details('divTest', 'click');