July 6, 2000 - HTC-Master Event Propagation | WebReference

July 6, 2000 - HTC-Master Event Propagation

Yehuda Shiran July 6, 2000
HTC-Master Event Propagation
Tips: July 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

Communication between a primary document and its ViewLinked HTCs is quite tricky. Signals are carried via events, which may or may not be fired from an HTC to its primary document. For example, if a user moves the mouse pointer over a ViewLink component (in the primary document), an onmouseover event is fired on the master element. Likewise, when the user moves the mouse pointer out of the component, an onmouseout event is fired on the master element (with no effect on the HTC elements). On the other hand, when the user moves the mouse pointer over elements within the ViewLink component, the onmouseover and onmouseout event are not fired back to the primary document. The only events that are fired back to the primary document are onmouseenter and onmouseleave events.

When the onmouseenter and the onmouseleave events are fired on the top-most element in the HTC tree, the onmouseover and onmouseout events are fired on the master element. The onmouseenter event fires when the mouse pointer enters an element, and the onmouseleave event fires when the mouse pointer leaves the element. Keep in mind that these events do not bubble. The only way to fire them is by their occurrence on the root element of the HTC tree. For example, if onmouseenter fires on the root element, both the onmouseenter and onmouseover event fire on the master element. Similarly, if onmouseleave fires on the root element, both the onmouseleave and onmouseout events fire on the master element.

In summary, don't count on onmouseover and onmouseout to propagate information to the master element, they do not. When the user moves the mouse pointer over a master element in the primary document, an onmouseover event fires. When the user moves the mouse pointer out of the master element, one onmouseout event fires. When the user moves the mouse pointer in our out of elements within the ViewLink HTC, these events are not fired on the master element -- they remain local to the HTC file.