How to stop propagated event from a third function or plugin where we don't have event object
<p>I am creating a plugin to show a modal box . In that i want to assign event on html so that clicking outside of that box ,it must close. If the plugin is called from any event handler it is propagated to body , and closing function is called. 
I want to stop propagated event from within the plugin. As i can't ask user to add event.stopPropagtion() on their event handler.<br>
One hack i did is by adding setTimeout on binding close event but i know that can fail in some situation.</p>

<p>So is there any way to achieve it.</p>

<p><strong>Sample code:</strong></p>

<pre><code>(function ($, window, document, undefined) {

    $.fn.modelBox = function (option) {
        var myoptions = $.extend({}, $.fn.modelBox.defaults, option);

        methods['show'].call(this, myoptions);
        return this;
    };

    //default options
    $.fn.modelBox.defaults = {
        //default options
    }


    //internal method
    var clickEvent=function(e){
        modelBox=e.data.modalBox;
        methods['close'].call(modelBox);
    };

    var methods={
        show:function(option){
            var elm=this,
            elm.show();

            elm.bind('click',function(e){
                e.stopPropagation();
            });

            setTimeout(function(){$('html').bind('click',{modalBox:elm},clickEvent)},1000);


            //want to achieve this without time out

        },
        close:function(){
            var elm=this;
            elm.css('display','none');
            $('html').unbind('click',clickEvent);
        }   
    }               
})(jQuery, window, document);

$(document).ready(function(e) {
    $('#testBut').click(function(e) {
        $('#testDiv').modelBox();

    });
});
</code></pre>

<p>HTML</p>

<pre><code>&lt;div id="testDiv"&gt;&lt;/div&gt;
&lt;input type="button" id="testBut" /&gt;
</code></pre>

<p>CSS</p>

<pre><code>#testDiv{
    width:400px;
    height:400px;
    background:#CCC;
}
</code></pre>
