top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is event bubbling?

+6 votes
264 views
What is event bubbling?
posted Feb 5, 2014 by Khusboo

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

The concept of event bubbling was introduced to deal with situations where a single event, such as a mouse click, may be handled by two or more event handlers defined at different levels of the Document Object Model (DOM) hierarchy. If this is the case, the event bubbling process starts by executing the event handler defined for individual elements at the lowest level (e.g. individual hyperlinks, buttons, table cells etc.). From there, the event bubbles up to the containing elements (e.g. a table or a form with its own event handler), then up to even higher-level elements (e.g. the BODY element of the page). Finally, the event ends up being handled at the highest level in the DOM hierarchy, the document element itself (provided that your document has its own event handler).

The term event propagation is often used as a synonym of event bubbling. However, strictly speaking, event propagation is a wider term: it includes not only event bubbling but also event capturing. Event capturing is the opposite of bubbling (events are handled at higher levels first, then sink down to individual elements at lower levels). Event capturing is supported in fewer browsers and rarely used; notably, Internet Explorer prior to version 9.0 does not support event capturing.

Credit: www.javascripter.net

answer Feb 5, 2014 by Salil Agrawal
Similar Questions
+3 votes

I am having textbox and submit and close button. There is jquery validation on focusout of textbox. Which is fine. But when user type something in textbox and directly click the Close button i don't want to do validation. As focusout event fired first so validation work. I want button click event to fire first.

0 votes

I need to execute a function while mouse hover.But i want to execute only when mouse hover for over 2 or 3 seconds.Or else i don't want to execute the function.

0 votes

I tried the following code.Both onpaste() and Oncopy() will trigger when user trying to copy or paste.

But my problem is while copying something window.getSelection() not working.

Window.getSelection() is used to get the selected data.

I mean before copying something user need to select some values.So,using this window.getselection() we will get the value what they are selected.

Here, my problem is window.getselection() will work in oncopy but not working in onpaste.

Check the below examples and help me to solve the problem.

Also ,is there any alternative method also please let me know.I also tried window.clipboardData.But not getting the solution for this.

<!doctype html>
<html>
<head>
<style>
    textarea {
        width:500px;
        height:200px;
        border:2px solid #999;
    }
</style>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

    <script type="text/javascript">

        function OnPaste () {                                                                       
            var selection = window.getSelection();          
            alert(selection.toString());            
        }                                       
        function OnCopy() {         
            var selection = window.getSelection();
            alert(selection.toString());
         }

// Call the OnCopy function while user trying to copy 
document.oncopy = OnCopy;

// Call the OnPaste function while user trying to Paste
document.onpaste = OnPaste;
 </script>

</head>
<body>
    Select some text, copy it to the clipboard and try to paste it to the following fields:
    <br /><br />
    <textarea size="40" value="Copy and Paste operation is enabled">
+2 votes

In my Informatica mapping, when an SP is called via an unconnected stored procedure transformation, the workflow succeeds. However there is a divide-by-zero error in the SP and ideally the workflow should fail. The source and target used in this mapping are dummy flat-files.

However, when I use dummy tables instead for source and target, with a connected SP transformation this time, the error bubbles up successfully.

Any idea why this would happen? Why does the error show only with source table and connected SP transformation, and not with flat-file source unconnected SP transformation?

...